1414: rp: report errors from buffered and dma uart receives r=Dirbaio a=pennae

neither of these reported errors so far, which is not ideal. add error reporting to both of them that matches the blocking error reporting as closely as is feasible, even allowing partial receives from buffered uarts before errors are reported where they would have been by the blocking code. dma transfers don't do this, if an errors applies to any byte in a transfer the entire transfer is nuked (though we probably could report how many bytes have been transferred).

Co-authored-by: pennae <github@quasiparticle.net>
This commit is contained in:
bors[bot]
2023-05-01 15:35:39 +00:00
committed by GitHub
6 changed files with 1006 additions and 152 deletions

View File

@ -7,6 +7,7 @@
use defmt::*;
use embassy_executor::Spawner;
use embassy_rp::interrupt;
use embassy_rp::peripherals::UART1;
use embassy_rp::uart::{Async, Config, UartRx, UartTx};
use embassy_time::{Duration, Timer};
@ -17,7 +18,13 @@ async fn main(spawner: Spawner) {
let p = embassy_rp::init(Default::default());
let mut uart_tx = UartTx::new(p.UART0, p.PIN_0, p.DMA_CH0, Config::default());
let uart_rx = UartRx::new(p.UART1, p.PIN_5, p.DMA_CH1, Config::default());
let uart_rx = UartRx::new(
p.UART1,
p.PIN_5,
interrupt::take!(UART1_IRQ),
p.DMA_CH1,
Config::default(),
);
unwrap!(spawner.spawn(reader(uart_rx)));