mirror of
https://github.com/micropython/micropython.git
synced 2026-03-11 11:20:17 +01:00
alif/modmachine: Disable IRQs before going to sleep.
Per the Alif example code and documentation for these functions. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -99,10 +99,14 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
|
||||
MICROPY_BOARD_ENTER_STANDBY();
|
||||
#endif
|
||||
|
||||
__disable_irq();
|
||||
|
||||
// This enters the deepest possible CPU sleep state, without
|
||||
// losing CPU state. CPU and subsystem power will remain on.
|
||||
pm_core_enter_deep_sleep();
|
||||
|
||||
__enable_irq();
|
||||
|
||||
#ifdef MICROPY_BOARD_EXIT_STANDBY
|
||||
MICROPY_BOARD_EXIT_STANDBY();
|
||||
#endif
|
||||
@@ -121,6 +125,8 @@ MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args
|
||||
MICROPY_BOARD_ENTER_STOP();
|
||||
#endif
|
||||
|
||||
__disable_irq();
|
||||
|
||||
// If power is removed from the subsystem, the function does
|
||||
// not return, and the CPU will reboot when/if the subsystem
|
||||
// is next powered up.
|
||||
|
||||
Reference in New Issue
Block a user