diff options
author | Damien George <damien.p.george@gmail.com> | 2016-04-06 00:12:58 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-06 00:12:58 +0300 |
commit | 96eca22322e45aa8b6e7e611eabe4e5c6fb93c90 (patch) | |
tree | 406a1e68c15cbf04eadfe120de23ec800fd4d887 /esp8266/uart.c | |
parent | e6a4d4e23c5e3d31436d3cebfabc894d5772c0d8 (diff) |
esp8266: Make destination for vendor OS debug output soft-configurable.
Use esp.osdebug(None) to disable, or esp.osdebug(uart_id) to send output
to a UART.
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 |