Remove debug serial logic from stm32/uart module

This commit is contained in:
Henrik Stickann
2023-01-20 02:24:00 +01:00
parent dd2983821e
commit c1edafa59e
4 changed files with 60 additions and 62 deletions

30
src/debug_serial.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include <sta/debug_serial.hpp>
#ifdef STA_DEBUG_SERIAL_ENABLED
#ifdef STA_PLATFORM_STM32
#include <sta/stm32/uart.hpp>
#include <usart.h>
// Set platform UART alias
using PlatformUART = sta::STM32UART;
#endif // STA_PLATFORM_STM32
namespace
{
// Create platform specific serial interface
PlatformUART platformDebugSerial(&STA_DEBUG_SERIAL_UART);
}
namespace sta
{
// Create debug serial object using platform specific serial interface
PrintableUART DebugSerial(&platformDebugSerial);
} // namespace sta
#endif // STA_DEBUG_SERIAL_ENABLED

View File

@@ -22,22 +22,4 @@ namespace sta
} // namespace sta
#ifdef STA_STM32_UART_DEBUG_SERIAL
// Get extern declaration for DebugSerial because const namespace level variables have internal linkage by default
#include <sta/debug_serial.hpp>
#include <usart.h>
namespace sta
{
STM32UART gStm32DebugSerial(&STA_STM32_UART_DEBUG_SERIAL);
// Used by <sta/debug.hpp>
PrintableUART DebugSerial(&gStm32DebugSerial);
} // namespace sta
#endif // STA_STM32_UART_DEBUG_SERIAL
#endif // STA_STM32_UART_ENABLED