I configured my TIM4 as encoder input and everything is working well when I execute TIM_GetCounter(TIM4)
But I would like to put the timer value back to 0 (reset?) when I press a push button with an interrupt on it) and I don't find a reset function. I'm running a STM32F103 with only StdPeriph Lib.
Electronic – STM32: Timer encoder reset
encoderinterruptsrotarystm32timer
Best Answer
You should write one for yourself based on the 'get' function:
So a
TIM_ResetCounter
should look like this:If you check in the reference manual, you can see that the counter value register has read-write access. So you can set it to 0.
You can create a general set function as well with an additional "value" parameter.