TinyGPU
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DisplayDriverParallel8< RGB_T > Class Template Reference

Common base class for 8-bit parallel ("Intel 8080"-style) TFT display drivers: 8 data lines (D0-D7), WR (write strobe), RD (read strobe, unused - this class only writes), RS/DC (command vs. data) and CS. This is the bus MCUFRIEND-style shields and many 40-pin parallel TFT breakout boards use, wired straight to 8 GPIOs rather than through SPI/QSPI - no dedicated bus peripheral is assumed, every data line and the WR strobe is bit-banged via digitalWrite(), the same portable approach TinyGPU/Input/TouchDriverArduino.h's TouchDriverBitBang uses for a resistive touch panel's four GPIO pins. This trades throughput (one digitalWrite() per bit, per byte) for working unmodified on any Arduino core - a hardware-accelerated 8080 driver (e.g. ESP32's LCD_CAM/ esp_lcd_panel_io_i80) would be faster but ties the implementation to one platform's peripheral, the same tradeoff DisplayDriverQSPI.h already makes explicitly for ESP32-only QSPI. More...

#include <DisplayDriverParallel8.h>

Inheritance diagram for DisplayDriverParallel8< RGB_T >:
Inheritance graph
[legend]
Collaboration diagram for DisplayDriverParallel8< RGB_T >:
Collaboration graph
[legend]

Public Member Functions

 DisplayDriverParallel8 (int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5, int8_t d6, int8_t d7, int8_t wr, int8_t dc, int8_t cs=-1, int8_t rd=-1, int8_t rst=-1, size_t xOffset=0, size_t yOffset=0, size_t width=240, size_t height=320)
 
size_t width () const override
 
size_t height () const override
 
bool writeData (ISurface< RGB_T > &surface) override
 
bool writeData (ISurface< RGB_T > &surface, size_t x, size_t y) override
 
- Public Member Functions inherited from DisplayDriver< RGB_T >
virtual ~DisplayDriver ()=default
 
virtual bool begin ()=0
 
virtual void end ()
 
virtual bool writeData (ISurface< RGB_T > &surface)=0
 
virtual bool writeData (ISurface< RGB_T > &surface, size_t x, size_t y)=0
 
virtual void setRotation (DisplayRotation rotation)
 
virtual size_t width () const =0
 
virtual size_t height () const =0
 
void writeColor (size_t width, size_t height, RGB_T color)
 

Protected Member Functions

void setColumnRowAddress (size_t x, size_t y, size_t w, size_t h)
 
bool setAddressWindow (size_t x, size_t y, size_t w, size_t h) override
 
void setupPinsAndReset ()
 
void writeCommand (uint8_t cmd)
 
void writeData16 (uint16_t d1, uint16_t d2)
 
void writeData8 (uint8_t data)
 
void writeDataN (std::initializer_list< uint8_t > bytes)
 
virtual bool setAddressWindow (size_t x, size_t y, size_t w, size_t h)=0
 

Protected Attributes

int8_t d_ [8]
 
int8_t wr_
 
int8_t dc_
 
int8_t cs_
 
int8_t rd_
 
int8_t rst_
 
size_t xOffset_
 
size_t yOffset_
 
size_t width_
 
size_t height_
 
- Protected Attributes inherited from DisplayDriver< RGB_T >
Font5x7< RGB_T > defaultFont
 

Detailed Description

template<typename RGB_T = RGB565>
class tinygpu::DisplayDriverParallel8< RGB_T >

Common base class for 8-bit parallel ("Intel 8080"-style) TFT display drivers: 8 data lines (D0-D7), WR (write strobe), RD (read strobe, unused - this class only writes), RS/DC (command vs. data) and CS. This is the bus MCUFRIEND-style shields and many 40-pin parallel TFT breakout boards use, wired straight to 8 GPIOs rather than through SPI/QSPI - no dedicated bus peripheral is assumed, every data line and the WR strobe is bit-banged via digitalWrite(), the same portable approach TinyGPU/Input/TouchDriverArduino.h's TouchDriverBitBang uses for a resistive touch panel's four GPIO pins. This trades throughput (one digitalWrite() per bit, per byte) for working unmodified on any Arduino core - a hardware-accelerated 8080 driver (e.g. ESP32's LCD_CAM/ esp_lcd_panel_io_i80) would be faster but ties the implementation to one platform's peripheral, the same tradeoff DisplayDriverQSPI.h already makes explicitly for ESP32-only QSPI.

The command/parameter protocol on the wire (0x2A/0x2B/0x2C column/row/ RAM-write, 0x36 MADCTL, 0x3A pixel format, ...) is identical to the SPI wiring of the same controller families (see DisplayDriverSPI.h) - only how each command/data byte reaches the panel differs, so concrete drivers here mirror DisplayDriverSPI.h's ILI9341Driver/ST7789Driver/... init sequences byte-for-byte.

Constructor & Destructor Documentation

◆ DisplayDriverParallel8()

DisplayDriverParallel8 ( int8_t  d0,
int8_t  d1,
int8_t  d2,
int8_t  d3,
int8_t  d4,
int8_t  d5,
int8_t  d6,
int8_t  d7,
int8_t  wr,
int8_t  dc,
int8_t  cs = -1,
int8_t  rd = -1,
int8_t  rst = -1,
size_t  xOffset = 0,
size_t  yOffset = 0,
size_t  width = 240,
size_t  height = 320 
)
inline
Parameters
d0..d7the 8 data lines, D0 = least significant bit.
wrwrite-strobe pin: data is latched by the panel on WR's rising edge.
dcdata/command ("RS") select pin: LOW selects command, HIGH selects data - same polarity/role as DisplayDriverSPI's dc pin.
cschip-select pin, or -1 if the panel has CS permanently tied low (common on single-panel parallel shields).
rdread-strobe pin, or -1 if unused - this class never reads from the panel, so it only needs to hold RD in its idle (HIGH, inactive) state so the panel doesn't drive the (shared, bidirectional on some boards) data bus back.
rstreset pin, or -1 if not wired up (e.g. tied to the MCU's own reset).
width/heightthe panel's addressable resolution, as reported by width()/height() - subclasses with a rotation concept (e.g. ILI9341Driver8080) override width()/height() themselves instead and can ignore these.

Member Function Documentation

◆ height()

size_t height ( ) const
inlineoverridevirtual

Implements DisplayDriver< RGB_T >.

Reimplemented in ILI9341Driver8080< RGB_T >.

◆ setAddressWindow()

bool setAddressWindow ( size_t  x,
size_t  y,
size_t  w,
size_t  h 
)
inlineoverrideprotectedvirtual

◆ setColumnRowAddress()

void setColumnRowAddress ( size_t  x,
size_t  y,
size_t  w,
size_t  h 
)
inlineprotected

◆ setupPinsAndReset()

void setupPinsAndReset ( )
inlineprotected

◆ width()

size_t width ( ) const
inlineoverridevirtual

Current addressable panel width/height in pixels - for a driver that supports setRotation(), these reflect the current rotation (landscape vs portrait swaps them; see isLandscapeFamily()), not necessarily the panel's native/physical orientation. Callers that need to lay out content (e.g. OutputTinyGPU's scale_to_fit target, or clearScreen()'s band loop) should read these fresh rather than caching their own copy, so a setRotation() call is picked up automatically without needing separate bookkeeping.

Implements DisplayDriver< RGB_T >.

Reimplemented in ILI9341Driver8080< RGB_T >.

◆ writeCommand()

void writeCommand ( uint8_t  cmd)
inlineprotected

◆ writeData() [1/2]

bool writeData ( ISurface< RGB_T > &  surface)
inlineoverridevirtual

◆ writeData() [2/2]

bool writeData ( ISurface< RGB_T > &  surface,
size_t  x,
size_t  y 
)
inlineoverridevirtual

◆ writeData16()

void writeData16 ( uint16_t  d1,
uint16_t  d2 
)
inlineprotected

◆ writeData8()

void writeData8 ( uint8_t  data)
inlineprotected

◆ writeDataN()

void writeDataN ( std::initializer_list< uint8_t >  bytes)
inlineprotected

Writes each byte as a separate writeData8() call - a convenience for sending a command's multi-byte parameter list during init sequences, matching DisplayDriverSPI::writeDataN().

Member Data Documentation

◆ cs_

int8_t cs_
protected

◆ d_

int8_t d_[8]
protected

◆ dc_

int8_t dc_
protected

◆ height_

size_t height_
protected

◆ rd_

int8_t rd_
protected

◆ rst_

int8_t rst_
protected

◆ width_

size_t width_
protected

◆ wr_

int8_t wr_
protected

◆ xOffset_

size_t xOffset_
protected

◆ yOffset_

size_t yOffset_
protected

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