diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/src/bin/gpio.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index 614b6317a..8bd0df8d8 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs | |||
| @@ -67,6 +67,40 @@ async fn main(_spawner: Spawner) { | |||
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | // Test input inversion | ||
| 71 | { | ||
| 72 | let mut b = Input::new(b.reborrow(), Pull::None); | ||
| 73 | b.set_inversion(true); | ||
| 74 | // no pull, the status is undefined | ||
| 75 | |||
| 76 | let mut a = Output::new(a.reborrow(), Level::Low); | ||
| 77 | delay(); | ||
| 78 | assert!(b.is_high()); | ||
| 79 | a.set_high(); | ||
| 80 | delay(); | ||
| 81 | assert!(b.is_low()); | ||
| 82 | |||
| 83 | b.set_inversion(false); | ||
| 84 | a.set_inversion(true); | ||
| 85 | |||
| 86 | a.set_low(); | ||
| 87 | delay(); | ||
| 88 | assert!(b.is_high()); | ||
| 89 | |||
| 90 | a.set_high(); | ||
| 91 | delay(); | ||
| 92 | assert!(b.is_low()); | ||
| 93 | |||
| 94 | b.set_inversion(true); | ||
| 95 | a.set_high(); | ||
| 96 | delay(); | ||
| 97 | assert!(b.is_high()); | ||
| 98 | |||
| 99 | a.set_high(); | ||
| 100 | delay(); | ||
| 101 | assert!(b.is_high()); | ||
| 102 | } | ||
| 103 | |||
| 70 | // Test input no pull | 104 | // Test input no pull |
| 71 | { | 105 | { |
| 72 | let b = Input::new(b.reborrow(), Pull::None); | 106 | let b = Input::new(b.reborrow(), Pull::None); |
