aboutsummaryrefslogtreecommitdiff
path: root/tests/stm32
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-07-11 12:38:53 +0200
committerDario Nieuwenhuis <[email protected]>2023-07-11 12:40:07 +0200
commit91c1d17f166541c5dafc765e952486f21841e120 (patch)
tree3adb656e8c461023f16f58d0d11cc652d53cb96f /tests/stm32
parent8a811cfcf75b25fe81168134bf0cf8a8d387c391 (diff)
rp/gpio: fix is_set_high/is_set_low, expand tests.
Diffstat (limited to 'tests/stm32')
-rw-r--r--tests/stm32/src/bin/gpio.rs36
1 files changed, 34 insertions, 2 deletions
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs
index 67f44317e..aad174431 100644
--- a/tests/stm32/src/bin/gpio.rs
+++ b/tests/stm32/src/bin/gpio.rs
@@ -40,14 +40,46 @@ async fn main(_spawner: Spawner) {
40 let b = Input::new(&mut b, Pull::None); 40 let b = Input::new(&mut b, Pull::None);
41 41
42 { 42 {
43 let _a = Output::new(&mut a, Level::Low, Speed::Low); 43 let a = Output::new(&mut a, Level::Low, Speed::Low);
44 delay(); 44 delay();
45 assert!(b.is_low()); 45 assert!(b.is_low());
46 assert!(!b.is_high());
47 assert!(a.is_set_low());
48 assert!(!a.is_set_high());
46 } 49 }
47 { 50 {
48 let _a = Output::new(&mut a, Level::High, Speed::Low); 51 let mut a = Output::new(&mut a, Level::High, Speed::Low);
49 delay(); 52 delay();
53 assert!(!b.is_low());
50 assert!(b.is_high()); 54 assert!(b.is_high());
55 assert!(!a.is_set_low());
56 assert!(a.is_set_high());
57
58 // Test is_set_low / is_set_high
59 a.set_low();
60 delay();
61 assert!(b.is_low());
62 assert!(a.is_set_low());
63 assert!(!a.is_set_high());
64
65 a.set_high();
66 delay();
67 assert!(b.is_high());
68 assert!(!a.is_set_low());
69 assert!(a.is_set_high());
70
71 // Test toggle
72 a.toggle();
73 delay();
74 assert!(b.is_low());
75 assert!(a.is_set_low());
76 assert!(!a.is_set_high());
77
78 a.toggle();
79 delay();
80 assert!(b.is_high());
81 assert!(!a.is_set_low());
82 assert!(a.is_set_high());
51 } 83 }
52 } 84 }
53 85