Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2019
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