nrf: sequencepwm nitpicks for clarity
This commit is contained in:
parent
937f49dead
commit
7bee43df5a
@ -396,7 +396,7 @@ impl<'d, T: Instance> SimplePwm<'d, T> {
|
|||||||
|
|
||||||
r.seq0
|
r.seq0
|
||||||
.ptr
|
.ptr
|
||||||
.write(|w| unsafe { w.bits(&pwm.duty as *const _ as u32) });
|
.write(|w| unsafe { w.bits((&pwm.duty).as_ptr() as u32) });
|
||||||
|
|
||||||
r.seq0.cnt.write(|w| unsafe { w.bits(4) });
|
r.seq0.cnt.write(|w| unsafe { w.bits(4) });
|
||||||
r.seq0.refresh.write(|w| unsafe { w.bits(0) });
|
r.seq0.refresh.write(|w| unsafe { w.bits(0) });
|
||||||
@ -447,17 +447,14 @@ impl<'d, T: Instance> SimplePwm<'d, T> {
|
|||||||
|
|
||||||
self.duty[channel] = duty & 0x7FFF;
|
self.duty[channel] = duty & 0x7FFF;
|
||||||
|
|
||||||
r.seq0
|
|
||||||
.ptr
|
|
||||||
.write(|w| unsafe { w.bits(&self.duty as *const _ as u32) });
|
|
||||||
|
|
||||||
// defensive before seqstart
|
// defensive before seqstart
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
|
|
||||||
// tasks_seqstart() doesn't exist in all svds so write its bit instead
|
// tasks_seqstart() doesn't exist in all svds so write its bit instead
|
||||||
r.tasks_seqstart[0].write(|w| unsafe { w.bits(1) });
|
r.tasks_seqstart[0].write(|w| unsafe { w.bits(1) });
|
||||||
|
|
||||||
// defensive wait until waveform is loaded after seqstart
|
// 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 {}
|
while r.events_seqend[0].read().bits() == 0 {}
|
||||||
r.events_seqend[0].write(|w| w);
|
r.events_seqend[0].write(|w| w);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user