Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Aug 27, 2022
1 parent 81ce4e0 commit 5379747
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ where
loop {
let sr = self.spi.sr.read();
if sr.txe().bit_is_set() {
// NOTE(write_volatile) see note above
// unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, *word) }
self.write_data_reg(*word);
if sr.modf().bit_is_set() {
return Err(Error::ModeFault);
Expand All @@ -381,24 +379,10 @@ where
}
}
// Wait for final TXE
loop {
let sr = self.spi.sr.read();
if sr.txe().bit_is_set() {
break;
}
}
while self.spi.sr.read().txe().bit_is_clear() { }
// Wait for final !BSY
loop {
let sr = self.spi.sr.read();
if !sr.bsy().bit_is_set() {
break;
}
}
while self.spi.sr.read().bsy().bit_is_set() { }
// Clear OVR set due to dropped received values
// NOTE(read_volatile) see note above
// unsafe {
// let _ = ptr::read_volatile(&self.spi.dr as *const _ as *const u8);
// }
let _ = self.read_data_reg();
let _ = self.spi.sr.read();
Ok(())
Expand Down

0 comments on commit 5379747

Please sign in to comment.