summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-11-14 16:17:24 +1100
committerDamien George <damien@micropython.org>2023-11-29 16:25:28 +1100
commit12ef8a5ba2558a1dd9209c2b1b843a28fb2b584e (patch)
tree3b65a8430314191eec2635e457cd526f4a348b1a
parentfc94399ffe3c0c794319dd2641386b1ad896ec4f (diff)
rp2/mphalport: Optimise exit of mp_hal_delay_ms loop.
best_effort_wfe_or_timeout() already calls time_reached() and returns the result of it, so no need to call it again. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/rp2/mphalport.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c
index c567a560b..1fb833f2e 100644
--- a/ports/rp2/mphalport.c
+++ b/ports/rp2/mphalport.c
@@ -192,10 +192,9 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
void mp_hal_delay_ms(mp_uint_t ms) {
absolute_time_t t = make_timeout_time_ms(ms);
- while (!time_reached(t)) {
+ do {
MICROPY_EVENT_POLL_HOOK_FAST;
- best_effort_wfe_or_timeout(t);
- }
+ } while (!best_effort_wfe_or_timeout(t));
}
void mp_hal_time_ns_set_from_rtc(void) {