From 3c5ed4b1088a7d80f042baae4a8d36397904b548 Mon Sep 17 00:00:00 2001 From: mazhiyuan Date: Wed, 13 Oct 2021 15:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstm32g=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E8=8A=AF=E7=89=87=E4=B8=B2=E5=8F=A3=E4=B8=AD?= =?UTF-8?q?=E6=96=AD=E4=B8=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HAL_Drivers/config/g0/uart_config.h | 89 +++++++++++++++++-- 1 file changed, 80 insertions(+), 9 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h index 3cbb77eefd..fd8cdab194 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h @@ -13,6 +13,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #if defined(BSP_USING_LPUART1) #ifndef LPUART1_CONFIG #define LPUART1_CONFIG \ @@ -61,12 +65,21 @@ #if defined(BSP_USING_UART2) #ifndef UART2_CONFIG +#if defined(STM32G0B1xx) || defined(STM32G0C1xx) +#define UART2_CONFIG \ + { \ + .name = "uart2", \ + .Instance = USART2, \ + .irq_type = USART2_LPUART2_IRQn , \ + } +#else #define UART2_CONFIG \ { \ .name = "uart2", \ .Instance = USART2, \ .irq_type = USART2_IRQn, \ } +#endif /* defined(STM32G0B1xx) || defined(STM32G0C1xx) */ #endif /* UART2_CONFIG */ #endif /* BSP_USING_UART2 */ @@ -84,21 +97,42 @@ #if defined(BSP_USING_UART3) #ifndef UART3_CONFIG -#ifndef SOC_SERIES_STM32G0 +#if defined(STM32G0B1xx) || defined(STM32G0C1xx) #define UART3_CONFIG \ { \ .name = "uart3", \ .Instance = USART3, \ - .irq_type = USART3_IRQn, \ + .irq_type = USART3_4_5_6_LPUART1_IRQn, \ } -#else +#elif defined(STM32G070xx) +#define UART3_CONFIG \ + { \ + .name = "uart3", \ + .Instance = USART3, \ + .irq_type = USART3_4_IRQn, \ + } +#elif defined(STM32G071xx) || defined(STM32G081xx) #define UART3_CONFIG \ { \ .name = "uart3", \ .Instance = USART3, \ .irq_type = USART3_4_LPUART1_IRQn, \ } -#endif /* SOC_SERIES_STM32G0 */ +#elif defined(STM32G0B0xx) +#define UART3_CONFIG \ + { \ + .name = "uart3", \ + .Instance = USART3, \ + .irq_type = USART3_4_5_6_IRQn, \ + } +#else +#define UART3_CONFIG \ + { \ + .name = "uart3", \ + .Instance = USART3, \ + .irq_type = USART3_IRQn, \ + } +#endif /* defined(STM32G0B1xx) || defined(STM32G0C1xx) */ #endif /* UART3_CONFIG */ #endif /* BSP_USING_UART3 */ @@ -116,22 +150,43 @@ #if defined(BSP_USING_UART4) #ifndef UART4_CONFIG -#ifndef SOC_SERIES_STM32G0 +#if defined(STM32G0B1xx) || defined(STM32G0C1xx) #define UART4_CONFIG \ { \ .name = "uart4", \ - .Instance = UART4, \ - .irq_type = UART4_IRQn, \ + .Instance = USART4, \ + .irq_type = USART3_4_5_6_LPUART1_IRQn, \ } -#else +#elif defined(STM32G070xx) +#define UART4_CONFIG \ + { \ + .name = "uart4", \ + .Instance = USART4, \ + .irq_type = USART3_4_IRQn, \ + } +#elif defined(STM32G071xx) || defined(STM32G081xx) #define UART4_CONFIG \ { \ .name = "uart4", \ .Instance = USART4, \ .irq_type = USART3_4_LPUART1_IRQn, \ } +#elif defined(STM32G0B0xx) +#define UART4_CONFIG \ + { \ + .name = "uart4", \ + .Instance = USART4, \ + .irq_type = USART3_4_5_6_IRQn, \ + } +#else +#define UART4_CONFIG \ + { \ + .name = "uart4", \ + .Instance = USART4, \ + .irq_type = USART4_IRQn, \ + } +#endif /* defined(STM32G0B1xx) || defined(STM32G0C1xx) */ #endif /* UART4_CONFIG */ -#endif /* SOC_SERIES_STM32G0 */ #endif /* BSP_USING_UART4 */ #if defined(BSP_UART4_RX_USING_DMA) @@ -148,12 +203,28 @@ #if defined(BSP_USING_UART5) #ifndef UART5_CONFIG +#if defined(STM32G0B1xx) || defined(STM32G0C1xx) +#define UART5_CONFIG \ + { \ + .name = "uart5", \ + .Instance = UART5, \ + .irq_type = USART3_4_5_6_LPUART1_IRQn, \ + } +#elif defined(STM32G0B0xx) +#define UART5_CONFIG \ + { \ + .name = "uart5", \ + .Instance = UART5, \ + .irq_type = USART3_4_5_6_IRQn, \ + } +#else #define UART5_CONFIG \ { \ .name = "uart5", \ .Instance = UART5, \ .irq_type = UART5_IRQn, \ } +#endif /* defined(STM32G0B1xx) || defined(STM32G0C1xx) */ #endif /* UART5_CONFIG */ #endif /* BSP_USING_UART5 */ -- GitLab