diff options
| author | [email protected] <[email protected]> | 2022-07-08 22:10:52 +0200 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2022-07-08 22:10:52 +0200 |
| commit | 00df9b507c66526dee1e395fc82a0f71b17c557e (patch) | |
| tree | a60f8ae6eeb1d3fc4bfbb57597e68a51980889b9 /tests | |
| parent | 1d91405d4d5ceee64fa0331e63f6ed565906a77a (diff) | |
Flex/ input pull up test done
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/bin/gpio.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index f9b9e8f7f..edcb1ecae 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs | |||
| @@ -142,10 +142,10 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 142 | // Test input pulldown | 142 | // Test input pulldown |
| 143 | { | 143 | { |
| 144 | let mut b = Flex::new(&mut b); | 144 | let mut b = Flex::new(&mut b); |
| 145 | b.set_as_input(Pull::Down); // no pull, the status is undefined | 145 | b.set_as_input(Pull::Down); |
| 146 | delay(); | 146 | delay(); |
| 147 | assert!(b.is_low()); | 147 | assert!(b.is_low()); |
| 148 | 148 | ||
| 149 | let mut a = Flex::new(&mut a); | 149 | let mut a = Flex::new(&mut a); |
| 150 | a.set_low(); | 150 | a.set_low(); |
| 151 | a.set_as_output(Speed::Low); | 151 | a.set_as_output(Speed::Low); |
| @@ -155,21 +155,24 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 155 | delay(); | 155 | delay(); |
| 156 | assert!(b.is_high()); | 156 | assert!(b.is_high()); |
| 157 | } | 157 | } |
| 158 | /* | 158 | |
| 159 | // Test input pullup | 159 | // Test input pullup |
| 160 | { | 160 | { |
| 161 | let b = Input::new(&mut b, Pull::Down); | 161 | let mut b = Flex::new(&mut b); |
| 162 | b.set_as_input(Pull::Up); | ||
| 162 | delay(); | 163 | delay(); |
| 163 | assert!(b.is_low()); | 164 | assert!(b.is_high()); |
| 164 | 165 | ||
| 165 | let mut a = Output::new(&mut a, Level::Low, Speed::Low); | 166 | let mut a = Flex::new(&mut a); |
| 166 | delay(); | ||
| 167 | assert!(b.is_low()); | ||
| 168 | a.set_high(); | 167 | a.set_high(); |
| 168 | a.set_as_output(Speed::Low); | ||
| 169 | delay(); | 169 | delay(); |
| 170 | assert!(b.is_high()); | 170 | assert!(b.is_high()); |
| 171 | a.set_low(); | ||
| 172 | delay(); | ||
| 173 | assert!(b.is_low()); | ||
| 171 | } | 174 | } |
| 172 | 175 | /* | |
| 173 | // Test output open drain | 176 | // Test output open drain |
| 174 | { | 177 | { |
| 175 | let b = Input::new(&mut b, Pull::Down); | 178 | let b = Input::new(&mut b, Pull::Down); |
