3 ms·
Yes. Essentially, when you see an edge, update the state immediately but have a guard interval before allowing further state changes. Intuitively, this means r
by fps-hero 5y ago
Yes. Essentially, when you see an edge, update the state immediately but have a guard interval before allowing further state changes.
Intuitively, this means register the event when you see the first edge, not once the bounces have finished.
For an example of incorrect denouncing, see most articles on denouncing (the hackaday article comes to mind), and the QMK firmware last time I checked (most keyboard set the denounce time to zero, so the debounce time just becomes the update rate).
- colejohnson66 5y ago> Yes. Essentially, when you see an edge, update the state immediately but have a guard interval before allowing further state changes. Isn’t that ultimately what capacitor + Schmitt buffer debouncers does? The only difference is that this would be in software?
- fps-hero 5y agoA capacitor plus pull up resistor will add an RC time constant delay on switch release, and for it to be effective at denouncing it needs to be on the order of 10ms. A software solution has zero delay in both cases. A Schmitt buffer isn’t necessary when using polled GPIO with a microcontroller. An equivalent accurate discrete logic circuit would be a latching circuit with a gated input pulse on state change corresponding to the denounce time, which is overkill for simple button handling.
- stevenhuang 5y agoJust to check, you do mean 'debounce' right? Since you said 'denounce' a couple times I'm not sure if this is some jargon I've not been aware of or just auto-correct.