aboutsummaryrefslogtreecommitdiff
path: root/cyw43-pio/src/lib.rs
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2023-12-19 16:08:06 +0100
committerUlf Lilleengen <[email protected]>2023-12-19 16:08:06 +0100
commit39c166ef9b754c5caa44ef4dd4a4e216078dbcea (patch)
treecece1955c41b80d92bd8056cc265a91cf3d0cf79 /cyw43-pio/src/lib.rs
parent5e76c8b41a05c89652a6c53061107482adc4125f (diff)
docs: document public apis for cyw43 driver
Diffstat (limited to 'cyw43-pio/src/lib.rs')
-rw-r--r--cyw43-pio/src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs
index 8304740b3..5efab10e4 100644
--- a/cyw43-pio/src/lib.rs
+++ b/cyw43-pio/src/lib.rs
@@ -1,5 +1,7 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![doc = include_str!("../README.md")]
4#![warn(missing_docs)]
3 5
4use core::slice; 6use core::slice;
5 7
@@ -11,6 +13,7 @@ use embassy_rp::{Peripheral, PeripheralRef};
11use fixed::FixedU32; 13use fixed::FixedU32;
12use pio_proc::pio_asm; 14use pio_proc::pio_asm;
13 15
16/// SPI comms driven by PIO.
14pub struct PioSpi<'d, CS: Pin, PIO: Instance, const SM: usize, DMA> { 17pub struct PioSpi<'d, CS: Pin, PIO: Instance, const SM: usize, DMA> {
15 cs: Output<'d, CS>, 18 cs: Output<'d, CS>,
16 sm: StateMachine<'d, PIO, SM>, 19 sm: StateMachine<'d, PIO, SM>,
@@ -25,6 +28,7 @@ where
25 CS: Pin, 28 CS: Pin,
26 PIO: Instance, 29 PIO: Instance,
27{ 30{
31 /// Create a new instance of PioSpi.
28 pub fn new<DIO, CLK>( 32 pub fn new<DIO, CLK>(
29 common: &mut Common<'d, PIO>, 33 common: &mut Common<'d, PIO>,
30 mut sm: StateMachine<'d, PIO, SM>, 34 mut sm: StateMachine<'d, PIO, SM>,
@@ -143,6 +147,7 @@ where
143 } 147 }
144 } 148 }
145 149
150 /// Write data to peripheral and return status.
146 pub async fn write(&mut self, write: &[u32]) -> u32 { 151 pub async fn write(&mut self, write: &[u32]) -> u32 {
147 self.sm.set_enable(false); 152 self.sm.set_enable(false);
148 let write_bits = write.len() * 32 - 1; 153 let write_bits = write.len() * 32 - 1;
@@ -170,6 +175,7 @@ where
170 status 175 status
171 } 176 }
172 177
178 /// Send command and read response into buffer.
173 pub async fn cmd_read(&mut self, cmd: u32, read: &mut [u32]) -> u32 { 179 pub async fn cmd_read(&mut self, cmd: u32, read: &mut [u32]) -> u32 {
174 self.sm.set_enable(false); 180 self.sm.set_enable(false);
175 let write_bits = 31; 181 let write_bits = 31;