From 70f2ba39e8948319c20afe0e7b38732ea08fe542 Mon Sep 17 00:00:00 2001 From: "@CarlWachter" Date: Sat, 6 Jan 2024 11:48:53 +0100 Subject: [PATCH 1/3] Feature: Weak definition of UARThandle getter --- src/startup.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/startup.cpp b/src/startup.cpp index 98448ed..fe3e085 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -48,6 +48,17 @@ namespace sta namespace tacos { + /** + * @brief Function that returns the UART handle used for debugging. Override it in userspace to adjust. + */ + STA_WEAK + UART_HandleTypeDef * getUARThandle(){ + return &huart1; + } + + /** + * @brief Function that initializes the printable object given by getUARThandle(). + */ void initPrintable() { // Initialize the mutex for UART communication. @@ -55,7 +66,7 @@ namespace sta // Initialize the UART interface and printable object. UARTSettings settings = { .mode = UARTMode::RX_TX }; - STM32UART * intf_ptr = new STM32UART(&huart2, settings, mutex); + STM32UART * intf_ptr = new STM32UART(getUARThandle(), settings, mutex); Debug = new PrintableUART(intf_ptr); STA_DEBUG_PRINTLN("UART SUCCESSFULLY INITIALIZED"); From 50fc23ed646db0152e861031f54a404f162a79b8 Mon Sep 17 00:00:00 2001 From: "@CarlWachter" Date: Sat, 6 Jan 2024 15:22:41 +0100 Subject: [PATCH 2/3] Feature: Variable for USART handle --- src/startup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/startup.cpp b/src/startup.cpp index fe3e085..53fbc56 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -53,7 +53,7 @@ namespace sta */ STA_WEAK UART_HandleTypeDef * getUARThandle(){ - return &huart1; + return &STA_STM32_USART_HANDLE; } /** From c78ccccd195dc2c9f7143693bd083edc4ebfae67 Mon Sep 17 00:00:00 2001 From: "@CarlWachter" Date: Sat, 6 Jan 2024 15:24:22 +0100 Subject: [PATCH 3/3] Fix: Doxygen grouping startup --- src/startup.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/startup.cpp b/src/startup.cpp index 53fbc56..73a5b21 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -50,6 +50,8 @@ namespace sta { /** * @brief Function that returns the UART handle used for debugging. Override it in userspace to adjust. + * + * @ingroup tacos_startup */ STA_WEAK UART_HandleTypeDef * getUARThandle(){ @@ -58,6 +60,8 @@ namespace sta /** * @brief Function that initializes the printable object given by getUARThandle(). + * + * @ingroup tacos_startup */ void initPrintable() {