mirror of https://github.com/ARMmbed/mbed-os.git
Force events into the future
parent
094d9ac909
commit
72ccf0b2b5
|
@ -185,11 +185,12 @@ static void lptmr_isr(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void us_ticker_set_interrupt(timestamp_t timestamp) {
|
void us_ticker_set_interrupt(timestamp_t timestamp) {
|
||||||
int delta = (int)((uint32_t)timestamp - us_ticker_read());
|
uint32_t tcur = us_ticker_read();
|
||||||
|
int delta = (int)((uint32_t)timestamp - tcur);
|
||||||
if (delta <= 0) {
|
if (delta <= 0) {
|
||||||
// This event was in the past:
|
// This event was in the past. Force it into the very near
|
||||||
us_ticker_irq_handler();
|
// future instead.
|
||||||
return;
|
timestamp = tcur + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
us_ticker_int_counter = (uint32_t)(delta >> 16);
|
us_ticker_int_counter = (uint32_t)(delta >> 16);
|
||||||
|
|
Loading…
Reference in New Issue