summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJosef Gajdusek <atx@atx.name>2015-05-10 17:54:09 +0200
committerDamien George <damien.p.george@gmail.com>2015-05-12 23:47:18 +0100
commit800d5cd16f2e153a2dfc750c507f5a82d17491d7 (patch)
treecbfeda8e66708ea70aceba82d3dfb6b13e53f38e
parentc7df9c6c47855adcfd204100098e355358935dc3 (diff)
downloadmicropython-800d5cd16f2e153a2dfc750c507f5a82d17491d7.tar.gz
micropython-800d5cd16f2e153a2dfc750c507f5a82d17491d7.zip
esp8266: Implement time functions
-rw-r--r--esp8266/esp_mphal.c4
-rw-r--r--esp8266/modpyb.c4
2 files changed, 4 insertions, 4 deletions
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);