diff options
Diffstat (limited to 'stmhal/extint.c')
-rw-r--r-- | stmhal/extint.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/stmhal/extint.c b/stmhal/extint.c index dacf8dd568..59b00cb73c 100644 --- a/stmhal/extint.c +++ b/stmhal/extint.c @@ -28,7 +28,6 @@ #include <stddef.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" @@ -412,6 +411,7 @@ void Handle_EXTI_Irq(uint32_t line) { if (line < EXTI_NUM_VECTORS) { mp_obj_t *cb = &MP_STATE_PORT(pyb_extint_callback)[line]; if (*cb != mp_const_none) { + mp_sched_lock(); // When executing code within a handler we must lock the GC to prevent // any memory allocations. We must also catch any exceptions. gc_lock(); @@ -427,6 +427,7 @@ void Handle_EXTI_Irq(uint32_t line) { mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); } gc_unlock(); + mp_sched_unlock(); } } } |