diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-01-09 23:58:26 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-01-10 00:00:10 +0100 |
| commit | 495b8b739aaba3d1fe7e105559c830496fabb1d7 (patch) | |
| tree | 6cc6597e9dfa6ac75736ebd4be4a63ca4b546771 /tests/rp/src | |
| parent | 67ed134479886023ec133a3a95074972e6d83236 (diff) | |
Change GPIO inherent methods back to `&self`.
With the embedded-hal rc3 update I changed them to require `&mut self`, but
in retrospect I think `&self` is better, for extra flexibility.
This PR reverts the changes from the rc3 update to inherent methods.
Diffstat (limited to 'tests/rp/src')
| -rw-r--r-- | tests/rp/src/bin/gpio.rs | 10 | ||||
| -rw-r--r-- | tests/rp/src/bin/pwm.rs | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index a57d5d9e8..e0c309887 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs | |||
| @@ -16,10 +16,10 @@ async fn main(_spawner: Spawner) { | |||
| 16 | 16 | ||
| 17 | // Test initial output | 17 | // Test initial output |
| 18 | { | 18 | { |
| 19 | let mut b = Input::new(&mut b, Pull::None); | 19 | let b = Input::new(&mut b, Pull::None); |
| 20 | 20 | ||
| 21 | { | 21 | { |
| 22 | let mut a = Output::new(&mut a, Level::Low); | 22 | let a = Output::new(&mut a, Level::Low); |
| 23 | delay(); | 23 | delay(); |
| 24 | assert!(b.is_low()); | 24 | assert!(b.is_low()); |
| 25 | assert!(!b.is_high()); | 25 | assert!(!b.is_high()); |
| @@ -64,7 +64,7 @@ async fn main(_spawner: Spawner) { | |||
| 64 | 64 | ||
| 65 | // Test input no pull | 65 | // Test input no pull |
| 66 | { | 66 | { |
| 67 | let mut b = Input::new(&mut b, Pull::None); | 67 | let b = Input::new(&mut b, Pull::None); |
| 68 | // no pull, the status is undefined | 68 | // no pull, the status is undefined |
| 69 | 69 | ||
| 70 | let mut a = Output::new(&mut a, Level::Low); | 70 | let mut a = Output::new(&mut a, Level::Low); |
| @@ -77,7 +77,7 @@ async fn main(_spawner: Spawner) { | |||
| 77 | 77 | ||
| 78 | // Test input pulldown | 78 | // Test input pulldown |
| 79 | { | 79 | { |
| 80 | let mut b = Input::new(&mut b, Pull::Down); | 80 | let b = Input::new(&mut b, Pull::Down); |
| 81 | delay(); | 81 | delay(); |
| 82 | assert!(b.is_low()); | 82 | assert!(b.is_low()); |
| 83 | 83 | ||
| @@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) { | |||
| 91 | 91 | ||
| 92 | // Test input pullup | 92 | // Test input pullup |
| 93 | { | 93 | { |
| 94 | let mut b = Input::new(&mut b, Pull::Up); | 94 | let b = Input::new(&mut b, Pull::Up); |
| 95 | delay(); | 95 | delay(); |
| 96 | assert!(b.is_high()); | 96 | assert!(b.is_high()); |
| 97 | 97 | ||
diff --git a/tests/rp/src/bin/pwm.rs b/tests/rp/src/bin/pwm.rs index 3fc0bb2a0..e71d9e610 100644 --- a/tests/rp/src/bin/pwm.rs +++ b/tests/rp/src/bin/pwm.rs | |||
| @@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) { | |||
| 45 | 45 | ||
| 46 | // Test output from A | 46 | // Test output from A |
| 47 | { | 47 | { |
| 48 | let mut pin1 = Input::new(&mut p9, Pull::None); | 48 | let pin1 = Input::new(&mut p9, Pull::None); |
| 49 | let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone()); | 49 | let _pwm = Pwm::new_output_a(&mut p.PWM_CH3, &mut p6, cfg.clone()); |
| 50 | Timer::after_millis(1).await; | 50 | Timer::after_millis(1).await; |
| 51 | assert_eq!(pin1.is_low(), invert_a); | 51 | assert_eq!(pin1.is_low(), invert_a); |
| @@ -59,7 +59,7 @@ async fn main(_spawner: Spawner) { | |||
| 59 | 59 | ||
| 60 | // Test output from B | 60 | // Test output from B |
| 61 | { | 61 | { |
| 62 | let mut pin2 = Input::new(&mut p11, Pull::None); | 62 | let pin2 = Input::new(&mut p11, Pull::None); |
| 63 | let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone()); | 63 | let _pwm = Pwm::new_output_b(&mut p.PWM_CH3, &mut p7, cfg.clone()); |
| 64 | Timer::after_millis(1).await; | 64 | Timer::after_millis(1).await; |
| 65 | assert_ne!(pin2.is_low(), invert_a); | 65 | assert_ne!(pin2.is_low(), invert_a); |
| @@ -73,8 +73,8 @@ async fn main(_spawner: Spawner) { | |||
| 73 | 73 | ||
| 74 | // Test output from A+B | 74 | // Test output from A+B |
| 75 | { | 75 | { |
| 76 | let mut pin1 = Input::new(&mut p9, Pull::None); | 76 | let pin1 = Input::new(&mut p9, Pull::None); |
| 77 | let mut pin2 = Input::new(&mut p11, Pull::None); | 77 | let pin2 = Input::new(&mut p11, Pull::None); |
| 78 | let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone()); | 78 | let _pwm = Pwm::new_output_ab(&mut p.PWM_CH3, &mut p6, &mut p7, cfg.clone()); |
| 79 | Timer::after_millis(1).await; | 79 | Timer::after_millis(1).await; |
| 80 | assert_eq!(pin1.is_low(), invert_a); | 80 | assert_eq!(pin1.is_low(), invert_a); |
