Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align constants across core board variants #3681

Open
soundanalogous opened this issue Aug 15, 2015 · 1 comment
Open

align constants across core board variants #3681

soundanalogous opened this issue Aug 15, 2015 · 1 comment
Assignees
Labels
Component: Core Related to the code for the standard Arduino API Component: Documentation Related to Arduino's documentation content feature request A request to make an enhancement (not a bug fix)

Comments

@soundanalogous
Copy link

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

DAC0                  (14ul)
DACC_RESOLUTION       10  // or if DACC is specific to Due, then create a neutral way to define this

Add to /arduino_zero/variant.h and /arduino_due_x/variant.h
(currently defined for all AVR variants)

SCL                PIN_WIRE_SCL
SDA                PIN_WIRE_SDA

and to /arduino_due_x/variant.h

SCL1               PIN_WIRE1_SCL
SDA1               PIN_WIRE1_SDA

Add to all variants that have more than 1 HW serial port

PIN_SERIAL1_RX, PIN_SERIAL1_TX, PIN_SERIAL2_RX, PIN_SERIAL2_TX, etc.

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.

@soundanalogous
Copy link
Author

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.

@per1234 per1234 added Component: Core Related to the code for the standard Arduino API Component: Documentation Related to Arduino's documentation content feature request A request to make an enhancement (not a bug fix) labels Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Related to the code for the standard Arduino API Component: Documentation Related to Arduino's documentation content feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

No branches or pull requests

3 participants