From 957c34760b350cd9c99cff9fd08e9f2fe725fae3 Mon Sep 17 00:00:00 2001
From: Pietro Bortolus <Pietro.bortolus@skywarder.eu>
Date: Thu, 5 Dec 2024 23:27:44 +0100
Subject: [PATCH] changed an issue in stm32f756zg_nucleo where tx and rx were
 used before being defined

---
 src/bsps/stm32f756zg_nucleo/interfaces-impl/bsp.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/bsps/stm32f756zg_nucleo/interfaces-impl/bsp.cpp b/src/bsps/stm32f756zg_nucleo/interfaces-impl/bsp.cpp
index 51d37fbed..b6a873312 100644
--- a/src/bsps/stm32f756zg_nucleo/interfaces-impl/bsp.cpp
+++ b/src/bsps/stm32f756zg_nucleo/interfaces-impl/bsp.cpp
@@ -78,10 +78,13 @@ void IRQbspInit()
     delayMs(100);
     ledOff();
 
-    tx.alternateFunction(7);
     auto tx = Gpio<GPIOD_BASE, 8>::getPin();
-    rx.alternateFunction(7);
+    tx.alternateFunction(7);
     auto rx = Gpio<GPIOD_BASE, 9>::getPin();
+    rx.alternateFunction(7);
+
+    // rx and tx alternate function is set here, mode will be set by the
+    // STM32Serial class later on
 
     DefaultConsole::instance().IRQset(intrusive_ref_ptr<Device>(
         new STM32Serial(3, defaultSerialSpeed, tx, rx)));
-- 
GitLab