Skip to content
Snippets Groups Projects
Commit 43910c1b authored by Mariano Alvira's avatar Mariano Alvira
Browse files

don't worry about wraparound in rtimer_arch_schedule

parent 6c0bbc49
No related branches found
No related tags found
No related merge requests found
...@@ -77,11 +77,19 @@ rtimer_arch_schedule(rtimer_clock_t t) ...@@ -77,11 +77,19 @@ rtimer_arch_schedule(rtimer_clock_t t)
volatile uint32_t now; volatile uint32_t now;
now = rtimer_arch_now(); now = rtimer_arch_now();
PRINTF("rtimer_arch_schedule time %u; now is %u\n", t,now); PRINTF("rtimer_arch_schedule time %u; now is %u\n", t,now);
#if 1
/* If specified time is always in the future, counter can wrap without harm */
*CRM_RTC_TIMEOUT = t - now;
#else
/* Immediate interrupt if specified time is before current time. This may also
happen on counter overflow. */
if(now>t) { if(now>t) {
*CRM_RTC_TIMEOUT = 1; *CRM_RTC_TIMEOUT = 1;
} else { } else {
*CRM_RTC_TIMEOUT = t - now; *CRM_RTC_TIMEOUT = t - now;
} }
#endif
clear_rtc_wu_evt(); clear_rtc_wu_evt();
enable_rtc_wu(); enable_rtc_wu();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment