aboutsummaryrefslogtreecommitdiff
path: root/tests/stm32/src/bin/spi.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-03-15 00:46:18 +0100
committerDario Nieuwenhuis <[email protected]>2022-03-15 02:14:24 +0100
commit06f35c25176795c8e856ea7b41a52dba4b160f66 (patch)
tree1b1ed6e1d85012e4e0b13ef318d18c0accb17857 /tests/stm32/src/bin/spi.rs
parent306110f56e4614cc51f6c3d3e9ff96b5fe2ced6f (diff)
stm32/spi: more exhaustive test.
Diffstat (limited to 'tests/stm32/src/bin/spi.rs')
-rw-r--r--tests/stm32/src/bin/spi.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs
index 47d0017ac..6151058b7 100644
--- a/tests/stm32/src/bin/spi.rs
+++ b/tests/stm32/src/bin/spi.rs
@@ -37,9 +37,24 @@ async fn main(_spawner: Spawner, p: Peripherals) {
37 // Arduino pins D11 and D12 (MOSI-MISO) are connected together with a 1K resistor. 37 // Arduino pins D11 and D12 (MOSI-MISO) are connected together with a 1K resistor.
38 // so we should get the data we sent back. 38 // so we should get the data we sent back.
39 let mut buf = data; 39 let mut buf = data;
40 spi.blocking_transfer(&mut buf, &data).unwrap();
41 assert_eq!(buf, data);
42
40 spi.blocking_transfer_in_place(&mut buf).unwrap(); 43 spi.blocking_transfer_in_place(&mut buf).unwrap();
41 assert_eq!(buf, data); 44 assert_eq!(buf, data);
42 45
46 // Check read/write don't hang. We can't check they transfer the right data
47 // without fancier test mechanisms.
48 spi.blocking_write(&buf).unwrap();
49 spi.blocking_read(&mut buf).unwrap();
50 spi.blocking_write(&buf).unwrap();
51 spi.blocking_read(&mut buf).unwrap();
52 spi.blocking_write(&buf).unwrap();
53
54 // Check transfer doesn't break after having done a write, due to garbage in the FIFO
55 spi.blocking_transfer(&mut buf, &data).unwrap();
56 assert_eq!(buf, data);
57
43 info!("Test OK"); 58 info!("Test OK");
44 cortex_m::asm::bkpt(); 59 cortex_m::asm::bkpt();
45} 60}