what are relevant defines for Teensy

Status
Not open for further replies.

NikoTeen

Well-known member
analyzing code of libraries often shows define statements like
Code:
#if defined(__MK20DX256__)
#define KINETISK
#define HAS_KINETISK_UART0
...

and so on
Between a #if defined(...) ... #endif, pinning or ADC-settings are defined.
But what is KINETISK?

For my own code I need to know what type of #if defined() I have to use.
When writing code for a Teensy 3.2 I guess that a "#if defined(__MK20DX256__)" will cover all settings for a Teensy 3.2.
Where do I have to look to find out what #define's then are available?
 
The #defines with a specific processor type like __MK20DX256__ are exclusive for that processor. #defines like KINETISK are for things with are common for all Teensy 3.X while KINETISL is for the Teensy LC.

All defines can be found in the Teensyduino core files, for example in kinetis.h and core_pins.h.
 
Some defines come from the command line. You can use File > Preferences to show verbose info while compiling to see them. Look for all the -DNAME parts in the commands. These defines are the primary info Arduino gives the compiler.

The rest come from the header files, mostly kinetis.h. For ordinary Arduino code (in .ino files) you can use any of these. If writing a library or using .cpp or .c or .S files, you need to include the header to get access to the ones that aren't defined on the command line.
 
Status
Not open for further replies.
Back
Top