mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
189:f392fc9709a3
Parent:
188:bcfe06ba3d64
--- a/hal/LowPowerTickerWrapper.cpp	Thu Nov 08 11:46:34 2018 +0000
+++ b/hal/LowPowerTickerWrapper.cpp	Wed Feb 20 22:31:08 2019 +0000
@@ -1,5 +1,6 @@
 /* mbed Microcontroller Library
  * Copyright (c) 2018 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -32,7 +33,12 @@
 {
     core_util_critical_section_enter();
 
-    if (_pending_fire_now || _match_check(_intf->read()) || _suspended) {
+    // This code no longer filters out early interrupts. Instead it
+    // passes them through to the next layer and ignores further interrupts
+    // until the next call to set_interrrupt or fire_interrupt (when not suspended).
+    // This is to ensure that the device doesn't get stuck in sleep due to an
+    // early low power ticker interrupt that was ignored.
+    if (_pending_fire_now || _pending_match || _suspended) {
         _timeout.detach();
         _pending_timeout = false;
         _pending_match = false;
@@ -214,13 +220,13 @@
 
     timestamp_t current = _intf->read();
     /* Add extra check for '_last_set_interrupt == _cur_match_time'
-     * 
+     *
      * When '_last_set_interrupt == _cur_match_time', _ticker_match_interval_passed sees it as
      * one-round interval rather than just-pass, so add extra check for it. In rare cases, we
      * may trap in _timeout_handler/_schedule_match loop. This check can break it.
      */
     if ((_last_set_interrupt == _cur_match_time) ||
-        _ticker_match_interval_passed(_last_set_interrupt, current, _cur_match_time)) {
+            _ticker_match_interval_passed(_last_set_interrupt, current, _cur_match_time)) {
         _intf->fire_interrupt();
     } else {
         _schedule_match(current);
@@ -238,7 +244,7 @@
     }
     /* Add extra check for '_last_set_interrupt == _cur_match_time' as above */
     return (_last_set_interrupt == _cur_match_time) ||
-        _ticker_match_interval_passed(_last_set_interrupt, current, _cur_match_time);
+           _ticker_match_interval_passed(_last_set_interrupt, current, _cur_match_time);
 }
 
 uint32_t LowPowerTickerWrapper::_lp_ticks_to_us(uint32_t ticks)