From 19b671c5cd4c189a2d88d1b747b7acd496032c0f Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Thu, 29 Oct 2015 20:42:12 +0300
Subject: [PATCH] stmhal/moduselect: Use mp_hal_ticks_ms().

---
 stmhal/moduselect.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stmhal/moduselect.c b/stmhal/moduselect.c
index 67e4e2a28..0ba595488 100644
--- a/stmhal/moduselect.c
+++ b/stmhal/moduselect.c
@@ -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;
-- 
GitLab