diff options
author | Angus Gratton <angus@redyak.com.au> | 2023-11-30 14:32:41 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-12-08 12:48:50 +1100 |
commit | df3948d3c23e3572c49d18ede03bf3ac97ee601c (patch) | |
tree | 7435061520a222a0ef859535a6c814d9eaffb486 /extmod/network_cyw43.c | |
parent | f5be0128e4da1417136495c20888f8291cd22386 (diff) | |
download | micropython-df3948d3c23e3572c49d18ede03bf3ac97ee601c.tar.gz micropython-df3948d3c23e3572c49d18ede03bf3ac97ee601c.zip |
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>
Diffstat (limited to 'extmod/network_cyw43.c')
-rw-r--r-- | extmod/network_cyw43.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c index 834f09eae9..f8490d6b9a 100644 --- a/extmod/network_cyw43.c +++ b/extmod/network_cyw43.c @@ -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; |