don't worry about wraparound in rtimer_arch_schedule
This commit is contained in:
parent
6c0bbc492b
commit
43910c1be7
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue