Commit 6a2c6098 authored by Paul Sokolovsky's avatar Paul Sokolovsky

windows: Enable utime_mphal following unix, define mp_hal_ticks_*.

mp_hal_ticks_ms, mp_hal_ticks_us taken from unix port, mp_hal_ticks_cpu
dummy.
parent 3cc87b1e
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
#define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UBINASCII (1)
#define MICROPY_PY_URANDOM (1) #define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME (1)
#define MICROPY_PY_UTIME_MP_HAL (1)
#define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE (1)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_DETAILED)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <windows.h> #include <windows.h>
#include <unistd.h> #include <unistd.h>
#include <sys/time.h>
HANDLE std_in = NULL; HANDLE std_in = NULL;
HANDLE con_out = NULL; HANDLE con_out = NULL;
...@@ -204,3 +205,15 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) { ...@@ -204,3 +205,15 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) {
void mp_hal_stdout_tx_str(const char *str) { void mp_hal_stdout_tx_str(const char *str) {
mp_hal_stdout_tx_strn(str, strlen(str)); mp_hal_stdout_tx_strn(str, strlen(str));
} }
mp_uint_t mp_hal_ticks_ms(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
mp_uint_t mp_hal_ticks_us(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000000 + tv.tv_usec;
}
...@@ -31,3 +31,6 @@ ...@@ -31,3 +31,6 @@
void mp_hal_move_cursor_back(unsigned int pos); void mp_hal_move_cursor_back(unsigned int pos);
void mp_hal_erase_line_from_cursor(unsigned int n_chars_to_erase); void mp_hal_erase_line_from_cursor(unsigned int n_chars_to_erase);
// TODO: Implement.
#define mp_hal_ticks_cpu() 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment