Timer

Struct Timer 

Source
pub struct Timer<D>
where D: TimerDevice,
{ /* private fields */ }
Expand description

Timer peripheral

Implementations§

Source§

impl Timer<CopyableTimer0>

Source

pub fn new_timer0( timer: TIMER0, resets: &mut RESETS, _clocks: &ClocksManager, ) -> Timer<CopyableTimer0>

Create a new Timer using TIMER0

Make sure that clocks and watchdog are configured, so that timer ticks happen at a frequency of 1MHz. Otherwise, Timer won’t work as expected.

Source§

impl Timer<CopyableTimer1>

Source

pub fn new_timer1( timer: TIMER1, resets: &mut RESETS, _clocks: &ClocksManager, ) -> Timer<CopyableTimer1>

Create a new Timer using TIMER1

Make sure that clocks and watchdog are configured, so that timer ticks happen at a frequency of 1MHz. Otherwise, Timer won’t work as expected.

Source§

impl<D> Timer<D>
where D: TimerDevice,

Source

pub fn get_counter(&self) -> Instant<u64, 1, 1000000>

Get the current counter value.

Source

pub fn get_counter_low(&self) -> u32

Get the value of the least significant word of the counter.

Source

pub fn count_down(&self) -> CountDown<'_, D>

Initialized a Count Down instance without starting it.

Source

pub fn alarm_0(&mut self) -> Option<Alarm0<D>>

Retrieve a reference to alarm 0. Will only return a value the first time this is called

Source

pub fn alarm_1(&mut self) -> Option<Alarm1<D>>

Retrieve a reference to alarm 1. Will only return a value the first time this is called

Source

pub fn alarm_2(&mut self) -> Option<Alarm2<D>>

Retrieve a reference to alarm 2. Will only return a value the first time this is called

Source

pub fn alarm_3(&mut self) -> Option<Alarm3<D>>

Retrieve a reference to alarm 3. Will only return a value the first time this is called

Trait Implementations§

Source§

impl<D> Clone for Timer<D>
where D: Clone + TimerDevice,

Source§

fn clone(&self) -> Timer<D>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<D> DelayMs<i32> for Timer<D>
where D: TimerDevice,

Source§

fn delay_ms(&mut self, ms: i32)

Pauses execution for ms milliseconds
Source§

impl<D> DelayMs<u16> for Timer<D>
where D: TimerDevice,

Source§

fn delay_ms(&mut self, ms: u16)

Pauses execution for ms milliseconds
Source§

impl<D> DelayMs<u32> for Timer<D>
where D: TimerDevice,

Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for ms milliseconds
Source§

impl<D> DelayMs<u8> for Timer<D>
where D: TimerDevice,

Source§

fn delay_ms(&mut self, ms: u8)

Pauses execution for ms milliseconds
Source§

impl<D> DelayNs for Timer<D>
where D: TimerDevice,

Source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

impl<D> DelayUs<i32> for Timer<D>
where D: TimerDevice,

Source§

fn delay_us(&mut self, us: i32)

Pauses execution for us microseconds
Source§

impl<D> DelayUs<u16> for Timer<D>
where D: TimerDevice,

Source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
Source§

impl<D> DelayUs<u32> for Timer<D>
where D: TimerDevice,

Source§

fn delay_us(&mut self, us: u32)

Pauses execution for us microseconds
Source§

impl<D> DelayUs<u8> for Timer<D>
where D: TimerDevice,

Source§

fn delay_us(&mut self, us: u8)

Pauses execution for us microseconds
Source§

impl<D> Copy for Timer<D>
where D: Copy + TimerDevice,

Auto Trait Implementations§

§

impl<D> Freeze for Timer<D>

§

impl<D> RefUnwindSafe for Timer<D>
where D: RefUnwindSafe,

§

impl<D> Send for Timer<D>
where D: Send,

§

impl<D> Sync for Timer<D>
where D: Sync,

§

impl<D> Unpin for Timer<D>
where D: Unpin,

§

impl<D> UnwindSafe for Timer<D>
where D: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

Source§

type Remainder = Choices

Source§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

Source§

fn lift_into(self) -> U

Performs the indexed conversion.
Source§

impl<Source> Sculptor<HNil, HNil> for Source

Source§

type Remainder = Source

Source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
Source§

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

Source§

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

Source§

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.