embassy-rp

Crates

git

Versions

rp235xa

Flavors

Skip to main content

PioStepDir

Struct PioStepDir 

Source
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>

Source

pub fn new( pio: &mut Common<'d, T>, sm: StateMachine<'d, T, SM>, irq: Irq<'d, T, SM>, step_pin: Peri<'d, impl PioPin>, dir_pin: Peri<'d, impl GpioPin>, program: &PioStepDirProgram<'d, T>, ) -> Self

Configure a state machine to generate STEP pulses and bind a DIR pin.

Source

pub fn min_frequency(&self) -> u32

Return the minimum supported pulse frequency in Hz for this program.

Source

pub fn set_frequency( &mut self, freq_hz: u32, ) -> Result<(), StepDirFrequencyError>

Set output pulse frequency in Hz.

Source

pub fn frequency(&self) -> u32

Get the currently configured pulse frequency in Hz.

Source

pub fn set_direction(&mut self, direction: StepDir)

Set motion direction.

Source

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.

Source

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.

Source

pub fn stop(&mut self)

Stop pulse generation immediately and clear the state machine FIFOs.

Source

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 T: RefUnwindSafe,

§

impl<'d, T, const SM: usize> Send for PioStepDir<'d, T, SM>
where T: Send,

§

impl<'d, T, const SM: usize> Sync for PioStepDir<'d, T, SM>
where T: Sync,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.