pub struct PioPwm<'d, T: Instance, const SM: usize> { /* private fields */ }Expand description
Pio backed PWM output
Implementations§
Source§impl<'d, T: Instance, const SM: usize> PioPwm<'d, T, SM>
impl<'d, T: Instance, const SM: usize> PioPwm<'d, T, SM>
Sourcepub fn new(
pio: &mut Common<'d, T>,
sm: StateMachine<'d, T, SM>,
pin: Peri<'d, impl PioPin>,
program: &PioPwmProgram<'d, T>,
) -> Self
pub fn new( pio: &mut Common<'d, T>, sm: StateMachine<'d, T, SM>, pin: Peri<'d, impl PioPin>, program: &PioPwmProgram<'d, T>, ) -> Self
Configure a state machine as a PWM output
Sourcepub fn start(&mut self)
pub fn start(&mut self)
Enables the PIO program, continuing the wave generation from the PIO program.
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stops the PIO program, ceasing all signals from the PIN that were generated via PIO.
Sourcepub fn set_period(&mut self, duration: Duration)
pub fn set_period(&mut self, duration: Duration)
Sets the pwm period, which is the length of time for each pio wave until reset.
Sourcepub fn set_level(&mut self, level: u32)
pub fn set_level(&mut self, level: u32)
Set the number of pio cycles to set the wave on high to.
Sourcepub fn release(self) -> (StateMachine<'d, T, SM>, Pin<'d, T>)
pub fn release(self) -> (StateMachine<'d, T, SM>, Pin<'d, T>)
Return the state machine and pin.
Auto Trait Implementations§
impl<'d, T, const SM: usize> !UnwindSafe for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> Freeze for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> RefUnwindSafe for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> Send for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> Sync for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> Unpin for PioPwm<'d, T, SM>
impl<'d, T, const SM: usize> UnsafeUnpin for PioPwm<'d, T, SM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more