Struct atsamd_hal::timer::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
sourceimpl TimerCounter<TC2>
impl TimerCounter<TC2>
sourcepub fn tc2_(clock: &Tc2Tc3Clock, tc: TC2, mclk: &mut MCLK) -> Self
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.
sourceimpl TimerCounter<TC3>
impl TimerCounter<TC3>
sourcepub fn tc3_(clock: &Tc2Tc3Clock, tc: TC3, mclk: &mut MCLK) -> Self
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.
sourceimpl TimerCounter<TC4>
impl TimerCounter<TC4>
sourcepub fn tc4_(clock: &Tc4Tc5Clock, tc: TC4, mclk: &mut MCLK) -> Self
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.
sourceimpl TimerCounter<TC5>
impl TimerCounter<TC5>
sourcepub fn tc5_(clock: &Tc4Tc5Clock, tc: TC5, mclk: &mut MCLK) -> Self
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
sourceimpl<TC> CountDown for TimerCounter<TC>where
TC: Count16,
impl<TC> CountDown for TimerCounter<TC>where
TC: Count16,
sourceimpl<TC> InterruptDrivenTimer for TimerCounter<TC>where
TC: Count16,
impl<TC> InterruptDrivenTimer for TimerCounter<TC>where
TC: Count16,
sourcefn enable_interrupt(&mut self)
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.
sourcefn disable_interrupt(&mut self)
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.