diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-01-08 18:55:22 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-01-08 18:55:22 +0100 |
| commit | 07fe3415f5204ecffd75dcede79e827f4e48717c (patch) | |
| tree | 8be5e709f59e78af87498fbd7c2dd472da8dd823 /embassy-nrf/src/gpio.rs | |
| parent | 6ec108232e14cfab817848a8772cf095a6a44642 (diff) | |
nrf/gpio: fix missing setting input as disconnected.
Diffstat (limited to 'embassy-nrf/src/gpio.rs')
| -rw-r--r-- | embassy-nrf/src/gpio.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/embassy-nrf/src/gpio.rs b/embassy-nrf/src/gpio.rs index 130339c15..cacaf1911 100644 --- a/embassy-nrf/src/gpio.rs +++ b/embassy-nrf/src/gpio.rs | |||
| @@ -375,7 +375,9 @@ impl<'d> Flex<'d> { | |||
| 375 | /// Put the pin into disconnected mode. | 375 | /// Put the pin into disconnected mode. |
| 376 | #[inline] | 376 | #[inline] |
| 377 | pub fn set_as_disconnected(&mut self) { | 377 | pub fn set_as_disconnected(&mut self) { |
| 378 | self.pin.conf().write(|_| ()); | 378 | self.pin.conf().write(|w| { |
| 379 | w.set_input(vals::Input::DISCONNECT); | ||
| 380 | }); | ||
| 379 | } | 381 | } |
| 380 | 382 | ||
| 381 | /// Get whether the pin input level is high. | 383 | /// Get whether the pin input level is high. |
| @@ -448,7 +450,7 @@ impl<'d> Flex<'d> { | |||
| 448 | 450 | ||
| 449 | impl<'d> Drop for Flex<'d> { | 451 | impl<'d> Drop for Flex<'d> { |
| 450 | fn drop(&mut self) { | 452 | fn drop(&mut self) { |
| 451 | self.pin.conf().write(|_| ()) | 453 | self.set_as_disconnected(); |
| 452 | } | 454 | } |
| 453 | } | 455 | } |
| 454 | 456 | ||
| @@ -591,7 +593,9 @@ pub(crate) fn deconfigure_pin(psel: Psel) { | |||
| 591 | if psel.connect() == Connect::DISCONNECTED { | 593 | if psel.connect() == Connect::DISCONNECTED { |
| 592 | return; | 594 | return; |
| 593 | } | 595 | } |
| 594 | unsafe { AnyPin::steal(psel.0 as _).conf().write(|_| ()) } | 596 | unsafe { AnyPin::steal(psel.0 as _) }.conf().write(|w| { |
| 597 | w.set_input(vals::Input::DISCONNECT); | ||
| 598 | }) | ||
| 595 | } | 599 | } |
| 596 | 600 | ||
| 597 | // ==================== | 601 | // ==================== |
