39#if defined(HF_TARGET_MCU_ESP32) || defined(HF_TARGET_MCU_ESP32S2) || \
40 defined(HF_TARGET_MCU_ESP32S3) || defined(HF_TARGET_MCU_ESP32C3) || \
41 defined(HF_TARGET_MCU_ESP32C2) || defined(HF_TARGET_MCU_ESP32C6) || \
42 defined(HF_TARGET_MCU_ESP32H2)
44 namespace hf_time { using ::hf_time::esp32::MonotonicUs;
45 using ::hf_time::esp32::InitMonotonic; }
47#elif defined(HF_TARGET_MCU_STM32F4) || defined(HF_TARGET_MCU_STM32H7)
48# include "Stm32Time.h"
49 namespace hf_time { using ::hf_time::stm32::MonotonicUs;
50 using ::hf_time::stm32::InitMonotonic; }
52#elif defined(HF_TARGET_MCU_RP2040)
53# include "Rp2040Time.h"
54 namespace hf_time { using ::hf_time::rp2040::MonotonicUs;
55 using ::hf_time::rp2040::InitMonotonic; }
57#elif defined(HF_TARGET_MCU_NONE)
61 inline std::uint64_t
MonotonicUs() noexcept {
return 0; }
66# error "HfTime: no implementation for this target — set HF_TARGET_MCU_* (see McuSelect.h)"
79 return MonotonicUs() / 1000ULL;
83inline std::uint64_t
ElapsedUs(std::uint64_t t0)
noexcept {
84 return MonotonicUs() - t0;
ESP32-family implementation of the high-resolution monotonic time source consumed via HfTime....
Centralized MCU platform selection and configuration header.
void InitMonotonic() noexcept
No-op on ESP-IDF: the high-resolution timer is started by the system bootstrap before app_main runs.
Definition EspTime.h:36
std::uint64_t MonotonicUs() noexcept
Microseconds since boot from the hardware-backed timer.
Definition EspTime.h:47
std::uint64_t ElapsedUs(std::uint64_t t0) noexcept
Convenience: elapsed-since-t0 in microseconds.
Definition HfTime.h:83
std::uint64_t MonotonicMs() noexcept
Convenience milliseconds view of the monotonic counter.
Definition HfTime.h:78