I’m sure this is documented somewhere but I’ve not been able to find it after 45+ minutes of searching.
I would like to write a custom local library that benefits from the power of the platformio.ini config file. Specifically, I would like the library to be able to access the registers and MMIO for my custom board (which is using the ATmega1284p).
I know that I can get these definitions directly by doing this in each library src file:
But this is no longer automatic (ignores what should already be available via platformio.ini through the board definition which specifies the MCU used).
By the way, I am using the method recommended in the documentation (the non-deprecated method) to specify my library folders, e.g.:
lib_deps = file://C:\Users.…\AVR\common
…where the “common” folder includes library.json and folders “src”, and “include”.
Can someone point me in the right direction?
I forgot that you don’t need to include the specific avr/ioXXX.h file directly, rather just:
This requires the macro “__ AVR_ATmega1284P__” be passed in as a symbol definition which then includes the file I need (based on which MCU I specified in the board file).
So that answers the question, however, if I had my own IO definition (not AVR for example) could I do the same thing? Do I follow the same pattern or is there another way?