Skip to content

Commit 6d9d880

Browse files
committed
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>
1 parent 45556c4 commit 6d9d880

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ports/alif/modmachine.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) {
9999
MICROPY_BOARD_ENTER_STANDBY();
100100
#endif
101101

102+
__disable_irq();
103+
102104
// This enters the deepest possible CPU sleep state, without
103105
// losing CPU state. CPU and subsystem power will remain on.
104106
pm_core_enter_deep_sleep();
105107

108+
__enable_irq();
109+
106110
#ifdef MICROPY_BOARD_EXIT_STANDBY
107111
MICROPY_BOARD_EXIT_STANDBY();
108112
#endif
@@ -121,6 +125,8 @@ MP_NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args
121125
MICROPY_BOARD_ENTER_STOP();
122126
#endif
123127

128+
__disable_irq();
129+
124130
// If power is removed from the subsystem, the function does
125131
// not return, and the CPU will reboot when/if the subsystem
126132
// is next powered up.

0 commit comments

Comments
 (0)