2020-12-10 02:08 AM
I am using STM32F072RB.
On my system there is 5 buttons(which is connected to GPIO).I am reading that GPIO continuously to detect the button press.
If there is no any button press detect for 10 min, I want to generate a alarm. And if any of the button pressed then timer should restart the counting from 0.
//to generate 1 second interrupt
timer = timer2
APB timer clock = 8 Mhz
htim2.Init.Prescaler = 8000-1;
htim2.Init.Period = 1000-1;
how to handle the timer for this case?
2020-12-10 02:19 AM
Such long and not timing critical thing are better handle in the main programm loop waiting for a number of systicks to happen while some condition is active. Otherwise there is also a 32 bit timer in the F072 that allows such long waits.
2020-12-10 03:50 AM
Easier to use EXTI and a milli-second count down to generatre an alarm at expiry.