ArduinoCore-samd
ArduinoCore-samd copied to clipboard
FEAT make Serial and Serial1 def and ISR optional
see also this discussion: https://github.com/arduino/ArduinoCore-samd/issues/631
I'm willing to port the defines to the other samd variant.cpp
What's your idea about setting these defines? You can't really set defines from a sketch, so are you thinking about a custom boards.txt that reuses the variant but sets these defines in the extra_flags or something like that?
Looking at the code, I think this now prevents definition of e.g. Serial or Serial1, but not the declaration, leading to linker error. I would think it would make sense to also not declare the objects at all, so you would get a compiler error earlier if you tried to use them, but I'm not quite sure where they are declared exactly.
(Also, I'm just offering some thoughts on the PR since I participated in the issue, I'm not at all sure if adding these guards is the best approach, but I'm also not in a position to decide on whether to merge this or not).
Yes we might just as well not neclare them, I was just shooting for the most minimal changes.
The use case would me to add -D ARDUINO_ZERO_CUSTOM_SERCOM0_SERIAL to the build command.
I don't know how to do that in Arduino IDE, I use platformio