3 ms·
Out of curiosity, is there anything in particular that you're looking for? On a cursory glance, whenever a key state is sampled as different to the previously r
by Teknoman117 5y ago
Out of curiosity, is there anything in particular that you're looking for? On a cursory glance, whenever a key state is sampled as different to the previously reported state, it immediately reports a state change and locks out any further reports for a specified amount of time. So, the report goes out the moment the state changes, so long as you can't perceive the debounce time, which I presume would be a few dozen microseconds. (Rather than some debouncers I've seen which wait for the debounce period to end before sending the initial report)
- fps-hero 5y agoYes. 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.