Browse Source

修改串口V2的putc顺序

1.顺序修改回V1,保证每次都是当前数据发送完才跳出
少年老王 2 years ago
parent
commit
12ec87d64e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c

+ 1 - 1
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;
 }