mirror of
https://github.com/micropython/micropython.git
synced 2025-12-15 17:30:14 +01:00
samd/mphalport: Simplify mp_hal_delay_ms().
Do NOT use `mp_hal_delay_us()` for short delays. This was initially done to make short delays precise, but it does not allow for scheduling. Leave using `mp_hal_delay_us()` to user code if needed. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user