Skip to content

Commit

Permalink
update rustc version
Browse files Browse the repository at this point in the history
  • Loading branch information
dotcypress committed Nov 22, 2023
1 parent e8cbec8 commit e6145ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use crate::rcc::{Enable, Rcc, Reset};
use crate::stm32::CRC;
use core::hash::Hasher;
use core::ptr;

/// Extension trait to constrain the CRC peripheral.
pub trait CrcExt {
Expand Down Expand Up @@ -174,11 +173,8 @@ impl Crc {
pub fn feed(&mut self, data: &[u8]) {
let crc = unsafe { &(*CRC::ptr()) };
for byte in data {
unsafe {
// Workaround with svd2rust, it does not generate the byte interface to the DR
// register
ptr::write_volatile(&crc.dr as *const _ as *mut u8, *byte);
}
let ptr = &crc.dr as *const _;
unsafe { core::ptr::write_volatile(ptr as *mut u8, *byte) };
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ macro_rules! gpio {
let _ = &(*$GPIOX::ptr()).pupdr.modify(|r, w| {
w.bits(r.bits() & !(0b11 << offset))
});
&(*$GPIOX::ptr()).moder.modify(|r, w| {
let _ = &(*$GPIOX::ptr()).moder.modify(|r, w| {
w.bits(r.bits() & !(0b11 << offset))
})
});
};
let offset = ($i % 4) * 8;
let mask = $Pxn << offset;
Expand Down Expand Up @@ -475,9 +475,9 @@ macro_rules! gpio {
pub fn set_speed(self, speed: Speed) -> Self {
let offset = 2 * $i;
unsafe {
&(*$GPIOX::ptr()).ospeedr.modify(|r, w| {
let _ = &(*$GPIOX::ptr()).ospeedr.modify(|r, w| {
w.bits((r.bits() & !(0b11 << offset)) | ((speed as u32) << offset))
})
});
};
self
}
Expand Down
4 changes: 2 additions & 2 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ macro_rules! spi {
} else if sr.crcerr().bit_is_set() {
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) }
let ptr = &self.spi.dr as *const _;
unsafe { core::ptr::write_volatile(ptr as *mut u8, byte) };
return Ok(());
} else {
nb::Error::WouldBlock
Expand Down

0 comments on commit e6145ef

Please sign in to comment.