Skip to content

Commit

Permalink
Merge pull request #170 from JanekGraff/compile-fix
Browse files Browse the repository at this point in the history
Fix compilation error in spi.rs for rust Version 1.73+
  • Loading branch information
therealprof authored Dec 12, 2023
2 parents eed06fb + ec3e603 commit 73b81e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Wrong mode when using PWM channel 2 of a two-channel timer
- `adc_values` example conversion error
- `invalid_reference_casting` Compilation error in spi.rs for Rust version 1.73+ (
See [PR#112431](https://github.com/rust-lang/rust/pull/112431) for more info)
- `unused_doc_comments` Warning in rcc.rs

## [v0.18.0] - 2021-11-14

Expand Down
2 changes: 1 addition & 1 deletion src/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl RccExt for RCC {
pclk: None,
sysclk: None,
clock_src: SysClkSource::HSI,
/// CRS is only available on devices with HSI48
// CRS is only available on devices with HSI48
#[cfg(any(
feature = "stm32f042",
feature = "stm32f048",
Expand Down
4 changes: 2 additions & 2 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ where

fn send_u8(&mut self, byte: u8) {
// NOTE(write_volatile) see note above
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u8, byte) }
unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u8, byte) }
}

fn read_u16(&mut self) -> u16 {
Expand All @@ -423,7 +423,7 @@ where

fn send_u16(&mut self, byte: u16) {
// NOTE(write_volatile) see note above
unsafe { ptr::write_volatile(&self.spi.dr as *const _ as *mut u16, byte) }
unsafe { ptr::write_volatile(ptr::addr_of!(self.spi.dr) as *mut u16, byte) }
}

pub fn release(self) -> (SPI, (SCKPIN, MISOPIN, MOSIPIN)) {
Expand Down

0 comments on commit 73b81e6

Please sign in to comment.