Struct stm32f4xx_hal::timer::pwm::PwmHz
source · pub struct PwmHz<TIM, PINS>{ /* private fields */ }
Implementations§
source§impl<TIM, PINS> PwmHz<TIM, PINS>
impl<TIM, PINS> PwmHz<TIM, PINS>
sourcepub fn set_polarity(&mut self, channel: Channel, p: Polarity)
pub fn set_polarity(&mut self, channel: Channel, p: Polarity)
Set the polarity of the active state for the primary PWM output of the timer on channel channel
sourcepub fn get_duty(&self, channel: Channel) -> u16
pub fn get_duty(&self, channel: Channel) -> u16
Get the current duty cycle of the timer on channel channel
sourcepub fn set_duty(&mut self, channel: Channel, duty: u16)
pub fn set_duty(&mut self, channel: Channel, duty: u16)
Set the duty cycle of the timer on channel channel
sourcepub fn get_max_duty(&self) -> u16
pub fn get_max_duty(&self) -> u16
Get the maximum duty cycle value of the timer
If 0
returned means max_duty is 2^16
sourcepub fn get_period(&self) -> Hertz
pub fn get_period(&self) -> Hertz
Get the PWM frequency of the timer in Hertz
sourcepub fn set_period(&mut self, period: Hertz)
pub fn set_period(&mut self, period: Hertz)
Set the PWM frequency for the timer in Hertz
sourcepub fn set_complementary_polarity(&mut self, channel: Channel, p: Polarity)
pub fn set_complementary_polarity(&mut self, channel: Channel, p: Polarity)
Set the polarity of the active state for the complementary PWM output of the advanced timer on channel channel
source§impl<TIM, PINS> PwmHz<TIM, PINS>
impl<TIM, PINS> PwmHz<TIM, PINS>
sourcepub fn enable_complementary(&mut self, channel: Channel)
pub fn enable_complementary(&mut self, channel: Channel)
Enable complementary PWM output of the timer on channel channel
sourcepub fn disable_complementary(&mut self, channel: Channel)
pub fn disable_complementary(&mut self, channel: Channel)
Disable complementary PWM output of the timer on channel channel
sourcepub fn set_dead_time(&mut self, dts_ticks: u16)
pub fn set_dead_time(&mut self, dts_ticks: u16)
Set number DTS ticks during that the primary and complementary PWM pins are simultaneously forced to their inactive states
( see Polarity
setting ) when changing PWM state. This duration when both channels are in an ‘off’ state is called ‘dead time’.
This is necessary in applications like motor control or power converters to prevent the destruction of the switching elements by short circuit in the moment of switching.
sourcepub fn set_dead_time_bits(&mut self, bits: u8)
pub fn set_dead_time_bits(&mut self, bits: u8)
Set raw dead time (DTG) bits
The dead time generation is nonlinear and constrained by the DTS tick duration. DTG register configuration and calculation of the actual resulting dead time is described in the application note RM0368 from ST Microelectronics
sourcepub fn get_dead_time(&self) -> u16
pub fn get_dead_time(&self) -> u16
Return dead time for complementary pins in the unit of DTS ticks
sourcepub fn get_dead_time_bits(&self) -> u8
pub fn get_dead_time_bits(&self) -> u8
Get raw dead time (DTG) bits
sourcepub fn set_idle_state(&mut self, channel: Channel, s: IdleState)
pub fn set_idle_state(&mut self, channel: Channel, s: IdleState)
Set the pin idle state
sourcepub fn set_complementary_idle_state(&mut self, channel: Channel, s: IdleState)
pub fn set_complementary_idle_state(&mut self, channel: Channel, s: IdleState)
Set the complementary pin idle state
Methods from Deref<Target = Timer<TIM>>§
pub fn configure(&mut self, clocks: &Clocks)
pub fn configure_external(&mut self, clocks: &Clocks)
pub fn configure(&mut self, clocks: &Clocks)
pub fn set_master_mode(&mut self, mode: TIM::Mms)
Trait Implementations§
source§impl<TIM, PINS> Pwm for PwmHz<TIM, PINS>
impl<TIM, PINS> Pwm for PwmHz<TIM, PINS>
source§fn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
If 0
returned means max_duty is 2^16