Struct embassy_rp::pwm::Pwm
source · 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.