pub struct Timer<D>where
D: TimerDevice,{ /* private fields */ }Expand description
Timer peripheral
Implementations§
Source§impl Timer<CopyableTimer0>
impl Timer<CopyableTimer0>
Sourcepub fn new_timer0(
timer: TIMER0,
resets: &mut RESETS,
_clocks: &ClocksManager,
) -> Timer<CopyableTimer0>
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>
impl Timer<CopyableTimer1>
Sourcepub fn new_timer1(
timer: TIMER1,
resets: &mut RESETS,
_clocks: &ClocksManager,
) -> Timer<CopyableTimer1>
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,
impl<D> Timer<D>where
D: TimerDevice,
Sourcepub fn get_counter(&self) -> Instant<u64, 1, 1000000>
pub fn get_counter(&self) -> Instant<u64, 1, 1000000>
Get the current counter value.
Sourcepub fn get_counter_low(&self) -> u32
pub fn get_counter_low(&self) -> u32
Get the value of the least significant word of the counter.
Sourcepub fn count_down(&self) -> CountDown<'_, D>
pub fn count_down(&self) -> CountDown<'_, D>
Initialized a Count Down instance without starting it.
Sourcepub fn alarm_0(&mut self) -> Option<Alarm0<D>>
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
Sourcepub fn alarm_1(&mut self) -> Option<Alarm1<D>>
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
Trait Implementations§
Source§impl<D> DelayNs for Timer<D>where
D: TimerDevice,
impl<D> DelayNs for Timer<D>where
D: TimerDevice,
Source§fn delay_ns(&mut self, ns: u32)
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.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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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