aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/pio_programs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp/src/pio_programs')
-rw-r--r--embassy-rp/src/pio_programs/i2s.rs18
-rw-r--r--embassy-rp/src/pio_programs/pwm.rs2
-rw-r--r--embassy-rp/src/pio_programs/spi.rs4
-rw-r--r--embassy-rp/src/pio_programs/uart.rs2
4 files changed, 13 insertions, 13 deletions
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs
index 7e5f68ad6..5c49beecb 100644
--- a/embassy-rp/src/pio_programs/i2s.rs
+++ b/embassy-rp/src/pio_programs/i2s.rs
@@ -1,4 +1,4 @@
1//! Pio backed I2s output and output drivers 1//! Pio backed I2S output and output drivers
2 2
3use fixed::traits::ToFixed; 3use fixed::traits::ToFixed;
4 4
@@ -9,7 +9,7 @@ use crate::pio::{
9 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine, 9 Common, Config, Direction, FifoJoin, Instance, LoadedProgram, PioPin, ShiftConfig, ShiftDirection, StateMachine,
10}; 10};
11 11
12/// This struct represents an i2s receiver & controller driver program 12/// This struct represents an I2S receiver & controller driver program
13pub struct PioI2sInProgram<'d, PIO: Instance> { 13pub struct PioI2sInProgram<'d, PIO: Instance> {
14 prg: LoadedProgram<'d, PIO>, 14 prg: LoadedProgram<'d, PIO>,
15} 15}
@@ -35,7 +35,7 @@ impl<'d, PIO: Instance> PioI2sInProgram<'d, PIO> {
35 } 35 }
36} 36}
37 37
38/// Pio backed I2s input driver 38/// Pio backed I2S input driver
39pub struct PioI2sIn<'d, P: Instance, const S: usize> { 39pub struct PioI2sIn<'d, P: Instance, const S: usize> {
40 dma: Peri<'d, AnyChannel>, 40 dma: Peri<'d, AnyChannel>,
41 sm: StateMachine<'d, P, S>, 41 sm: StateMachine<'d, P, S>,
@@ -50,7 +50,7 @@ impl<'d, P: Instance, const S: usize> PioI2sIn<'d, P, S> {
50 // Whether or not to use the MCU's internal pull-down resistor, as the 50 // Whether or not to use the MCU's internal pull-down resistor, as the
51 // Pico 2 is known to have problems with the inbuilt pulldowns, many 51 // Pico 2 is known to have problems with the inbuilt pulldowns, many
52 // opt to just use an external pull down resistor to meet requirements of common 52 // opt to just use an external pull down resistor to meet requirements of common
53 // i2s microphones such as the INMP441 53 // I2S microphones such as the INMP441
54 data_pulldown: bool, 54 data_pulldown: bool,
55 data_pin: Peri<'d, impl PioPin>, 55 data_pin: Peri<'d, impl PioPin>,
56 bit_clock_pin: Peri<'d, impl PioPin>, 56 bit_clock_pin: Peri<'d, impl PioPin>,
@@ -90,13 +90,13 @@ impl<'d, P: Instance, const S: usize> PioI2sIn<'d, P, S> {
90 Self { dma: dma.into(), sm } 90 Self { dma: dma.into(), sm }
91 } 91 }
92 92
93 /// Return an in-prograss dma transfer future. Awaiting it will guarentee a complete transfer. 93 /// Return an in-progress dma transfer future. Awaiting it will guarantee a complete transfer.
94 pub fn read<'b>(&'b mut self, buff: &'b mut [u32]) -> Transfer<'b, AnyChannel> { 94 pub fn read<'b>(&'b mut self, buff: &'b mut [u32]) -> Transfer<'b, AnyChannel> {
95 self.sm.rx().dma_pull(self.dma.reborrow(), buff, false) 95 self.sm.rx().dma_pull(self.dma.reborrow(), buff, false)
96 } 96 }
97} 97}
98 98
99/// This struct represents an i2s output driver program 99/// This struct represents an I2S output driver program
100/// 100///
101/// The sample bit-depth is set through scratch register `Y`. 101/// The sample bit-depth is set through scratch register `Y`.
102/// `Y` has to be set to sample bit-depth - 2. 102/// `Y` has to be set to sample bit-depth - 2.
@@ -128,14 +128,14 @@ impl<'d, PIO: Instance> PioI2sOutProgram<'d, PIO> {
128 } 128 }
129} 129}
130 130
131/// Pio backed I2s output driver 131/// Pio backed I2S output driver
132pub struct PioI2sOut<'d, P: Instance, const S: usize> { 132pub struct PioI2sOut<'d, P: Instance, const S: usize> {
133 dma: Peri<'d, AnyChannel>, 133 dma: Peri<'d, AnyChannel>,
134 sm: StateMachine<'d, P, S>, 134 sm: StateMachine<'d, P, S>,
135} 135}
136 136
137impl<'d, P: Instance, const S: usize> PioI2sOut<'d, P, S> { 137impl<'d, P: Instance, const S: usize> PioI2sOut<'d, P, S> {
138 /// Configure a state machine to output I2s 138 /// Configure a state machine to output I2S
139 pub fn new( 139 pub fn new(
140 common: &mut Common<'d, P>, 140 common: &mut Common<'d, P>,
141 mut sm: StateMachine<'d, P, S>, 141 mut sm: StateMachine<'d, P, S>,
@@ -179,7 +179,7 @@ impl<'d, P: Instance, const S: usize> PioI2sOut<'d, P, S> {
179 Self { dma: dma.into(), sm } 179 Self { dma: dma.into(), sm }
180 } 180 }
181 181
182 /// Return an in-prograss dma transfer future. Awaiting it will guarentee a complete transfer. 182 /// Return an in-progress dma transfer future. Awaiting it will guarantee a complete transfer.
183 pub fn write<'b>(&'b mut self, buff: &'b [u32]) -> Transfer<'b, AnyChannel> { 183 pub fn write<'b>(&'b mut self, buff: &'b [u32]) -> Transfer<'b, AnyChannel> {
184 self.sm.tx().dma_push(self.dma.reborrow(), buff, false) 184 self.sm.tx().dma_push(self.dma.reborrow(), buff, false)
185 } 185 }
diff --git a/embassy-rp/src/pio_programs/pwm.rs b/embassy-rp/src/pio_programs/pwm.rs
index ba06bb3c1..e4ad4a6f0 100644
--- a/embassy-rp/src/pio_programs/pwm.rs
+++ b/embassy-rp/src/pio_programs/pwm.rs
@@ -67,7 +67,7 @@ impl<'d, T: Instance, const SM: usize> PioPwm<'d, T, SM> {
67 Self { sm, pin } 67 Self { sm, pin }
68 } 68 }
69 69
70 /// Enable's the PIO program, continuing the wave generation from the PIO program. 70 /// Enables the PIO program, continuing the wave generation from the PIO program.
71 pub fn start(&mut self) { 71 pub fn start(&mut self) {
72 self.sm.set_enable(true); 72 self.sm.set_enable(true);
73 } 73 }
diff --git a/embassy-rp/src/pio_programs/spi.rs b/embassy-rp/src/pio_programs/spi.rs
index b10fc6628..765ffaa06 100644
--- a/embassy-rp/src/pio_programs/spi.rs
+++ b/embassy-rp/src/pio_programs/spi.rs
@@ -1,4 +1,4 @@
1//! PIO backed SPi drivers 1//! PIO backed SPI drivers
2 2
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4 4
@@ -83,7 +83,7 @@ pub enum Error {
83 // No errors for now 83 // No errors for now
84} 84}
85 85
86/// PIO based Spi driver. 86/// PIO based SPI driver.
87/// Unlike other PIO programs, the PIO SPI driver owns and holds a reference to 87/// Unlike other PIO programs, the PIO SPI driver owns and holds a reference to
88/// the PIO memory it uses. This is so that it can be reconfigured at runtime if 88/// the PIO memory it uses. This is so that it can be reconfigured at runtime if
89/// desired. 89/// desired.
diff --git a/embassy-rp/src/pio_programs/uart.rs b/embassy-rp/src/pio_programs/uart.rs
index 444efb5db..d59596dd1 100644
--- a/embassy-rp/src/pio_programs/uart.rs
+++ b/embassy-rp/src/pio_programs/uart.rs
@@ -130,7 +130,7 @@ impl<'d, PIO: Instance> PioUartRxProgram<'d, PIO> {
130 } 130 }
131} 131}
132 132
133/// PIO backed Uart reciever 133/// PIO backed Uart receiver
134pub struct PioUartRx<'d, PIO: Instance, const SM: usize> { 134pub struct PioUartRx<'d, PIO: Instance, const SM: usize> {
135 sm_rx: StateMachine<'d, PIO, SM>, 135 sm_rx: StateMachine<'d, PIO, SM>,
136} 136}