aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-04-15 19:14:19 +0200
committerGitHub <[email protected]>2025-04-15 19:14:19 +0200
commitc955320e5d65005e4cc0c9ca201bd25ad7ff17e2 (patch)
tree040cbf5cf4800e258a5a466b4ab2ef6e7643821b
parente56a1d0e457bee087a4094206b277fbf595a8f17 (diff)
parentdbd7ce4d385e26f78b139c0d9e135d70501c939f (diff)
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
-rw-r--r--embassy-rp/src/pwm.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs
index f631402a2..6dfb90fef 100644
--- a/embassy-rp/src/pwm.rs
+++ b/embassy-rp/src/pwm.rs
@@ -157,6 +157,11 @@ impl<'d> Pwm<'d> {
157 pin.pad_ctrl().modify(|w| { 157 pin.pad_ctrl().modify(|w| {
158 #[cfg(feature = "_rp235x")] 158 #[cfg(feature = "_rp235x")]
159 w.set_iso(false); 159 w.set_iso(false);
160 #[cfg(feature = "_rp235x")]
161 if divmode != Divmode::DIV {
162 // Is in input mode and so must enable input mode for the pin
163 w.set_ie(true);
164 }
160 w.set_pue(b_pull == Pull::Up); 165 w.set_pue(b_pull == Pull::Up);
161 w.set_pde(b_pull == Pull::Down); 166 w.set_pde(b_pull == Pull::Down);
162 }); 167 });
@@ -462,6 +467,11 @@ impl<'d> Drop for Pwm<'d> {
462 } 467 }
463 if let Some(pin) = &self.pin_b { 468 if let Some(pin) = &self.pin_b {
464 pin.gpio().ctrl().write(|w| w.set_funcsel(31)); 469 pin.gpio().ctrl().write(|w| w.set_funcsel(31));
470 #[cfg(feature = "_rp235x")]
471 // Disable input mode. Only pin_b can be input, so not needed for pin_a
472 pin.pad_ctrl().modify(|w| {
473 w.set_ie(false);
474 });
465 } 475 }
466 } 476 }
467} 477}