mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: drivers/Ticker.cpp
- Revision:
- 187:0387e8f68319
- Parent:
- 175:af195413fb11
- Child:
- 189:f392fc9709a3
--- a/drivers/Ticker.cpp Fri Jun 22 16:45:37 2018 +0100 +++ b/drivers/Ticker.cpp Thu Sep 06 13:40:20 2018 +0100 @@ -22,11 +22,12 @@ namespace mbed { -void Ticker::detach() { +void Ticker::detach() +{ core_util_critical_section_enter(); remove(); // unlocked only if we were attached (we locked it) and this is not low power ticker - if(_function && _lock_deepsleep) { + if (_function && _lock_deepsleep) { sleep_manager_unlock_deep_sleep(); } @@ -34,7 +35,8 @@ core_util_critical_section_exit(); } -void Ticker::setup(us_timestamp_t t) { +void Ticker::setup(us_timestamp_t t) +{ core_util_critical_section_enter(); remove(); _delay = t; @@ -42,7 +44,8 @@ core_util_critical_section_exit(); } -void Ticker::handler() { +void Ticker::handler() +{ insert_absolute(event.timestamp + _delay); if (_function) { _function();