Merge pull request #9483 from mprse/ticker_sleep_lock_fix

Fix for Issue #7308 (Deep_sleep_lock Ticker.h Issue)
pull/9528/head
Martin Kojtal 2019-01-29 09:27:12 +01:00 committed by GitHub
commit d1b367fbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View File

@ -53,4 +53,16 @@ void Ticker::handler()
}
}
void Ticker::attach_us(Callback<void()> func, us_timestamp_t t)
{
core_util_critical_section_enter();
// lock only for the initial callback setup and this is not low power ticker
if (!_function && _lock_deepsleep) {
sleep_manager_lock_deep_sleep();
}
_function = func;
setup(t);
core_util_critical_section_exit();
}
} // namespace mbed

View File

@ -117,17 +117,7 @@ public:
* for threads scheduling.
*
*/
void attach_us(Callback<void()> func, us_timestamp_t t)
{
core_util_critical_section_enter();
// lock only for the initial callback setup and this is not low power ticker
if (!_function && _lock_deepsleep) {
sleep_manager_lock_deep_sleep();
}
_function = func;
setup(t);
core_util_critical_section_exit();
}
void attach_us(Callback<void()> func, us_timestamp_t t);
/** Attach a member function to be called by the Ticker, specifying the interval in microseconds
*