Skip to content

Data Bus Class

moononournation edited this page Dec 25, 2022 · 14 revisions
  • CS pin is optional (Some display breakout board does not have CS pin, input GFX_NOT_DEFINED in this case)
  • For the Data Bus class using hardware implementation, you can specify the data speed while calling bus->begin(speed) or gfx->begin(speed); Software implementation simply ignore this parameters.

SPI

Hardware SPI

Underlaying of this data bus class is Arduino generic SPIClass, so it works for most Arduino board that support hardware SPI.

Arduino_DataBus *bus = new Arduino_HWSPI(8 /* DC */, 9 /* CS */);

Software SPI

  • MISO pin is optional (Arduino_GFX not yet have any features read from display)
Arduino_DataBus *bus = new Arduino_SWSPI(8 /* DC */, 9 /* CS */, 13 /* SCK */, 11 /* MOSI */, GFX_NOT_DEFINED /* MISO */);

Parallel Interface

Software Parallel

This is very slow but it works.

  • RD pin is optional (Arduino_GFX not yet have any features read from display), but you still need pull-up RD pin if not connect to a GPIO
Arduino_DataBus *bus = new Arduino_SWPAR8(TFT_DC, TFT_CS, 25 /* WR */, 32 /* RD */, 23 /* D0 */, 19 /* D1 */, 18 /* D2 */, 26 /* D3 */, 21 /* D4 */, 4 /* D5 */, 0 /* D6 */, 2 /* D7 */);

RGB Interface

Currently only ESP32-S3 support RGB Interface.

Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
    18 /* DE */, 17 /* VSYNC */, 16 /* HSYNC */, 21 /* PCLK */,
    4 /* R0 */, 3 /* R1 */, 2 /* R2 */, 1 /* R3 */, 0 /* R4 */,
    10 /* G0 */, 9 /* G1 */, 8 /* G2 */, 7 /* G3 */, 6 /* G4 */, 5 /* G5 */,
    15 /* B0 */, 14 /* B1 */, 13 /* B2 */, 12 /* B3 */, 11 /* B4 */,
    1 /* hsync_polarity */, 40 /* hsync_front_porch */, 48 /* hsync_pulse_width */, 128 /* hsync_back_porch */,
    1 /* vsync_polarity */, 13 /* vsync_front_porch */, 3 /* vsync_pulse_width */, 45 /* vsync_back_porch */);

Platform tailor-made class

Arduino AVR

8-bit port Parallel

This class direct use AVR 8-bit port as parallel interface. Most dev board not breakout all GPIOs of a 8-bit port, so please check your dev board pinout first before try to use it.

  • e.g. Arduino Pro Micro port 2(PB): 17, 15, 16, 14, 8, 9, 10, 11
  • RD pin is optional (Arduino_GFX not yet have any features read from display), but you still need pull-up RD pin if not connect to a GPIO
Arduino_DataBus *bus = new Arduino_AVRPAR8(4 /* DC */, 5 /* CS */, 18 /* WR */, 19 /* RD */, 2 /* PORT */);

Arduino Nano 33 BLE / BLE Sense

There are various SPI class in ArduinoCore-mbed, Arduino_GFX implemented 2 of them.

Mbed SPI

Arduino_DataBus *bus = new Arduino_mbedSPI(8 /* DC */, 9 /* CS */);

Nrfx SPI

Lower level API and faster

  • MISO pin is optional (Arduino_GFX not yet have any features read from display)
Arduino_DataBus *bus = new Arduino_NRFXSPI(8 /* DC */, 9 /* CS */, 13 /* SCK */, 11 /* MOSI */, 12 /* MISO */);

ESP32

Below classes can use with ESP32 family such as ESP32, ESP32-S2, ESP32-S3 and ESP32-C3.

SPI

Support hardware 8-bit and 9-bit SPI

  • DC pin is optional (GFX_NOT_DEFINED means using 9-bit SPI)
  • MISO pin is optional (Arduino_GFX not yet have any features read from display)
  • spi_num can be HSPI or VSPI
Arduino_DataBus *bus = new Arduino_ESP32SPI(27 /* DC */, 5 /* CS */, 18 /* SCK */, 23 /* MOSI */, GFX_NOT_DEFINED /* MISO */, VSPI /* spi_num */);

Parallel

ESP32 parallel classes use pre-generated lookup table to implement a faster software parallel interface.

  • RD pin is optional (Arduino_GFX not yet have any features read from display), but you still need pull-up RD pin if not connect to a GPIO
  • Arduino_ESP32PAR8Q, Arduino_ESP32PAR8QQ, Arduino_ESP32PAR16Q and Arduino_ESP32PAR16QQ are faster variation class but may not work for all pin combinations and displays.

8-bit

Arduino_DataBus *bus = new Arduino_ESP32PAR8(27 /* DC */, 5 /* CS */, 26 /* WR */, GFX_NOT_DEFINED /* RD */,
    16 /* D0 */, 17 /* D1 */, 18 /* D2 */, 19 /* D3 */, 21 /* D4 */, 12 /* D5 */, 23 /* D6 */, 25 /* D7 */);

16-bit

Almost all GPIO 0-31 used up for 16-bit and WR, disable PSRAM to gain 16 and 17 but still no GPIOs remain for CS and RD. Since no further device can be connected, simply connect CS pin to GND keeps enable, RD connect to Vcc keeps disable.

Arduino_DataBus *bus = new Arduino_ESP32PAR16(32 /* DC */, GFX_NOT_DEFINED /* CS */, 21 /* WR */, GFX_NOT_DEFINED /* RD */,
    19 /* D0 */, 23 /* D1 */, 18 /* D2 */, 5 /* D3 */, 17 /* D4 */, 16 /* D5 */, 25 /* D6 */, 26 /* D7 */,
    27 /* D8 */, 14 /* D9 */, 12 /* D10 */, 13 /* D11 */, 15 /* D12 */, 2 /* D13 */, 0 /* D14 */, 4 /* D15 */);

ESP32-S2 addition classes

Parallel

  • RD pin is optional (Arduino_GFX not yet have any features read from display), but you still need pull-up RD pin if not connect to a GPIO
  • Arduino_ESP32S2PAR8Q, and Arduino_ESP32S2PAR16Q are faster variation class but may not work for all displays.

8-bit

Display D0-D7 connect to GPIO 0-7

Arduino_DataBus *bus = new Arduino_ESP32S2PAR8(TFT_DC, TFT_CS, 16 /* WR */, 17 /* RD */);

16-bit

Display D0-D15 connect to GPIO 0-15

Arduino_DataBus *bus = new Arduino_ESP32S2PAR16(TFT_DC, TFT_CS, 16 /* WR */, 17 /* RD */);

ESP32-S3 addition classes

Parallel

ESP32-S3 parallel classes utilize ESP32-S3 i80 LCD interface

8-bit

Arduino_DataBus *bus = new Arduino_ESP32LCD8(
    TFT_DC, TFT_CS, 16 /* WR */, 17 /* RD */,
    0 /* D0 */, 1 /* D1 */, 2 /* D2 */, 3 /* D3 */, 4 /* D4 */, 5 /* D5 */, 6 /* D6 */, 7 /* D7 */);

16-bit

Arduino_DataBus *bus = new Arduino_ESP32LCD16(
    TFT_DC, TFT_CS, 16 /* WR */, 17 /* RD */,
    0 /* D0 */, 1 /* D1 */, 2 /* D2 */, 3 /* D3 */, 4 /* D4 */, 5 /* D5 */, 6 /* D6 */, 7 /* D7 */,
    8 /* D8 */, 9 /* D9 */, 10 /* D10 */, 11 /* D11 */, 12 /* D12 */, 13 /* D13 */, 14 /* D14 */, 15 /* D15 */);

ESP8266

SPI

Arduino_DataBus *bus = new Arduino_ESP8266SPI(5 /* DC */, 15 /* CS */);

Raspberry Pi Pico

SPI

Arduino_DataBus *bus = new Arduino_RPiPicoSPI(27 /* DC */, 17 /* CS */, 18 /* SCK */, 19 /* MOSI */, 16 /* MISO */, spi0 /* spi */);

Parallel

8-bit

Display D0-D7 connect to GPIO 0-7.

Arduino_DataBus *bus = new Arduino_RPiPicoPAR8(27 /* DC */, 17 /* CS */, 18 /* WR */, 19 /* RD */);

16-bit

Display D0-D15 connect to GPIO 0-15.

Arduino_DataBus *bus = new Arduino_RPiPicoPAR16(27 /* DC */, 17 /* CS */, 18 /* WR */, 19 /* RD */);

STM32

Parallel 8-bit

This class direct use STM32 8-bit port as parallel interface and maintained by @monte-monte.

Arduino_DataBus *bus = new Arduino_STM32PAR8(PB7 /* DC */, PB4 /* CS */, PB6 /* WR */, PB0 /* RD */, GPIOA /* PORT */);

Realtek RTL872x

RTL872x parallel classes use pre-generated lookup table to implement a faster software parallel interface.

Parallel 8-bit

  • RD pin is optional (Arduino_GFX not yet have any features read from display), but you still need pull-up RD pin if not connect to a GPIO
Arduino_DataBus *bus = new Arduino_RTLPAR8(0 /* DC */, GFX_NOT_DEFINED /* CS */, 1 /* WR */, GFX_NOT_DEFINED /* RD */, 18 /* D0 */, 22 /* D1 */, 17 /* D2 */, 20 /* D3 */, 19 /* D4 */, 23 /* D5 */, 21 /* D6 */, 16 /* D7 */);

I2C Software SPI

Arduino_XL9535SWSPI is a special class using I2C communication with a XL9535 port expansion chip control the expanded GPIOs to implement a software SPI.

Arduino_DataBus *bus = new Arduino_XL9535SWSPI(8 /* SDA */, 48 /* SCL */, 2 /* XL PWD */, 3 /* XL CS */, 5 /* XL SCK */, 4 /* XL MOSI */);