pub struct ComplementaryPwm<'d, T: AdvancedInstance4Channel> { /* private fields */ }
Expand description
PWM driver with support for standard and complementary outputs.
Implementations§
Source§impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T>
impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T>
Sourcepub fn new(
tim: Peri<'d, T>,
_ch1: Option<PwmPin<'d, T, Ch1>>,
_ch1n: Option<ComplementaryPwmPin<'d, T, Ch1>>,
_ch2: Option<PwmPin<'d, T, Ch2>>,
_ch2n: Option<ComplementaryPwmPin<'d, T, Ch2>>,
_ch3: Option<PwmPin<'d, T, Ch3>>,
_ch3n: Option<ComplementaryPwmPin<'d, T, Ch3>>,
_ch4: Option<PwmPin<'d, T, Ch4>>,
_ch4n: Option<ComplementaryPwmPin<'d, T, Ch4>>,
freq: Hertz,
counting_mode: CountingMode,
) -> Self
pub fn new( tim: Peri<'d, T>, _ch1: Option<PwmPin<'d, T, Ch1>>, _ch1n: Option<ComplementaryPwmPin<'d, T, Ch1>>, _ch2: Option<PwmPin<'d, T, Ch2>>, _ch2n: Option<ComplementaryPwmPin<'d, T, Ch2>>, _ch3: Option<PwmPin<'d, T, Ch3>>, _ch3n: Option<ComplementaryPwmPin<'d, T, Ch3>>, _ch4: Option<PwmPin<'d, T, Ch4>>, _ch4n: Option<ComplementaryPwmPin<'d, T, Ch4>>, freq: Hertz, counting_mode: CountingMode, ) -> Self
Create a new complementary PWM driver.
Sourcepub fn set_output_idle_state(
&mut self,
channels: &[Channel],
polarity: IdlePolarity,
)
pub fn set_output_idle_state( &mut self, channels: &[Channel], polarity: IdlePolarity, )
Sets the idle output state for the given channels.
Sourcepub fn set_off_state_selection_idle(&mut self, val: Ossi)
pub fn set_off_state_selection_idle(&mut self, val: Ossi)
Set state of OSSI-bit in BDTR register
Sourcepub fn get_off_state_selection_idle(&self) -> Ossi
pub fn get_off_state_selection_idle(&self) -> Ossi
Get state of OSSI-bit in BDTR register
Sourcepub fn set_off_state_selection_run(&mut self, val: Ossr)
pub fn set_off_state_selection_run(&mut self, val: Ossr)
Set state of OSSR-bit in BDTR register
Sourcepub fn get_off_state_selection_run(&self) -> Ossr
pub fn get_off_state_selection_run(&self) -> Ossr
Get state of OSSR-bit in BDTR register
Sourcepub fn trigger_software_break(&mut self, n: usize)
pub fn trigger_software_break(&mut self, n: usize)
Trigger break input from software
Sourcepub fn set_master_output_enable(&mut self, enable: bool)
pub fn set_master_output_enable(&mut self, enable: bool)
Set Master Output Enable
Sourcepub fn get_master_output_enable(&self) -> bool
pub fn get_master_output_enable(&self) -> bool
Get Master Output Enable
Sourcepub fn set_frequency(&mut self, freq: Hertz)
pub fn set_frequency(&mut self, freq: Hertz)
Set PWM frequency.
Note: when you call this, the max duty value changes, so you will have to
call set_duty
on all channels with the duty calculated based on the new max duty.
Sourcepub fn get_max_duty(&self) -> u16
pub fn get_max_duty(&self) -> u16
Get max duty value.
This value depends on the configured frequency and the timer’s clock rate from RCC.
Sourcepub fn set_duty(&mut self, channel: Channel, duty: u16)
pub fn set_duty(&mut self, channel: Channel, duty: u16)
Set the duty for a given channel.
The value ranges from 0 for 0% duty, to get_max_duty
for 100% duty, both included.
Sourcepub fn set_polarity(&mut self, channel: Channel, polarity: OutputPolarity)
pub fn set_polarity(&mut self, channel: Channel, polarity: OutputPolarity)
Set the output polarity for a given channel.
Sourcepub fn set_dead_time(&mut self, value: u16)
pub fn set_dead_time(&mut self, value: u16)
Set the dead time as a proportion of max_duty
Trait Implementations§
Source§impl<'d, T: AdvancedInstance4Channel> Pwm for ComplementaryPwm<'d, T>
impl<'d, T: AdvancedInstance4Channel> Pwm for ComplementaryPwm<'d, T>
Source§type Channel = Channel
type Channel = Channel
Pwm
interface Read more