EX-Display
EX-Display
Loading...
Searching...
No Matches
MockSPIDisplay Class Reference

Mock physical display class for an SPI device Use this mock to test manual switching between SPI devices Constructor with no CS pin should never switch, and one with the CS pin should always switch. More...

#include <MockSPIDisplay.h>

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

Public Member Functions

 MockSPIDisplay ()
 
 MockSPIDisplay (int csPin)
 
 MOCK_METHOD (void, begin,(),(override))
 
 MOCK_METHOD (void, clearScreen,(),(override))
 
 MOCK_METHOD (void, displayScreen,(Screen *screen),(override))
 
 MOCK_METHOD (void, displayStartupInfo,(const char *version),(override))
 
 MOCK_METHOD (void, displayFormattedRow,(uint8_t row, uint8_t column, RowAttributes attributes, const char *text, bool append),(override))
 
- Public Member Functions inherited from DisplayInterface
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.
 

Static Public Member Functions

static MockSPIDisplaycreate (int csPin=-1)
 

Additional Inherited Members

- Protected Member Functions inherited from DisplayInterface
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 inherited from DisplayInterface
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

Mock physical display class for an SPI device Use this mock to test manual switching between SPI devices Constructor with no CS pin should never switch, and one with the CS pin should always switch.

Constructor & Destructor Documentation

◆ MockSPIDisplay() [1/2]

MockSPIDisplay::MockSPIDisplay ( )
inline
Here is the caller graph for this function:

◆ MockSPIDisplay() [2/2]

MockSPIDisplay::MockSPIDisplay ( int  csPin)
inline

Member Function Documentation

◆ create()

static MockSPIDisplay * MockSPIDisplay::create ( int  csPin = -1)
inlinestatic
Here is the call graph for this function:

◆ MOCK_METHOD() [1/5]

MockSPIDisplay::MOCK_METHOD ( void  ,
begin  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [2/5]

MockSPIDisplay::MOCK_METHOD ( void  ,
clearScreen  ,
()  ,
(override)   
)

◆ MOCK_METHOD() [3/5]

MockSPIDisplay::MOCK_METHOD ( void  ,
displayFormattedRow  ,
(uint8_t row, uint8_t column, RowAttributes attributes, const char *text, bool append)  ,
(override)   
)

◆ MOCK_METHOD() [4/5]

MockSPIDisplay::MOCK_METHOD ( void  ,
displayScreen  ,
(Screen *screen)  ,
(override)   
)

◆ MOCK_METHOD() [5/5]

MockSPIDisplay::MOCK_METHOD ( void  ,
displayStartupInfo  ,
(const char *version)  ,
(override)   
)

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