summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDario Nieuwenhuis <dirbaio@dirbaio.net>2022-03-15 00:48:11 +0100
committerDario Nieuwenhuis <dirbaio@dirbaio.net>2022-03-15 02:14:24 +0100
commit3d6592d22d37402509bd43d88a0a979683f74b04 (patch)
tree530e95bc084f7c6e8e2be20bd4e523d75055f201 /tests
parent06f35c25176795c8e856ea7b41a52dba4b160f66 (diff)
downloadembassy-3d6592d22d37402509bd43d88a0a979683f74b04.zip
stm32/spi: check zero-length trasnfers.
Diffstat (limited to 'tests')
-rw-r--r--tests/stm32/src/bin/spi.rs6
-rw-r--r--tests/stm32/src/bin/spi_dma.rs6
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs
index 6151058b..b079472d 100644
--- a/tests/stm32/src/bin/spi.rs
+++ b/tests/stm32/src/bin/spi.rs
@@ -55,6 +55,12 @@ async fn main(_spawner: Spawner, p: Peripherals) {
spi.blocking_transfer(&mut buf, &data).unwrap();
assert_eq!(buf, data);
+ // Check zero-length operations, these should be noops.
+ spi.blocking_transfer::<u8>(&mut [], &[]).unwrap();
+ spi.blocking_transfer_in_place::<u8>(&mut []).unwrap();
+ spi.blocking_read::<u8>(&mut []).unwrap();
+ spi.blocking_write::<u8>(&[]).unwrap();
+
info!("Test OK");
cortex_m::asm::bkpt();
}
diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs
index 67785778..3e9521ae 100644
--- a/tests/stm32/src/bin/spi_dma.rs
+++ b/tests/stm32/src/bin/spi_dma.rs
@@ -62,6 +62,12 @@ async fn main(_spawner: Spawner, p: Peripherals) {
spi.transfer(&mut buf, &data).await.unwrap();
assert_eq!(buf, data);
+ // Check zero-length operations, these should be noops.
+ spi.transfer::<u8>(&mut [], &[]).await.unwrap();
+ spi.transfer_in_place::<u8>(&mut []).await.unwrap();
+ spi.read::<u8>(&mut []).await.unwrap();
+ spi.write::<u8>(&[]).await.unwrap();
+
info!("Test OK");
cortex_m::asm::bkpt();
}