mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
stm32/test: workaround #1426
This commit is contained in:
parent
2bb6e93e86
commit
1078f6f4e7
@ -94,6 +94,9 @@ async fn main(_spawner: Spawner) {
|
||||
let rx_fut = async {
|
||||
rx.read(&mut rx_buf).await.unwrap();
|
||||
};
|
||||
|
||||
// note: rx needs to be polled first, to workaround this bug:
|
||||
// https://github.com/embassy-rs/embassy/issues/1426
|
||||
join(rx_fut, tx_fut).await;
|
||||
|
||||
assert_eq!(tx_buf, rx_buf);
|
||||
|
@ -145,13 +145,16 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn transmit_task(mut tx: UartTx<'static, board::Uart, board::TxDma>) {
|
||||
// workaround https://github.com/embassy-rs/embassy/issues/1426
|
||||
Timer::after(Duration::from_millis(100) as _).await;
|
||||
|
||||
let mut rng = ChaCha8Rng::seed_from_u64(1337);
|
||||
|
||||
info!("Starting random transmissions into void...");
|
||||
|
||||
let mut i: u8 = 0;
|
||||
loop {
|
||||
let mut buf = [0; 32];
|
||||
let mut buf = [0; 256];
|
||||
let len = 1 + (rng.next_u32() as usize % buf.len());
|
||||
for b in &mut buf[..len] {
|
||||
*b = i;
|
||||
@ -172,7 +175,7 @@ async fn receive_task(mut rx: RingBufferedUartRx<'static, board::Uart, board::Rx
|
||||
let mut i = 0;
|
||||
let mut expected = 0;
|
||||
loop {
|
||||
let mut buf = [0; 100];
|
||||
let mut buf = [0; 256];
|
||||
let max_len = 1 + (rng.next_u32() as usize % buf.len());
|
||||
let received = match rx.read(&mut buf[..max_len]).await {
|
||||
Ok(r) => r,
|
||||
|
Loading…
Reference in New Issue
Block a user