Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions drivers/Ticker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 1 addition & 11 deletions drivers/Ticker.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,7 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
* 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
*
Expand Down