summaryrefslogtreecommitdiff
path: root/stmhal/can.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-15 23:04:53 +1100
committerDamien George <damien.p.george@gmail.com>2017-03-20 15:20:26 +1100
commita5159edc2090a5670c33a829d7e54ab2ba8635c4 (patch)
tree036b854990ce272ec39f6d7605452ad13b34a3fd /stmhal/can.c
parentc138b21cebfa1a32e9911c1424aa1016c679463b (diff)
stmhal: Enable micropython.schedule().
ExtInt, Timer and CAN IRQ callbacks are made to work with the scheduler. They are still hard IRQs by default, but one can now call micropython.schedule within the hard IRQ to schedule a soft callback.
Diffstat (limited to 'stmhal/can.c')
-rw-r--r--stmhal/can.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stmhal/can.c b/stmhal/can.c
index e293b8742..9b8f2a071 100644
--- a/stmhal/can.c
+++ b/stmhal/can.c
@@ -865,6 +865,7 @@ void can_rx_irq_handler(uint can_id, uint fifo_id) {
}
if (callback != mp_const_none) {
+ mp_sched_lock();
gc_lock();
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
@@ -877,6 +878,7 @@ void can_rx_irq_handler(uint can_id, uint fifo_id) {
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
}
gc_unlock();
+ mp_sched_unlock();
}
}