mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
extmod: Switch to use new event functions.
See previous commit for details of these functions. As of this commit, these still call the old hook macros on all ports. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
committed by
Damien George
parent
f5be0128e4
commit
df3948d3c2
@@ -222,8 +222,13 @@ STATIC mp_obj_t network_cyw43_scan(size_t n_args, const mp_obj_t *pos_args, mp_m
|
||||
|
||||
// Wait for scan to finish, with a 10s timeout
|
||||
uint32_t start = mp_hal_ticks_ms();
|
||||
while (cyw43_wifi_scan_active(self->cyw) && mp_hal_ticks_ms() - start < 10000) {
|
||||
MICROPY_EVENT_POLL_HOOK
|
||||
const uint32_t TIMEOUT = 10000;
|
||||
while (cyw43_wifi_scan_active(self->cyw)) {
|
||||
uint32_t elapsed = mp_hal_ticks_ms() - start;
|
||||
if (elapsed >= TIMEOUT) {
|
||||
break;
|
||||
}
|
||||
mp_event_wait_ms(TIMEOUT - elapsed);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user