pub struct Timer<const TIM: u8, PWM> { /* private fields */ }
Expand description
Implementations§
source§impl<const TIM: u8, PWM> Timer<TIM, PWM>where
PWM: PwmPeripheral,
impl<const TIM: u8, PWM> Timer<TIM, PWM>where
PWM: PwmPeripheral,
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 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).
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
Auto Trait Implementations§
impl<const TIM: u8, PWM> RefUnwindSafe for Timer<TIM, PWM>where
PWM: RefUnwindSafe,
impl<const TIM: u8, PWM> Send for Timer<TIM, PWM>where
PWM: Send,
impl<const TIM: u8, PWM> Sync for Timer<TIM, PWM>where
PWM: Sync,
impl<const TIM: u8, PWM> Unpin for Timer<TIM, PWM>where
PWM: Unpin,
impl<const TIM: u8, PWM> UnwindSafe for Timer<TIM, PWM>where
PWM: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more