atsamd_hal::timer

Struct TimerCounter

Source
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<T> TimerCounter<T>
where T: AsyncCount16,

Source

pub fn into_future<I>(self, _irq: I) -> TimerFuture<T>

Transform a TimerCounter into an TimerFuture

Source§

impl TimerCounter<Tc2>

Source

pub fn tc2_(clock: &Tc2Tc3Clock, tc: Tc2, mclk: &mut Mclk) -> Self

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

Source

pub fn tc3_(clock: &Tc2Tc3Clock, tc: Tc3, mclk: &mut Mclk) -> Self

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, mclk: &mut Mclk) -> Self

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, mclk: &mut Mclk) -> Self

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

fn start<T>(&mut self, timeout: T)

Start the timer with a given timeout in nanoseconds
Source§

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

Wait for the timer to finish counting down without blocking.
Source§

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

Source§

type Time = Duration<u32, 1, 1000000000>

The unit of time used by this timer
Source§

fn start<T>(&mut self, timeout: T)
where T: Into<Self::Time>,

Starts a new count down
Source§

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

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

impl<TC> Periodic for TimerCounter<TC>

Auto Trait Implementations§

§

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

§

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 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.