On line 301
of app_timer.c
there is the following code:
// No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue.
if (mp_timer_id_head == NULL)
{
NRF_RTC1->TASKS_CLEAR = 1;
m_ticks_latest = 0;
m_rtc1_reset = true;
}
Why do you have to clear the timer to zero when there are no more running timers and start timer operations are present in the queue? What is it good for?
In my use I have only single shot timers that run and when they expire in the callback I setup a new timer. This is exactly that situation -> no running timers but new timer present in the queue.
I wish to use app_timer_cnt_get
to get the lapsed time but it is impossible when you clear the timer with NRF_RTC1->TASKS_CLEAR = 1;
.
As I see it you should never clear NRF_RTC1->TASKS_CLEAR = 1;
because it makes app_timer_cnt_get
unusable.
What do you think?
EDIT: If you remove the aforementioned code then you can also remove m_rtc1_reset
because it is not used anywhere else.