Skip to content

Commit 7f7adad

Browse files
committed
mimxrt/mphalport: Run events at least once in mp_hal_delay_ms.
Per the docs for `time.sleep()` and `time.sleep_ms()`. This gets the `tests/micropython/schedule_sleep.py` test working when using the native emitter. Signed-off-by: Damien George <damien@micropython.org>
1 parent eaa7ca6 commit 7f7adad

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ports/mimxrt/mphalport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ static inline mp_uint_t mp_hal_ticks_us(void) {
123123
}
124124

125125
static inline void mp_hal_delay_ms(mp_uint_t ms) {
126+
// This function must run events at least once, so do that now.
127+
mp_event_handle_nowait();
128+
126129
uint64_t us = (uint64_t)ms * 1000;
127130
ticks_delay_us64(us);
128131
}

0 commit comments

Comments
 (0)