Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _formerly [MabezDev/stm32l4xx-hal](https://github.com/mabezdev/stm32l4xx-hal)_

## About

- Minimum rustc version 1.51
- Minimum rustc version 1.73

## License

Expand Down
7 changes: 5 additions & 2 deletions src/qspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::gpio::{
use crate::gpio::{Alternate, PushPull, Speed};
use crate::rcc::{Enable, AHB3};
use crate::stm32::QUADSPI;
use core::ptr;
use core::{cell::UnsafeCell, ptr};

#[doc(hidden)]
mod private {
Expand Down Expand Up @@ -676,7 +676,10 @@ impl<CLK, NCS, IO0, IO1, IO2, IO3> Qspi<(CLK, NCS, IO0, IO1, IO2, IO3)> {
for byte in data {
while self.qspi.sr.read().ftf().bit_is_clear() {}
unsafe {
ptr::write_volatile(&self.qspi.dr as *const _ as *mut u8, *byte);
ptr::write_volatile(
UnsafeCell::raw_get(&self.qspi.dr as *const _ as *mut _),
*byte,
);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! This module support both polling and interrupt based accesses to the serial peripherals.

use core::cell::UnsafeCell;
use core::fmt;
use core::marker::PhantomData;
use core::ops::DerefMut;
Expand Down Expand Up @@ -468,7 +469,7 @@ macro_rules! hal {
if isr.rxne().bit_is_set() {
// NOTE(read_volatile) see `write_volatile` below
return Ok(unsafe {
ptr::read_volatile(&(*pac::$USARTX::ptr()).rdr as *const _ as *const _)
ptr::read_volatile(UnsafeCell::raw_get(&(*pac::$USARTX::ptr()).rdr as *const _ as *const _))
});
}

Expand Down Expand Up @@ -520,7 +521,7 @@ macro_rules! hal {
// NOTE(unsafe) atomic write to stateless register
// NOTE(write_volatile) 8-bit write that's not possible through the svd2rust API
unsafe {
ptr::write_volatile(&(*pac::$USARTX::ptr()).tdr as *const _ as *mut _, byte)
ptr::write_volatile(UnsafeCell::raw_get(&(*pac::$USARTX::ptr()).tdr as *const _ as *mut _), byte)
}
Ok(())
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! don't have it (L432xx and L442xx don't, L452xx does). Users of this MCU variant that
//! don't have it shouldn't attempt to use it. Relevant info is on user-manual level.

use core::cell::UnsafeCell;
use core::ptr;
use core::sync::atomic;
use core::sync::atomic::Ordering;
Expand Down Expand Up @@ -250,7 +251,7 @@ macro_rules! hal {
// NOTE(read_volatile) read only 1 byte (the svd2rust API only allows
// reading a half-word)
return Ok(unsafe {
ptr::read_volatile(&self.spi.dr as *const _ as *const u8)
ptr::read_volatile(UnsafeCell::raw_get(&self.spi.dr as *const _ as *const _))
});
} else {
nb::Error::WouldBlock
Expand All @@ -268,7 +269,7 @@ macro_rules! hal {
nb::Error::Other(Error::Crc)
} else if sr.txe().bit_is_set() {
// NOTE(write_volatile) see note above
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) }
unsafe { ptr::write_volatile(UnsafeCell::raw_get(&self.spi.dr as *const _ as *mut _), byte) }
return Ok(());
} else {
nb::Error::WouldBlock
Expand Down