pub struct Pwm<'d> { /* private fields */ }
Expand description
PWM driver.
Implementations§
Source§impl<'d> Pwm<'d>
impl<'d> Pwm<'d>
Sourcepub fn new_free<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
config: Config,
) -> Self
pub fn new_free<T: Slice>( slice: impl Peripheral<P = T> + 'd, config: Config, ) -> Self
Create PWM driver without any configured pins.
Sourcepub fn new_output_a<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_a<T: Slice>( slice: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, config: Config, ) -> Self
Create PWM driver with a single ‘a’ pin as output.
Sourcepub fn new_output_b<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_b<T: Slice>( slice: impl Peripheral<P = T> + 'd, b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, config: Config, ) -> Self
Create PWM driver with a single ‘b’ pin as output.
Sourcepub fn new_output_ab<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_ab<T: Slice>( slice: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, config: Config, ) -> Self
Create PWM driver with a ‘a’ and ‘b’ pins as output.
Sourcepub fn new_input<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
b_pull: Pull,
mode: InputMode,
config: Config,
) -> Self
pub fn new_input<T: Slice>( slice: impl Peripheral<P = T> + 'd, b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, b_pull: Pull, mode: InputMode, config: Config, ) -> Self
Create PWM driver with a single ‘b’ as input pin.
Sourcepub fn new_output_input<T: Slice>(
slice: impl Peripheral<P = T> + 'd,
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
b_pull: Pull,
mode: InputMode,
config: Config,
) -> Self
pub fn new_output_input<T: Slice>( slice: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, b: impl Peripheral<P = impl ChannelBPin<T>> + 'd, b_pull: Pull, mode: InputMode, config: Config, ) -> Self
Create PWM driver with a ‘a’ and ‘b’ pins in the desired input mode.
Sourcepub fn set_config(&mut self, config: &Config)
pub fn set_config(&mut self, config: &Config)
Set the PWM config.
Sourcepub fn phase_advance(&mut self)
pub fn phase_advance(&mut self)
Advances a slice’s output phase by one count while it is running by inserting a pulse into the clock enable. The counter will not count faster than once per cycle.
Sourcepub fn phase_retard(&mut self)
pub fn phase_retard(&mut self)
Retards a slice’s output phase by one count while it is running by deleting a pulse from the clock enable. The counter will not count backward when clock enable is permanently low.
Sourcepub fn set_counter(&self, ctr: u16)
pub fn set_counter(&self, ctr: u16)
Write PWM counter.
Sourcepub fn wait_for_wrap(&mut self)
pub fn wait_for_wrap(&mut self)
Wait for channel interrupt.
Sourcepub fn clear_wrapped(&mut self)
pub fn clear_wrapped(&mut self)
Clear interrupt flag.
Trait Implementations§
Source§impl<'d> SetDutyCycle for Pwm<'d>
impl<'d> SetDutyCycle for Pwm<'d>
Source§fn max_duty_cycle(&self) -> u16
fn max_duty_cycle(&self) -> u16
Source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
duty / max_duty
. Read more