Steady
Button Debounce Code in C Exercise
Task
The button on PA0 bounces as it is pressed and released while your program runs. Report the button on USART1 for as long as the board runs: if a press has settled -> print PRESS; if a release has settled -> print RELEASE. The registers and bit fields are on the Datasheet tab.
Circuit
Pass condition
A level counts once it has lasted 20 ms. Anything shorter, and the level at reset, prints nothing. The lines are compared in order.
Notes
The given code sets up USART1 and TIM2. The window is timed on TIM2, which counts microseconds and does not wrap during the run.