diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-03-15 04:13:33 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-03-15 04:13:33 +0100 |
commit | 1dc618f0e4e045de63007893fb36fcaba82acfa4 (patch) | |
tree | 50fb3b7175ceb0063dc440ec7221ff8399532981 /tests | |
parent | 49ef19c0b284eeb6d97cec597bbb1f82d18397c5 (diff) | |
download | embassy-1dc618f0e4e045de63007893fb36fcaba82acfa4.zip |
stm32/spi: fix blocking transfer hanging after async.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stm32/src/bin/spi_dma.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs index 3e9521ae..f4f1994c 100644 --- a/tests/stm32/src/bin/spi_dma.rs +++ b/tests/stm32/src/bin/spi_dma.rs @@ -68,6 +68,22 @@ async fn main(_spawner: Spawner, p: Peripherals) { spi.read::<u8>(&mut []).await.unwrap(); spi.write::<u8>(&[]).await.unwrap(); + // === Check mixing blocking with async. + spi.blocking_transfer(&mut buf, &data).unwrap(); + assert_eq!(buf, data); + spi.transfer(&mut buf, &data).await.unwrap(); + assert_eq!(buf, data); + spi.blocking_write(&buf).unwrap(); + spi.transfer(&mut buf, &data).await.unwrap(); + assert_eq!(buf, data); + spi.blocking_read(&mut buf).unwrap(); + spi.blocking_write(&buf).unwrap(); + spi.write(&buf).await.unwrap(); + spi.read(&mut buf).await.unwrap(); + spi.blocking_write(&buf).unwrap(); + spi.blocking_read(&mut buf).unwrap(); + spi.write(&buf).await.unwrap(); + info!("Test OK"); cortex_m::asm::bkpt(); } |