Help with a simple debounce program on STM32
Make 2  global variables called tick and previousTick, or whatever you want, and inside the timer ISR increment the tick variable by 1. then check if the difference between this tick and previous tick is larger than a value of your choice then consider the button debounced, otherwise if the difference of this tick and previousTick is not large enough then that means your button has bounced.  At the end of ISR  set previousTick = tick.
Psuedo code:
//GLOBALS
uint32_t tick = 0 ; 
uint32_t previousTick = 0 ; 

timerInterrupt()
{

tick++;


if( (tick - previousTick) &gt; 5 ) 
// using your 20ms this means  100ms spread.


then *do some stuff here because button has been deboucned.*

else *do nothing or something else here since button has been clicked too rapidly  or is boucning*

ClearInterrupts();

previousTick = tick;

}