mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
Diff: drivers/Ticker.cpp
- Revision:
- 174:b96e65c34a4d
- Parent:
- 167:e84263d55307
- Child:
- 175:af195413fb11
diff -r e131a1973e81 -r b96e65c34a4d drivers/Ticker.cpp --- 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