t
Fork of mbed-dev by
Diff: drivers/Ticker.cpp
- Revision:
- 175:b96e65c34a4d
- Parent:
- 168:e84263d55307
- Child:
- 176: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