summaryrefslogtreecommitdiff
path: root/ports/esp8266/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/esp8266/uart.c')
-rw-r--r--ports/esp8266/uart.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ports/esp8266/uart.c b/ports/esp8266/uart.c
index 978a7efc3..117cd1bf6 100644
--- a/ports/esp8266/uart.c
+++ b/ports/esp8266/uart.c
@@ -111,6 +111,15 @@ void uart_tx_one_char(uint8 uart, uint8 TxChar) {
WRITE_PERI_REG(UART_FIFO(uart), TxChar);
}
+int uart_txdone(uint8 uart) {
+ 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) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
void uart_flush(uint8 uart) {
while (true) {
uint32 fifo_cnt = READ_PERI_REG(UART_STATUS(uart)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S);