pub struct PioSpi<'d, PIO: Instance, const SM: usize> { /* private fields */ }Expand description
SPI comms driven by PIO.
Implementations§
Source§impl<'d, PIO, const SM: usize> PioSpi<'d, PIO, SM>where
PIO: Instance,
impl<'d, PIO, const SM: usize> PioSpi<'d, PIO, SM>where
PIO: Instance,
Sourcepub fn new(
common: &mut Common<'d, PIO>,
sm: StateMachine<'d, PIO, SM>,
clock_divider: u32,
irq: Irq<'d, PIO, 0>,
cs: Output<'d>,
dio: Peri<'d, impl PioPin>,
clk: Peri<'d, impl PioPin>,
dma_tx: Channel<'d, Async>,
dma_rx: Channel<'d, Async>,
) -> Self
pub fn new( common: &mut Common<'d, PIO>, sm: StateMachine<'d, PIO, SM>, clock_divider: u32, irq: Irq<'d, PIO, 0>, cs: Output<'d>, dio: Peri<'d, impl PioPin>, clk: Peri<'d, impl PioPin>, dma_tx: Channel<'d, Async>, dma_rx: Channel<'d, Async>, ) -> Self
Create a new instance of PioSpi.
clock_divider is the PIO clock divider as a fixed-point number with 16 integer bits
and 8 fractional bits (the divider multiplied by 256), see DEFAULT_CLOCK_DIVIDER.
Trait Implementations§
Source§impl<'d, PIO, const SM: usize> SpiBusCyw43 for PioSpi<'d, PIO, SM>where
PIO: Instance,
impl<'d, PIO, const SM: usize> SpiBusCyw43 for PioSpi<'d, PIO, SM>where
PIO: Instance,
Source§async fn cmd_write(&mut self, write: &[u32]) -> u32
async fn cmd_write(&mut self, write: &[u32]) -> u32
Issues a write command on the bus
First 32 bits of
word are expected to be a cmd wordSource§async fn cmd_read(&mut self, write: u32, read: &mut [u32]) -> u32
async fn cmd_read(&mut self, write: u32, read: &mut [u32]) -> u32
Issues a read command on the bus
write is expected to be a 32 bit cmd word
read will contain the response of the device
Backplane reads have a response delay that produces one extra unspecified word at the beginning of read.
Callers that want to read n word from the backplane, have to provide a slice that is n+1 words long.Source§async fn prepare_reset(&mut self)
async fn prepare_reset(&mut self)
Called immediately before the device is power-cycled, to setup bus/pins
to the correct state required during reset.
Source§async fn wait_for_event(&mut self)
async fn wait_for_event(&mut self)
Wait for events from the Device. A typical implementation would wait for the IRQ pin to be high.
The default implementation always reports ready, resulting in active polling of the device.
Auto Trait Implementations§
impl<'d, PIO, const SM: usize> !UnwindSafe for PioSpi<'d, PIO, SM>
impl<'d, PIO, const SM: usize> Freeze for PioSpi<'d, PIO, SM>
impl<'d, PIO, const SM: usize> RefUnwindSafe for PioSpi<'d, PIO, SM>where
StateMachine<'d, PIO, SM>: RefUnwindSafe,
Irq<'d, PIO, 0>: RefUnwindSafe,
Pin<'d, PIO>: RefUnwindSafe,
impl<'d, PIO, const SM: usize> Send for PioSpi<'d, PIO, SM>
impl<'d, PIO, const SM: usize> Sync for PioSpi<'d, PIO, SM>
impl<'d, PIO, const SM: usize> Unpin for PioSpi<'d, PIO, SM>
impl<'d, PIO, const SM: usize> UnsafeUnpin for PioSpi<'d, PIO, SM>where
StateMachine<'d, PIO, SM>: UnsafeUnpin,
Irq<'d, PIO, 0>: UnsafeUnpin,
Pin<'d, PIO>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more