idle loop: add deepsleep locks

For backward compability, we invoke just sleep mode. Adding critical section to complete
lock/unlock deepsleep section.
pull/4912/head
Martin Kojtal 2017-08-30 12:51:50 +01:00
parent c5a41d83c2
commit 39f31c3195
1 changed files with 6 additions and 4 deletions

View File

@ -22,14 +22,16 @@
#include "rtos/rtos_idle.h"
#include "platform/mbed_sleep.h"
#include "mbed_critical.h"
static void default_idle_hook(void)
{
/* Sleep: ideally, we should put the chip to sleep.
Unfortunately, this usually requires disconnecting the interface chip (debugger).
This can be done, but it would break the local file system.
*/
// critical section to complete sleep with locked deepsleep
core_util_critical_section_enter();
sleep_manager_lock_deep_sleep();
sleep();
sleep_manager_unlock_deep_sleep();
core_util_critical_section_exit();
}
static void (*idle_hook_fptr)(void) = &default_idle_hook;