Merge pull request #4093 from 1-rafael-1/rp235x-input-pwm-fix

Enable input mode for PWM pins on RP235x and disable it on drop
This commit is contained in:
Dario Nieuwenhuis 2025-04-15 19:14:19 +02:00 committed by GitHub
commit c955320e5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,6 +157,11 @@ impl<'d> Pwm<'d> {
pin.pad_ctrl().modify(|w| {
#[cfg(feature = "_rp235x")]
w.set_iso(false);
#[cfg(feature = "_rp235x")]
if divmode != Divmode::DIV {
// Is in input mode and so must enable input mode for the pin
w.set_ie(true);
}
w.set_pue(b_pull == Pull::Up);
w.set_pde(b_pull == Pull::Down);
});
@ -462,6 +467,11 @@ impl<'d> Drop for Pwm<'d> {
}
if let Some(pin) = &self.pin_b {
pin.gpio().ctrl().write(|w| w.set_funcsel(31));
#[cfg(feature = "_rp235x")]
// Disable input mode. Only pin_b can be input, so not needed for pin_a
pin.pad_ctrl().modify(|w| {
w.set_ie(false);
});
}
}
}