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,

source

pub fn release(self) -> T

Release the adapter to acquire the raw count down timer.

The released timer’s state is unspecified.

source

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.

source

pub fn cancel(&mut self)

Cancel a running timer.

Does nothing if the timer is already canceled / disabled.

source

pub fn is_elapsed(&self) -> bool

Indicates if the timer has elapsed.

source

pub fn clear_elapsed(&mut self)

Clears the elapsed condition.

source§

impl<const N: u8> RawCountDown<Pit<N>>

source

pub fn from_pit(pit: Pit<N>) -> Self

Create a count down timer from a PIT channel.

source

pub fn from_pit_channel(pit: Pit<N>) -> Self

👎Deprecated since 0.5.1: Use from_pit

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>>

source

pub fn from_pit_chained(chain: Chained<L, R>) -> Self

Create a count down timer from a PIT chain.

source§

impl<const N: u8> RawCountDown<Gpt<N>>

source

pub fn from_gpt(gpt: Gpt<N>) -> Self

Create a count down timer from a GPT.

Trait Implementations§

source§

impl<T> CountDown for RawCountDown<T>
where T: HardwareTimer,

§

type Time = <T as HardwareTimer>::Ticks

The unit of time used by this timer
source§

fn start<C>(&mut self, count: C)
where C: Into<Self::Time>,

Starts a new count down
source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
source§

impl<T> Periodic for RawCountDown<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for RawCountDown<T>
where T: RefUnwindSafe,

§

impl<T> Send for RawCountDown<T>
where T: Send,

§

impl<T> Sync for RawCountDown<T>
where T: Sync,

§

impl<T> Unpin for RawCountDown<T>
where T: Unpin,

§

impl<T> UnwindSafe for RawCountDown<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.