summaryrefslogtreecommitdiff
path: root/hw/bsp/stm32g4
diff options
context:
space:
mode:
authorhohoho <[email protected]>2025-01-23 19:56:57 +0100
committerhohoho <[email protected]>2025-01-23 19:56:57 +0100
commit5ca38228308271dda7fdcdeb085de9bb4d6d8f6a (patch)
tree607997d7a7942b750ff9d91d6eeca0e566bb0ace /hw/bsp/stm32g4
parent597446fbeab9524ba675502c3b6a42d51c0b57ad (diff)
stm32: fix conditional compilation error when not using uart
Diffstat (limited to 'hw/bsp/stm32g4')
-rw-r--r--hw/bsp/stm32g4/family.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/bsp/stm32g4/family.c b/hw/bsp/stm32g4/family.c
index d0ef7e503..49ef86db9 100644
--- a/hw/bsp/stm32g4/family.c
+++ b/hw/bsp/stm32g4/family.c
@@ -57,7 +57,9 @@ void UCPD1_IRQHandler(void) {
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
+#ifdef UART_DEV
UART_HandleTypeDef UartHandle;
+#endif
void board_init(void) {
HAL_Init();
@@ -71,8 +73,6 @@ void board_init(void) {
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
- UART_CLK_EN();
-
#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
@@ -107,6 +107,8 @@ void board_init(void) {
HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct);
#ifdef UART_DEV
+ UART_CLK_EN();
+
// UART
memset(&GPIO_InitStruct, 0, sizeof(GPIO_InitStruct));
GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN;
@@ -197,7 +199,6 @@ int board_uart_write(void const *buf, int len) {
#else
(void) buf;
(void) len;
- (void) UartHandle;
return 0;
#endif
}