From 6a09e7d7aea2a5ef02cf1c04769b8eb58aef9e60 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 29 Oct 2015 19:35:04 +0300 Subject: [PATCH] esp8266: Switch to standard mp_hal_ticks_ms() MPHAL function. --- esp8266/esp_mphal.c | 2 +- esp8266/esp_mphal.h | 2 +- esp8266/modpyb.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c index 44ccea42be..471b1fe345 100644 --- a/esp8266/esp_mphal.c +++ b/esp8266/esp_mphal.c @@ -82,7 +82,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len) { } } -uint32_t HAL_GetTick(void) { +uint32_t mp_hal_ticks_ms(void) { return system_get_time() / 1000; } diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h index 7ef02bc2a5..e3ba0c4fac 100644 --- a/esp8266/esp_mphal.h +++ b/esp8266/esp_mphal.h @@ -37,7 +37,7 @@ void mp_hal_stdout_tx_str(const char *str); void mp_hal_stdout_tx_strn(const char *str, uint32_t len); void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len); -uint32_t HAL_GetTick(void); +uint32_t mp_hal_ticks_ms(void); void mp_hal_delay_ms(uint32_t delay); void mp_hal_delay_us(uint32_t); void mp_hal_set_interrupt_char(int c); diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c index 8d3e98c996..c5c24c07d1 100644 --- a/esp8266/modpyb.c +++ b/esp8266/modpyb.c @@ -102,13 +102,13 @@ STATIC mp_obj_t pyb_sync(void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_sync_obj, pyb_sync); STATIC mp_obj_t pyb_millis(void) { - return MP_OBJ_NEW_SMALL_INT(HAL_GetTick()); + return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms()); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis); STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) { uint32_t startMillis = mp_obj_get_int(start); - uint32_t currMillis = HAL_GetTick(); + uint32_t currMillis = mp_hal_ticks_ms(); return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x3fffffff); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);