FabGL
ESP32 Display Controller and Graphics Library

◆ connectSerialPort() [2/2]

void connectSerialPort ( uint32_t  baud,
uint32_t  config,
int  rxPin,
int  txPin,
FlowControl  flowControl,
bool  inverted = false 
)

Connects a remote host using UART.

When serial port is set, the typed keys on PS/2 keyboard are encoded as ANSI/VT100 codes and then sent to the specified serial port.
Also replies to terminal queries like terminal identification, cursor position, etc.. will be sent to the serial port.
This method setups the UART2 with specified parameters. Received characters are handlded using interrupts freeing main loop to do something other.

This is the preferred way to connect the Terminal with a serial port.
You may call connectSerialPort whenever a parameters needs to be changed (except for rx and tx pins).

Parameters
baudBaud rate.
configDefines word length, parity and stop bits. Example: SERIAL_8N1.
rxPinUART RX pin GPIO number.
txPinUART TX pin GPIO number.
flowControlFlow control. When set to FlowControl::Software, XON and XOFF characters are automatically sent.
invertedIf true RX and TX signals are inverted.

Example:

Terminal.begin(&DisplayController);
Terminal.connectSerialPort(115200, SERIAL_8N1, 34, 2, FlowControl::Software);

Definition at line 486 of file terminal.cpp.