Update us_ticker.c

pull/3982/head
mjrgh 2017-03-21 15:52:52 -07:00 committed by GitHub
parent 72ccf0b2b5
commit 15c740f8cb
1 changed files with 2 additions and 3 deletions

View File

@ -185,12 +185,11 @@ static void lptmr_isr(void) {
} }
void us_ticker_set_interrupt(timestamp_t timestamp) { void us_ticker_set_interrupt(timestamp_t timestamp) {
uint32_t tcur = us_ticker_read(); int delta = (int)((uint32_t)timestamp - us_ticker_read());
int delta = (int)((uint32_t)timestamp - tcur);
if (delta <= 0) { if (delta <= 0) {
// This event was in the past. Force it into the very near // This event was in the past. Force it into the very near
// future instead. // future instead.
timestamp = tcur + 2; delta = 1;
} }
us_ticker_int_counter = (uint32_t)(delta >> 16); us_ticker_int_counter = (uint32_t)(delta >> 16);