Skip to content

Commit

Permalink
More adjustments for unsafe-cell
Browse files Browse the repository at this point in the history
  • Loading branch information
David-OConnor committed Dec 19, 2023
1 parent 9cd022c commit 5e71346
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ where
fn send(&mut self, word: u8) -> Result<(), SpiError> {
// NOTE(write_volatile) see note above
unsafe {
#[allow(invalid_reference_casting)]
ptr::write_volatile(&self.regs.txdr as *const _ as *mut u8, word);
}
// write CSTART to start a transaction in
Expand All @@ -675,6 +676,7 @@ where
return Err(SpiError::Crc);
}

#[allow(invalid_reference_casting)]
unsafe {
ptr::write_volatile(&self.regs.txdr as *const _ as *mut _, word);
Ok(ptr::read_volatile(&self.regs.rxdr as *const _ as *const u8))
Expand Down

0 comments on commit 5e71346

Please sign in to comment.