File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change 22
22
#include " platform/NonCopyable.h"
23
23
#include " platform/mbed_sleep.h"
24
24
#include " hal/lp_ticker_api.h"
25
+ #include " platform/mbed_critical.h"
25
26
26
27
namespace mbed {
27
28
/* * \addtogroup drivers */
@@ -113,12 +114,14 @@ class Ticker : public TimerEvent, private NonCopyable<Ticker> {
113
114
*
114
115
*/
115
116
void attach_us (Callback<void ()> func, us_timestamp_t t) {
117
+ core_util_critical_section_enter ();
116
118
// lock only for the initial callback setup and this is not low power ticker
117
119
if (!_function && _lock_deepsleep) {
118
120
sleep_manager_lock_deep_sleep ();
119
121
}
120
122
_function = func;
121
123
setup (t);
124
+ core_util_critical_section_exit ();
122
125
}
123
126
124
127
/* * Attach a member function to be called by the Ticker, specifying the interval in micro-seconds
You can’t perform that action at this time.
0 commit comments