ArduinoCore-samd icon indicating copy to clipboard operation
ArduinoCore-samd copied to clipboard

FEAT make Serial and Serial1 def and ISR optional

Open maxlem opened this issue 3 years ago • 5 comments

see also this discussion: https://github.com/arduino/ArduinoCore-samd/issues/631

maxlem avatar May 21 '21 16:05 maxlem

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 21 '21 16:05 CLAassistant

I'm willing to port the defines to the other samd variant.cpp

maxlem avatar May 21 '21 16:05 maxlem

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.

matthijskooijman avatar May 22 '21 13:05 matthijskooijman

(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).

matthijskooijman avatar May 22 '21 13:05 matthijskooijman

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

maxlem avatar May 22 '21 17:05 maxlem