From c6a6dca81a0758b2eafde886446e7599b3528fba Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 24 May 2019 12:28:23 +0200 Subject: [PATCH] empty rx fifo after Tx BRK --- src/emsuart.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emsuart.cpp b/src/emsuart.cpp index 4dde6fe0f..e0b9dd054 100644 --- a/src/emsuart.cpp +++ b/src/emsuart.cpp @@ -237,7 +237,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) { emsuart_loopback(true); USC0(EMSUART_UART) |= (1 << UCBRK); // set - while (!(U0IS & (1 << UIBD))) // wait until BRK detected... + while (!(U0IS & (1 << UIBD))) ; // wait until BRK detected... delayMicroseconds(EMSUART_BIT_TIME / 8); // ~13µs USC0(EMSUART_UART) &= ~(1 << UCBRK); // clear @@ -245,6 +245,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) { emsuart_loopback(false); // disable loopback mode } + emsuart_flush_fifos(); // flush Rx buffer to be sure ETS_UART_INTR_ENABLE(); // receive anything from FIFO... }