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

Display driver that renders a TinyGPU surface through Bodmer's TFT_eSPI (https://github.com/Bodmer/TFT_eSPI) instead of one of this library's own SPI panel drivers (DisplayDriverSPI/QSPI/DSI) - useful if you already have a working TFT_eSPI User_Setup.h for your panel and would rather reuse it than duplicate the same init sequence/pin wiring here. More...

#include <DisplayDriverTFTeSPI.h>

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

Public Member Functions

 DisplayDriverTFTeSPI (TFT_eSPI &tft, DisplayRotation rotation=DisplayRotation::kNone)
 
bool begin () override
 
bool writeData (ISurface< RGB_T > &surface) override
 
bool writeData (ISurface< RGB_T > &surface, size_t x, size_t y) override
 
void setRotation (DisplayRotation rotation) override
 
size_t width () const override
 
size_t height () const 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 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

TFT_eSPI & tft_
 
DisplayRotation rotation_
 
- Protected Attributes inherited from DisplayDriver< RGB_T >
Font5x7< RGB_T > defaultFont
 

Detailed Description

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

Display driver that renders a TinyGPU surface through Bodmer's TFT_eSPI (https://github.com/Bodmer/TFT_eSPI) instead of one of this library's own SPI panel drivers (DisplayDriverSPI/QSPI/DSI) - useful if you already have a working TFT_eSPI User_Setup.h for your panel and would rather reuse it than duplicate the same init sequence/pin wiring here.

TFT_eSPI is a separate, optional Arduino library - install it alongside TinyGPU and #include <TinyGPU/Drivers/DisplayDriverTFTeSPI.h> explicitly (this header is not pulled in by TinyGPU/DisplayDriver.h or TinyGPU.h) to opt in. All of the panel-specific configuration (which controller, which pins, SPI frequency, ...) is TFT_eSPI's own User_Setup.h/User_Setup_Select.h job, same as any other TFT_eSPI sketch - this driver only bridges TinyGPU's ISurface/writeData() calls onto TFT_eSPI's own API.

Usage: TFT_eSPI tft; DisplayDriverTFTeSPI<RGB565> display(tft); display.begin(); // calls tft.init() and tft.setRotation() display.writeData(surface);

Only a 16bpp RGB_T (RGB565) is supported, since that's the only pixel format TFT_eSPI's pushImage() accepts.

Constructor & Destructor Documentation

◆ DisplayDriverTFTeSPI()

DisplayDriverTFTeSPI ( TFT_eSPI &  tft,
DisplayRotation  rotation = DisplayRotation::kNone 
)
inlineexplicit

Wraps an existing TFT_eSPI instance (ownership not taken - construct and keep it alive for as long as this driver is used, the same way DisplayDriverSPI takes its SPIClass& rather than owning one).

Member Function Documentation

◆ begin()

bool begin ( )
inlineoverridevirtual

Initializes TFT_eSPI (tft.init()) and applies the rotation passed to the constructor, if any.

Implements 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

◆ setRotation()

void setRotation ( DisplayRotation  rotation)
inlineoverridevirtual

Changes the panel's rotation - forwards directly to TFT_eSPI::setRotation(), whose 0-3 values already match DisplayRotation's own kPortrait/kLandscape/kPortraitFlipped/ kLandscapeFlipped numbering. kNone is a no-op (nothing to apply).

Reimplemented from DisplayDriver< RGB_T >.

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

◆ 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

◆ rotation_

DisplayRotation rotation_
protected

◆ tft_

TFT_eSPI& tft_
protected

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