-
-
Notifications
You must be signed in to change notification settings - Fork 725
pin initialization #428
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
Comments
Hi @sslupsky, This was done to maintain compatibility with AVR, where the default modes of pins in INPUT. |
I see. Could a compiler directive be used to selectively set the mode to inputs if AVR otherwise, use the variant? |
Sorry, it's not clear what you mean. I was talking more about existing sketches that run on AVR could run on SAMD boards as is, if they don't explicitly set the pin mode to input. |
Ok. I mistakenly thought the issue was to ensure existing AVR sketches would run on AVR hardware. Perhaps the best way then is to use an approach similar to what is done with the new VERY_LOW_POWER directive. However, instead of not initializing the pins at all, initialize them as described by the variant definition (variant.cpp). The VERY_LOW_POWER directive itself mostly addresses this issue though since the original motivation was to avoid excessive current. |
Yup, VERY_LOW_POWER defines targets exactly this problem, not by initializing all the pins to the expected function but avoiding any initialization and waiting for the proper user action. |
Pin initialization appears to default to "INPUT" per PR #28 to maintain compatibility with AVR Arduinos. It is not clear to me what the consequence is if this was changed. Could someone please explain why this is necessary?
I would like to suggest that the pins should be initialized according to their definition in the boards corresponding variant.cpp file as follows:
That would ensure that there is no confusion regarding what the intended "default" state of the pins is when the initialization is complete.
The text was updated successfully, but these errors were encountered: