cancel
Showing results for 
Search instead for 
Did you mean: 

Example to debounce multiple buttons

LMorr.3
Senior II

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!

2 REPLIES 2
S.Ma
Principal

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
Senior II

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