pub struct Timer { /* private fields */ }Expand description
Timer peripheral
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn new(timer: TIMER, resets: &mut RESETS, _clocks: &ClocksManager) -> Self
pub fn new(timer: TIMER, resets: &mut RESETS, _clocks: &ClocksManager) -> Self
Create a new Timer
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.
Sourcepub fn get_counter(&self) -> Instant
pub fn get_counter(&self) -> Instant
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
pub fn count_down(&self) -> CountDown
Initialized a Count Down instance without starting it.
Sourcepub fn alarm_0(&mut self) -> Option<Alarm0>
pub fn alarm_0(&mut self) -> Option<Alarm0>
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>
pub fn alarm_1(&mut self) -> Option<Alarm1>
Retrieve a reference to alarm 1. Will only return a value the first time this is called
Trait Implementations§
impl Copy for Timer
Source§impl DelayNs for Timer
impl DelayNs for Timer
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.Auto Trait Implementations§
impl Freeze for Timer
impl RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl UnsafeUnpin for Timer
impl UnwindSafe for Timer
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