Is there a #ifdef test for detecting particle devices?

Hello , I write my firmware for use on multiple devices (e.g. Arduino, teensy :grimacing: (am i allowed to mention those:smiling_imp:)).
I use compiler directives for replacing blocks of code that are not relevant to the particular development environment. is the a way I can check that this code is compiling in the particle compiler e.g.
#ifdef PARTICLE
//do some particle stuff
#else
// do some arduino stuff

#endif

Exactly that (or the nicer looking #if defined(PARTICLE) :wink: )
In addition to that you can drill down via PRODUCT_ID and other “secondary” defines like Wiring_WiFi, Wiring_Cellular (defined in spark_wiring_platform.h )
Or you use the HW specific defines like STM32F2XX (in that thread SPARK is mentioned which still works but was superceded by PARTICLE)

2 Likes