pub struct StateMachine<'d, PIO: Instance, const SM: usize> { /* private fields */ }
Expand description
A type representing a single PIO state machine.
Implementations§
Source§impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM>
impl<'d, PIO: Instance + 'd, const SM: usize> StateMachine<'d, PIO, SM>
Sourcepub fn set_config(&mut self, config: &Config<'d, PIO>)
pub fn set_config(&mut self, config: &Config<'d, PIO>)
Set the config for a given PIO state machine.
Sourcepub fn set_clock_divider(&mut self, clock_divider: FixedU32<U8>)
pub fn set_clock_divider(&mut self, clock_divider: FixedU32<U8>)
Set the clock divider for this state machine.
Sourcepub fn set_enable(&mut self, enable: bool)
pub fn set_enable(&mut self, enable: bool)
Enable state machine.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if state machine is enabled.
Sourcepub fn clkdiv_restart(&mut self)
pub fn clkdiv_restart(&mut self)
Restart a state machine’s clock divider from an initial phase of 0.
Sourcepub fn set_pin_dirs(&mut self, dir: Direction, pins: &[&Pin<'d, PIO>])
pub fn set_pin_dirs(&mut self, dir: Direction, pins: &[&Pin<'d, PIO>])
Sets pin directions. This pauses the current state machine to run SET
commands
and temporarily unsets the OUT_STICKY
bit.
Sourcepub fn set_pins(&mut self, level: Level, pins: &[&Pin<'d, PIO>])
pub fn set_pins(&mut self, level: Level, pins: &[&Pin<'d, PIO>])
Sets pin output values. This pauses the current state machine to run
SET
commands and temporarily unsets the OUT_STICKY
bit.
Sourcepub fn clear_fifos(&mut self)
pub fn clear_fifos(&mut self)
Flush FIFOs for state machine.
Sourcepub unsafe fn exec_instr(&mut self, instr: u16)
pub unsafe fn exec_instr(&mut self, instr: u16)
Instruct state machine to execute a given instructions
SAFETY: The state machine must be in a state where executing an arbitrary instruction does not crash it.
Sourcepub fn rx(&mut self) -> &mut StateMachineRx<'d, PIO, SM>
pub fn rx(&mut self) -> &mut StateMachineRx<'d, PIO, SM>
Return a read handle for reading state machine outputs.
Sourcepub fn tx(&mut self) -> &mut StateMachineTx<'d, PIO, SM>
pub fn tx(&mut self) -> &mut StateMachineTx<'d, PIO, SM>
Return a handle for writing to inputs.
Sourcepub fn rx_tx(
&mut self,
) -> (&mut StateMachineRx<'d, PIO, SM>, &mut StateMachineTx<'d, PIO, SM>)
pub fn rx_tx( &mut self, ) -> (&mut StateMachineRx<'d, PIO, SM>, &mut StateMachineTx<'d, PIO, SM>)
Return both read and write handles for the state machine.