You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if pull=True when creating a PinAlarm, the pull chosen is the opposite from the value argument. From the doc:
pull (bool) – Enable a pull-up or pull-down which pulls the pin to the level opposite that of value. For instance, if value is set to True, setting pull to True will enable a pull-down, to hold the pin low normally until an outside signal pulls it high.
A user is using a normally-closed switch, connected to a PinAlarm pin. (In this case, the switch is closed when a box lid is closed.) The switch is attached to ground at the far end. So, in the sleeping case (lid closed, switch closed) the alarm pin would be low. When the switch opens, the user wants a wake-up.
I didn't consider normally-closed switches when designing the API. If I had, I might have made pull take either None or digitalio.Pull.UP or digitalio.Pull.DOWN. However, an upward-compatible addition to the API would be:
If pull is False or None (None would be a new allowed arg), do not enable a pull.
if pull is True, enable a pull opposite to value, as is currently done.
If pull is a digitalio.Pull, enable that specific pull.
(The same thing might be done with keypad, but we haven't had a call for that yet, and that complicates thinking about "pressed" and "released". So I'm not going there for keypad.)
The text was updated successfully, but these errors were encountered:
See https://forums.adafruit.com/viewtopic.php?t=215000 for motivation.
Currently, if
pull=True
when creating aPinAlarm
, the pull chosen is the opposite from thevalue
argument. From the doc:A user is using a normally-closed switch, connected to a
PinAlarm
pin. (In this case, the switch is closed when a box lid is closed.) The switch is attached to ground at the far end. So, in the sleeping case (lid closed, switch closed) the alarm pin would be low. When the switch opens, the user wants a wake-up.I didn't consider normally-closed switches when designing the API. If I had, I might have made
pull
take eitherNone
ordigitalio.Pull.UP
ordigitalio.Pull.DOWN
. However, an upward-compatible addition to the API would be:pull
isFalse
orNone
(None
would be a new allowed arg), do not enable a pull.pull
isTrue
, enable apull
opposite tovalue
, as is currently done.pull
is adigitalio.Pull
, enable that specific pull.(The same thing might be done with
keypad
, but we haven't had a call for that yet, and that complicates thinking about "pressed" and "released". So I'm not going there forkeypad
.)The text was updated successfully, but these errors were encountered: