Skip to main content
LMorr.3
Senior
April 17, 2022
Question

Example to debounce multiple buttons

  • April 17, 2022
  • 2 replies
  • 1186 views

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
April 18, 2022

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
April 18, 2022

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