Struct imxrt_hal::timer::RawCountDown
source · pub struct RawCountDown<T> { /* private fields */ }
Expand description
A count down timer that uses ticks for the timeout.
This adapter does not require you to know about the clock frequency. However, not knowing this means that you’re responsible for choosing meaningful count ticks.
The adapter implements Periodic
. However, it does not
implement Cancel
, since it cannot decide the error type
for all possible users. You’re encouraged to build your
own adapter atop this type if you need to provide a Cancel
implementation.
See CountDown
for an example of using this type with
a GPT timer.
Implementations§
source§impl<T> RawCountDown<T>where
T: HardwareTimer,
impl<T> RawCountDown<T>where
T: HardwareTimer,
sourcepub fn release(self) -> T
pub fn release(self) -> T
Release the adapter to acquire the raw count down timer.
The released timer’s state is unspecified.
sourcepub fn start(&mut self, ticks: T::Ticks)
pub fn start(&mut self, ticks: T::Ticks)
Start the count down timer to periodically elapse every
number of ticks
clock counts.
If this is invoked when a timer is already counting,
this resets the timer to run at ticks
.
The type of ticks
depends on the underlying timer.
See the module documentation for specifics.
sourcepub fn cancel(&mut self)
pub fn cancel(&mut self)
Cancel a running timer.
Does nothing if the timer is already canceled / disabled.
sourcepub fn is_elapsed(&self) -> bool
pub fn is_elapsed(&self) -> bool
Indicates if the timer has elapsed.
sourcepub fn clear_elapsed(&mut self)
pub fn clear_elapsed(&mut self)
Clears the elapsed condition.
source§impl<const N: u8> RawCountDown<Pit<N>>
impl<const N: u8> RawCountDown<Pit<N>>
sourcepub fn from_pit_channel(pit: Pit<N>) -> Self
👎Deprecated since 0.5.1: Use from_pit
pub fn from_pit_channel(pit: Pit<N>) -> Self
Create a count down timer from a PIT channel.
Prefer from_pit
, which is easier to type
and matches the name of the type we’re converting.
source§impl<const L: u8, const R: u8> RawCountDown<Chained<L, R>>
impl<const L: u8, const R: u8> RawCountDown<Chained<L, R>>
sourcepub fn from_pit_chained(chain: Chained<L, R>) -> Self
pub fn from_pit_chained(chain: Chained<L, R>) -> Self
Create a count down timer from a PIT chain.