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§
- Blocking
- A blocking timer that runs at
HZ. - Count
Down - A count down timer adapter that uses
fugitdurations. - RawCount
Down - A count down timer that uses ticks for the timeout.
Type Aliases§
- Blocking
Gpt - A GPT that acts as a blocking timer.
- Blocking
Pit - A single PIT channel that acts as a blocking timer.
- Blocking
PitChain - A chain of PIT channels that act as a blocking timer.
- Blocking
PitChan Deprecated - A single PIT channel that acts as a blocking timer.
- RawCount
Down Gpt - A count down timer over a GPT.
- RawCount
Down Pit - A count down timer over a PIT channel.
- RawCount
Down PitChain - A count down timer over two chained PIT channels.
- RawCount
Down PitChan Deprecated - A count down timer over a PIT channel.