|
|
@ -138,13 +138,13 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) { |
|
|
|
poll_map_add(&poll_map, w_array, rwx_len[1], MP_IOCTL_POLL_WR, true); |
|
|
|
poll_map_add(&poll_map, x_array, rwx_len[2], MP_IOCTL_POLL_ERR | MP_IOCTL_POLL_HUP, true); |
|
|
|
|
|
|
|
mp_uint_t start_tick = HAL_GetTick(); |
|
|
|
mp_uint_t start_tick = mp_hal_ticks_ms(); |
|
|
|
rwx_len[0] = rwx_len[1] = rwx_len[2] = 0; |
|
|
|
for (;;) { |
|
|
|
// poll the objects
|
|
|
|
mp_uint_t n_ready = poll_map_poll(&poll_map, rwx_len); |
|
|
|
|
|
|
|
if (n_ready > 0 || (timeout != -1 && HAL_GetTick() - start_tick >= timeout)) { |
|
|
|
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) { |
|
|
|
// one or more objects are ready, or we had a timeout
|
|
|
|
mp_obj_t list_array[3]; |
|
|
|
list_array[0] = mp_obj_new_list(rwx_len[0], NULL); |
|
|
@ -232,12 +232,12 @@ STATIC mp_obj_t poll_poll(uint n_args, const mp_obj_t *args) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
mp_uint_t start_tick = HAL_GetTick(); |
|
|
|
mp_uint_t start_tick = mp_hal_ticks_ms(); |
|
|
|
for (;;) { |
|
|
|
// poll the objects
|
|
|
|
mp_uint_t n_ready = poll_map_poll(&self->poll_map, NULL); |
|
|
|
|
|
|
|
if (n_ready > 0 || (timeout != -1 && HAL_GetTick() - start_tick >= timeout)) { |
|
|
|
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) { |
|
|
|
// one or more objects are ready, or we had a timeout
|
|
|
|
mp_obj_list_t *ret_list = mp_obj_new_list(n_ready, NULL); |
|
|
|
n_ready = 0; |
|
|
|