esp8266: Switch to standard mp_hal_ticks_ms() MPHAL function.

This commit is contained in:
Paul Sokolovsky 2015-10-29 19:35:04 +03:00
parent 04fa999cfe
commit 6a09e7d7ae
3 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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);