Program

Struct Program 

Source
pub struct Program<const PROGRAM_SIZE: usize> {
    pub code: ArrayVec<u16, PROGRAM_SIZE>,
    pub origin: Option<u8>,
    pub wrap: Wrap,
    pub side_set: SideSet,
    pub version: PioVersion,
}
Expand description

Program ready to be executed by PIO hardware.

Fields§

§code: ArrayVec<u16, PROGRAM_SIZE>

Assembled program code.

§origin: Option<u8>

Offset at which the program must be loaded.

Most often 0 if defined. This might be needed when using data based JMPs.

NOTE: Instruction addresses in JMP instructions as well as wrap source/target are calculated as if the origin was 0. Functions loading the program into PIO instruction memory will adjust those addresses accordingly if the program is loaded to a non-zero origin address.

§wrap: Wrap

Wrapping behavior for this program.

§side_set: SideSet

Side-set info for this program.

§version: PioVersion

Pio Version required for this program.

Implementations§

Source§

impl<const PROGRAM_SIZE: usize> Program<PROGRAM_SIZE>

Source

pub fn set_origin(self, origin: Option<u8>) -> Self

Set the program loading location.

If None, the program can be loaded at any location in the instruction memory.

Source

pub fn set_wrap(self, wrap: Wrap) -> Self

Set the wrapping of the program.

Trait Implementations§

Source§

impl<const PROGRAM_SIZE: usize> Debug for Program<PROGRAM_SIZE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const PROGRAM_SIZE: usize> Freeze for Program<PROGRAM_SIZE>

§

impl<const PROGRAM_SIZE: usize> RefUnwindSafe for Program<PROGRAM_SIZE>

§

impl<const PROGRAM_SIZE: usize> Send for Program<PROGRAM_SIZE>

§

impl<const PROGRAM_SIZE: usize> Sync for Program<PROGRAM_SIZE>

§

impl<const PROGRAM_SIZE: usize> Unpin for Program<PROGRAM_SIZE>

§

impl<const PROGRAM_SIZE: usize> UnwindSafe for Program<PROGRAM_SIZE>

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