pub struct Timer<const TIM: u8, PWM> { /* private fields */ }Expand description
Implementations§
Source§impl<const TIM: u8, PWM: PwmPeripheral> Timer<TIM, PWM>
impl<const TIM: u8, PWM: PwmPeripheral> Timer<TIM, PWM>
Sourcepub fn start(&mut self, timer_config: TimerClockConfig)
pub fn start(&mut self, timer_config: TimerClockConfig)
Applies the given timer configuration.
The prescaler and period configuration will be applied immediately by
default and before setting the PwmWorkingMode.
If the timer is already running, call Timer::stop
or Timer::set_counter first
(if the new period is larger than the current counter value this will
cause weird behavior).
If configured via TimerClockConfig::with_period_updating_method,
another behavior can be applied. Currently, only
PeriodUpdatingMethod::Immediately
and PeriodUpdatingMethod::TimerEqualsZero are useful as the sync
method is not yet implemented.
The hardware supports writing these settings in sync with certain timer events but this HAL does not expose these for now.
Sourcepub fn set_counter(&mut self, phase: u16, direction: CounterDirection)
pub fn set_counter(&mut self, phase: u16, direction: CounterDirection)
Sets the timer counter to the provided value.
Sourcepub fn status(&self) -> (u16, CounterDirection)
pub fn status(&self) -> (u16, CounterDirection)
Reads the counter value and counter direction of the timer.