summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/systick.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/systick.c
parentc138b21cebfa1a32e9911c1424aa1016c679463b (diff)
downloadmicropython-a5159edc2090a5670c33a829d7e54ab2ba8635c4.tar.gz
micropython-a5159edc2090a5670c33a829d7e54ab2ba8635c4.zip
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/systick.c')
-rw-r--r--stmhal/systick.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stmhal/systick.c b/stmhal/systick.c
index eb11de9b74..71e3d34889 100644
--- a/stmhal/systick.c
+++ b/stmhal/systick.c
@@ -24,6 +24,7 @@
* THE SOFTWARE.
*/
+#include "py/runtime.h"
#include "py/mphal.h"
#include "irq.h"
#include "systick.h"
@@ -58,6 +59,7 @@ void mp_hal_delay_ms(mp_uint_t Delay) {
// Wraparound of tick is taken care of by 2's complement arithmetic.
while (uwTick - start < Delay) {
// Enter sleep mode, waiting for (at least) the SysTick interrupt.
+ mp_handle_pending();
#if MICROPY_PY_THREAD
if (pyb_thread_enabled) {
pyb_thread_yield();