From abba86d1bac38ab0e776fe376c78017299c8f699 Mon Sep 17 00:00:00 2001 From: "amugniere@gmail.com" Date: Fri, 8 Jul 2022 22:24:29 +0200 Subject: [PATCH] Have added doc + minor correction --- tests/stm32/src/bin/gpio.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index 2cdf52c0..952d4cd6 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) { // FLEX // Test initial output { - let mut b = Flex::new(&mut b); + //Flex pin configured as input + let mut b = Flex::new(&mut b); b.set_as_input(Pull::None); { - let mut a = Flex::new(&mut a); - a.set_low(); + //Flex pin configured as output + let mut a = Flex::new(&mut a); //Flex pin configured as output + a.set_low(); // Pin state must be set before configuring the pin, thus we avoid unknown state a.set_as_output(Speed::Low); delay(); assert!(b.is_low()); } { - let mut a = Flex::new(&mut a); - a.set_as_output(Speed::Low); + //Flex pin configured as output + let mut a = Flex::new(&mut a); a.set_high(); + a.set_as_output(Speed::Low); + delay(); assert!(b.is_high()); } @@ -125,12 +129,13 @@ async fn main(_spawner: Spawner, p: Peripherals) { // Test input no pull { - let mut b = Flex::new(&mut b); + let mut b = Flex::new(&mut b); b.set_as_input(Pull::None); // no pull, the status is undefined let mut a = Flex::new(&mut a); a.set_low(); - a.set_as_output(Speed::Low); + a.set_as_output(Speed::Low); + delay(); assert!(b.is_low()); a.set_high();