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:
Damien George
2026-01-26 01:03:20 +11:00
parent 45556c466a
commit 6d9d880f38

View File

@@ -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.