From 5e713467e11bfb9d3f4319a60bca7c193b0aec1d Mon Sep 17 00:00:00 2001 From: David O'Connor Date: Tue, 19 Dec 2023 09:08:47 -0500 Subject: [PATCH] More adjustments for unsafe-cell --- src/spi.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/spi.rs b/src/spi.rs index 13d508a..b59ff26 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -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 @@ -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))