diff --git a/esp8266/uart.c b/esp8266/uart.c
index aa3d368b7c03dcc443572de499488c6ac4dc0d4c..942c397e9090614dc5ca2378e559157a1cecf357 100644
--- a/esp8266/uart.c
+++ b/esp8266/uart.c
@@ -105,6 +105,15 @@ void uart_tx_one_char(uint8 uart, uint8 TxChar) {
     WRITE_PERI_REG(UART_FIFO(uart), TxChar);
 }
 
+void uart_flush(uint8 uart) {
+    while (true) {
+        uint32 fifo_cnt = READ_PERI_REG(UART_STATUS(uart)) & (UART_TXFIFO_CNT<<UART_TXFIFO_CNT_S);
+        if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) == 0) {
+            break;
+        }
+    }
+}
+
 /******************************************************************************
  * FunctionName : uart1_write_char
  * Description  : Internal used function
diff --git a/esp8266/uart.h b/esp8266/uart.h
index ce1438baf3f81eae486b9a3de1c5316df6531599..ed0dcfb4457c3a904c1329f7f622f7653a07cc4f 100644
--- a/esp8266/uart.h
+++ b/esp8266/uart.h
@@ -92,5 +92,6 @@ typedef struct {
 void uart_init(UartBautRate uart0_br, UartBautRate uart1_br);
 int uart0_rx(void);
 void uart_tx_one_char(uint8 uart, uint8 TxChar);
+void uart_flush(uint8 uart);
 
 #endif // _INCLUDED_UART_H_