Have added doc + minor correction
@@ -104,20 +104,24 @@ async fn main(_spawner: Spawner, p: Peripherals) {
// FLEX
// Test initial output
{
+ //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());
}
{
+ //Flex pin configured as output
let mut a = Flex::new(&mut a);
- a.set_as_output(Speed::Low);
a.set_high();
+ a.set_as_output(Speed::Low);
+
delay();
assert!(b.is_high());
}
@@ -131,6 +135,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let mut a = Flex::new(&mut a);
a.set_low();
a.set_as_output(Speed::Low);
+
delay();
assert!(b.is_low());
a.set_high();
