diff options
Diffstat (limited to 'esp8266/uart.c')
-rw-r--r-- | esp8266/uart.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/esp8266/uart.c b/esp8266/uart.c index 0d180aa55..f37193539 100644 --- a/esp8266/uart.c +++ b/esp8266/uart.c @@ -24,6 +24,9 @@ // UartDev is defined and initialized in rom code. extern UartDevice UartDev; +// the uart to which OS messages go; -1 to disable +static int uart_os = UART_OS; + /* unused // circular buffer for RX buffering #define RX_BUF_SIZE (256) @@ -134,15 +137,23 @@ void uart_flush(uint8 uart) { *******************************************************************************/ static void ICACHE_FLASH_ATTR uart_os_write_char(char c) { + if (uart_os == -1) { + return; + } if (c == '\n') { - uart_tx_one_char(UART_OS, '\r'); - uart_tx_one_char(UART_OS, '\n'); + uart_tx_one_char(uart_os, '\r'); + uart_tx_one_char(uart_os, '\n'); } else if (c == '\r') { } else { - uart_tx_one_char(UART_OS, c); + uart_tx_one_char(uart_os, c); } } +void ICACHE_FLASH_ATTR +uart_os_config(int uart) { + uart_os = uart; +} + /****************************************************************************** * FunctionName : uart0_rx_intr_handler * Description : Internal used function |