Skip to content

Commit

Permalink
extmod/modopenamp: Use mp_event_* functions for poll/wait.
Browse files Browse the repository at this point in the history
These are the new helper functions to use for polling/waiting.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
  • Loading branch information
iabdalkader authored and dpgeorge committed Aug 8, 2024
1 parent 9a48ce3 commit 1743a7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extmod/modopenamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ static mp_obj_t endpoint_send(uint n_args, const mp_obj_t *pos_args, mp_map_t *k
for (mp_uint_t start = mp_hal_ticks_ms(); ;) {
bytes = rpmsg_send_offchannel_raw(&self->ep, src, dest, rbuf.buf, rbuf.len, false);
if (bytes > 0 || timeout == 0) {
MICROPY_EVENT_POLL_HOOK
mp_event_handle_nowait();
break;
}
if (timeout > 0 && (mp_hal_ticks_ms() - start > timeout)) {
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("timeout waiting for a free buffer"));
}
MICROPY_EVENT_POLL_HOOK
mp_event_wait_ms(1);
}
return mp_obj_new_int(bytes);
}
Expand Down

0 comments on commit 1743a7d

Please sign in to comment.