diff --git a/cpu/mc1322x/rtimer-arch.c b/cpu/mc1322x/rtimer-arch.c index 0cbff6b15..f85fb15a2 100644 --- a/cpu/mc1322x/rtimer-arch.c +++ b/cpu/mc1322x/rtimer-arch.c @@ -77,11 +77,19 @@ rtimer_arch_schedule(rtimer_clock_t t) volatile uint32_t now; now = rtimer_arch_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) { *CRM_RTC_TIMEOUT = 1; } else { *CRM_RTC_TIMEOUT = t - now; } +#endif clear_rtc_wu_evt(); enable_rtc_wu();