Skip to main content
LMorr.3
Senior
Apr 17, 2022 2:50 PM UTC
Question

Example to debounce multiple buttons

I will have 8 buttons to debounce. I also would like to detect 'press and hold' as well as double taps. Are there existing examples on how to do this correctly using interupt?

Thanks!

This topic has been closed for replies.

2 replies

S.Ma
Principal
Apr 18, 2022 2:02 AM UTC

Each situation is different. In bare metal without low power mode, I use a 50+ msec flag set by systick 50 sw counter, cleared by main loop to read each pin and increment a key counter when key level is pressed and was pressed previously, then use counter values for debounced, repeat push slow, fast and long pressed key. This should be working in less than few hours.

LMorr.3
LMorr.3Author
Senior
Apr 18, 2022 5:57 PM UTC

Ok, I see what you mean. What do you clear in the main loop?