File tree 1 file changed +2
-8
lines changed 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -413,10 +413,7 @@ where
413
413
414
414
fn send_u8 ( & mut self , byte : u8 ) {
415
415
// NOTE(write_volatile) see note above
416
- #[ allow( invalid_reference_casting) ]
417
- unsafe {
418
- ptr:: write_volatile ( & self . spi . dr as * const _ as * mut u8 , byte)
419
- }
416
+ unsafe { ptr:: write_volatile ( ptr:: addr_of!( self . spi. dr) as * mut u8 , byte) }
420
417
}
421
418
422
419
fn read_u16 ( & mut self ) -> u16 {
@@ -426,10 +423,7 @@ where
426
423
427
424
fn send_u16 ( & mut self , byte : u16 ) {
428
425
// NOTE(write_volatile) see note above
429
- #[ allow( invalid_reference_casting) ]
430
- unsafe {
431
- ptr:: write_volatile ( & self . spi . dr as * const _ as * mut u16 , byte)
432
- }
426
+ unsafe { ptr:: write_volatile ( ptr:: addr_of!( self . spi. dr) as * mut u16 , byte) }
433
427
}
434
428
435
429
pub fn release ( self ) -> ( SPI , ( SCKPIN , MISOPIN , MOSIPIN ) ) {
You can’t perform that action at this time.
0 commit comments