mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 00:50:24 +08:00
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>
This commit is contained in:
parent
fc94399ffe
commit
12ef8a5ba2
@ -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) {
|
void mp_hal_delay_ms(mp_uint_t ms) {
|
||||||
absolute_time_t t = make_timeout_time_ms(ms);
|
absolute_time_t t = make_timeout_time_ms(ms);
|
||||||
while (!time_reached(t)) {
|
do {
|
||||||
MICROPY_EVENT_POLL_HOOK_FAST;
|
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) {
|
void mp_hal_time_ns_set_from_rtc(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user