Expand description
General timer APIs.
timer
provides adapters for implementing (non-)blocking
timers. It builds upon hardware drivers like gpt
and pit
, and implements various embedded-hal
timer traits.
Use Blocking
to adapt a timer for simple, blocking delays. Blocking
delays use durations, not raw clock ticks; this means that you need to
specify the clock’s frequency.
Use CountDown
to adapt a timer for periodic, non-blocking time
tracking. This also uses time duration, not raw clock ticks, for
timing, so it again needs the clock frequency. Use RawCountDown
if you want to track time in clock ticks.
§Raw count representations
The raw count, or ticks, supported by the driver influences the API. The table below describes the raw bit width for each adapter.
Driver | Bit width |
---|---|
PIT channel | 32 |
PIT chain | 64 |
GPT | 32 |
§Computing the clock frequency
ccm
APIs make it easy to understand, at compile time, the intended
clock frequency for a given timer. Consider using these to simply compute
the clock frequency. See the Blocking
and CountDown
examples for
demonstrations.
This package does not provide an implementation of Cancel
from embedded-hal 0.2.
See RawCountDown
documentation for more information.
§Limitations of CountDown
This module cannot provide the embedded-hal 0.2 CountDown
implementation for all
possible drivers. You’re encouraged to adapt RawCountDown
to implement a
CountDown
implementation for your specific driver.
Structs§
- A blocking timer that runs at
HZ
. - A count down timer adapter that uses
fugit
durations. - A count down timer that uses ticks for the timeout.
Type Aliases§
- A GPT that acts as a blocking timer.
- A single PIT channel that acts as a blocking timer.
- A chain of PIT channels that act as a blocking timer.
- Blocking
PitChan Deprecated A single PIT channel that acts as a blocking timer. - A count down timer over a GPT.
- A count down timer over a PIT channel.
- A count down timer over two chained PIT channels.
- RawCount
Down PitChan Deprecated A count down timer over a PIT channel.