diff options
Diffstat (limited to 'stmhal/stm32_it.c')
-rw-r--r-- | stmhal/stm32_it.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c index e1129ac39..a6503d310 100644 --- a/stmhal/stm32_it.c +++ b/stmhal/stm32_it.c @@ -73,6 +73,7 @@ #include "py/obj.h" #include "pendsv.h" #include "irq.h" +#include "pybthread.h" #include "extint.h" #include "timer.h" #include "uart.h" @@ -287,6 +288,11 @@ void SysTick_Handler(void) { if (DMA_IDLE_ENABLED() && DMA_IDLE_TICK(uwTick)) { dma_idle_handler(uwTick); } + + // signal a thread switch at 4ms=250Hz + if (pyb_thread_enabled && (uwTick & 0x03) == 0x03) { + SCB->ICSR = SCB_ICSR_PENDSVSET_Msk; + } } /******************************************************************************/ |