stm32/spi: check zero-length trasnfers.
This commit is contained in:
parent
06f35c2517
commit
3d6592d22d
2 changed files with 12 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue