Internal Interface Wrap
API reference
Loading...
Searching...
No Matches
Namespaces | Functions
HfTime.h File Reference

MCU-agnostic high-resolution monotonic time source. More...

#include <cstdint>
#include "McuSelect.h"
Include dependency graph for HfTime.h:

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.
 

Detailed Description

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:

  1. drop in mcu/<vendor>/<X>Time.h exposing namespace hf_time::<vendor> { void InitMonotonic(); uint64_t MonotonicUs(); },
  2. extend McuSelect.h if it doesn't already detect that target,
  3. add one #elif block here aliasing the new namespace into hf_time.

Why this is a static-policy header and not a virtual BaseTime:

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.