Address issues in PR.

This commit is contained in:
Richard Dodd 2021-05-05 18:25:14 +01:00
parent 1ad18aa09a
commit 9de12a0a7a

View file

@ -232,7 +232,6 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer<u8> for Spim<'d, T>
compiler_fence(Ordering::SeqCst);
let r = T::regs();
let s = T::state();
// Set up the DMA write.
r.txd
@ -250,23 +249,20 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer<u8> for Spim<'d, T>
.maxcnt
.write(|w| unsafe { w.maxcnt().bits(words.len() as _) });
// Reset and enable the event
// Disable the end event since we are busy-polling.
r.events_end.reset();
r.intenset.write(|w| w.end().set());
// Start SPI transaction.
r.tasks_start.write(|w| unsafe { w.bits(1) });
// Wait for 'end' event.
while r.events_end.read().bits() == 0 {}
// Conservative compiler fence to prevent optimizations that do not
// take in to account actions by DMA. The fence has been placed here,
// after all possible DMA actions have completed.
compiler_fence(Ordering::SeqCst);
// Wait for 'end' event.
while r.events_end.read().bits() == 0 {
continue;
}
Ok(words)
}
}