diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /tests/rp/src/bin/uart_buffered.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'tests/rp/src/bin/uart_buffered.rs')
| -rw-r--r-- | tests/rp/src/bin/uart_buffered.rs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/tests/rp/src/bin/uart_buffered.rs b/tests/rp/src/bin/uart_buffered.rs index a543320e0..b270a60ce 100644 --- a/tests/rp/src/bin/uart_buffered.rs +++ b/tests/rp/src/bin/uart_buffered.rs | |||
| @@ -73,7 +73,15 @@ async fn main(_spawner: Spawner) { | |||
| 73 | let config = Config::default(); | 73 | let config = Config::default(); |
| 74 | let tx_buf = &mut [0u8; 16]; | 74 | let tx_buf = &mut [0u8; 16]; |
| 75 | let rx_buf = &mut [0u8; 16]; | 75 | let rx_buf = &mut [0u8; 16]; |
| 76 | let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); | 76 | let mut uart = BufferedUart::new( |
| 77 | uart.reborrow(), | ||
| 78 | Irqs, | ||
| 79 | tx.reborrow(), | ||
| 80 | rx.reborrow(), | ||
| 81 | tx_buf, | ||
| 82 | rx_buf, | ||
| 83 | config, | ||
| 84 | ); | ||
| 77 | 85 | ||
| 78 | // Make sure we send more bytes than fits in the FIFO, to test the actual | 86 | // Make sure we send more bytes than fits in the FIFO, to test the actual |
| 79 | // bufferedUart. | 87 | // bufferedUart. |
| @@ -93,7 +101,15 @@ async fn main(_spawner: Spawner) { | |||
| 93 | let config = Config::default(); | 101 | let config = Config::default(); |
| 94 | let tx_buf = &mut [0u8; 16]; | 102 | let tx_buf = &mut [0u8; 16]; |
| 95 | let rx_buf = &mut [0u8; 16]; | 103 | let rx_buf = &mut [0u8; 16]; |
| 96 | let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); | 104 | let mut uart = BufferedUart::new( |
| 105 | uart.reborrow(), | ||
| 106 | Irqs, | ||
| 107 | tx.reborrow(), | ||
| 108 | rx.reborrow(), | ||
| 109 | tx_buf, | ||
| 110 | rx_buf, | ||
| 111 | config, | ||
| 112 | ); | ||
| 97 | 113 | ||
| 98 | // Make sure we send more bytes than fits in the FIFO, to test the actual | 114 | // Make sure we send more bytes than fits in the FIFO, to test the actual |
| 99 | // bufferedUart. | 115 | // bufferedUart. |
| @@ -128,7 +144,15 @@ async fn main(_spawner: Spawner) { | |||
| 128 | config.baudrate = 1000; | 144 | config.baudrate = 1000; |
| 129 | let tx_buf = &mut [0u8; 16]; | 145 | let tx_buf = &mut [0u8; 16]; |
| 130 | let rx_buf = &mut [0u8; 16]; | 146 | let rx_buf = &mut [0u8; 16]; |
| 131 | let mut uart = BufferedUart::new(&mut uart, Irqs, &mut tx, &mut rx, tx_buf, rx_buf, config); | 147 | let mut uart = BufferedUart::new( |
| 148 | uart.reborrow(), | ||
| 149 | Irqs, | ||
| 150 | tx.reborrow(), | ||
| 151 | rx.reborrow(), | ||
| 152 | tx_buf, | ||
| 153 | rx_buf, | ||
| 154 | config, | ||
| 155 | ); | ||
| 132 | 156 | ||
| 133 | // break on empty buffer | 157 | // break on empty buffer |
| 134 | uart.send_break(20).await; | 158 | uart.send_break(20).await; |
| @@ -156,13 +180,13 @@ async fn main(_spawner: Spawner) { | |||
| 156 | // parity detection. here we bitbang to not require two uarts. | 180 | // parity detection. here we bitbang to not require two uarts. |
| 157 | info!("test parity error detection"); | 181 | info!("test parity error detection"); |
| 158 | { | 182 | { |
| 159 | let mut pin = Output::new(&mut tx, Level::High); | 183 | let mut pin = Output::new(tx.reborrow(), Level::High); |
| 160 | // choose a very slow baud rate to make tests reliable even with O0 | 184 | // choose a very slow baud rate to make tests reliable even with O0 |
| 161 | let mut config = Config::default(); | 185 | let mut config = Config::default(); |
| 162 | config.baudrate = 1000; | 186 | config.baudrate = 1000; |
| 163 | config.parity = Parity::ParityEven; | 187 | config.parity = Parity::ParityEven; |
| 164 | let rx_buf = &mut [0u8; 16]; | 188 | let rx_buf = &mut [0u8; 16]; |
| 165 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); | 189 | let mut uart = BufferedUartRx::new(uart.reborrow(), Irqs, rx.reborrow(), rx_buf, config); |
| 166 | 190 | ||
| 167 | async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { | 191 | async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) { |
| 168 | send(pin, v, Some(parity != 0)).await; | 192 | send(pin, v, Some(parity != 0)).await; |
| @@ -204,12 +228,12 @@ async fn main(_spawner: Spawner) { | |||
| 204 | // framing error detection. here we bitbang because there's no other way. | 228 | // framing error detection. here we bitbang because there's no other way. |
| 205 | info!("test framing error detection"); | 229 | info!("test framing error detection"); |
| 206 | { | 230 | { |
| 207 | let mut pin = Output::new(&mut tx, Level::High); | 231 | let mut pin = Output::new(tx.reborrow(), Level::High); |
| 208 | // choose a very slow baud rate to make tests reliable even with O0 | 232 | // choose a very slow baud rate to make tests reliable even with O0 |
| 209 | let mut config = Config::default(); | 233 | let mut config = Config::default(); |
| 210 | config.baudrate = 1000; | 234 | config.baudrate = 1000; |
| 211 | let rx_buf = &mut [0u8; 16]; | 235 | let rx_buf = &mut [0u8; 16]; |
| 212 | let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config); | 236 | let mut uart = BufferedUartRx::new(uart.reborrow(), Irqs, rx.reborrow(), rx_buf, config); |
| 213 | 237 | ||
| 214 | async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { | 238 | async fn chr(pin: &mut Output<'_>, v: u8, good: bool) { |
| 215 | if good { | 239 | if good { |
