set_interrupt: short-circuit the setting of the same interrupt.

pull/932/head
Rohit Grover 2015-02-25 11:20:37 +00:00 committed by Rohit Grover
parent 54dc3c1dcf
commit 7d688ad607
1 changed files with 4 additions and 1 deletions

View File

@ -174,7 +174,10 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
us_ticker_init();
}
uint32_t callbackTime = MICROSECONDS_TO_RTC_UNITS(timestamp);
uint32_t callbackTime = MICROSECONDS_TO_RTC_UNITS(timestamp);
if (us_ticker_callbackPending && (callbackTime == us_ticker_callbackTimestamp)) {
return;
}
NRF_RTC1->CC[0] = callbackTime & MAX_RTC_COUNTER_VAL;
us_ticker_callbackTimestamp = callbackTime;
if (!us_ticker_callbackPending) {