Do not wait when the pwm is disabled

Reason: because in this case no seqend event is raised and therefore an infinity loop occurs
This commit is contained in:
Martin Marmsoler 2024-01-27 18:20:53 +01:00
parent b08a0955c3
commit 319b0fe3d7

View file

@ -760,7 +760,9 @@ impl<'d, T: Instance> SimplePwm<'d, T> {
// defensive wait until waveform is loaded after seqstart so set_duty
// can't be called again while dma is still reading
while r.events_seqend[0].read().bits() == 0 {}
if self.is_enabled() {
while r.events_seqend[0].read().bits() == 0 {}
}
}
/// Sets the PWM clock prescaler.