pub struct Pio { /* private fields */ }
Implementations§
Source§impl Pio
impl Pio
Sourcepub fn blinking_hello_program_init(
&self,
sm_number: SMNumber,
pin: u32,
config: &StateMachineConfiguration,
)
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.
pub fn blink_program_init( &self, sm_number: SMNumber, pin: u32, config: &StateMachineConfiguration, )
pub fn sideset_program_init( &self, sm_number: SMNumber, pin: u32, config: &StateMachineConfiguration, )
pub fn hello_program_init( &self, sm_number: SMNumber, pin1: u32, pin2: u32, config: &StateMachineConfiguration, )
pub fn pwm_program_init( &self, sm_number: SMNumber, pin: u32, pwm_period: u32, config: &StateMachineConfiguration, )
pub fn spi_program_init( &self, sm_number: SMNumber, clock_pin: u32, in_pin: u32, out_pin: u32, config: &StateMachineConfiguration, )
Sourcepub fn read_instr(&self, sm_number: SMNumber) -> u32
pub fn read_instr(&self, sm_number: SMNumber) -> u32
Returns current instruction running on the state machine.
pub fn read_sideset_reg(&self, sm_number: SMNumber)
pub fn read_dbg_padout(&self) -> u32
pub fn read_fdebug(&self, tx: bool, stall: bool) -> u32
Source§impl Pio
impl Pio
Sourcepub fn gpio_init(&self, pin: &RPGpioPin<'_>)
pub fn gpio_init(&self, pin: &RPGpioPin<'_>)
Setup the function select for a GPIO to use output from the given PIO instance.
Sourcepub fn sm(&self, sm_number: SMNumber) -> &StateMachine
pub fn sm(&self, sm_number: SMNumber) -> &StateMachine
Get state machine
Sourcepub fn set_irq_source(
&self,
irq_index: u32,
interrupt_source: InterruptSources,
enabled: bool,
)
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.
Sourcepub fn interrupt_get(&self, irq_num: u32) -> bool
pub fn interrupt_get(&self, irq_num: u32) -> bool
Checks if a PIO interrupt is set.
Sourcepub fn interrupt_clear(&self, irq_num: u32)
pub fn interrupt_clear(&self, irq_num: u32)
Clear a PIO interrupt.
Sourcepub fn handle_interrupt(&self)
pub fn handle_interrupt(&self)
Handle interrupts
Sourcepub fn add_program(
&self,
origin: Option<usize>,
program: &[u8],
) -> Result<LoadedProgram, ProgramError>
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.
Sourcepub fn add_program16(
&self,
origin: Option<usize>,
program: &[u16],
) -> Result<LoadedProgram, ProgramError>
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.
Sourcepub fn clear_instr_registers(&self)
pub fn clear_instr_registers(&self)
Clears all of a PIO instance’s instruction memory.