From 141f826e10802a40ac1bca8fdcdfa3da821e0f28 Mon Sep 17 00:00:00 2001 From: Cristian Milatinov Date: Wed, 9 Jul 2025 20:35:01 -0400 Subject: feat: stm32 spi driver slave mode Add SPI slave constructors Fix SPI slave constructors Fix embedded hal async trait One more constructor fix Set SSM bit in SPI driver according to CommunicationMode Fix embedded_hal_async trait to be generic for both master and slave Fix I2S driver to use async master SPI Forgot import from spi mode Fix CommunicationMode associated const conditionals Duplicate doc for CommunicationMode const Add missing nss argument Fix existing SPI tests not compiling Fix stm32h7rs examples not compiling Fix failing stm32l4 example Fix stm32h7 example Fix stm32h7 spi_bdma example Fix stm32h7 spi example Fix stm32f4 example docs: added entry in changelog.md fix: spi_v3 vals mismatch + rise_fall_speed renamed to gpio_speed fix: added spi_v6 conditional compilation feature fix: use if_afio macro in slave constructors fix: add missing trait bound fix: if_afio for cs pin trait fix: changelog message fix: broken rebase --- tests/stm32/src/bin/spi.rs | 7 ++++--- tests/stm32/src/bin/spi_dma.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs index e8310866a..cedff772c 100644 --- a/tests/stm32/src/bin/spi.rs +++ b/tests/stm32/src/bin/spi.rs @@ -8,6 +8,7 @@ use defmt::assert_eq; use embassy_executor::Spawner; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::mode::Blocking; +use embassy_stm32::spi::mode::Master; use embassy_stm32::spi::{self, Spi, Word}; use embassy_stm32::time::Hertz; @@ -65,7 +66,7 @@ async fn main(_spawner: Spawner) { cortex_m::asm::bkpt(); } -fn test_txrx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>) +fn test_txrx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>) where W: core::ops::Not, { @@ -109,7 +110,7 @@ where spi.blocking_write::(&[]).unwrap(); } -fn test_rx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>, mosi_out: &mut Output<'_>) +fn test_rx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>, mosi_out: &mut Output<'_>) where W: core::ops::Not, { @@ -125,7 +126,7 @@ where spi.blocking_read::(&mut []).unwrap(); } -fn test_tx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking>) +fn test_tx + defmt::Format + Eq>(spi: &mut Spi<'_, Blocking, Master>) where W: core::ops::Not, { diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs index b4fdb8faa..c8cd92401 100644 --- a/tests/stm32/src/bin/spi_dma.rs +++ b/tests/stm32/src/bin/spi_dma.rs @@ -8,6 +8,7 @@ use defmt::assert_eq; use embassy_executor::Spawner; use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::mode::Async; +use embassy_stm32::spi::mode::Master; use embassy_stm32::spi::{self, Spi, Word}; use embassy_stm32::time::Hertz; @@ -78,7 +79,7 @@ async fn main(_spawner: Spawner) { cortex_m::asm::bkpt(); } -async fn test_txrx + defmt::Format + Eq>(spi: &mut Spi<'_, Async>) +async fn test_txrx + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>) where W: core::ops::Not, { @@ -142,7 +143,7 @@ where spi.write(&buf).await.unwrap(); } -async fn test_rx + defmt::Format + Eq>(spi: &mut Spi<'_, Async>, mosi_out: &mut Output<'_>) +async fn test_rx + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>, mosi_out: &mut Output<'_>) where W: core::ops::Not, { @@ -168,7 +169,7 @@ where spi.blocking_read::(&mut []).unwrap(); } -async fn test_tx + defmt::Format + Eq>(spi: &mut Spi<'_, Async>) +async fn test_tx + defmt::Format + Eq>(spi: &mut Spi<'_, Async, Master>) where W: core::ops::Not, { -- cgit