Commit d61e7a6d authored by Chris Mason's avatar Chris Mason Committed by Damien George

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

parent 9ca8a503
......@@ -196,7 +196,7 @@
#define PYB_EXTI_NUM_VECTORS (30) // TODO (22 configurable, 7 direct)
#define MICROPY_HW_MAX_I2C (3)
#define MICROPY_HW_MAX_TIMER (22)
#define MICROPY_HW_MAX_UART (4)
#define MICROPY_HW_MAX_UART (5)
// Configuration for STM32L4 series
#elif defined(STM32L4)
......
......@@ -731,6 +731,15 @@ void USART3_8_IRQHandler(void) {
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
void USART3_IRQHandler(void) {
......
......@@ -247,6 +247,10 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
UARTx = USART4;
irqn = USART3_8_IRQn;
__HAL_RCC_USART4_CLK_ENABLE();
#elif defined(STM32L0)
UARTx = USART4;
irqn = USART4_5_IRQn;
__HAL_RCC_USART4_CLK_ENABLE();
#else
UARTx = UART4;
irqn = UART4_IRQn;
......@@ -274,6 +278,10 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
UARTx = USART5;
irqn = USART3_8_IRQn;
__HAL_RCC_USART5_CLK_ENABLE();
#elif defined(STM32L0)
UARTx = USART5;
irqn = USART4_5_IRQn;
__HAL_RCC_USART5_CLK_ENABLE();
#else
UARTx = UART5;
irqn = UART5_IRQn;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment