5#include "Adafruit_ST7735.h"
36 St7735Matrix(uint8_t csPin, uint8_t dcPin, uint8_t rsPin, uint8_t hardware, uint8_t rotation)
37 : Adafruit_ST7735(csPin, dcPin, rsPin), hardware(hardware), rotation(rotation) {
38 textbgcolor = ST77XX_BLACK;
39 textcolor = ST77XX_WHITE;
46 fillScreen(textbgcolor);
47 setRotation(rotation);
99 void getCharBounds(
unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny,
100 int16_t *maxx, int16_t *maxy) {
101 charBounds(c, x, y, minx, miny, maxx, maxy);
120 bool printFormatted(int16_t x, int16_t y, int16_t w, int16_t align, String content,
121 uint8_t baseLine, uint8_t yAdvance = 0) {
122 int16_t xx = 0, yy = 0;
123 uint16_t ww = 0, hh = 0;
124 bool old_wrap = wrap;
126 getTextBounds(content, 0, 0, &xx, &yy, &ww, &hh);
144 if (yAdvance && (hh % yAdvance)) {
145 hh = ((hh / yAdvance) + 1) * yAdvance;
147 GFXcanvas16 tmp(w, hh);
149 tmp.setFont(gfxFont);
151 tmp.fillScreen(textbgcolor);
152 tmp.setTextWrap(
false);
153 tmp.setCursor(xx, baseLine ? baseLine : -1 * yy);
154 tmp.setTextColor(textcolor, textbgcolor);
156 drawRGBBitmap(x, y, tmp.getBuffer(), w, hh);
158 setCursor(x + tmp.getCursorX(), y + (baseLine ? baseLine : -1 * yy));
159 return w >= (int16_t)ww;
The ST7735 Matrix Display Class.
Definition: st7735_matrix.h:20
int16_t getCursorX() const
Definition: st7735_matrix.h:60
uint16_t getTextBackground() const
Definition: st7735_matrix.h:81
St7735Matrix(uint8_t csPin, uint8_t dcPin, uint8_t rsPin, uint8_t hardware, uint8_t rotation)
Definition: st7735_matrix.h:36
int16_t getCursorY() const
Definition: st7735_matrix.h:67
void begin()
Definition: st7735_matrix.h:44
void getCharBounds(unsigned char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy)
Definition: st7735_matrix.h:99
bool getTextWrap() const
Definition: st7735_matrix.h:53
uint16_t getTextColor() const
Definition: st7735_matrix.h:74
bool printFormatted(int16_t x, int16_t y, int16_t w, int16_t align, String content, uint8_t baseLine, uint8_t yAdvance=0)
Definition: st7735_matrix.h:120
The muwerk namespace.
Definition: display_digits_max72xx.h:10