mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 00:02:28 +00:00
tests/stm32: add uart async and blocking flush test.
This commit is contained in:
parent
ad5f7bf6f7
commit
014583aaa5
@ -33,6 +33,13 @@ async fn main(_spawner: Spawner) {
|
||||
let mut buf = [0; 2];
|
||||
usart.blocking_read(&mut buf).unwrap();
|
||||
assert_eq!(buf, data);
|
||||
|
||||
// Test flush doesn't hang.
|
||||
usart.blocking_write(&data).unwrap();
|
||||
usart.blocking_flush().unwrap();
|
||||
|
||||
// Test flush doesn't hang if there's nothing to flush
|
||||
usart.blocking_flush().unwrap();
|
||||
}
|
||||
|
||||
// Test error handling with with an overflow error
|
||||
|
@ -51,6 +51,23 @@ async fn main(_spawner: Spawner) {
|
||||
assert_eq!(tx_buf, rx_buf);
|
||||
}
|
||||
|
||||
// Test flush doesn't hang. Check multiple combinations of async+blocking.
|
||||
tx.write(&tx_buf).await.unwrap();
|
||||
tx.flush().await.unwrap();
|
||||
tx.flush().await.unwrap();
|
||||
|
||||
tx.write(&tx_buf).await.unwrap();
|
||||
tx.blocking_flush().unwrap();
|
||||
tx.flush().await.unwrap();
|
||||
|
||||
tx.blocking_write(&tx_buf).unwrap();
|
||||
tx.blocking_flush().unwrap();
|
||||
tx.flush().await.unwrap();
|
||||
|
||||
tx.blocking_write(&tx_buf).unwrap();
|
||||
tx.flush().await.unwrap();
|
||||
tx.blocking_flush().unwrap();
|
||||
|
||||
info!("Test OK");
|
||||
cortex_m::asm::bkpt();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user