Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32: fix compilation error when not using uart #2959

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions hw/bsp/stm32g0/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ void USB_UCPD1_2_IRQHandler(void) {
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
#ifdef UART_DEV
UART_HandleTypeDef UartHandle;
#endif

void board_init(void) {
HAL_Init(); // required for HAL_RCC_Osc TODO check with freeRTOS
Expand All @@ -59,8 +61,6 @@ void board_init(void) {
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_PWR_CLK_ENABLE();

UART_CLK_EN();

#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
Expand Down Expand Up @@ -91,6 +91,8 @@ void board_init(void) {
HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct);

#ifdef UART_DEV
UART_CLK_EN();

// UART
GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
Expand Down Expand Up @@ -167,7 +169,6 @@ int board_uart_write(void const *buf, int len) {
#else
(void) buf;
(void) len;
(void) UartHandle;
return 0;
#endif
}
Expand Down
7 changes: 4 additions & 3 deletions hw/bsp/stm32g4/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -197,7 +199,6 @@ int board_uart_write(void const *buf, int len) {
#else
(void) buf;
(void) len;
(void) UartHandle;
return 0;
#endif
}
Expand Down
7 changes: 4 additions & 3 deletions hw/bsp/stm32h5/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ void USB_DRD_FS_IRQHandler(void) {
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
#ifdef UART_DEV
UART_HandleTypeDef UartHandle;
#endif

void board_init(void) {
HAL_Init(); // required for HAL_RCC_Osc TODO check with freeRTOS
Expand All @@ -82,8 +84,6 @@ void board_init(void) {
__HAL_RCC_GPIOI_CLK_ENABLE();
#endif

UART_CLK_EN();

#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
Expand Down Expand Up @@ -114,6 +114,8 @@ void board_init(void) {
HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct);

#ifdef UART_DEV
UART_CLK_EN();

// UART
GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
Expand Down Expand Up @@ -192,7 +194,6 @@ int board_uart_write(void const* buf, int len) {
#else
(void) buf;
(void) len;
(void) UartHandle;
return 0;
#endif
}
Expand Down
8 changes: 5 additions & 3 deletions hw/bsp/stm32wb/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void USB_LP_IRQHandler(void) {
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM
//--------------------------------------------------------------------+
#ifdef UART_DEV
UART_HandleTypeDef UartHandle;
#endif

void board_init(void) {
board_clock_init();
Expand All @@ -58,8 +60,6 @@ void board_init(void) {
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();

UART_CLK_EN();

#if CFG_TUSB_OS == OPT_OS_NONE
// 1ms tick timer
SysTick_Config(SystemCoreClock / 1000);
Expand Down Expand Up @@ -102,6 +102,8 @@ void board_init(void) {
HAL_GPIO_Init(BUTTON_PORT, &GPIO_InitStruct);

#ifdef UART_DEV
UART_CLK_EN();

// UART
GPIO_InitStruct.Pin = UART_TX_PIN | UART_RX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
Expand Down Expand Up @@ -159,7 +161,7 @@ int board_uart_write(void const* buf, int len) {
HAL_UART_Transmit(&UartHandle, (uint8_t*) (uintptr_t) buf, len, 0xffff);
return len;
#else
(void) buf; (void) len; (void) UartHandle;
(void) buf; (void) len;
return 0;
#endif
}
Expand Down
Loading