FabGL2 2.0.0
ESP32 Display Controller and Graphics Library for ESP-IDF
Loading...
Searching...
No Matches
UARTStream Class Reference

A Stream implemented on top of the ESP-IDF UART driver. More...

#include <uartstream.h>

Inheritance diagram for UARTStream:

Public Member Functions

bool begin (int port=0, int baud=0, int rxPin=-1, int txPin=-1, int rxBufferSize=1024, int txBufferSize=0)
 Initializes the UART.
void end ()
 Uninstalls the UART driver.
void flush ()
 Waits until all data has been transmitted.
size_t readBytes (uint8_t *buffer, size_t length)
 Reads up to length bytes, waiting until all bytes have been received or the timeout expires.
void setTimeout (int timeOutMS)
 Sets the timeout used by readBytes().

Detailed Description

A Stream implemented on top of the ESP-IDF UART driver.

It can be used wherever FabGL requires a Stream object (e.g. Terminal::setLogStream()). On UART 0 it shares the ESP-IDF console (the one used by printf() and "idf.py monitor").

Example:

fabgl::UARTStream Console;

extern "C" void app_main() {
  Console.begin();                 // UART0, 115200 baud, console pins
  Terminal.setLogStream(Console);
  ...
  if (Console.available())
    int c = Console.read();
}

Definition at line 68 of file uartstream.h.


The documentation for this class was generated from the following files: