From b3eda9914b27913fa5c8edb9050e236ba3053bd1 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Thu, 20 May 2021 14:24:40 -0400 Subject: [PATCH] Use the correct register names. --- embassy-stm32/src/spi/v1.rs | 8 ++++---- embassy-stm32/src/spi/v2.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/embassy-stm32/src/spi/v1.rs b/embassy-stm32/src/spi/v1.rs index 95afaa67..d1f0473c 100644 --- a/embassy-stm32/src/spi/v1.rs +++ b/embassy-stm32/src/spi/v1.rs @@ -152,7 +152,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Write for Spi<'d, T> { // spin } unsafe { - let dr = regs.txdr().ptr() as *mut u8; + let dr = regs.dr().ptr() as *mut u8; ptr::write_volatile(dr, *word); } loop { @@ -188,7 +188,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer for Spi<'d, T> { // spin } unsafe { - let dr = regs.txdr().ptr() as *mut u8; + let dr = regs.dr().ptr() as *mut u8; ptr::write_volatile(dr, *word); } @@ -229,7 +229,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Write for Spi<'d, T> { // spin } unsafe { - let dr = regs.txdr().ptr() as *mut u16; + let dr = regs.dr().ptr() as *mut u16; ptr::write_volatile(dr, *word); } loop { @@ -265,7 +265,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer for Spi<'d, T> // spin } unsafe { - let dr = regs.txdr().ptr() as *mut u16; + let dr = regs.dr().ptr() as *mut u16; ptr::write_volatile(dr, *word); } while unsafe { !regs.sr().read().rxne() } { diff --git a/embassy-stm32/src/spi/v2.rs b/embassy-stm32/src/spi/v2.rs index 00ea1082..393adc4e 100644 --- a/embassy-stm32/src/spi/v2.rs +++ b/embassy-stm32/src/spi/v2.rs @@ -220,7 +220,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer for Spi<'d, T> { } } unsafe { - let dr = regs.rxdr().ptr() as *const u8; + let dr = regs.dr().ptr() as *const u8; *word = ptr::read_volatile(dr); } let sr = unsafe { regs.sr().read() }; @@ -294,7 +294,7 @@ impl<'d, T: Instance> embedded_hal::blocking::spi::Transfer for Spi<'d, T> // spin waiting for inbound to shift in. } unsafe { - let dr = regs.rxdr().ptr() as *const u16; + let dr = regs.dr().ptr() as *const u16; *word = ptr::read_volatile(dr); } let sr = unsafe { regs.sr().read() };