cpp symbol for ItsyBitsy M4

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
AlainB
 
Posts: 26
Joined: Sat Jul 07, 2018 7:28 am

cpp symbol for ItsyBitsy M4

Post by AlainB »

Hello,

I'm try to find the C preprocessor symbol defined to identify the ItsyBitsy M4 hardware (using Arduino IDE).
When compiling for the Feather M0 Express, symbol ARDUINO_SAMD_FEATHER_M0_EXPRESS is defined and can be tested.
What would be the equivalent for ItsyBitsy M4? I tried ARDUINO_SAMD_ITSYBITSY_M4 and ARDUINO_SAMD_ITSYBITSY_M4_EXPRESS, ADAFRUIT_SAMD_ITSYBITSY_M4 and ADAFRUIT_SAMD_ITSYBITSY_M4_EXPRESS but none of them seem to be defined...

I detected a _VARIANT_ITSYBITSY_M4 in one of the core files, but it doesn't seem to be defined either.

Thanks for your clarifications!

Alain.

PS: more generally, where can I find this information for other Adafruit boards?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: cpp symbol for ItsyBitsy M4

Post by mikeysklar »

This github repo contains boards.txt:

https://github.com/adafruit/ArduinoCore-samd

Code: Select all

$ grep -i itsybitsy boards.txt  | grep board
adafruit_itsybitsy_m0.build.board=ITSYBITSY_M0
adafruit_itsybitsy_m4.build.board=ITSYBITSY_M4

User avatar
AlainB
 
Posts: 26
Joined: Sat Jul 07, 2018 7:28 am

Re: cpp symbol for ItsyBitsy M4

Post by AlainB »

That was fast... Thanks a lot! :-)

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: cpp symbol for ItsyBitsy M4

Post by mikeysklar »

You pretty much guess the right name. Just need an underscore.

User avatar
AlainB
 
Posts: 26
Joined: Sat Jul 07, 2018 7:28 am

Re: cpp symbol for ItsyBitsy M4

Post by AlainB »

Mmmh, I'm afraid that's not the symbol I'm looking for,.. I think the symbol should be defined somewhere in a header file I cannot locate, and that it probably is not that easy to guess, after all... :-)

Let's compile this sketch:

Code: Select all

#include "Arduino.h"

#ifdef ARDUINO_SAMD_FEATHER_M0_EXPRESS
#error Feather M0 express
#else
#error not Feather M0 express
#endif

#ifdef ITSYBITSY_M4
#error M4
#else
#error not M4
#endif

void setup() {}

void loop() {}
I get this when compiling for Feather M0 Express, which is as expected (symbol ARDUINO_SAMD_FEATHER_M0_EXPRESS is defined):

Code: Select all

 ~/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4 >arduino-cli compile --fqbn adafruit:samd:adafruit_feather_m0_express 
/Users/Alain/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4/TestItsyBitsyM4.ino:6:2: 
 #errror Feather M0 express
  ^
/Users/Alain/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4/TestItsyBitsyM4.ino:14:2: error: #error not M4
 #error not M4
  ^
Error during build: exit status 1
When compiling for ItsyBitsyM4, I get this (the ITSYBITSY_M4 symbol is clearly not defined, so which one is??):

Code: Select all

~/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4 >arduino-cli compile --fqbn adafruit:samd:adafruit_itsybitsy_m4 
/Users/Alain/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4/TestItsyBitsyM4.ino:8:2: error: #error not Feather M0 express
 #error not Feather M0 express
  ^
/Users/Alain/Documents/Arduino/cansat-asgard/personal/baudhuin/TestItsyBitsyM4/TestItsyBitsyM4.ino:14:2: error: #error not M4
 #error not M4
  ^
Error during build: exit status 1
Sorry to inconvenience...
Alain.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: cpp symbol for ItsyBitsy M4

Post by mikeysklar »

my bad....brute force google searching turned this up:

Code: Select all

ARDUINO_ITSYBITSY_M4

User avatar
AlainB
 
Posts: 26
Joined: Sat Jul 07, 2018 7:28 am

Re: cpp symbol for ItsyBitsy M4

Post by AlainB »

That's the one!
Your brute force search is definetely better than mine.
Issue closed, thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”