Struct embassy_rp::pwm::Pwm
source · pub struct Pwm<'d, T: Slice> { /* private fields */ }
Expand description
PWM driver.
Implementations§
source§impl<'d, T: Slice> Pwm<'d, T>
impl<'d, T: Slice> Pwm<'d, T>
sourcepub fn new_free(inner: impl Peripheral<P = T> + 'd, config: Config) -> Self
pub fn new_free(inner: impl Peripheral<P = T> + 'd, config: Config) -> Self
Create PWM driver without any configured pins.
sourcepub fn new_output_a(
inner: impl Peripheral<P = T> + 'd,
a: impl Peripheral<P = impl ChannelAPin<T>> + 'd,
config: Config
) -> Self
pub fn new_output_a( inner: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl ChannelAPin<T>> + 'd, config: Config ) -> Self
Create PWM driver with a single ‘a’ as output.
sourcepub fn new_output_b(
inner: impl Peripheral<P = T> + 'd,
b: impl Peripheral<P = impl ChannelBPin<T>> + 'd,
config: Config
) -> Self
pub fn new_output_b( inner: 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(
inner: 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( inner: 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(
inner: 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( inner: 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(
inner: 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( inner: 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 permenantly 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.