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

Base driver for QSPI ("4-wire quad SPI") TFT panels: 1 clock, 1 chip-select, 4 data lines, no separate D/C pin. Used by a family of compact panel controllers (NV3041A, ST77916, CO5300, SH8601, AXS15231B, ...) that all speak a de-facto-standardized QSPI wire protocol - see IQSPIBus.h for the exact 32-bit command-frame/data layout. More...

#include <DisplayDriverQSPI.h>

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

Public Member Functions

 DisplayDriverQSPI (int8_t cs, int8_t sclk, int8_t d0, int8_t d1, int8_t d2, int8_t d3, size_t width, size_t height, uint32_t pclkHz=40000000, spi_host_device_t host=SPI3_HOST)
 
 DisplayDriverQSPI (IQSPIBus &bus, size_t width, size_t height)
 
void end () override
 
 ~DisplayDriverQSPI () override
 
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

bool beginBus ()
 
bool writeCommand (uint8_t cmd, const uint8_t *param=nullptr, size_t len=0)
 
bool setAddressWindow (size_t x, size_t y, size_t w, size_t h) override
 
virtual bool setAddressWindow (size_t x, size_t y, size_t w, size_t h)=0
 

Protected Attributes

IQSPIBus * bus_ = nullptr
 
size_t width_
 
size_t height_
 
- Protected Attributes inherited from DisplayDriver< RGB_T >
Font5x7< RGB_T > defaultFont
 

Static Protected Attributes

static constexpr uint8_t kCmdRamWrite = 0x2C
 

Detailed Description

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

Base driver for QSPI ("4-wire quad SPI") TFT panels: 1 clock, 1 chip-select, 4 data lines, no separate D/C pin. Used by a family of compact panel controllers (NV3041A, ST77916, CO5300, SH8601, AXS15231B, ...) that all speak a de-facto-standardized QSPI wire protocol - see IQSPIBus.h for the exact 32-bit command-frame/data layout.

The wire protocol is handled by an IQSPIBus (dependency-injected, see the two constructors below), not by this class - this class only turns ISurface writes into writeColor() calls and exposes writeCommand() to subclasses for their chip-specific init sequence, the same division of labor DisplayDriverSPI's setupPinsAndReset() uses for its SPI-panel subclasses. That split is what makes this family portable: adding a platform means implementing IQSPIBus once (see QSPIBusESP32.h, hardware/DMA-backed; QSPIBusBitBang.h, portable software fallback for RP2040/STM32/anything else), while every panel subclass (NV3041ADriver, ...) keeps working unchanged on every platform that has a bus.

Constructor & Destructor Documentation

◆ DisplayDriverQSPI() [1/2]

DisplayDriverQSPI ( int8_t  cs,
int8_t  sclk,
int8_t  d0,
int8_t  d1,
int8_t  d2,
int8_t  d3,
size_t  width,
size_t  height,
uint32_t  pclkHz = 40000000,
spi_host_device_t  host = SPI3_HOST 
)
inline

Pin-based constructor: builds and owns the platform's default IQSPIBus (QSPIBusESP32 on ESP32, QSPIBusBitBang everywhere else). pclkHz only affects the ESP32 backend - QSPIBusBitBang runs as fast as digitalWrite() allows, uncapped.

◆ DisplayDriverQSPI() [2/2]

DisplayDriverQSPI ( IQSPIBus &  bus,
size_t  width,
size_t  height 
)
inline

Bus-injection constructor: use any IQSPIBus implementation (e.g. a future PIO-accelerated RP2040 bus) without changing this class or its panel subclasses. The caller keeps ownership of bus.

◆ ~DisplayDriverQSPI()

~DisplayDriverQSPI ( )
inlineoverride

Member Function Documentation

◆ beginBus()

bool beginBus ( )
inlineprotected

Sets up the bus. Subclasses call this first thing in their begin(), then send their chip's init register sequence via writeCommand() before returning.

◆ end()

void end ( )
inlineoverridevirtual

Reimplemented from DisplayDriver< RGB_T >.

◆ height()

size_t height ( ) const
inlineoverridevirtual

◆ setAddressWindow()

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

◆ 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 >.

◆ writeCommand()

bool writeCommand ( uint8_t  cmd,
const uint8_t *  param = nullptr,
size_t  len = 0 
)
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

Member Data Documentation

◆ bus_

IQSPIBus* bus_ = nullptr
protected

◆ height_

size_t height_
protected

◆ kCmdRamWrite

constexpr uint8_t kCmdRamWrite = 0x2C
staticconstexprprotected

◆ width_

size_t width_
protected

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