2022-03-07 09:17 AM
2022-03-07 10:30 PM
Like a tap for tempo detection in music?
Anyway...
Use the timer's input capture mode, which means the timer values are stored in the CCR registers when the button is pressed (or released, check the hardware, set the edge sensitivity of the capture accordingly).
If it's a button press made by a human being, you'll have enough time to use just interrupts:
button action 1st interrupt: reset timer counter to 0
button action 2nd interrupt: save timer counter value, then reset
2022-03-07 10:30 PM
Like a tap for tempo detection in music?
Anyway...
Use the timer's input capture mode, which means the timer values are stored in the CCR registers when the button is pressed (or released, check the hardware, set the edge sensitivity of the capture accordingly).
If it's a button press made by a human being, you'll have enough time to use just interrupts:
button action 1st interrupt: reset timer counter to 0
button action 2nd interrupt: save timer counter value, then reset