Skip to content

Commit 39f31c3

Browse files
committed
idle loop: add deepsleep locks
For backward compability, we invoke just sleep mode. Adding critical section to complete lock/unlock deepsleep section.
1 parent c5a41d8 commit 39f31c3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

rtos/rtos_idle.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222

2323
#include "rtos/rtos_idle.h"
2424
#include "platform/mbed_sleep.h"
25+
#include "mbed_critical.h"
2526

2627
static void default_idle_hook(void)
2728
{
28-
/* Sleep: ideally, we should put the chip to sleep.
29-
Unfortunately, this usually requires disconnecting the interface chip (debugger).
30-
This can be done, but it would break the local file system.
31-
*/
29+
// critical section to complete sleep with locked deepsleep
30+
core_util_critical_section_enter();
31+
sleep_manager_lock_deep_sleep();
3232
sleep();
33+
sleep_manager_unlock_deep_sleep();
34+
core_util_critical_section_exit();
3335
}
3436
static void (*idle_hook_fptr)(void) = &default_idle_hook;
3537

0 commit comments

Comments
 (0)