EX-Display
EX-Display
Loading...
Searching...
No Matches
DisplayInterface Class Referenceabstract

Class to abstract away all physical display implementation to enable multiple display types. More...

#include <DisplayInterface.h>

Inheritance diagram for DisplayInterface:
[legend]
Collaboration diagram for DisplayInterface:
[legend]

Public Member Functions

virtual void begin ()=0
 Perform any initial once off setup or configuration here and call only once.
 
virtual void clearScreen ()=0
 Clear the entire screen.
 
virtual void displayScreen (Screen *screen)=0
 Display the specified Screen on this display.
 
virtual void displayStartupInfo (const char *version)=0
 Display the startup screen with software version.
 
virtual void displayFormattedRow (uint8_t row, uint8_t column, RowAttributes attributes, const char *text, bool append)=0
 Display a row using formatting modifiers.
 
void setNext (DisplayInterface *display)
 Set the next DisplayInterface derived instance in the list.
 
DisplayInterfacegetNext ()
 Get the next DisplayInterface derived instance in the list.
 
void setLogger (Logger *logger)
 Set the logger instance to use for diagnostic logging.
 
void setId (uint8_t displayId)
 Set the ID for this display instance.
 
uint8_t getId ()
 Get the ID of this display instance.
 
void setScreenId (int screenId)
 Set the Screen ID this display is currently displaying.
 
int getScreenId ()
 Get the Screen ID this display is currently displaing.
 
int getCSPin ()
 Get the defined CS pin for this display to see if it needs manual SPI switching.
 
void setNeedsRedraw (bool redraw)
 Set the flag for whether this display needs redrawing or not - individual row updates are not affected.
 
bool needsRedraw ()
 Test if this display needs an entire redraw.
 
void formatRow (int row, const char *text)
 Static method to enable calling back to a derived class with a formatted row.
 
virtual ~DisplayInterface ()=default
 Destructor for a DisplayInterface.
 

Protected Member Functions

RowAttributes _sanitiseAttributes (RowAttributes attributes)
 Sanitise the provided struct of RowAttributes.
 
bool _isModifier (char check)
 Validates the provided char is a valid modifier.
 
RowAttributes _setAttribute (RowAttributes attributes, char modifier, uint16_t colour=0xFFFF)
 Update the provided RowAttributes struct according to the provided modifier.
 
bool _isRGB (const char *colour)
 Check if the provided string constant translates to a valid RGB colour code.
 
uint16_t _convertRGBtoRGB565 (const char *colour)
 Convert the provided RGB colour code string constant to a uint16_t RGB565 colour.
 

Protected Attributes

DisplayInterface_next = nullptr
 Pointer to the next DisplayInterface derived instance in the list.
 
uint16_t _textColour
 Default text colour for the display.
 
uint16_t _backgroundColour
 Default background colour for the display.
 
Logger_logger = nullptr
 Pointer to the Logger instance for the DisplayInterface derived classes.
 
uint8_t _displayId = 0
 ID for this display instance.
 
int _screenId = -1
 ID of the screen this display is currently displaying, defaults to -1 to flag it is not a valid ID.
 
uint8_t _rotation = 0
 Orientation of this display, most displays require this setting otherwise ignore it.
 
uint8_t _textSize = 1
 Multiplier for text size, most displays require this setting otherwise ignore it.
 
uint8_t _maxRow = 0
 Maximum row number (not count) that will fit on this display (based on font height, not pixels)
 
uint8_t _maxColumn = 0
 Maximum column number (not count) that will fit on this display (based on font width, not pixels)
 
uint8_t _fontHeight = 0
 Calculated font height to determine row positioning.
 
uint8_t _fontWidth = 0
 Calculated font width to determine column positioning.
 
int _csPin = -1
 If there are more than one SPI displays that libraries don't officially support, the CS pin can be provided to switch between them (default -1 disables this)
 
bool _needsRedraw = true
 Flag that this display needs redrawing - needed for switching between screens.
 

Detailed Description

Class to abstract away all physical display implementation to enable multiple display types.

Constructor & Destructor Documentation

◆ ~DisplayInterface()

virtual DisplayInterface::~DisplayInterface ( )
virtualdefault

Destructor for a DisplayInterface.

Member Function Documentation

◆ _convertRGBtoRGB565()

uint16_t DisplayInterface::_convertRGBtoRGB565 ( const char *  colour)
protected

Convert the provided RGB colour code string constant to a uint16_t RGB565 colour.

Parameters
colourString constant containing the RGB colour code
Returns
uint16_t RGB565 colour code
Here is the caller graph for this function:

◆ _isModifier()

bool DisplayInterface::_isModifier ( char  check)
protected

Validates the provided char is a valid modifier.

Parameters
checkContains the char to be validated
Returns
true If modifier is valid (_, -, ~, !, #)
false If modifier is invalid
Here is the caller graph for this function:

◆ _isRGB()

bool DisplayInterface::_isRGB ( const char *  colour)
protected

Check if the provided string constant translates to a valid RGB colour code.

Parameters
colourString constant containing RGB colour codes to check
Returns
true If valid - #000000 to #FFFFFF
false If invalid
Here is the caller graph for this function:

◆ _sanitiseAttributes()

RowAttributes DisplayInterface::_sanitiseAttributes ( RowAttributes  attributes)
protected

Sanitise the provided struct of RowAttributes.

If isLine is set, all other attributes except colour are overridden to false. If both alwaysTicker and neverTicker are set, both will be set to false as they conflict.

Parameters
attributesRowAttributes struct to sanitise
Returns
RowAttributes Sanitised struct according to the precedence rules
Here is the caller graph for this function:

◆ _setAttribute()

RowAttributes DisplayInterface::_setAttribute ( RowAttributes  attributes,
char  modifier,
uint16_t  colour = 0xFFFF 
)
protected

Update the provided RowAttributes struct according to the provided modifier.

Parameters
attributesRowAttribute to be updated
modifierModifier to apply
colourIf applied modifier is colour, set this 16bit colour, otherwise this is ignored
Returns
RowAttributes The updated struct
Here is the caller graph for this function:

◆ begin()

virtual void DisplayInterface::begin ( )
pure virtual

Perform any initial once off setup or configuration here and call only once.

Implemented in TFT_eSPIDisplay.

Here is the caller graph for this function:

◆ clearScreen()

virtual void DisplayInterface::clearScreen ( )
pure virtual

Clear the entire screen.

Implemented in TFT_eSPIDisplay.

Here is the caller graph for this function:

◆ displayFormattedRow()

virtual void DisplayInterface::displayFormattedRow ( uint8_t  row,
uint8_t  column,
RowAttributes  attributes,
const char *  text,
bool  append 
)
pure virtual

Display a row using formatting modifiers.

Parameters
rowRow ID to display
columnColumn at which to display text (not pixels)
attributesRowAttributes structure containing modifier details
textText to display
appendFlag if this is appending to an existing row and should not clear the row first

Implemented in TFT_eSPIDisplay.

Here is the caller graph for this function:

◆ displayScreen()

virtual void DisplayInterface::displayScreen ( Screen screen)
pure virtual

Display the specified Screen on this display.

Parameters
screenPointer to the Screen to display

Implemented in TFT_eSPIDisplay.

◆ displayStartupInfo()

virtual void DisplayInterface::displayStartupInfo ( const char *  version)
pure virtual

Display the startup screen with software version.

Parameters
versionEX-Display version

Implemented in TFT_eSPIDisplay.

◆ formatRow()

void DisplayInterface::formatRow ( int  rowId,
const char *  text 
)

Static method to enable calling back to a derived class with a formatted row.

Parameters
rowRow to display
textText containing formatting

Valid uses of modifiers: "`_`This is an underlined row" "`-`This is a horizontal line, text will be ignored" "`~`This row will always ticker when implemented" "`!`This row will never ticker when implemented" "`#FF0000`This row has red text" "`_``~`This row is underlined, will always ticker, and `#FF0000`this bit of text is red" "`!``_`This row is underlined, and will never ticker" "`#FF0000`This row starts red, then goes `#FFFFFF`white"

Parameters
rowRow to display
textText containing formatting

stateMachine enum allows us to iterate through each char of text and examine it byte by byte for modifiers.

Length of the provided text, we can't return anything longer than this

Starting index of text we need to return, enables subtracting modifiers

Size of text to copy into textOnly later

Default start at column 0, needs to be updated if appending

Default is a new row, update if colours are embedded

Text only minus any modifiers, no bigger than provided size

Holds each char for checking

Start by looking for the first backtick

Set all attributes false to start with, and white text

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCSPin()

int DisplayInterface::getCSPin ( )

Get the defined CS pin for this display to see if it needs manual SPI switching.

Returns
Pin number of the SPI CS pin for this display (default -1 for no switching)
Here is the caller graph for this function:

◆ getId()

uint8_t DisplayInterface::getId ( )

Get the ID of this display instance.

Returns
ID of this display
Here is the caller graph for this function:

◆ getNext()

DisplayInterface * DisplayInterface::getNext ( )

Get the next DisplayInterface derived instance in the list.

Returns
Pointer to the next instance
Here is the caller graph for this function:

◆ getScreenId()

int DisplayInterface::getScreenId ( )

Get the Screen ID this display is currently displaing.

Returns
Screen ID
Here is the caller graph for this function:

◆ needsRedraw()

bool DisplayInterface::needsRedraw ( )

Test if this display needs an entire redraw.

Returns
true|false

◆ setId()

void DisplayInterface::setId ( uint8_t  displayId)

Set the ID for this display instance.

Parameters
displayIdID of this display
Here is the caller graph for this function:

◆ setLogger()

void DisplayInterface::setLogger ( Logger logger)

Set the logger instance to use for diagnostic logging.

Parameters
loggerPointer to the Logger instance to use
Here is the caller graph for this function:

◆ setNeedsRedraw()

void DisplayInterface::setNeedsRedraw ( bool  redraw)

Set the flag for whether this display needs redrawing or not - individual row updates are not affected.

Parameters
redrawtrue if entire redraw, otherwise false

◆ setNext()

void DisplayInterface::setNext ( DisplayInterface display)

Set the next DisplayInterface derived instance in the list.

Parameters
displayPointer to the next instance
Here is the caller graph for this function:

◆ setScreenId()

void DisplayInterface::setScreenId ( int  screenId)

Set the Screen ID this display is currently displaying.

Parameters
screenIdScreen ID
Here is the caller graph for this function:

Member Data Documentation

◆ _backgroundColour

uint16_t DisplayInterface::_backgroundColour
protected

Default background colour for the display.

◆ _csPin

int DisplayInterface::_csPin = -1
protected

If there are more than one SPI displays that libraries don't officially support, the CS pin can be provided to switch between them (default -1 disables this)

◆ _displayId

uint8_t DisplayInterface::_displayId = 0
protected

ID for this display instance.

◆ _fontHeight

uint8_t DisplayInterface::_fontHeight = 0
protected

Calculated font height to determine row positioning.

◆ _fontWidth

uint8_t DisplayInterface::_fontWidth = 0
protected

Calculated font width to determine column positioning.

◆ _logger

Logger* DisplayInterface::_logger = nullptr
protected

Pointer to the Logger instance for the DisplayInterface derived classes.

◆ _maxColumn

uint8_t DisplayInterface::_maxColumn = 0
protected

Maximum column number (not count) that will fit on this display (based on font width, not pixels)

◆ _maxRow

uint8_t DisplayInterface::_maxRow = 0
protected

Maximum row number (not count) that will fit on this display (based on font height, not pixels)

◆ _needsRedraw

bool DisplayInterface::_needsRedraw = true
protected

Flag that this display needs redrawing - needed for switching between screens.

◆ _next

DisplayInterface* DisplayInterface::_next = nullptr
protected

Pointer to the next DisplayInterface derived instance in the list.

◆ _rotation

uint8_t DisplayInterface::_rotation = 0
protected

Orientation of this display, most displays require this setting otherwise ignore it.

◆ _screenId

int DisplayInterface::_screenId = -1
protected

ID of the screen this display is currently displaying, defaults to -1 to flag it is not a valid ID.

◆ _textColour

uint16_t DisplayInterface::_textColour
protected

Default text colour for the display.

◆ _textSize

uint8_t DisplayInterface::_textSize = 1
protected

Multiplier for text size, most displays require this setting otherwise ignore it.


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