diff options
| author | Damien George <damien@micropython.org> | 2023-09-13 16:08:25 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-09-13 16:48:15 +1000 |
| commit | dc99840b3a0e8afd97ab3b92ad2042233b000225 (patch) | |
| tree | 2abebbc99bf3d4bfb573843f7b3aaaa4a612b242 | |
| parent | a4d28e5279ff8d4b8b4676abcd86687c44be5e64 (diff) | |
stm32/uart: Add support for UART10 when it's a USART.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | ports/stm32/stm32_it.c | 8 | ||||
| -rw-r--r-- | ports/stm32/uart.c | 15 |
2 files changed, 22 insertions, 1 deletions
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index 7363e26e8..50fd56eca 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -1015,6 +1015,14 @@ void UART10_IRQHandler(void) { } #endif +#if defined(USART10) +void USART10_IRQHandler(void) { + IRQ_ENTER(USART10_IRQn); + uart_irq_handler(10); + IRQ_EXIT(USART10_IRQn); +} +#endif + #endif #if defined(LPUART1) diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index 7a2a3a958..1823596df 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -491,9 +491,15 @@ bool uart_init(pyb_uart_obj_t *uart_obj, #if defined(MICROPY_HW_UART10_TX) && defined(MICROPY_HW_UART10_RX) case PYB_UART_10: uart_unit = 10; + #if defined(UART10) UARTx = UART10; irqn = UART10_IRQn; __HAL_RCC_UART10_CLK_ENABLE(); + #else + UARTx = USART10; + irqn = USART10_IRQn; + __HAL_RCC_USART10_CLK_ENABLE(); + #endif pins[0] = MICROPY_HW_UART10_TX; pins[1] = MICROPY_HW_UART10_RX; break; @@ -771,6 +777,13 @@ void uart_deinit(pyb_uart_obj_t *self) { __HAL_RCC_UART10_RELEASE_RESET(); __HAL_RCC_UART10_CLK_DISABLE(); #endif + #if defined(USART10) + } else if (self->uart_id == 10) { + HAL_NVIC_DisableIRQ(USART10_IRQn); + __HAL_RCC_USART10_FORCE_RESET(); + __HAL_RCC_USART10_RELEASE_RESET(); + __HAL_RCC_USART10_CLK_DISABLE(); + #endif #if defined(LPUART1) } else if (self->uart_id == PYB_LPUART_1) { #if defined(STM32G0) @@ -886,7 +899,7 @@ uint32_t uart_get_source_freq(pyb_uart_obj_t *self) { #if defined(UART9) || self->uart_id == 9 #endif - #if defined(UART10) + #if defined(UART10) || defined(USART10) || self->uart_id == 10 #endif ) { |
