Skip to content

Commit 54ef354

Browse files
committed
pwm: enable pull-down resistors for pins in Drop implementation
1 parent 9d62fba commit 54ef354

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)