From fcacbae2335c1c6cabf76f4731e367c9245bcc74 Mon Sep 17 00:00:00 2001 From: noracarmig Date: Sun, 26 Jan 2025 14:58:56 +0000 Subject: [PATCH] Allow chips from L5 (sai_v3_2pdm) and H7 (sai_v3_4pdm) families to use external sai sync --- embassy-stm32/src/sai/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/embassy-stm32/src/sai/mod.rs b/embassy-stm32/src/sai/mod.rs index 18d5d7568..0dc8b62d0 100644 --- a/embassy-stm32/src/sai/mod.rs +++ b/embassy-stm32/src/sai/mod.rs @@ -190,7 +190,7 @@ pub enum SyncInput { /// Syncs with the other A/B sub-block within the SAI unit Internal, /// Syncs with a sub-block in the other SAI unit - #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] + #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] External(SyncInputInstance), } @@ -199,14 +199,14 @@ impl SyncInput { match self { SyncInput::None => vals::Syncen::ASYNCHRONOUS, SyncInput::Internal => vals::Syncen::INTERNAL, - #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] + #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] SyncInput::External(_) => vals::Syncen::EXTERNAL, } } } /// SAI instance to sync from. -#[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] +#[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] #[derive(Copy, Clone, PartialEq)] #[allow(missing_docs)] pub enum SyncInputInstance { @@ -704,12 +704,12 @@ fn update_synchronous_config(config: &mut Config) { config.mode = Mode::Slave; config.sync_output = false; - #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm))] + #[cfg(any(sai_v1, sai_v2))] { config.sync_input = SyncInput::Internal; } - #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] + #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] { //this must either be Internal or External //The asynchronous sub-block on the same SAI needs to enable sync_output @@ -870,7 +870,7 @@ impl<'d, T: Instance, W: word::Word> Sai<'d, T, W> { ch.cr2().modify(|w| w.set_fflush(true)); - #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] + #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] { if let SyncInput::External(i) = config.sync_input { T::REGS.gcr().modify(|w| {