Take a look on the STM8S Firmware TIM1 example ''TIM1_Input_Capture'', it calculate the frequency of an external signal. STM8S and STM32 Timers are compatible and the Firmwares are 99% similar. link is :
I am using the STM32F103 VE chip in my project. I need to be able to record the timing between to events to measure the speed of a device. When I get an external interrupt on one of my GPIO's I know that a wheel has moved x inches. So, every time I get this interrupt I would want to start a counter and then stop , record the difference and start the timer again. More specifically one of my GPIO pins will be high and when i get an interrupt it will be pulled low, signaling the fact that the wheel has moved x inches. Then I clear the interrupt and the same thing continues. I have TIM8 on that pin. I was wondering what configuration would be most suitable to get the time difference between the two events. Thanks for your help! -Regards.