muwerk mupplet Display Library
muwerk applets; mupplets: functional units that support specific hardware or reusable applications
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ustd::St7735Matrix Class Reference

The ST7735 Matrix Display Class. More...

#include <st7735_matrix.h>

Inherits Adafruit_ST7735.

Public Member Functions

 St7735Matrix (uint8_t csPin, uint8_t dcPin, uint8_t rsPin, uint8_t hardware, uint8_t rotation)
 
void begin ()
 
bool getTextWrap () const
 
int16_t getCursorX () const
 
int16_t getCursorY () const
 
uint16_t getTextColor () const
 
uint16_t getTextBackground () const
 
void getCharBounds (unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
 
bool printFormatted (int16_t x, int16_t y, int16_t w, int16_t align, String content, uint8_t baseLine, uint8_t yAdvance=0)
 

Detailed Description

The ST7735 Matrix Display Class.

This class derived from Adafruit's ST7735 TFT driver class provides an implementation of a TFT dot matrix display based on the Sitronix ST7735 color single-chip TFT controller connected via SPI.

Constructor & Destructor Documentation

◆ St7735Matrix()

ustd::St7735Matrix::St7735Matrix ( uint8_t  csPin,
uint8_t  dcPin,
uint8_t  rsPin,
uint8_t  hardware,
uint8_t  rotation 
)
inline

Instantiate Adafruit ST7735 driver with default hardware SPI

Parameters
csPinChip select pin #
dcPinData/Command pin #
rsPinReset pin # (optional, pass -1 if unused)
hardwareHardware type (one of INITR_GREENTAB, INITR_REDTAB, INITR_BLACKTAB, INITR_MINI160x80 or INITR_HALLOWING)
rotationDefine if and how the display is rotated. rotation can be a numeric value from 0 to 3 representing respectively no rotation, 90 degrees clockwise, 180 degrees and 90 degrees counter clockwise.

Member Function Documentation

◆ begin()

void ustd::St7735Matrix::begin ( )
inline

Start the matrix display

◆ getCharBounds()

void ustd::St7735Matrix::getCharBounds ( unsigned char  c,
int16_t *  x,
int16_t *  y,
int16_t *  minx,
int16_t *  miny,
int16_t *  maxx,
int16_t *  maxy 
)
inline

Calculates the bounding box of a character

Parameters
cThe ASCII character in question
xPointer to x location of character. Value is modified by this function to advance to next character.
yPointer to y location of character. Value is modified by this function to advance to next character.
minxPointer to minimum X coordinate, passed in to AND returned by this function – this is used to incrementally build a bounding rectangle for a string.
minyPointer to minimum Y coord, passed in AND returned.
maxxPointer to maximum X coord, passed in AND returned.
maxyPointer to maximum Y coord, passed in AND returned.

◆ getCursorX()

int16_t ustd::St7735Matrix::getCursorX ( ) const
inline

Get text cursor X location

Returns
X coordinate in digit positions

◆ getCursorY()

int16_t ustd::St7735Matrix::getCursorY ( ) const
inline

Get text cursor Y location

Returns
Y coordinate in digit positions

◆ getTextBackground()

uint16_t ustd::St7735Matrix::getTextBackground ( ) const
inline

Get text background color value

Returns
Text background color value

◆ getTextColor()

uint16_t ustd::St7735Matrix::getTextColor ( ) const
inline

Get text color value

Returns
Text color value

◆ getTextWrap()

bool ustd::St7735Matrix::getTextWrap ( ) const
inline

Returns if too long text will be wrapped to the next line

Returns
Wrapping mode

◆ printFormatted()

bool ustd::St7735Matrix::printFormatted ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  align,
String  content,
uint8_t  baseLine,
uint8_t  yAdvance = 0 
)
inline

Prints a text at a specified location with a specified formatting

This method prints a text at the specified location with the specified length using left, right or centered alignment. All parameters are checked for plasibility and will be adapted to the current display size.

Parameters
xTop left corner x coordinate
yTop left corner y coordinate
wWidth in digit positions
alignAlignment of the string to display: 0 = left, 1 = center, 2 = right
contentThe string to print
baseLineThe distance between baseline and topline
yAdvanceThe newline distance - If specified, the height of the calculated bounding box is adjusted to a multiple of this value
Returns
true if the string fits the defined space, false if output was truncated

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