trigger interrupt manually if timer is  to be scheduled within TIMERTHRESHOLD ticks.
@@ -52,11 +52,17 @@ void sctimer_setCompare(uint32_t val){
if (SleepModeTimerCountGet() - val < TIMERLOOP_THRESHOLD){
// the timer is already late, schedule the ISR right now manually
IntPendSet(INT_SMTIM);
+ } else {
+ if (val-SleepModeTimerCountGet()<TIMERTHRESHOLD){
+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks
+ // schedule ISR right now manually
+ IntPendSet(INT_SMTIM);
} else {
// schedule the timer at val
SleepModeTimerCompareSet(val);
}
}
+}
/**
\brief Return the current value of the timer's counter.
