aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-12-06 21:09:27 +0100
committerDario Nieuwenhuis <[email protected]>2022-12-06 21:09:27 +0100
commit54c153673d9e79ea36f687fbdfa3e6f56ff62fc8 (patch)
tree354a1a98e66bef55cb7f7c3d79df34327cadeed2 /tests
parent7cbc3aefe6540599e1361a8c3dc51e93e6f83dcd (diff)
rp: add OutputOpenDrain input test.
Diffstat (limited to 'tests')
-rw-r--r--tests/rp/src/bin/gpio.rs28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs
index af22fe27d..80e92d0fd 100644
--- a/tests/rp/src/bin/gpio.rs
+++ b/tests/rp/src/bin/gpio.rs
@@ -78,6 +78,7 @@ async fn main(_spawner: Spawner) {
78 a.set_as_input(); 78 a.set_as_input();
79 79
80 // When an OutputOpenDrain is high, it doesn't drive the pin. 80 // When an OutputOpenDrain is high, it doesn't drive the pin.
81 b.set_high();
81 a.set_pull(Pull::Up); 82 a.set_pull(Pull::Up);
82 delay(); 83 delay();
83 assert!(a.is_high()); 84 assert!(a.is_high());
@@ -85,9 +86,8 @@ async fn main(_spawner: Spawner) {
85 delay(); 86 delay();
86 assert!(a.is_low()); 87 assert!(a.is_low());
87 88
88 b.set_low();
89
90 // When an OutputOpenDrain is low, it drives the pin low. 89 // When an OutputOpenDrain is low, it drives the pin low.
90 b.set_low();
91 a.set_pull(Pull::Up); 91 a.set_pull(Pull::Up);
92 delay(); 92 delay();
93 assert!(a.is_low()); 93 assert!(a.is_low());
@@ -95,14 +95,36 @@ async fn main(_spawner: Spawner) {
95 delay(); 95 delay();
96 assert!(a.is_low()); 96 assert!(a.is_low());
97 97
98 // Check high again
98 b.set_high(); 99 b.set_high();
99
100 a.set_pull(Pull::Up); 100 a.set_pull(Pull::Up);
101 delay(); 101 delay();
102 assert!(a.is_high()); 102 assert!(a.is_high());
103 a.set_pull(Pull::Down); 103 a.set_pull(Pull::Down);
104 delay(); 104 delay();
105 assert!(a.is_low()); 105 assert!(a.is_low());
106
107 // When an OutputOpenDrain is high, it reads the input value in the pin.
108 b.set_high();
109 a.set_as_input();
110 a.set_pull(Pull::Up);
111 delay();
112 assert!(b.is_high());
113 a.set_as_output();
114 a.set_low();
115 delay();
116 assert!(b.is_low());
117
118 // When an OutputOpenDrain is low, it always reads low.
119 b.set_low();
120 a.set_as_input();
121 a.set_pull(Pull::Up);
122 delay();
123 assert!(b.is_low());
124 a.set_as_output();
125 a.set_low();
126 delay();
127 assert!(b.is_low());
106 } 128 }
107 129
108 // FLEX 130 // FLEX