Sometimes we need to figure out unecessary complexities, so that we can make things more accessable.
I'm talking about Arduino Board Type. Something you'd think is very straight forward, yet .. its not. Not because it can't be, but I think because few have taken the time to make sense of it.
"Board Type" is a general term, but there are potentially 2 things which depend on it.
- bootloaders are paired with board types - if we don't get the board type correct, we can not upload mrlcomm .. and that would be sad :(
- pin definitions - the number and types of pins
I think other definitions of board type may have come around because of marketing or licensing and no real difference between the two important aspects I listed.
I found this little gold mine -
http://arduino.stackexchange.com/questions/21137/arduino-how-to-get-the-board-type-in-code
- the author rightfully wrote : "Because it is a pity that every Arduino programmer has to go through the same pain to figure out how to get the board name"
It gives a list of defines, so I think we could use these ... but once the board type for the uploader is defined, the rest of the software needs to know the PinDefinitions ...
Guess I need to work on that mapping ..
There is a file in one of the
There is a file in one of the arduino folder called boards.txt
it contains all the parametters to upload the code to the different arduino types. you can use a parser to dig out all the arduino type. the arduino board are always define like this
uno.build.board=AVR_UNO
Sadly, knowing the board name is not enough to be able to upload the code to the arduino, some board need extra parametters, by example, for the nano, I had need to add the parameters ":cpu=atmega328" or the code won't even compile
Ya .. I've looked through it
Ya .. I've looked through it before ..
It has the following names ..
You mean you can't compile by just selecting "Arduino nano" in the dropdown ?
uno.name=Arduino/Genuino Uno
Teensey & Mega's I know have different pin layouts
The next best thing is to have it compiled in.
Now I ask you, if the compiler knows what board it is, why doesnt the compiler compile this info into the board ? - Instead its still 'sort of' added with a variety of macros :(
You mean you can't compile by
I mean by compiling script with the command line, using ArduinoUtils
When using the menu, it seem that some default value are selected, but are not when compiling from command line
So yes it sad that those board info are not easily available, so you have to do identify and maintain a list a value ourself.
About the pin definition, they are also only defined by macro wich make it hard to retrieve a pin definition directly from the board, as the board type, we need to manually check the macro to build the definition list. And for other board than arduino, like espressif board (ESP32) the macro managing the pin definition seem to be different (so my code for the neopixel is not working on the espressif board)
board types
any this is yet another reason why I'm trying to develop teh board I've been designing. eliminate all the others and have a standard centralized goal and focus. I'm working on the PDN now, and testing code on a prototype, once I get the initial code working, I'll make a post too.