Skip to content

Commit 2fab524

Browse files
authored
Merge pull request #6068 from mprse/fix_for_issue_6054_interrupts_scheduled_in_the_past
Fix for issue #6054 - interrupts scheduled in the past.
2 parents 28ac288 + c2760be commit 2fab524

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hal/mbed_ticker_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ static void schedule_interrupt(const ticker_data_t *const ticker)
235235
}
236236

237237
timestamp_t match_tick = compute_tick(ticker, match_time);
238+
// The time has been checked to be future, but it could still round
239+
// to the last tick as a result of us to ticks conversion
240+
if (match_tick == queue->tick_last_read) {
241+
// Match time has already expired so fire immediately
242+
ticker->interface->fire_interrupt();
243+
return;
244+
}
245+
238246
ticker->interface->set_interrupt(match_tick);
239247
timestamp_t cur_tick = ticker->interface->read();
240248

0 commit comments

Comments
 (0)