I have defined a tag in the Arduino.h file like this:
and then I used that tag in the libraries like this:
#if defined(__AVR__) || defined(__X86__) ... #elif defined(CORE_TEENSY) // Teensy boards ... #else ... #endif
You have to add the define tag in the Arduino.h file for the Galileo and for the Edison (they use different Arduino.h files). So you could use for the Edison something like:
and for Galileo something like:
However I haven't tested them. I have tested only the #define __X86__ tag, but they should work in the same way.
I hope you find it useful. If you are able to test it, please share your results with the Community.
I was expecting something built by the compiler, however I will try your suggestion for the time being.
I was exploring the define PLATFORM_NAME that I found on the variants file, but did not find the Edison one.
I will report my progress.
Cheers and Feliz Navidad.
1 of 1 people found this helpful
For what it is worth, currently in my sketches to detect Edison (may also be set for Galileo), I have code like:
I believe the IDE is supposed to generate some defines depending on the architecture and variant... Would need to google to see the exact thing that this is supposed to be...
Could also search for something different in headers...
In a deeper research I found that the PLATFORM_NAME or PLATFORM_ID can be used, it is set to other "Galileo" or "Edison" by the compiler thru the variants.h include file, it is also very nice to print the debug information you can use it as: Serial.print(PLATFORM_NAME);
It is very handy to handle the differences between both libraries sets, like the function gettimeofday() is available on the Edison version, but not on the Galileo version, etc, ...
Thanks for your suggestions.