Skip to content

Commit cfcc53d

Browse files
pi-anldpgeorge
authored andcommitted
drivers/esp-hosted: Replace EVENT_POLL_HOOK with mp_event_wait_ms.
Signed-off-by: Andrew Leech <[email protected]>
1 parent 573180f commit cfcc53d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/esp-hosted/esp_hosted_bthci_uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int esp_hosted_hci_cmd(int ogf, int ocf, size_t param_len, const uint8_t *param_
7272
// Receive HCI event packet, initially reading 3 bytes (HCI Event, Event code, Plen).
7373
for (mp_uint_t start = mp_hal_ticks_ms(), size = 3, i = 0; i < size;) {
7474
while (!mp_bluetooth_hci_uart_any()) {
75-
MICROPY_EVENT_POLL_HOOK
75+
mp_event_wait_ms(1);
7676
// Timeout.
7777
if ((mp_hal_ticks_ms() - start) > HCI_COMMAND_TIMEOUT) {
7878
error_printf("timeout waiting for HCI packet\n");
@@ -126,7 +126,7 @@ int mp_bluetooth_hci_controller_init(void) {
126126
if (mp_bluetooth_hci_uart_any()) {
127127
mp_bluetooth_hci_uart_readchar();
128128
}
129-
MICROPY_EVENT_POLL_HOOK
129+
mp_event_wait_ms(1);
130130
}
131131

132132
#ifdef MICROPY_HW_BLE_UART_BAUDRATE_SECONDARY

drivers/esp-hosted/esp_hosted_wifi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int esp_hosted_request(CtrlMsgId msg_id, void *ctrl_payload) {
243243

244244
static CtrlMsg *esp_hosted_response(CtrlMsgId msg_id, uint32_t timeout) {
245245
CtrlMsg *ctrl_msg = NULL;
246-
for (mp_uint_t start = mp_hal_ticks_ms(); ; mp_hal_delay_ms(10)) {
246+
for (mp_uint_t start = mp_hal_ticks_ms(); ; mp_event_wait_ms(10)) {
247247
if (!esp_hosted_stack_empty(&esp_state.stack)) {
248248
ctrl_msg = esp_hosted_stack_pop(&esp_state.stack, true);
249249
if (ctrl_msg->msg_id == msg_id) {
@@ -264,8 +264,6 @@ static CtrlMsg *esp_hosted_response(CtrlMsgId msg_id, uint32_t timeout) {
264264
if ((mp_hal_ticks_ms() - start) >= timeout) {
265265
return NULL;
266266
}
267-
268-
MICROPY_EVENT_POLL_HOOK
269267
}
270268

271269
// If message type is a response, check the response struct's return value.

0 commit comments

Comments
 (0)