Skip to content

Data Bus Class

moononournation edited this page May 19, 2021 · 14 revisions
  • CS pin is optional (Some display breakout board does not have CS pin, input -1 in this case)

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 */, -1 /* MISO */);

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

SPI

Support hardware 8-bit and 9-bit SPI

  • DC pin is optional (-1 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 */, -1 /* MISO */, VSPI /* spi_num */);

Parallel 8-bit

  • RD pin is optional (Arduino_GFX not yet have any features read from display)
Arduino_DataBus *bus = new Arduino_ESP32PAR8(27 /* DC */, 5 /* CS */, 26 /* WR */, -1 /* RD */,
    16 /* D0 */, 17 /* D1 */, 18 /* D2 */, 19 /* D3 */, 21 /* D4 */, 12 /* D5 */, 23 /* D6 */, 25 /* D7 */);

Parallel 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 */, -1 /* CS */, 21 /* WR */, -1 /* 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 */);

ESP8266

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

Raspberry Pi Pico

SPI

Arduino_DataBus *bus = new Arduino_RPiPicoSPI(27 /* DC */, 17 /* CS */, PIN_SPI0_SCK /* SCK */, PIN_SPI0_MOSI /* MOSI */, PIN_SPI0_MISO /* 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 */);
Clone this wiki locally