summaryrefslogtreecommitdiff
path: root/stmhal/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/timer.c')
-rw-r--r--stmhal/timer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 494045c28..7f0a70c5e 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -1363,6 +1363,7 @@ STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_o
// execute callback if it's set
if (callback != 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();
@@ -1382,6 +1383,7 @@ STATIC void timer_handle_irq_channel(pyb_timer_obj_t *tim, uint8_t channel, mp_o
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
gc_unlock();
+ mp_sched_unlock();
}
}
}