diff options
| author | noracarmig <[email protected]> | 2025-01-26 14:58:56 +0000 |
|---|---|---|
| committer | noracarmig <[email protected]> | 2025-01-26 15:58:52 +0000 |
| commit | fcacbae2335c1c6cabf76f4731e367c9245bcc74 (patch) | |
| tree | 78de11de1711d45dce6a452601b5384b17117325 | |
| parent | 72020fc0126483f61be8ce2a4c8b78b0a5a95cc7 (diff) | |
Allow chips from L5 (sai_v3_2pdm) and H7 (sai_v3_4pdm) families to use external sai sync
| -rw-r--r-- | embassy-stm32/src/sai/mod.rs | 12 |
1 files 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 { | |||
| 190 | /// Syncs with the other A/B sub-block within the SAI unit | 190 | /// Syncs with the other A/B sub-block within the SAI unit |
| 191 | Internal, | 191 | Internal, |
| 192 | /// Syncs with a sub-block in the other SAI unit | 192 | /// Syncs with a sub-block in the other SAI unit |
| 193 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 193 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 194 | External(SyncInputInstance), | 194 | External(SyncInputInstance), |
| 195 | } | 195 | } |
| 196 | 196 | ||
| @@ -199,14 +199,14 @@ impl SyncInput { | |||
| 199 | match self { | 199 | match self { |
| 200 | SyncInput::None => vals::Syncen::ASYNCHRONOUS, | 200 | SyncInput::None => vals::Syncen::ASYNCHRONOUS, |
| 201 | SyncInput::Internal => vals::Syncen::INTERNAL, | 201 | SyncInput::Internal => vals::Syncen::INTERNAL, |
| 202 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 202 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 203 | SyncInput::External(_) => vals::Syncen::EXTERNAL, | 203 | SyncInput::External(_) => vals::Syncen::EXTERNAL, |
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | /// SAI instance to sync from. | 208 | /// SAI instance to sync from. |
| 209 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 209 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 210 | #[derive(Copy, Clone, PartialEq)] | 210 | #[derive(Copy, Clone, PartialEq)] |
| 211 | #[allow(missing_docs)] | 211 | #[allow(missing_docs)] |
| 212 | pub enum SyncInputInstance { | 212 | pub enum SyncInputInstance { |
| @@ -704,12 +704,12 @@ fn update_synchronous_config(config: &mut Config) { | |||
| 704 | config.mode = Mode::Slave; | 704 | config.mode = Mode::Slave; |
| 705 | config.sync_output = false; | 705 | config.sync_output = false; |
| 706 | 706 | ||
| 707 | #[cfg(any(sai_v1, sai_v2, sai_v3_2pdm, sai_v3_4pdm))] | 707 | #[cfg(any(sai_v1, sai_v2))] |
| 708 | { | 708 | { |
| 709 | config.sync_input = SyncInput::Internal; | 709 | config.sync_input = SyncInput::Internal; |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 712 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 713 | { | 713 | { |
| 714 | //this must either be Internal or External | 714 | //this must either be Internal or External |
| 715 | //The asynchronous sub-block on the same SAI needs to enable sync_output | 715 | //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> { | |||
| 870 | 870 | ||
| 871 | ch.cr2().modify(|w| w.set_fflush(true)); | 871 | ch.cr2().modify(|w| w.set_fflush(true)); |
| 872 | 872 | ||
| 873 | #[cfg(any(sai_v4_2pdm, sai_v4_4pdm))] | 873 | #[cfg(any(sai_v3_2pdm, sai_v3_4pdm, sai_v4_2pdm, sai_v4_4pdm))] |
| 874 | { | 874 | { |
| 875 | if let SyncInput::External(i) = config.sync_input { | 875 | if let SyncInput::External(i) = config.sync_input { |
| 876 | T::REGS.gcr().modify(|w| { | 876 | T::REGS.gcr().modify(|w| { |
