diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index 6249de84e..808854f00 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs @@ -1,6 +1,7 @@ #![macro_use] #[cfg_attr(spi_v1, path = "v1.rs")] +#[cfg_attr(spi_f1, path = "v1.rs")] #[cfg_attr(spi_v2, path = "v2.rs")] #[cfg_attr(spi_v3, path = "v3.rs")] mod _version; diff --git a/embassy-stm32/src/spi/v1.rs b/embassy-stm32/src/spi/v1.rs index 53d8252e6..982f1cc4b 100644 --- a/embassy-stm32/src/spi/v1.rs +++ b/embassy-stm32/src/spi/v1.rs @@ -414,7 +414,7 @@ fn write_word(regs: &'static crate::pac::spi::Spi, word: W) -> Result<( let sr = unsafe { regs.sr().read() }; if sr.ovr() { return Err(Error::Overrun); - } else if sr.fre() { + } else if sr_fre(sr) { return Err(Error::Framing); } else if sr.modf() { return Err(Error::ModeFault); @@ -438,7 +438,7 @@ fn read_word(regs: &'static crate::pac::spi::Spi) -> Result { return Err(Error::Overrun); } else if sr.modf() { return Err(Error::ModeFault); - } else if sr.fre() { + } else if sr_fre(sr) { return Err(Error::Framing); } else if sr.crcerr() { return Err(Error::Crc); @@ -450,3 +450,17 @@ fn read_word(regs: &'static crate::pac::spi::Spi) -> Result { } } } + +// SPI on F1 is just V1 without FRE and FRF fields +// This driver only uses FRE, so add a simple function here to read fre on v1, +// and return false on f1 + +#[cfg(spi_v1)] +fn sr_fre(sr: crate::pac::spi::regs::Sr) -> bool { + sr.fre() +} + +#[cfg(spi_f1)] +fn sr_fre(_sr: crate::pac::spi::regs::Sr) -> bool { + false +} diff --git a/stm32-data b/stm32-data index e78ea6f05..bae2d3444 160000 --- a/stm32-data +++ b/stm32-data @@ -1 +1 @@ -Subproject commit e78ea6f05058dc1eff1dd4a4f07227d502a3b657 +Subproject commit bae2d34445f87e7b9a88b683c789c5d0c7560fb6