I don't know whether this is the correct forum to ask about this but I've been searching the Internet and cannot find any reference to preprocessor directives that reflect the type of board connected to the IDE. This functionality would be very handy for myself and others.
So for example when I have an Arduino Uno connected (and selected in the IDE) it would be great to have conditional code like:
#ifdef BOARD_UNO
... do this #else
... do this #endif
So my questions are:
Does this functionality exists currently?
How does one go about requesting this type of functionality be added?
If you switch on Preferences>Verbose and then re-compile, you will see the compile commands that Arduino is using.
Each compile command will contain a number of params, the ones that start -D are preprocessor constants that you can use. The selected board is one of them, the arduino version is another.
Hello,
i really agree with first message:
Switching things by source would be very usefull (at least for me :-).
i work with different types of Arduino at a time and its hard to change Board/Serial/Programmer
all times, when it must be compiled and upload.
So i tried this to as a first step:
/source/ #define ARDUINO_AVR_NANO
..
Then i selected a Mega1280 Board and hope to see somthing like this
-DARDUINO_AVR_NANO
from the precompiler output , but he ignored this an gave me a...
Is there a way to do this all on a "IDE-legal"-way ? Or do i have to do it in some way by changing scripts (are there scripts ?) ?
I think about write a wrapper for avr-gcc and place a script there to parse code and switch things - but there will be a small problem with IDE-updates :-/.
i dont know where to start now. internet searching does not help..
--
(sorry about many many errors in writing - keep some of them and use them in your own postings ! I place them in publicdomain )