Open soundanalogous opened 9 years ago
One other thing that would be helpful is if there was a consistent way across all variants to reference which HW serial ports are supported (Serial1, Serial2, Serial3, etc). I currently have to do this and when I add support for Zero this will likely get even more complex.
It would be helpful if pin feature constants could be aligned across all core board variants (related issue). They are arleady well aligned across the AVR boards, but the SAM boards introduce some differences. The changes that would be helpful are as follows:
Add to /arduino_zero/variant.h
Add to /arduino_zero/variant.h and /arduino_due_x/variant.h (currently defined for all AVR variants)
and to /arduino_due_x/variant.h
Add to all variants that have more than 1 HW serial port
The reason for defining HW SERIAL pin constants may be a specific need for Firmata and I could resolve it in Boards.h if Firmata is the only use case. I'm in the process of adding support for interfacing with Serial devices through Firmata (so users can interact with GPS, RFID, Serial LCDs, etc) and ran into an issue that I cannot resolve without a generic map of HW serial pin numbers.
The issue is that in Firmata, all digital pins are initially set to OUTPUT. This eliminates noise from triggering false digital reads (since in StandardFirmata all digital pins are read once per iteration of the main loop). However, this creates an issue with some serial devices such as the Adafruit Ultimate GPS breakout board. I'm only noticing this with an Arduino Due so far. It is not possible to read the output from the GPS board unless the RX pin (RX1, RX2, or RX3) is set back to INPUT when calling SerialN.begin (where N is 1, 2, or 3). The problem is there is no way to programmatically know which pins correspond to RX and TX for all boards. The Zero is the first board to provide constants for this. For Firmata the constants would also be helpful in reporting HW serial pins in the capability query results. Let me know if this would be useful for cases other than Firmata, otherwise I'll just add those defines for all applicable boards in Boards.h.