Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vivi202 committed Dec 23, 2024
1 parent f58efe9 commit c1197e4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion embassy-rp/src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,28 @@ impl PwmBatch {

impl<'d> Drop for Pwm<'d> {
fn drop(&mut self) {
pac::PWM.ch(self.slice).csr().write_clear(|w| w.set_en(false));
let p = pac::PWM.ch(self.slice);
if let Some(pin) = &self.pin_a {
p.cc().modify(|w| {
w.set_a(0);
});
pin.gpio().ctrl().write(|w| w.set_funcsel(31));
//Enable pin PULL-DOWN
pin.pad_ctrl().modify(|w| {
w.set_pde(true);
});
}
if let Some(pin) = &self.pin_b {
p.cc().modify(|w| {
w.set_b(0);
});
pin.gpio().ctrl().write(|w| w.set_funcsel(31));
//Enable pin PULL-DOWN
pin.pad_ctrl().modify(|w| {
w.set_pde(true);
});
}
p.csr().write_clear(|w| w.set_en(false));
}
}

Expand Down

0 comments on commit c1197e4

Please sign in to comment.