altos: Use fast timer for buttons instead of edge-triggered ISR
authorKeith Packard <keithp@keithp.com>
Tue, 13 Aug 2019 00:30:48 +0000 (17:30 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 13 Aug 2019 00:30:48 +0000 (17:30 -0700)
commitfcb5d55e94058810fc8b31ad5e8caa99fa61200c
tree3f2192b8ca74fdfc5fa68e6cc59ee294dd02e315
parent5e738fd2e3602c6a92f205df99361dbe06c1719e
altos: Use fast timer for buttons instead of edge-triggered ISR

If the button bounces between the triggering interrupt and the button
state check, we could lose the final state change of the button and
send an incorrect event to the application. In the worst case, the button
would end up in exactly the wrong state, toggling in the wrong direction.

Use the fast timer to poll all buttons instead so that there is only
one check of each button at each poll interval (instead of the
interrupt and the state check). This makes buttons reliably debounced.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_button.c