diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-19 00:29:40 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-19 00:31:37 +0300 |
commit | 949c5c91804655fe257f2444cd7ed5a5e5d9bfa7 (patch) | |
tree | d05069e36d2cae3b85c1209bd2af5a46b499f283 /unix/unix_mphal.c | |
parent | 779941095064efa0be8eca339f866311e19d9c0d (diff) | |
download | micropython-949c5c91804655fe257f2444cd7ed5a5e5d9bfa7.tar.gz micropython-949c5c91804655fe257f2444cd7ed5a5e5d9bfa7.zip |
unix/unix_mphal: Implement HAL_Delay() and HAL_GetTick().
Diffstat (limited to 'unix/unix_mphal.c')
-rw-r--r-- | unix/unix_mphal.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unix/unix_mphal.c b/unix/unix_mphal.c index 11cd03344d..0974b6ad21 100644 --- a/unix/unix_mphal.c +++ b/unix/unix_mphal.c @@ -27,6 +27,7 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <sys/time.h> #include "py/mpstate.h" #include MICROPY_HAL_H @@ -117,3 +118,9 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) { void mp_hal_stdout_tx_str(const char *str) { mp_hal_stdout_tx_strn(str, strlen(str)); } + +uint32_t HAL_GetTick(void) { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} |