From 1283d42fbfed9b7b401bb3c10f08a2634970e9f0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 2 Oct 2021 15:39:08 +1000 Subject: [PATCH] AP_HAL: added micros16() method fast method for both 16 and 32 bit timers --- libraries/AP_HAL/system.cpp | 5 +++++ libraries/AP_HAL/system.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libraries/AP_HAL/system.cpp b/libraries/AP_HAL/system.cpp index bb94ffedb3..1cdbd80c32 100644 --- a/libraries/AP_HAL/system.cpp +++ b/libraries/AP_HAL/system.cpp @@ -5,6 +5,11 @@ uint16_t WEAK AP_HAL::millis16() return millis() & 0xFFFF; } +uint16_t WEAK AP_HAL::micros16() +{ + return micros() & 0xFFFF; +} + void WEAK AP_HAL::dump_stack_trace() { // stack dump not available on this platform diff --git a/libraries/AP_HAL/system.h b/libraries/AP_HAL/system.h index e230d7c02d..c93a7f9f0b 100644 --- a/libraries/AP_HAL/system.h +++ b/libraries/AP_HAL/system.h @@ -12,6 +12,7 @@ void init(); void panic(const char *errormsg, ...) FMT_PRINTF(1, 2) NORETURN; +uint16_t micros16(); uint32_t micros(); uint32_t millis(); uint16_t millis16();