Skip to main content

Timer

Struct Timer 

Source
pub struct Timer { /* private fields */ }
Expand description

Timer peripheral

Implementations§

Source§

impl Timer

Source

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.

Source

pub fn get_counter(&self) -> Instant

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

Initialized a Count Down instance without starting it.

Source

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

Source

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

Source

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

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>

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

Trait Implementations§

Source§

impl Clone for Timer

Source§

fn clone(&self) -> Timer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Timer

Source§

impl DelayMs<i32> for Timer

Source§

fn delay_ms(&mut self, ms: i32)

Pauses execution for ms milliseconds
Source§

impl DelayMs<u8> for Timer

Source§

fn delay_ms(&mut self, ms: u8)

Pauses execution for ms milliseconds
Source§

impl DelayMs<u16> for Timer

Source§

fn delay_ms(&mut self, ms: u16)

Pauses execution for ms milliseconds
Source§

impl DelayMs<u32> for Timer

Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for ms milliseconds
Source§

impl DelayNs for Timer

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 DelayUs<i32> for Timer

Source§

fn delay_us(&mut self, us: i32)

Pauses execution for us microseconds
Source§

impl DelayUs<u8> for Timer

Source§

fn delay_us(&mut self, us: u8)

Pauses execution for us microseconds
Source§

impl DelayUs<u16> for Timer

Source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
Source§

impl DelayUs<u32> for Timer

Source§

fn delay_us(&mut self, us: u32)

Pauses execution for us microseconds

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