mbed-os/targets/TARGET_STM/TARGET_STM32L1/TARGET_NZ32_SC151
Bradley Scott b1f3ef4872 STM32: Fix 32-bit us ticker interrupt scheduling
For STM32 targets using a 32-bit timer for the microsecond ticker, the
driver did not properly handle timestamps that are in the past.  It
would just blindly set the compare register to the requested timestamp,
resulting in the interrupt being serviced up to 4295 seconds late
(i.e. after the 32-bit timer counts all the way around to hit the
timestamp again).

This problem can easily be reproduced by creating a Timeout object
then calling the timeout's attach_us() member function to attach a
callback with a timeout of 0 us.  The callback will not get called for
over 2147 seconds, and possibly up to 4295 seconds late if no other
microsecond ticker events are getting scheduled in the meantime.

Now, after the compare register has been set, the timestamp is checked
against the current time to see if the timestamp is in the past, and
if so, the compare event is manually set.

NOTE: By checking if the timestamp is in the past after configuring the
capture register, we ensure proper handling in the case where the timer
updates past the timestamp while setting the capture register.
2017-06-11 09:48:11 +01:00
..
device STM32: Fix 32-bit us ticker interrupt scheduling 2017-06-11 09:48:11 +01:00
PeripheralNames.h restructure - Moved targets out to top level 2016-09-30 19:18:09 -05:00
PeripheralPins.c STM32 L1: Define PWM Channels in PeripheralsPins.c 2017-02-17 14:11:41 +01:00
PinNames.h Added mapping to USER_BUTTON-labelled switches 2017-04-28 11:37:23 -05:00
objects.h STM32: remove useless include 2017-01-12 19:11:36 +01:00