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

Warn when input_pulldown is attemped on GPIO pins that do not support input_pulldown #99

Open
clay53 opened this issue Nov 15, 2021 · 1 comment

Comments

@clay53
Copy link

clay53 commented Nov 15, 2021

GPIO pins 2 & 3 do not support being pulled down. They are fixed pulled up pinout.xyz. I did not know this and have been going a little crazy for the past hour. There should be a warning when things like this are attempted (I don't know if an external resistor can be used but I still feel like there should be something to distinguish things).

@golemparts
Copy link
Owner

golemparts commented Nov 17, 2021

Thanks for posting this suggestion. Technically RPPAL will still properly configure the GPIO pin internally, but obviously the external pull-up resistor messes things up as you mentioned.

While it would be easy to say this is the user's responsibility, the external resistors are part of the board, which is why I agree RPPAL should warn users when certain configuration options have unintended consequences. The most logical solution would be to return an error when some of the Pin::into_... methods are called, although for the sake of consistency perhaps they should all return a Result. This will also require board identification and per-board GPIO pin details, as some boards (namely the Compute modules) don't have these pull-up resistors.

EDIT: Or alternatively, remove into_input_pulldown and into_input_pullup, add set_pullupdown back to InputPin, and return a Result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Feature requests
  
Awaiting triage
Development

No branches or pull requests

2 participants