helpfor studient

Dependents:   STM32_F103-C8T6basecanblink_led

Fork of mbed-dev by mbed official

Revision:
183:a56a73fd2a6f
Parent:
182:57724642e740
--- a/hal/mbed_ticker_api.c	Fri Feb 16 16:09:33 2018 +0000
+++ b/hal/mbed_ticker_api.c	Tue Mar 20 16:56:18 2018 +0000
@@ -235,6 +235,14 @@
         }
 
         timestamp_t match_tick = compute_tick(ticker, match_time);
+        // The time has been checked to be future, but it could still round
+        // to the last tick as a result of us to ticks conversion
+        if (match_tick == queue->tick_last_read) {
+            // Match time has already expired so fire immediately
+            ticker->interface->fire_interrupt();
+            return;
+        }
+
         ticker->interface->set_interrupt(match_tick);
         timestamp_t cur_tick = ticker->interface->read();