Merge pull request #524 from lulf/readd-write-flush

Add back MISO flush
This commit is contained in:
Dario Nieuwenhuis 2021-12-07 19:23:48 +01:00 committed by GitHub
commit c574b0eb73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -14,6 +14,11 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
T::regs().cr1().modify(|w| {
w.set_spe(false);
});
// Flush the read buffer to avoid errornous data from being read
while T::regs().sr().read().rxne() {
let _ = T::regs().dr().read();
}
}
self.set_word_size(WordSize::EightBit);

View file

@ -15,6 +15,11 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
T::regs().cr1().modify(|w| {
w.set_spe(false);
});
// Flush the read buffer to avoid errornous data from being read
while T::regs().sr().read().rxp() {
let _ = T::regs().rxdr().read();
}
}
let request = self.txdma.request();