Morten Hattesen

Morten Hattesen

Great article. So many debouncers are implemented in hardware (with RC filters creating noticeable delay) or software using interrupts or hardware dependent counting.
I have recently created a debounce+control library for a rotary switch with an integral pushbutton, requiring different debouncing times for the rotation (cw/ccw) and the pushbutton, and detecting push, long-push (cannot obviously not be detected leading-edge), as well as double-click. Suddenly you have to deal with debounce timing, as well aslong-click and double click timing limits.
The client programs register which events they are interested in receiving from the pushbutton, and if they are only interested in the push-event, they get leading edge detection, otherwise the client program will get notified upon key-release (and in case of a double-click, a notification on (short press) key-release, followed by a double-click notification).