Skip to content
Snippets Groups Projects
Commit d9d4a726 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266/uart: Add uart_flush() function.

parent d3a4d396
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment