Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 11 months ago.
Pausing the Timer, Timeout, Ticker using mbed?
How to do this not using HAL. Why there are only read, start, stop function? Where are pause and resume?
1 Answer
5 years, 11 months ago.
You can pause a Timer by using stop and start. It only returns to zero if you call reset.
If I have a ticker running to do something every second why pause it for some unknown length of time and then restart it with an unknown amount of time left until it next triggers? Doesn't it make more sense to simply stop it and then restart it, that way I know exactly when it's next going to trigger. Tickers and timeouts aren't stopwatches, they are for scheduling future events, if you want to change the time that something is scheduled for then most of the time it makes more sense to cancel it and schedule a new event for the new time.
I am using Timeout. Timeout calls for function which terminate some thread. I need to pause it. Pausing called by button. Button may be pressed for unknown times. I can't read from Timeout, how much time is left. I can't pause it either. All I can is to call Kernel::get_ms_count() and take this new time for Timeout. And this is bad, cause i need for double-triple checking for get_ms_count() as my program runs many threads. I could pause Timeout for stm32 HAL, but i don't know which stm32 timer is using for Timeout.
posted by 07 Jan 2019