pub struct Timer<const TIM: u8, PWM> { /* private fields */ }
unstable
only.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)
Apply the given timer configuration.
§Note:
The prescaler and period configuration will be applied immediately by
default and before setting the PwmWorkingMode
.
If the timer is already running you might want to call Timer::stop
and/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)
Set the timer counter to the provided value
Sourcepub fn status(&self) -> (u16, CounterDirection)
pub fn status(&self) -> (u16, CounterDirection)
Read the counter value and counter direction of the timer