summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/nimble/modbluetooth_nimble.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2023-11-30 14:32:41 +1100
committerDamien George <damien@micropython.org>2023-12-08 12:48:50 +1100
commitdf3948d3c23e3572c49d18ede03bf3ac97ee601c (patch)
tree7435061520a222a0ef859535a6c814d9eaffb486 /extmod/nimble/modbluetooth_nimble.c
parentf5be0128e4da1417136495c20888f8291cd22386 (diff)
downloadmicropython-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/nimble/modbluetooth_nimble.c')
-rw-r--r--extmod/nimble/modbluetooth_nimble.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/extmod/nimble/modbluetooth_nimble.c b/extmod/nimble/modbluetooth_nimble.c
index 3cdf4d1a78..2e1faa9b10 100644
--- a/extmod/nimble/modbluetooth_nimble.c
+++ b/extmod/nimble/modbluetooth_nimble.c
@@ -570,7 +570,7 @@ void mp_bluetooth_nimble_port_shutdown(void) {
ble_hs_stop(&ble_hs_shutdown_stop_listener, ble_hs_shutdown_stop_cb, NULL);
while (mp_bluetooth_nimble_ble_state != MP_BLUETOOTH_NIMBLE_BLE_STATE_OFF) {
- MICROPY_EVENT_POLL_HOOK
+ mp_event_wait_indefinite();
}
}
@@ -636,10 +636,11 @@ int mp_bluetooth_init(void) {
// On non-ringbuffer builds (NimBLE on STM32/Unix) this will also poll the UART and run the event queue.
mp_uint_t timeout_start_ticks_ms = mp_hal_ticks_ms();
while (mp_bluetooth_nimble_ble_state != MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE) {
- if (mp_hal_ticks_ms() - timeout_start_ticks_ms > NIMBLE_STARTUP_TIMEOUT) {
+ uint32_t elapsed = mp_hal_ticks_ms() - timeout_start_ticks_ms;
+ if (elapsed > NIMBLE_STARTUP_TIMEOUT) {
break;
}
- MICROPY_EVENT_POLL_HOOK
+ mp_event_wait_ms(NIMBLE_STARTUP_TIMEOUT - elapsed);
}
if (mp_bluetooth_nimble_ble_state != MP_BLUETOOTH_NIMBLE_BLE_STATE_ACTIVE) {