Use custom menu options in Arduino IDE

gonzales

Active member
Hello!

Is it possible to use custom menu options from boards.txt in arduino ide?
I know, that it works, when i do something like this
Code:
add to boards.txt
menu.BOOT=BOOT options
teensy41.menu.BOOT.TEENSY41_8=Cluster_v8
teensy41.menu.BOOT.TEENSY41_8.build.board=TEENSY41_V8
teensy41.menu.BOOT.TEENSY41_9=Cluster_v9
teensy41.menu.BOOT.TEENSY41_9.build.board=TEENSY41_V9

remove from boards.txt
teensy41.build.board=TEENSY41

Use in scetch

#ifdef ARDUINO_TEENSY41_V9
  //do something
#endif

But, due to the fact that the directive TEENSY_41 is used in various libraries, it is problematic to use it.
So, i want to use custom option, like
teensy41.menu.BOOT.TEENSY41_8.myoption=TEENSY41_V8
but i dont know, how can i use it in arduino.
Thanks a lot for answers!!!
 
I found, that i can use flags.defs for it, like this
Code:
teensy41.menu.BOOT.TEENSY41_8=Cluster_v8
teensy41.menu.BOOT.TEENSY41_8.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=157 -DTEENSY41_V8
teensy41.menu.BOOT.TEENSY41_9=Cluster_v9
teensy41.menu.BOOT.TEENSY41_9.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=157 -DTEENSY41_V9

and use it
Code:
#ifdef TEENSY41_V8
 Serial.println("TEENSY41_V8");
#endif
#ifdef TEENSY41_V9
 Serial.println("TEENSY41_V9");
#endif
This is the solution for me, but it seems to me that it can be done easier and better
 
Back
Top