FabGL
ESP32 Display Controller and Graphics Library

◆ connectSerialPort() [2/2]

void connectSerialPort ( uint32_t  baud,
int  dataLength,
char  parity,
float  stopBits,
int  rxPin,
int  txPin,
FlowControl  flowControl,
bool  inverted = false,
int  rtsPin = -1,
int  ctsPin = -1 
)

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.
dataLengthData word length. 5 = 5 bits, 6 = 6 bits, 7 = 7 bits, 8 = 8 bits
parityParity. 'N' = none, 'E' = even, 'O' = odd
stopBitsNumber of stop bits. 1 = 1 bit, 1.5 = 1.5 bits, 2 = 2 bits, 3 = 3 bits
rxPinUART RX pin GPIO number.
txPinUART TX pin GPIO number.
flowControlFlow control.
invertedIf true RX and TX signals are inverted.
rtsPinRTS signal GPIO number (-1 = not used)
ctsPinCTS signal GPIO number (-1 = not used)

Example:

Terminal.begin(&DisplayController);
Terminal.connectSerialPort(115200, 8, 'N', 1, 34, 2, FlowControl::Software);

Definition at line 542 of file terminal.cpp.