mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/Ticker.cpp
- Revision:
- 174:b96e65c34a4d
- Parent:
- 167:e84263d55307
- Child:
- 175:af195413fb11
--- a/drivers/Ticker.cpp Fri Sep 15 14:59:18 2017 +0100 +++ b/drivers/Ticker.cpp Mon Oct 02 15:33:19 2017 +0100 @@ -25,6 +25,10 @@ void Ticker::detach() { core_util_critical_section_enter(); remove(); + // unlocked only if we were attached (we locked it) + if (_function) { + sleep_manager_unlock_deep_sleep(); + } _function = 0; core_util_critical_section_exit(); } @@ -39,7 +43,9 @@ void Ticker::handler() { insert_absolute(event.timestamp + _delay); - _function(); + if (_function) { + _function(); + } } } // namespace mbed