CptDangerous
New member
Hi
My sincere apologies if this has been asked before but I can't find a reference in my searches...
As of Arduino IDE 1.5, according to https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification,
it is relatively easy to determine, at compile time, what board the IDE is compiling for.
I quote from boards.txt:
"...The uno.name property contains the name of the board shown in the Board menu of the Arduino IDE.
The uno.build.board property is used to set a compile-time variable ARDUINO_{build.board} to allow use of conditional code between #ifdef s. The Arduino IDE automatically generates a build.board value if not defined. In this case the variable defined at compile time will be ARDUINO_AVR_UNO."
The equivalent build.board values for the boards.txt in the teensy path are TEENSY31, TEENSYLC ... etc.
Is there an equivalent compile-time definition for the Teensy series?
I've tried #ifdef ARDUINO_TEENSY31 , #ifdef TEENSYDUINO_TEENSY31 & just #ifdef TEENSY31 without success. As in
#ifdef ARDUINO_TEENSY31
#warning "Teensy 3.2/3.1"
#endif
void setup() {
}
void loop() {
}
The warning is never emitted at compile time when the Tools->Board: setting in the IDE is set to Teensy 3.2/3.1 unlike:
#ifdef ARDUINO_AVR_NANO
#warning "Arduino Nano"
#endif
which does emit the warning at compile time when the Tools->Board: in IDE is set to Arduino Nano.
This facility would be very useful if it existed for the Teensy series. I know there are very clumsy definitions which require intimate knowledge of the chip used but the method described above would be much cleaner.
I'm sure there is a simple value which is generated by the IDE but I haven't found it yet...
Any help would be much appreciated.
TIA
CptDangerous
My sincere apologies if this has been asked before but I can't find a reference in my searches...
As of Arduino IDE 1.5, according to https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification,
it is relatively easy to determine, at compile time, what board the IDE is compiling for.
I quote from boards.txt:
"...The uno.name property contains the name of the board shown in the Board menu of the Arduino IDE.
The uno.build.board property is used to set a compile-time variable ARDUINO_{build.board} to allow use of conditional code between #ifdef s. The Arduino IDE automatically generates a build.board value if not defined. In this case the variable defined at compile time will be ARDUINO_AVR_UNO."
The equivalent build.board values for the boards.txt in the teensy path are TEENSY31, TEENSYLC ... etc.
Is there an equivalent compile-time definition for the Teensy series?
I've tried #ifdef ARDUINO_TEENSY31 , #ifdef TEENSYDUINO_TEENSY31 & just #ifdef TEENSY31 without success. As in
#ifdef ARDUINO_TEENSY31
#warning "Teensy 3.2/3.1"
#endif
void setup() {
}
void loop() {
}
The warning is never emitted at compile time when the Tools->Board: setting in the IDE is set to Teensy 3.2/3.1 unlike:
#ifdef ARDUINO_AVR_NANO
#warning "Arduino Nano"
#endif
which does emit the warning at compile time when the Tools->Board: in IDE is set to Arduino Nano.
This facility would be very useful if it existed for the Teensy series. I know there are very clumsy definitions which require intimate knowledge of the chip used but the method described above would be much cleaner.
I'm sure there is a simple value which is generated by the IDE but I haven't found it yet...
Any help would be much appreciated.
TIA
CptDangerous