Struct Pio

Source
pub struct Pio { /* private fields */ }

Implementations§

Source§

impl Pio

Source

pub fn blinking_hello_program_init( &self, sm_number: SMNumber, pin: u32, config: &StateMachineConfiguration, )

Used for the examples in the pico explorer base main.rs file.

Source

pub fn sideset_program_init( &self, sm_number: SMNumber, pin: u32, config: &StateMachineConfiguration, )

Source

pub fn hello_program_init( &self, sm_number: SMNumber, pin1: u32, pin2: u32, config: &StateMachineConfiguration, )

Source

pub fn pwm_program_init( &self, sm_number: SMNumber, pin: u32, pwm_period: u32, config: &StateMachineConfiguration, )

Source

pub fn spi_program_init( &self, sm_number: SMNumber, clock_pin: u32, in_pin: u32, out_pin: u32, config: &StateMachineConfiguration, )

Source

pub fn read_instr(&self, sm_number: SMNumber) -> u32

Returns current instruction running on the state machine.

Source

pub fn read_sideset_reg(&self, sm_number: SMNumber)

Source

pub fn read_dbg_padout(&self) -> u32

Source

pub fn read_fdebug(&self, tx: bool, stall: bool) -> u32

Source§

impl Pio

Source

pub fn gpio_init(&self, pin: &RPGpioPin<'_>)

Setup the function select for a GPIO to use output from the given PIO instance.

Source

pub fn new_pio0() -> Self

Create a new PIO0 struct.

Source

pub fn new_pio1() -> Self

Create a new PIO1 struct.

Source

pub fn sm(&self, sm_number: SMNumber) -> &StateMachine

Get state machine

Source

pub fn set_irq_source( &self, irq_index: u32, interrupt_source: InterruptSources, enabled: bool, )

Enable/Disable a single source on a PIO’s IRQ index.

Source

pub fn interrupt_get(&self, irq_num: u32) -> bool

Checks if a PIO interrupt is set.

Source

pub fn interrupt_clear(&self, irq_num: u32)

Clear a PIO interrupt.

Source

pub fn handle_interrupt(&self)

Handle interrupts

Source

pub fn add_program( &self, origin: Option<usize>, program: &[u8], ) -> Result<LoadedProgram, ProgramError>

Adds a program to PIO. Call this with add_program(Some(0), include_bytes!("path_to_file")). => origin: the address in the PIO instruction memory to start the program at or None to find an empty space => program: the program to load into the PIO Returns LoadedProgram which contains information about program location and length.

Source

pub fn add_program16( &self, origin: Option<usize>, program: &[u16], ) -> Result<LoadedProgram, ProgramError>

Adds a program to PIO. Takes &[u16] as input, cause pio-asm operations are 16bit. => origin: the address in the PIO instruction memory to start the program at or None to find an empty space => program: the program to load into the PIO Returns LoadedProgram which contains information about program location and size.

Source

pub fn clear_instr_registers(&self)

Clears all of a PIO instance’s instruction memory.

Source

pub fn init(&self)

Initialize a new PIO with the same default configuration for all four state machines.

Auto Trait Implementations§

§

impl !Freeze for Pio

§

impl !RefUnwindSafe for Pio

§

impl !Send for Pio

§

impl !Sync for Pio

§

impl Unpin for Pio

§

impl !UnwindSafe for Pio

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.