tests/stm32: do multiple transfers to catch more bugs.

This commit is contained in:
Dario Nieuwenhuis 2023-06-19 22:38:27 +02:00
parent 3c70f799a2
commit 990dd5e5db

View File

@ -69,12 +69,14 @@ async fn main(_spawner: Spawner) {
const LEN: usize = 128; const LEN: usize = 128;
let mut tx_buf = [0; LEN]; let mut tx_buf = [0; LEN];
let mut rx_buf = [0; LEN]; let mut rx_buf = [0; LEN];
for i in 0..LEN {
tx_buf[i] = i as u8;
}
let (mut tx, mut rx) = usart.split(); let (mut tx, mut rx) = usart.split();
for n in 0..42 {
for i in 0..LEN {
tx_buf[i] = (i ^ n) as u8;
}
let tx_fut = async { let tx_fut = async {
tx.write(&tx_buf).await.unwrap(); tx.write(&tx_buf).await.unwrap();
}; };
@ -87,6 +89,7 @@ async fn main(_spawner: Spawner) {
join(rx_fut, tx_fut).await; join(rx_fut, tx_fut).await;
assert_eq!(tx_buf, rx_buf); assert_eq!(tx_buf, rx_buf);
}
info!("Test OK"); info!("Test OK");
cortex_m::asm::bkpt(); cortex_m::asm::bkpt();