Predefined Macros

Status
Not open for further replies.

ProfHuster

Active member
I can not find a list of what macros or definitions there are in the Arduino IDE. For example, Examples code has lines like
Code:
#if defined(KINETISL)
(Some code)
#elif defined(KINETISK)
(Alternate code)
#else
(Different alternate code)
#endif
What KINETISL and KINETISK stand for? I think it is Teensy 3 or 4 or ?

Other code uses __MK20DX256__ and __IMXRT1062__ to compile for T3 or T4.

Is there a list of the preprocessor definitions that are commonly used without digging through a huge manual?
 
Here are a few:
Code:
ARDUINO_ARCH_AVR - Avr Architecture / (all Teensy < 3.0)
TEENSYDUINO=Version - Is a Teensy + gives TD version
KINETISL - Teensy LC
KINETISK - All Teensy 3.x
__MK20DX128__ - Teensy 3.0
__MK20DX256__ - Teensy 3.1, 3.2
__MK64FX512__ - Teensy 3.5
__MK66FX1M0__ - Teensy 3.6
__IMXRT1062__ - all Teensy 4.x + Teensy 4 MM
ARDUINO_TEENSY2 - Teensy 2
ARDUINO_TEENSY30 - Teensy 3.0
[...]
ARDUINO_TEENSY40 - Teensy 4.0
ARDUINO_TEENSY41 - Teensy 4.1
ARDUINO_TEENSYMM - Teensy 4 MM

Note: not complete.

+ There several other, which give the pincount, pll frequencies, etc. i.e. F_CPU gives the cpu freq at compile time (speed can be different @ runtime if it is a T4.x, if you've set it in the program)
+ the default ones, defined by the GCC Toolchain. Like __arm__ (is it a ARM CPU?) or __cplusplus (is the current file c++?) - this is a huge list, too. http://micro-os-plus.github.io/develop/predefined-macros/
 
Last edited:
Status
Not open for further replies.
Back
Top