How to detect Genuino 101 from inside the code? I am using a custom library for Arduino Mega which uses AES library for AES-128 encryption.

However, when I try to use that library in Intel Genuino 101 development board, it shows compilation error which is because the assembly language written in AES library was compatible with Atmel devices only.

And my question is whether there is a way, my code can automatically detect the GENUINO board by writing some sort of signature verification of this board and hence I can exclude the encryption part if it can successfully detect GENUINO 101.

For any queries, feel free to bug me, thanks.
Arduino defines some macros so you can use conditional compilation. For example these are from boards.txt:


use ARDUINO_AVR_PROMICRO if it's specific for board variant
use ARDUINO_ARCH_AVR if it's specific for Arduino with AVR


Also avr-gcc defines macros according to cpu settings (this should be similar for other platforms too):


use __AVR_ATmega32U4__ if it's specific for only one MCU
use __AVR__ if it's compatible with all AVR based MCUs


And code examples:

#if defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__)
// something for ATmegaXX8 family...
#else
// ...
#endif

#ifdef __AVR__ 
// Code related to AVR
#else
// Code for other architectures
#endif


More about predefined macros in avr-gcc.