pub struct PioStepDir<'d, T: Instance, const SM: usize> { /* private fields */ }Expand description
PIO-backed Step/Dir stepper pulse generator.
One pin is driven by PIO for STEP pulses, and one GPIO pin is controlled by software for DIR.
Implementations§
Source§impl<'d, T: Instance, const SM: usize> PioStepDir<'d, T, SM>
impl<'d, T: Instance, const SM: usize> PioStepDir<'d, T, SM>
Sourcepub fn new(
pio: &mut Common<'d, T>,
sm: StateMachine<'d, T, SM>,
step_pin: Peri<'d, impl PioPin>,
dir_pin: Peri<'d, impl GpioPin>,
irq: Irq<'d, T, SM>,
program: &PioStepDirProgram<'d, T>,
) -> Self
pub fn new( pio: &mut Common<'d, T>, sm: StateMachine<'d, T, SM>, step_pin: Peri<'d, impl PioPin>, dir_pin: Peri<'d, impl GpioPin>, irq: Irq<'d, T, SM>, program: &PioStepDirProgram<'d, T>, ) -> Self
Configure a state machine to generate STEP pulses and bind a DIR pin.
Sourcepub fn min_frequency(&self) -> u32
pub fn min_frequency(&self) -> u32
Return the minimum supported pulse frequency in Hz for this program.
Sourcepub fn set_frequency(
&mut self,
freq_hz: u32,
) -> Result<(), StepDirFrequencyError>
pub fn set_frequency( &mut self, freq_hz: u32, ) -> Result<(), StepDirFrequencyError>
Set output pulse frequency in Hz.
Sourcepub fn set_direction(&mut self, direction: StepDir)
pub fn set_direction(&mut self, direction: StepDir)
Set motion direction.
Sourcepub async fn move_with_dir(&mut self, steps: u32, direction: StepDir)
pub async fn move_with_dir(&mut self, steps: u32, direction: StepDir)
Generate an exact number of STEP pulses in the given direction and wait until completion.
Sourcepub async fn move_steps(&mut self, steps: u32)
pub async fn move_steps(&mut self, steps: u32)
Generate an exact number of STEP pulses and wait until completion.
If this future is dropped before completion (e.g. cancelled via select!),
the PIO state machine is automatically reset and the STEP pin is driven low.
Sourcepub fn release(
self,
) -> (Irq<'d, T, SM>, StateMachine<'d, T, SM>, PioPinHandle<'d, T>, Output<'d>)
pub fn release( self, ) -> (Irq<'d, T, SM>, StateMachine<'d, T, SM>, PioPinHandle<'d, T>, Output<'d>)
Release owned resources.
Auto Trait Implementations§
impl<'d, T, const SM: usize> !UnwindSafe for PioStepDir<'d, T, SM>
impl<'d, T, const SM: usize> Freeze for PioStepDir<'d, T, SM>
impl<'d, T, const SM: usize> RefUnwindSafe for PioStepDir<'d, T, SM>where
Irq<'d, T, SM>: RefUnwindSafe,
StateMachine<'d, T, SM>: RefUnwindSafe,
Pin<'d, T>: RefUnwindSafe,
impl<'d, T, const SM: usize> Send for PioStepDir<'d, T, SM>
impl<'d, T, const SM: usize> Sync for PioStepDir<'d, T, SM>
impl<'d, T, const SM: usize> Unpin for PioStepDir<'d, T, SM>
impl<'d, T, const SM: usize> UnsafeUnpin for PioStepDir<'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