stm32/uart: Add support for UART4/5 on L0 MCUs.

This commit is contained in:
Chris Mason 2019-12-05 00:46:24 +11:00 committed by Damien George
parent 9ca8a503ed
commit d61e7a6d8a
3 changed files with 18 additions and 1 deletions

View File

@ -196,7 +196,7 @@
#define PYB_EXTI_NUM_VECTORS (30) // TODO (22 configurable, 7 direct) #define PYB_EXTI_NUM_VECTORS (30) // TODO (22 configurable, 7 direct)
#define MICROPY_HW_MAX_I2C (3) #define MICROPY_HW_MAX_I2C (3)
#define MICROPY_HW_MAX_TIMER (22) #define MICROPY_HW_MAX_TIMER (22)
#define MICROPY_HW_MAX_UART (4) #define MICROPY_HW_MAX_UART (5)
// Configuration for STM32L4 series // Configuration for STM32L4 series
#elif defined(STM32L4) #elif defined(STM32L4)

View File

@ -731,6 +731,15 @@ void USART3_8_IRQHandler(void) {
IRQ_EXIT(USART3_8_IRQn); IRQ_EXIT(USART3_8_IRQn);
} }
#elif defined(STM32L0)
void USART4_5_IRQHandler(void) {
IRQ_ENTER(USART4_5_IRQn);
uart_irq_handler(4);
uart_irq_handler(5);
IRQ_EXIT(USART4_5_IRQn);
}
#else #else
void USART3_IRQHandler(void) { void USART3_IRQHandler(void) {

View File

@ -247,6 +247,10 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
UARTx = USART4; UARTx = USART4;
irqn = USART3_8_IRQn; irqn = USART3_8_IRQn;
__HAL_RCC_USART4_CLK_ENABLE(); __HAL_RCC_USART4_CLK_ENABLE();
#elif defined(STM32L0)
UARTx = USART4;
irqn = USART4_5_IRQn;
__HAL_RCC_USART4_CLK_ENABLE();
#else #else
UARTx = UART4; UARTx = UART4;
irqn = UART4_IRQn; irqn = UART4_IRQn;
@ -274,6 +278,10 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
UARTx = USART5; UARTx = USART5;
irqn = USART3_8_IRQn; irqn = USART3_8_IRQn;
__HAL_RCC_USART5_CLK_ENABLE(); __HAL_RCC_USART5_CLK_ENABLE();
#elif defined(STM32L0)
UARTx = USART5;
irqn = USART4_5_IRQn;
__HAL_RCC_USART5_CLK_ENABLE();
#else #else
UARTx = UART5; UARTx = UART5;
irqn = UART5_IRQn; irqn = UART5_IRQn;