macro to switch between LPC11U24 and LPC1768

22 Mar 2012

Is there a macro to switch between the different mbed's ? I plan to make a lib wich is using the 32 Bit counter. If I want to set up counter functions, I have to use different code.

Peter

22 Mar 2012

Yes, you can conditionally compile based on the definition of the following symbols:

  • TARGET_LPC1768
  • TARGET_LPC2368
  • TARGET_LPC11U24

Emilio

22 Mar 2012

This does work:



char Chip;


#ifdef TARGET_LPC11U24 Chip = 0x10; 
#endif
#ifdef TARGET_LPC1768 Chip = 0x20; 
#endif
#ifdef TARGET_LPC2368 Chip = 0x30; 
#endif

if (chip == 0x10) printf ("you are using M0\r\n");

Hope this helps

Ceri.