Browse Source

Merge pull request #2048 from greedyhao/master

[bsp/stm32f7-disco] 修复串口驱动编译报错
Bernard Xiong 6 years ago
parent
commit
70cb67245f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      bsp/stm32f7-disco/drivers/drv_usart.c

+ 2 - 1
bsp/stm32f7-disco/drivers/drv_usart.c

@@ -106,8 +106,9 @@ static int drv_putc(struct rt_serial_device *serial, char c)
     struct drv_uart *uart;
     struct drv_uart *uart;
     RT_ASSERT(serial != RT_NULL);
     RT_ASSERT(serial != RT_NULL);
     uart = (struct drv_uart *)serial->parent.user_data;
     uart = (struct drv_uart *)serial->parent.user_data;
-    __HAL_UART_CLEAR_FLAG(&(uart->UartHandle), UART_FLAG_TC);
+    __HAL_UART_CLEAR_IT(&(uart->UartHandle), UART_CLEAR_TCF);
     uart->UartHandle.Instance->TDR = c;
     uart->UartHandle.Instance->TDR = c;
+    while (__HAL_UART_GET_FLAG(&(uart->UartHandle), UART_FLAG_TC) == RESET);
     return 1;
     return 1;
 }
 }