添加USART1/2/3的管脚配置操作 (#6039)

This commit is contained in:
xiaoxiaolisunny 2022-06-08 23:29:32 +08:00 committed by GitHub
parent 4fa1beb812
commit e622ef3aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -23,6 +23,27 @@ rt_err_t rt_hw_board_uart_init(CM_USART_TypeDef *USARTx)
switch ((rt_uint32_t)USARTx)
{
#if defined(BSP_USING_UART1)
case (rt_uint32_t)CM_USART1:
/* Configure USART RX/TX pin. */
GPIO_SetFunc(USART1_RX_PORT, USART1_RX_PIN, GPIO_FUNC_33);
GPIO_SetFunc(USART1_TX_PORT, USART1_TX_PIN, GPIO_FUNC_32);
break;
#endif
#if defined(BSP_USING_UART2)
case (rt_uint32_t)CM_USART2:
/* Configure USART RX/TX pin. */
GPIO_SetFunc(USART2_RX_PORT, USART2_RX_PIN, GPIO_FUNC_37);
GPIO_SetFunc(USART2_TX_PORT, USART2_TX_PIN, GPIO_FUNC_36);
break;
#endif
#if defined(BSP_USING_UART3)
case (rt_uint32_t)CM_USART3:
/* Configure USART RX/TX pin. */
GPIO_SetFunc(USART3_RX_PORT, USART3_RX_PIN, GPIO_FUNC_33);
GPIO_SetFunc(USART3_TX_PORT, USART3_TX_PIN, GPIO_FUNC_32);
break;
#endif
#if defined(BSP_USING_UART4)
case (rt_uint32_t)CM_USART4:
/* Configure USART RX/TX pin. */