aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author[email protected] <[email protected]>2022-07-10 21:08:12 +0200
committer[email protected] <[email protected]>2022-07-10 21:08:12 +0200
commite4a36e1d98ac62482285dfb2b22f2683c3840572 (patch)
treee55b8fefcb5910bc02dd063fd74e00fbb0ccaf49 /tests
parent53388d4576617e621b5e63fd8599311a7f6066c3 (diff)
rustfmt on previously edited files
Diffstat (limited to 'tests')
-rw-r--r--tests/stm32/src/bin/gpio.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs
index a26daab4e..37cfe7cf4 100644
--- a/tests/stm32/src/bin/gpio.rs
+++ b/tests/stm32/src/bin/gpio.rs
@@ -6,7 +6,7 @@
6mod example_common; 6mod example_common;
7use defmt::assert; 7use defmt::assert;
8use embassy::executor::Spawner; 8use embassy::executor::Spawner;
9use embassy_stm32::gpio::{Input, Level, Output, OutputOpenDrain, Flex, Pull, Speed}; 9use embassy_stm32::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull, Speed};
10use embassy_stm32::Peripherals; 10use embassy_stm32::Peripherals;
11use example_common::*; 11use example_common::*;
12 12
@@ -104,21 +104,21 @@ async fn main(_spawner: Spawner, p: Peripherals) {
104 // FLEX 104 // FLEX
105 // Test initial output 105 // Test initial output
106 { 106 {
107 //Flex pin configured as input 107 //Flex pin configured as input
108 let mut b = Flex::new(&mut b); 108 let mut b = Flex::new(&mut b);
109 b.set_as_input(Pull::None); 109 b.set_as_input(Pull::None);
110 110
111 { 111 {
112 //Flex pin configured as output 112 //Flex pin configured as output
113 let mut a = Flex::new(&mut a); //Flex pin configured as output 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 114 a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state
115 a.set_as_output(Speed::Low); 115 a.set_as_output(Speed::Low);
116 delay(); 116 delay();
117 assert!(b.is_low()); 117 assert!(b.is_low());
118 } 118 }
119 { 119 {
120 //Flex pin configured as output 120 //Flex pin configured as output
121 let mut a = Flex::new(&mut a); 121 let mut a = Flex::new(&mut a);
122 a.set_high(); 122 a.set_high();
123 a.set_as_output(Speed::Low); 123 a.set_as_output(Speed::Low);
124 124
@@ -129,12 +129,12 @@ async fn main(_spawner: Spawner, p: Peripherals) {
129 129
130 // Test input no pull 130 // Test input no pull
131 { 131 {
132 let mut b = Flex::new(&mut b); 132 let mut b = Flex::new(&mut b);
133 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
134 134
135 let mut a = Flex::new(&mut a); 135 let mut a = Flex::new(&mut a);
136 a.set_low(); 136 a.set_low();
137 a.set_as_output(Speed::Low); 137 a.set_as_output(Speed::Low);
138 138
139 delay(); 139 delay();
140 assert!(b.is_low()); 140 assert!(b.is_low());
@@ -143,11 +143,10 @@ async fn main(_spawner: Spawner, p: Peripherals) {
143 assert!(b.is_high()); 143 assert!(b.is_high());
144 } 144 }
145 145
146
147 // Test input pulldown 146 // Test input pulldown
148 { 147 {
149 let mut b = Flex::new(&mut b); 148 let mut b = Flex::new(&mut b);
150 b.set_as_input(Pull::Down); 149 b.set_as_input(Pull::Down);
151 delay(); 150 delay();
152 assert!(b.is_low()); 151 assert!(b.is_low());
153 152
@@ -164,7 +163,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
164 // Test input pullup 163 // Test input pullup
165 { 164 {
166 let mut b = Flex::new(&mut b); 165 let mut b = Flex::new(&mut b);
167 b.set_as_input(Pull::Up); 166 b.set_as_input(Pull::Up);
168 delay(); 167 delay();
169 assert!(b.is_high()); 168 assert!(b.is_high());
170 169
@@ -185,7 +184,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
185 184
186 let mut a = Flex::new(&mut a); 185 let mut a = Flex::new(&mut a);
187 a.set_low(); 186 a.set_low();
188 a.set_as_input_output(Speed::Low, Pull::None); 187 a.set_as_input_output(Speed::Low, Pull::None);
189 delay(); 188 delay();
190 assert!(b.is_low()); 189 assert!(b.is_low());
191 a.set_high(); // High-Z output 190 a.set_high(); // High-Z output