Struct stm32f1xx_hal::timer::pwm::Pwm
source · pub struct Pwm<TIM, REMAP, P, PINS, const FREQ: u32>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,{ /* private fields */ }
Implementations§
source§impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
source§impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
pub fn enable(&mut self, channel: Channel)
pub fn disable(&mut self, channel: Channel)
pub fn get_duty(&self, channel: Channel) -> u16
pub fn set_duty(&mut self, channel: Channel, duty: u16)
sourcepub fn get_max_duty(&self) -> u16
pub fn get_max_duty(&self) -> u16
If 0
returned means max_duty is 2^16
pub fn get_period(&self) -> TimerDurationU32<FREQ>
pub fn set_period(&mut self, period: TimerDurationU32<FREQ>)
Methods from Deref<Target = FTimer<TIM, FREQ>>§
sourcepub fn listen(&mut self, event: Event)
pub fn listen(&mut self, event: Event)
Starts listening for an event
Note, you will also have to enable the TIM2 interrupt in the NVIC to start receiving events.
sourcepub fn clear_interrupt(&mut self, event: Event)
pub fn clear_interrupt(&mut self, event: Event)
Clears interrupt associated with event
.
If the interrupt is not cleared, it will immediately retrigger after the ISR has finished.
pub fn get_interrupt(&mut self) -> Event
sourcepub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)
pub fn stop_in_debug(&mut self, dbg: &mut DBG, state: bool)
Stopping timer in debug mode can cause troubles when sampling the signal
pub fn set_master_mode(&mut self, mode: TIM::Mms)
Trait Implementations§
source§impl<TIM, REMAP, P, PINS, const FREQ: u32> Deref for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
impl<TIM, REMAP, P, PINS, const FREQ: u32> Deref for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
source§impl<TIM, REMAP, P, PINS, const FREQ: u32> DerefMut for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
impl<TIM, REMAP, P, PINS, const FREQ: u32> DerefMut for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
source§impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
impl<TIM, REMAP, P, PINS, const FREQ: u32> Pwm for Pwm<TIM, REMAP, P, PINS, FREQ>where
TIM: Instance + WithPwm,
REMAP: Remap<Periph = TIM>,
PINS: Pins<REMAP, P>,
source§fn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
If 0
returned means max_duty is 2^16
§type Time = Duration<u32, 1, FREQ>
type Time = Duration<u32, 1, FREQ>
A time unit that can be converted into a human time unit (e.g. seconds)
source§fn get_period(&self) -> Self::Time
fn get_period(&self) -> Self::Time
Returns the current PWM period
source§fn set_period<T>(&mut self, period: T)where
T: Into<Self::Time>,
fn set_period<T>(&mut self, period: T)where
T: Into<Self::Time>,
Sets a new PWM period