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:
Angus Gratton
2023-11-30 14:32:41 +11:00
committed by Damien George
parent f5be0128e4
commit df3948d3c2
7 changed files with 29 additions and 27 deletions

View File

@@ -552,7 +552,7 @@ STATIC void set_random_address(void) {
volatile bool ready = false;
btstack_crypto_random_generate(&sm_crypto_random_request, static_addr, 6, &btstack_static_address_ready, (void *)&ready);
while (!ready) {
MICROPY_EVENT_POLL_HOOK
mp_event_wait_indefinite();
}
#endif // MICROPY_BLUETOOTH_USE_MP_HAL_GET_MAC_STATIC_ADDRESS
@@ -574,7 +574,7 @@ STATIC void set_random_address(void) {
break;
}
MICROPY_EVENT_POLL_HOOK
mp_event_wait_indefinite();
}
DEBUG_printf("set_random_address: Address loaded by controller\n");
}
@@ -654,7 +654,7 @@ int mp_bluetooth_init(void) {
// Either the HCI event will set state to ACTIVE, or the timeout will set it to TIMEOUT.
mp_bluetooth_btstack_port_start();
while (mp_bluetooth_btstack_state == MP_BLUETOOTH_BTSTACK_STATE_STARTING) {
MICROPY_EVENT_POLL_HOOK
mp_event_wait_indefinite();
}
btstack_run_loop_remove_timer(&btstack_init_deinit_timeout);
@@ -727,7 +727,7 @@ void mp_bluetooth_deinit(void) {
// either timeout or clean shutdown.
mp_bluetooth_btstack_port_deinit();
while (mp_bluetooth_btstack_state == MP_BLUETOOTH_BTSTACK_STATE_ACTIVE) {
MICROPY_EVENT_POLL_HOOK
mp_event_wait_indefinite();
}
btstack_run_loop_remove_timer(&btstack_init_deinit_timeout);