Fix for Issue #7308 (Deep_sleep_lock Ticker.h Issue)

pull/9483/head
Przemyslaw Stekiel 2019-01-24 08:22:24 +01:00
parent af52c30234
commit af02b23bf7
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 } // namespace mbed

View File

@ -117,17 +117,7 @@ public:
* for threads scheduling. * for threads scheduling.
* *
*/ */
void attach_us(Callback<void()> func, us_timestamp_t t) 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();
}
/** Attach a member function to be called by the Ticker, specifying the interval in microseconds /** Attach a member function to be called by the Ticker, specifying the interval in microseconds
* *