diff options
| author | [email protected] <[email protected]> | 2022-07-08 22:24:29 +0200 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2022-07-08 22:24:29 +0200 |
| commit | abba86d1bac38ab0e776fe376c78017299c8f699 (patch) | |
| tree | c45b8a950e4a4d8de6f7177ecf8b1bb04a59df82 /tests | |
| parent | dda528808a87af23feafb709dbcd665da91d5547 (diff) | |
Have added doc + minor correction
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/bin/gpio.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index 2cdf52c00..952d4cd62 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs | |||
| @@ -104,20 +104,24 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 104 | // FLEX | 104 | // FLEX |
| 105 | // Test initial output | 105 | // Test initial output |
| 106 | { | 106 | { |
| 107 | let mut b = Flex::new(&mut b); | 107 | //Flex pin configured as input |
| 108 | let mut b = Flex::new(&mut b); | ||
| 108 | b.set_as_input(Pull::None); | 109 | b.set_as_input(Pull::None); |
| 109 | 110 | ||
| 110 | { | 111 | { |
| 111 | let mut a = Flex::new(&mut a); | 112 | //Flex pin configured as output |
| 112 | a.set_low(); | 113 | let mut a = Flex::new(&mut a); //Flex pin configured as output |
| 114 | a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state | ||
| 113 | a.set_as_output(Speed::Low); | 115 | a.set_as_output(Speed::Low); |
| 114 | delay(); | 116 | delay(); |
| 115 | assert!(b.is_low()); | 117 | assert!(b.is_low()); |
| 116 | } | 118 | } |
| 117 | { | 119 | { |
| 118 | let mut a = Flex::new(&mut a); | 120 | //Flex pin configured as output |
| 119 | a.set_as_output(Speed::Low); | 121 | let mut a = Flex::new(&mut a); |
| 120 | a.set_high(); | 122 | a.set_high(); |
| 123 | a.set_as_output(Speed::Low); | ||
| 124 | |||
| 121 | delay(); | 125 | delay(); |
| 122 | assert!(b.is_high()); | 126 | assert!(b.is_high()); |
| 123 | } | 127 | } |
| @@ -125,12 +129,13 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 125 | 129 | ||
| 126 | // Test input no pull | 130 | // Test input no pull |
| 127 | { | 131 | { |
| 128 | let mut b = Flex::new(&mut b); | 132 | let mut b = Flex::new(&mut b); |
| 129 | b.set_as_input(Pull::None); // no pull, the status is undefined | 133 | b.set_as_input(Pull::None); // no pull, the status is undefined |
| 130 | 134 | ||
| 131 | let mut a = Flex::new(&mut a); | 135 | let mut a = Flex::new(&mut a); |
| 132 | a.set_low(); | 136 | a.set_low(); |
| 133 | a.set_as_output(Speed::Low); | 137 | a.set_as_output(Speed::Low); |
| 138 | |||
| 134 | delay(); | 139 | delay(); |
| 135 | assert!(b.is_low()); | 140 | assert!(b.is_low()); |
| 136 | a.set_high(); | 141 | a.set_high(); |
