From f29deb24880947db785af175b23988c65c10a1df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=ABl=20Schulz-Ansres?= <joel@systemscape.de>
Date: Thu, 2 May 2024 15:39:53 +0200
Subject: [PATCH] Add feature gate for f7

---
 embassy-stm32/src/dsihost.rs | 3 ++-
 embassy-stm32/src/ltdc.rs    | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/embassy-stm32/src/dsihost.rs b/embassy-stm32/src/dsihost.rs
index 0537d22cf..c711672c8 100644
--- a/embassy-stm32/src/dsihost.rs
+++ b/embassy-stm32/src/dsihost.rs
@@ -1,11 +1,12 @@
 //! DSI HOST
 
-use crate::rcc::RccPeripheral;
 use core::marker::PhantomData;
+
 use embassy_hal_internal::{into_ref, PeripheralRef};
 
 //use crate::gpio::{AnyPin, SealedPin};
 use crate::gpio::{AFType, AnyPin, Pull, Speed};
+use crate::rcc::RccPeripheral;
 use crate::{peripherals, Peripheral};
 
 /// Performs a busy-wait delay for a specified number of microseconds.
diff --git a/embassy-stm32/src/ltdc.rs b/embassy-stm32/src/ltdc.rs
index 1cdf71e7e..f261fce38 100644
--- a/embassy-stm32/src/ltdc.rs
+++ b/embassy-stm32/src/ltdc.rs
@@ -1,7 +1,8 @@
 //! LTDC
+use core::marker::PhantomData;
+
 use crate::rcc::RccPeripheral;
 use crate::{peripherals, Peripheral};
-use core::marker::PhantomData;
 
 /// LTDC driver.
 pub struct Ltdc<'d, T: Instance> {
@@ -47,6 +48,12 @@ impl<'d, T: Instance> Ltdc<'d, T> {
         critical_section::with(|_cs| {
             // RM says the pllsaidivr should only be changed when pllsai is off. But this could have other unintended side effects. So let's just give it a try like this.
             // According to the debugger, this bit gets set, anyway.
+            #[cfg(stm32f7)]
+            stm32_metapac::RCC
+                .dckcfgr1()
+                .modify(|w| w.set_pllsaidivr(stm32_metapac::rcc::vals::Pllsaidivr::DIV2));
+
+            #[cfg(not(stm32f7))]
             stm32_metapac::RCC
                 .dckcfgr()
                 .modify(|w| w.set_pllsaidivr(stm32_metapac::rcc::vals::Pllsaidivr::DIV2));