Let's say I have this code:
NRF_TIMER_Type *some_timer = ...; some_timer->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Msk;
If I understand correctly, the code above sets up the timer to automatically clear on the EVENTS_COMPARE[0] event. RTCs don't have a SHORTS register though, so I need to use PPI:
NRF_RTC_Type *some_rtc = ...; NRF_PPI->CH[chn].EEP = (uint32_t) &some_rtc->EVENTS_COMPARE[0]; NRF_PPI->CH[chn].TEP = (uint32_t) &some_rtc->TASKS_CLEAR; NRF_PPI->FORK[chn].TEP = 0; NRF_PPI->CHENSET = (1 << chn);
Does this code produce the same behavior for an RTC as I would see using a TIMER shortcut?
Yes, assuming they are setup properly - although obviously with the low frequency clock instead of the high frequency clock.