diff options
author | Damien George <damien@micropython.org> | 2020-08-01 23:50:23 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-08-22 16:13:44 +1000 |
commit | ee50a6effebf315c38d4a129dc9f65ee722eb5b6 (patch) | |
tree | 16cfee569848d9d75fbb8eeacf39466f5b2b7319 /py | |
parent | badd351150df70bea6644db98f48fbc3a1e5ffea (diff) |
py/mphal.h: Introduce mp_hal_time_ns and implement on various ports.
This should return a 64-bit value being the number of nanoseconds since
1970/1/1.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r-- | py/mphal.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/mphal.h b/py/mphal.h index 66d80705a..6d11f6ddc 100644 --- a/py/mphal.h +++ b/py/mphal.h @@ -26,6 +26,7 @@ #ifndef MICROPY_INCLUDED_PY_MPHAL_H #define MICROPY_INCLUDED_PY_MPHAL_H +#include <stdint.h> #include "py/mpconfig.h" #ifdef MICROPY_MPHALPORT_H @@ -74,6 +75,11 @@ mp_uint_t mp_hal_ticks_us(void); mp_uint_t mp_hal_ticks_cpu(void); #endif +#ifndef mp_hal_time_ns +// Nanoseconds since 1970/1/1. +uint64_t mp_hal_time_ns(void); +#endif + // If port HAL didn't define its own pin API, use generic // "virtual pin" API from the core. #ifndef mp_hal_pin_obj_t |