diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c index 53a1700277..8eb8cc8ca2 100644 --- a/esp8266/esp_mphal.c +++ b/esp8266/esp_mphal.c @@ -29,6 +29,7 @@ #include "etshal.h" #include "uart.h" #include "esp_mphal.h" +#include "user_interface.h" extern void ets_wdt_disable(void); extern void wdt_feed(void); @@ -82,8 +83,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len) { } uint32_t HAL_GetTick(void) { - // TODO - return 0; + return system_get_time() / 1000; } void HAL_Delay(uint32_t Delay) { diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c index 14dfebd333..57d0a6a9f2 100644 --- a/esp8266/modpyb.c +++ b/esp8266/modpyb.c @@ -108,13 +108,13 @@ STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis); STATIC mp_obj_t pyb_micros(void) { - return MP_OBJ_NEW_SMALL_INT(0); + return MP_OBJ_NEW_SMALL_INT(system_get_time()); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_micros_obj, pyb_micros); STATIC mp_obj_t pyb_elapsed_micros(mp_obj_t start) { uint32_t startMicros = mp_obj_get_int(start); - uint32_t currMicros = 0; + uint32_t currMicros = system_get_time(); return MP_OBJ_NEW_SMALL_INT((currMicros - startMicros) & 0x3fffffff); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);