is preprocessor directive defined for board selected from arduino-IDE?
I have code for multiple boards, it needs to know which board is built for so correct source is built and stuff like pin definitions. Because the nucleo boards typically have arduino-uno form-factor, but others arent and need different pins. An #ifdef used for this in code.
ifdef for selected board
Re: ifdef for selected board
every variant have a specific define, to see them use verbose output from compilation and look at the command line sent to the compiler, all the defines can be seen there (its a looooong line of includes and defines).
Re: ifdef for selected board
check the usual places like boards.txt and platforms.txt
Re: ifdef for selected board
https://github.com/stm32duino/Arduino_Core_STM32/blob/a7283739a4d8bafe95c9f9b9156e6f82a1ebbd75/platform.txt#L92-L93
Specifically: -DARDUINO_{build.board}
where build.board is defined in the boards.txt:
For example
So for this board you can use:
Code: Select all
# Build information's
build.info.flags=-D{build.series} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DBOARD_NAME="{build.board}" -DVARIANT_H="{build.variant_h}"
where build.board is defined in the boards.txt:
For example
Code: Select all
GenF1.menu.pnum.BLUEPILL_F103C8.build.board=BLUEPILL_F103C8
Code: Select all
#ifdef ARDUINO_BLUEPILL_F103C8