stm32/uart: Add support for UART10 when it's a USART.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2023-09-13 16:08:25 +10:00
parent a4d28e5279
commit dc99840b3a
2 changed files with 22 additions and 1 deletions

View File

@ -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)

View File

@ -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
) {