Skip to content

Commit 19b671c

Browse files
committed
stmhal/moduselect: Use mp_hal_ticks_ms().
1 parent f4decdc commit 19b671c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stmhal/moduselect.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
138138
poll_map_add(&poll_map, w_array, rwx_len[1], MP_IOCTL_POLL_WR, true);
139139
poll_map_add(&poll_map, x_array, rwx_len[2], MP_IOCTL_POLL_ERR | MP_IOCTL_POLL_HUP, true);
140140

141-
mp_uint_t start_tick = HAL_GetTick();
141+
mp_uint_t start_tick = mp_hal_ticks_ms();
142142
rwx_len[0] = rwx_len[1] = rwx_len[2] = 0;
143143
for (;;) {
144144
// poll the objects
145145
mp_uint_t n_ready = poll_map_poll(&poll_map, rwx_len);
146146

147-
if (n_ready > 0 || (timeout != -1 && HAL_GetTick() - start_tick >= timeout)) {
147+
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
148148
// one or more objects are ready, or we had a timeout
149149
mp_obj_t list_array[3];
150150
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) {
232232
}
233233
}
234234

235-
mp_uint_t start_tick = HAL_GetTick();
235+
mp_uint_t start_tick = mp_hal_ticks_ms();
236236
for (;;) {
237237
// poll the objects
238238
mp_uint_t n_ready = poll_map_poll(&self->poll_map, NULL);
239239

240-
if (n_ready > 0 || (timeout != -1 && HAL_GetTick() - start_tick >= timeout)) {
240+
if (n_ready > 0 || (timeout != -1 && mp_hal_ticks_ms() - start_tick >= timeout)) {
241241
// one or more objects are ready, or we had a timeout
242242
mp_obj_list_t *ret_list = mp_obj_new_list(n_ready, NULL);
243243
n_ready = 0;

0 commit comments

Comments
 (0)