pub struct TimerCounter<TC> { /* private fields */ }
Expand description

A generic hardware timer counter. The counters are exposed in 16-bit mode only. The hardware allows configuring the 8-bit mode and pairing up some instances to run in 32-bit mode, but that functionality is not currently exposed by this hal implementation. TimerCounter implements both the Periodic and the CountDown embedded_hal timer traits. Before a hardware timer can be used, it must first have a clock configured.

Implementations§

source§

impl TimerCounter<TC3>

source

pub fn tc3_(clock: &Tcc2Tc3Clock, tc: TC3, pm: &mut PM) -> TimerCounter<TC3>

Configure this timer counter instance. The clock is obtained from the GenericClockController instance and its frequency impacts the resolution and maximum range of the timeout values that can be passed to the start method. Note that some hardware timer instances share the same clock generator instance and thus will be clocked at the same rate.

source§

impl TimerCounter<TC4>

source

pub fn tc4_(clock: &Tc4Tc5Clock, tc: TC4, pm: &mut PM) -> TimerCounter<TC4>

Configure this timer counter instance. The clock is obtained from the GenericClockController instance and its frequency impacts the resolution and maximum range of the timeout values that can be passed to the start method. Note that some hardware timer instances share the same clock generator instance and thus will be clocked at the same rate.

source§

impl TimerCounter<TC5>

source

pub fn tc5_(clock: &Tc4Tc5Clock, tc: TC5, pm: &mut PM) -> TimerCounter<TC5>

Configure this timer counter instance. The clock is obtained from the GenericClockController instance and its frequency impacts the resolution and maximum range of the timeout values that can be passed to the start method. Note that some hardware timer instances share the same clock generator instance and thus will be clocked at the same rate.

Trait Implementations§

source§

impl<TC> CountDown for TimerCounter<TC>where TC: Count16,

§

type Time = Nanoseconds

The unit of time used by this timer
source§

fn start<T>(&mut self, timeout: T)where T: Into<<TimerCounter<TC> as CountDown>::Time>,

Starts a new count down
source§

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

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

impl<TC> InterruptDrivenTimer for TimerCounter<TC>where TC: Count16,

source§

fn enable_interrupt(&mut self)

Enable the interrupt generation for this hardware timer. This method only sets the clock configuration to trigger the interrupt; it does not configure the interrupt controller or define an interrupt handler.

source§

fn disable_interrupt(&mut self)

Disables interrupt generation for this hardware timer. This method only sets the clock configuration to prevent triggering the interrupt; it does not configure the interrupt controller.

source§

impl<TC> Periodic for TimerCounter<TC>

Auto Trait Implementations§

§

impl<TC> RefUnwindSafe for TimerCounter<TC>where TC: RefUnwindSafe,

§

impl<TC> Send for TimerCounter<TC>where TC: Send,

§

impl<TC> Sync for TimerCounter<TC>where TC: Sync,

§

impl<TC> Unpin for TimerCounter<TC>where TC: Unpin,

§

impl<TC> UnwindSafe for TimerCounter<TC>where TC: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.