sequence pwm remove disable fn for clarity, and disable peripheral on stop
This commit is contained in:
parent
b4cb24c735
commit
667a93b5c8
@ -102,9 +102,6 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
|
|||||||
r.intenclr.write(|w| unsafe { w.bits(0xFFFF_FFFF) });
|
r.intenclr.write(|w| unsafe { w.bits(0xFFFF_FFFF) });
|
||||||
r.shorts.reset();
|
r.shorts.reset();
|
||||||
|
|
||||||
// Enable
|
|
||||||
r.enable.write(|w| w.enable().enabled());
|
|
||||||
|
|
||||||
r.seq0
|
r.seq0
|
||||||
.ptr
|
.ptr
|
||||||
.write(|w| unsafe { w.bits(sequence.as_ptr() as u32) });
|
.write(|w| unsafe { w.bits(sequence.as_ptr() as u32) });
|
||||||
@ -208,6 +205,8 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
|
|||||||
pub fn stop(&self) {
|
pub fn stop(&self) {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
|
|
||||||
|
r.enable.write(|w| w.enable().disabled());
|
||||||
|
|
||||||
r.shorts.reset();
|
r.shorts.reset();
|
||||||
|
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
@ -215,13 +214,6 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
|
|||||||
// tasks_stop() doesn't exist in all svds so write its bit instead
|
// tasks_stop() doesn't exist in all svds so write its bit instead
|
||||||
r.tasks_stop.write(|w| unsafe { w.bits(0x01) });
|
r.tasks_stop.write(|w| unsafe { w.bits(0x01) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Disables the PWM generator.
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn disable(&self) {
|
|
||||||
let r = T::regs();
|
|
||||||
r.enable.write(|w| w.enable().disabled());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Instance> Drop for SequencePwm<'a, T> {
|
impl<'a, T: Instance> Drop for SequencePwm<'a, T> {
|
||||||
@ -229,7 +221,6 @@ impl<'a, T: Instance> Drop for SequencePwm<'a, T> {
|
|||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
|
|
||||||
self.stop();
|
self.stop();
|
||||||
self.disable();
|
|
||||||
|
|
||||||
if let Some(pin) = &self.ch0 {
|
if let Some(pin) = &self.ch0 {
|
||||||
pin.set_low();
|
pin.set_low();
|
||||||
|
Loading…
Reference in New Issue
Block a user