pub struct Pwm<'d, T: Channel> { /* private fields */ }Expand description
PWM driver.
Implementations§
Source§impl<'d, T: Channel> Pwm<'d, T>
impl<'d, T: Channel> 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 PwmPinA<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_a( inner: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl PwmPinA<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 PwmPinB<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_b( inner: impl Peripheral<P = T> + 'd, b: impl Peripheral<P = impl PwmPinB<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 PwmPinA<T>> + 'd,
b: impl Peripheral<P = impl PwmPinB<T>> + 'd,
config: Config,
) -> Self
pub fn new_output_ab( inner: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl PwmPinA<T>> + 'd, b: impl Peripheral<P = impl PwmPinB<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 PwmPinB<T>> + 'd,
mode: InputMode,
config: Config,
) -> Self
pub fn new_input( inner: impl Peripheral<P = T> + 'd, b: impl Peripheral<P = impl PwmPinB<T>> + 'd, 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 PwmPinA<T>> + 'd,
b: impl Peripheral<P = impl PwmPinB<T>> + 'd,
mode: InputMode,
config: Config,
) -> Self
pub fn new_output_input( inner: impl Peripheral<P = T> + 'd, a: impl Peripheral<P = impl PwmPinA<T>> + 'd, b: impl Peripheral<P = impl PwmPinB<T>> + 'd, 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.