void HardwareSerial::flush() { if(!_uart || !uart_tx_enabled(_uart)) { return; } uart_wait_tx_empty(_uart); }
int HardwareSerial::availableForWrite(void) { if(!_uart || !uart_tx_enabled(_uart)) { return 0; } return static_cast<int>(uart_tx_free(_uart)); }
irom void __serial_flush(uart_t *_uart) { if(!_uart || !uart_tx_enabled(_uart)) { return; } uart_wait_tx_empty(_uart); }
irom uint8_t __serial_availableForWrite(uart_t *_uart) { if(!_uart || !uart_tx_enabled(_uart)) { return 0; } return uart_tx_free(_uart); }
size_t HardwareSerial::write(uint8_t c) { if(!_uart || !uart_tx_enabled(_uart)) { return 0; } uart_write_char(_uart, c); return 1; }
irom size_t __serial_write(uart_t *_uart, char c) { if(!_uart || !uart_tx_enabled(_uart)) { return 0; } uart_write_char(_uart, c); return 1; }
void HardwareSerial::flush() { if(!_uart || !uart_tx_enabled(_uart)) { return; } uart_wait_tx_empty(_uart); //Workaround for a bug in serial not actually being finished yet //Wait for 8 data bits, 1 parity and 2 stop bits, just in case delayMicroseconds(11000000 / uart_get_baudrate(_uart) + 1); }
void HardwareSerial::setDebugOutput(bool en) { if(!_uart) { return; } if(en) { if(uart_tx_enabled(_uart)) { uart_set_debug(_uart_nr); } else { uart_set_debug(UART_NO); } } else { // disable debug for this interface if(uart_get_debug() == _uart_nr) { uart_set_debug(UART_NO); } } }
bool HardwareSerial::isTxEnabled(void) { return _uart && uart_tx_enabled(_uart); }