From ee50a6effebf315c38d4a129dc9f65ee722eb5b6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 1 Aug 2020 23:50:23 +1000 Subject: 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 --- py/mphal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'py') 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 #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 -- cgit v1.2.3