Skip to content

Commit ee23412

Browse files
authored
Merge pull request #4115 from 1-rafael-1/dropping-pwm-leaves-pins-in-incorrect-state
pwm: enable pull-down resistors for pins in Drop implementation
2 parents f97e5db + 54ef354 commit ee23412

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

embassy-rp/src/pwm.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ impl<'d> Drop for Pwm<'d> {
464464
pac::PWM.ch(self.slice).csr().write_clear(|w| w.set_en(false));
465465
if let Some(pin) = &self.pin_a {
466466
pin.gpio().ctrl().write(|w| w.set_funcsel(31));
467+
// Enable pin PULL-DOWN
468+
pin.pad_ctrl().modify(|w| {
469+
w.set_pde(true);
470+
});
467471
}
468472
if let Some(pin) = &self.pin_b {
469473
pin.gpio().ctrl().write(|w| w.set_funcsel(31));
@@ -472,6 +476,10 @@ impl<'d> Drop for Pwm<'d> {
472476
pin.pad_ctrl().modify(|w| {
473477
w.set_ie(false);
474478
});
479+
// Enable pin PULL-DOWN
480+
pin.pad_ctrl().modify(|w| {
481+
w.set_pde(true);
482+
});
475483
}
476484
}
477485
}

0 commit comments

Comments
 (0)