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
I'm using this library on a Pi Zero W to interface with an old rotary phone, and switch transitions definitely aren't clean 100% of the time.
Previously I have used the gpiozero Python library, which has the option to "debounce" inputs: a user-supplied time delay controls how soon before new input states can be registered. As far as I can tell, this crate does not have any such capability.
What I would love to see is a new method for InputPin that sets a debounce time using a Duration. This might work something like the following:
constBCM_INPUT:u8 = 2;let gpio = Gpio::new()?;// Ignore state changes on `button` less than 50 ms apart.let debounce_time = Duration::from_millis(50);let button = gpio.get(BCM_INPUT)?.into_input_pulldown().debounce(debounce_time);// ...
Of course, I could implement my own debouncing code on top of rppal, but I strongly feel that this is something that should be implemented in this crate directly, as debouncing digital inputs from switches is an extremely common practice.
The text was updated successfully, but these errors were encountered:
TheBerkin
changed the title
input debounce support
InputPin debounce support
Jun 3, 2020
I'm using this library on a Pi Zero W to interface with an old rotary phone, and switch transitions definitely aren't clean 100% of the time.
Previously I have used the
gpiozero
Python library, which has the option to "debounce" inputs: a user-supplied time delay controls how soon before new input states can be registered. As far as I can tell, this crate does not have any such capability.What I would love to see is a new method for
InputPin
that sets a debounce time using aDuration
. This might work something like the following:Of course, I could implement my own debouncing code on top of
rppal
, but I strongly feel that this is something that should be implemented in this crate directly, as debouncing digital inputs from switches is an extremely common practice.The text was updated successfully, but these errors were encountered: