Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf/gpio: fix missing setting input as disconnected. #3746

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions embassy-nrf/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ impl<'d> Flex<'d> {
/// Put the pin into disconnected mode.
#[inline]
pub fn set_as_disconnected(&mut self) {
self.pin.conf().write(|_| ());
self.pin.conf().write(|w| {
w.set_input(vals::Input::DISCONNECT);
});
}

/// Get whether the pin input level is high.
Expand Down Expand Up @@ -448,7 +450,7 @@ impl<'d> Flex<'d> {

impl<'d> Drop for Flex<'d> {
fn drop(&mut self) {
self.pin.conf().write(|_| ())
self.set_as_disconnected();
}
}

Expand Down Expand Up @@ -591,7 +593,9 @@ pub(crate) fn deconfigure_pin(psel: Psel) {
if psel.connect() == Connect::DISCONNECTED {
return;
}
unsafe { AnyPin::steal(psel.0 as _).conf().write(|_| ()) }
unsafe { AnyPin::steal(psel.0 as _) }.conf().write(|w| {
w.set_input(vals::Input::DISCONNECT);
})
}

// ====================
Expand Down
Loading