Hardware agnostic interfaces for time and timers within the Tock kernel.
These traits are designed to be able encompass the wide
variety of hardware counters in a general yet efficient way. They
abstract the frequency of a counter through the
and the width of a time value through the
trait. Higher-level software abstractions should generally rely on
standard and common implementations of these traits (e.g..
ticks and 16MHz frequency). Hardware counter implementations and
peripherals can represent the actual hardware units an translate
into these more general ones.
- Interface for receiving notification when a particular time (
Countervalue) is reached. Clients use the
AlarmClienttrait to signal when the counter has reached a pre-specified value set in
set_alarm. Alarms are intended for low-level time needs that require precision (i.e., firing on a precise clock tick). Software that needs more functionality but can tolerate some jitter should use the
- Callback handler for when an Alarm fires (a
Counterreaches a specific value).
- Represents a free-running hardware counter that can be started and stopped.
- Represents a clock’s frequency in Hz, allowing code to transform between computer time units and wall clock time. It is typically an associated type for an implementation of the
- Callback handler for when a counter has overflowed past its maximum value and returned to 0.
- An integer type defining the width of a time value, which allows clients to know when wraparound will occur.
- Represents a moment in time, obtained by calling
- Interface for controlling callbacks when an interval has passed. This interface is intended for software that requires repeated and/or one-shot timers and is willing to experience some jitter or imprecision in return for a simpler API that doesn’t require actual calculation of counter values. Software that requires more precisely timed callbacks should use the
- Callback handler for when a timer fires.
- Represents a static moment in time, that does not change over repeated calls to