diff options
| -rw-r--r-- | docs/samd/quickref.rst | 2 | ||||
| -rw-r--r-- | ports/samd/mphalport.c | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/docs/samd/quickref.rst b/docs/samd/quickref.rst index 60c57b3a4..25b5a8fc8 100644 --- a/docs/samd/quickref.rst +++ b/docs/samd/quickref.rst @@ -65,6 +65,8 @@ Use the :mod:`time <time>` module:: start = time.ticks_ms() # get millisecond counter delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference +Note that :func:`time.sleep_us()` delays by busy waiting. During that time, other tasks are +not scheduled. Clock and time -------------- diff --git a/ports/samd/mphalport.c b/ports/samd/mphalport.c index 3a33fdd6b..84d05b918 100644 --- a/ports/samd/mphalport.c +++ b/ports/samd/mphalport.c @@ -69,13 +69,9 @@ void mp_hal_clr_pin_mux(mp_hal_pin_obj_t pin) { } void mp_hal_delay_ms(mp_uint_t ms) { - if (ms > 10) { - uint32_t t0 = systick_ms; - while (systick_ms - t0 < ms) { - MICROPY_EVENT_POLL_HOOK - } - } else { - mp_hal_delay_us(ms * 1000); + uint32_t t0 = systick_ms; + while (systick_ms - t0 < ms) { + MICROPY_EVENT_POLL_HOOK } } |
