From 12ec87d64ec53f2395269713b8bf62bdb522e795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=B9=B4=E8=80=81=E7=8E=8B?= <710454786@qq.com> Date: Wed, 30 Nov 2022 20:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=B2=E5=8F=A3V2=E7=9A=84?= =?UTF-8?q?putc=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.顺序修改回V1,保证每次都是当前数据发送完才跳出 --- bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c b/bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c index 90b4d928c5..49fb0990a1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c @@ -302,9 +302,9 @@ static int stm32_putc(struct rt_serial_device *serial, char c) RT_ASSERT(serial != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); - while (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) == RESET); UART_INSTANCE_CLEAR_FUNCTION(&(uart->handle), UART_FLAG_TC); UART_SET_TDR(&uart->handle, c); + while (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) == RESET); return 1; } -- GitLab