rp: add OutputOpenDrain input test.
This commit is contained in:
parent
7cbc3aefe6
commit
54c153673d
@ -78,6 +78,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
a.set_as_input();
|
a.set_as_input();
|
||||||
|
|
||||||
// When an OutputOpenDrain is high, it doesn't drive the pin.
|
// When an OutputOpenDrain is high, it doesn't drive the pin.
|
||||||
|
b.set_high();
|
||||||
a.set_pull(Pull::Up);
|
a.set_pull(Pull::Up);
|
||||||
delay();
|
delay();
|
||||||
assert!(a.is_high());
|
assert!(a.is_high());
|
||||||
@ -85,9 +86,8 @@ async fn main(_spawner: Spawner) {
|
|||||||
delay();
|
delay();
|
||||||
assert!(a.is_low());
|
assert!(a.is_low());
|
||||||
|
|
||||||
b.set_low();
|
|
||||||
|
|
||||||
// When an OutputOpenDrain is low, it drives the pin low.
|
// When an OutputOpenDrain is low, it drives the pin low.
|
||||||
|
b.set_low();
|
||||||
a.set_pull(Pull::Up);
|
a.set_pull(Pull::Up);
|
||||||
delay();
|
delay();
|
||||||
assert!(a.is_low());
|
assert!(a.is_low());
|
||||||
@ -95,14 +95,36 @@ async fn main(_spawner: Spawner) {
|
|||||||
delay();
|
delay();
|
||||||
assert!(a.is_low());
|
assert!(a.is_low());
|
||||||
|
|
||||||
|
// Check high again
|
||||||
b.set_high();
|
b.set_high();
|
||||||
|
|
||||||
a.set_pull(Pull::Up);
|
a.set_pull(Pull::Up);
|
||||||
delay();
|
delay();
|
||||||
assert!(a.is_high());
|
assert!(a.is_high());
|
||||||
a.set_pull(Pull::Down);
|
a.set_pull(Pull::Down);
|
||||||
delay();
|
delay();
|
||||||
assert!(a.is_low());
|
assert!(a.is_low());
|
||||||
|
|
||||||
|
// When an OutputOpenDrain is high, it reads the input value in the pin.
|
||||||
|
b.set_high();
|
||||||
|
a.set_as_input();
|
||||||
|
a.set_pull(Pull::Up);
|
||||||
|
delay();
|
||||||
|
assert!(b.is_high());
|
||||||
|
a.set_as_output();
|
||||||
|
a.set_low();
|
||||||
|
delay();
|
||||||
|
assert!(b.is_low());
|
||||||
|
|
||||||
|
// When an OutputOpenDrain is low, it always reads low.
|
||||||
|
b.set_low();
|
||||||
|
a.set_as_input();
|
||||||
|
a.set_pull(Pull::Up);
|
||||||
|
delay();
|
||||||
|
assert!(b.is_low());
|
||||||
|
a.set_as_output();
|
||||||
|
a.set_low();
|
||||||
|
delay();
|
||||||
|
assert!(b.is_low());
|
||||||
}
|
}
|
||||||
|
|
||||||
// FLEX
|
// FLEX
|
||||||
|
Loading…
x
Reference in New Issue
Block a user