STM32G4 : add UART5 in IRQ init

pull/15269/head
Jerome Coutant 2022-04-19 16:54:20 +02:00
parent decc6d022c
commit 9b1d4ee62e
2 changed files with 34 additions and 9 deletions

View File

@ -51,7 +51,9 @@ typedef enum {
UART_1 = (int)USART1_BASE,
UART_2 = (int)USART2_BASE,
UART_3 = (int)USART3_BASE,
#if defined UART4_BASE
UART_4 = (int)UART4_BASE,
#endif
#if defined UART5_BASE
UART_5 = (int)UART5_BASE,
#endif

View File

@ -17,8 +17,13 @@
#include "serial_api_hal.h"
#if defined (STM32GBK1CB)
#define UART_NUM (4)
#elif defined (STM32G431xx) || defined (STM32G441xx)
#define UART_NUM (5)
#else
#define UART_NUM (6)
#endif
uint32_t serial_irq_ids[UART_NUM] = {0};
UART_HandleTypeDef uart_handlers[UART_NUM];
@ -80,13 +85,20 @@ static void uart3_irq(void)
}
#endif
#if defined(USART4_BASE)
#if defined(UART4_BASE)
static void uart4_irq(void)
{
uart_irq(UART_4);
}
#endif
#if defined(UART5_BASE)
static void uart5_irq(void)
{
uart_irq(UART_5);
}
#endif
#if defined(LPUART1_BASE)
static void lpuart1_irq(void)
{
@ -130,13 +142,20 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
}
#endif
#if defined(USART4_BASE)
#if defined(UART4_BASE)
if (obj_s->uart == UART_4) {
irq_n = USART3_4_LPUART1_IRQn;
irq_n = UART4_IRQn;
vector = (uint32_t)&uart4_irq;
}
#endif
#if defined(UART5_BASE)
if (obj_s->uart == UART_5) {
irq_n = UART5_IRQn;
vector = (uint32_t)&uart5_irq;
}
#endif
#if defined(LPUART1_BASE)
if (obj_s->uart == LPUART_1) {
irq_n = LPUART1_IRQn;
@ -318,18 +337,22 @@ static IRQn_Type serial_get_irq_n(UARTName uart_name)
#endif
#if defined(USART3_BASE)
case UART_3:
irq_n = USART3_4_LPUART1_IRQn;
irq_n = USART3_IRQn;
break;
#endif
#if defined(USART4_BASE)
#if defined(UART4_BASE)
case UART_4:
irq_n = USART3_4_LPUART1_IRQn;
irq_n = UART4_IRQn;
break;
#endif
#if defined(UART5_BASE)
case UART_5:
irq_n = UART5_IRQn;
break;
#endif
#if defined(LPUART1_BASE)
case LPUART_1:
irq_n = USART3_4_LPUART1_IRQn;
irq_n = LPUART1_IRQn;
break;
#endif
default: