|
Internal Interface Wrap
API reference
|
MCU-agnostic high-resolution monotonic time source. More...
Go to the source code of this file.
Namespaces | |
| namespace | hf_time |
Functions | |
| std::uint64_t | hf_time::MonotonicMs () noexcept |
| Convenience milliseconds view of the monotonic counter. | |
| std::uint64_t | hf_time::ElapsedUs (std::uint64_t t0) noexcept |
Convenience: elapsed-since-t0 in microseconds. | |
MCU-agnostic high-resolution monotonic time source.
Public surface for higher layers (HAL handlers, middleware, application self-tests) that need a sub-millisecond timebase. The concrete implementation lives under mcu/<vendor>/<X>Time.h and is selected at compile time from McuSelect.h. Adding a new MCU is a one-folder change:
mcu/<vendor>/<X>Time.h exposing namespace hf_time::<vendor> { void InitMonotonic(); uint64_t MonotonicUs(); },McuSelect.h if it doesn't already detect that target,#elif block here aliasing the new namespace into hf_time.Why this is a static-policy header and not a virtual BaseTime:
MonotonicUs() is a single hardware-counter read used inside tight sample loops; a vtable load + indirect call would measurably degrade self-test sampling at 50 Hz × N channels.call instruction.Use virtual Base* bases (BaseUart, BaseSpi, …) when the primitive owns state and dispatch happens once per logical operation; use static policy headers like this one for stateless hot-path primitives.