Added text helper functions (enlarge, bg color, etc.)
This commit is contained in:
parent
ae0b2d2b61
commit
07abc76eed
|
|
@ -291,6 +291,31 @@ void Adafruit_RA8875::textTransparent(uint16_t foreColor)
|
||||||
writeData(temp);
|
writeData(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
Sets the text enlarge settings, using one of the following values:
|
||||||
|
|
||||||
|
0 = 1x zoom
|
||||||
|
1 = 2x zoom
|
||||||
|
2 = 3x zoom
|
||||||
|
3 = 4x zoom
|
||||||
|
|
||||||
|
@args scale[in] The zoom factor (0..3 for 1-4x zoom)
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
void Adafruit_RA8875::textEnlarge(uint8_t scale)
|
||||||
|
{
|
||||||
|
if (scale > 3) scale = 3;
|
||||||
|
|
||||||
|
/* Set font size flags */
|
||||||
|
writeCommand(0x22);
|
||||||
|
uint8_t temp = readData();
|
||||||
|
temp &= ~(0xF); // Clears bits 0..3
|
||||||
|
temp |= scale << 2;
|
||||||
|
temp |= scale;
|
||||||
|
writeData(temp);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
Renders some text on the screen when in text mode
|
Renders some text on the screen when in text mode
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class Adafruit_RA8875 : public Adafruit_GFX {
|
||||||
void textMode(void);
|
void textMode(void);
|
||||||
void textColor(uint16_t foreColor, uint16_t bgColor);
|
void textColor(uint16_t foreColor, uint16_t bgColor);
|
||||||
void textTransparent(uint16_t foreColor);
|
void textTransparent(uint16_t foreColor);
|
||||||
|
void textEnlarge(uint8_t scale);
|
||||||
void textWrite(uint8_t* buffer, uint16_t len);
|
void textWrite(uint8_t* buffer, uint16_t len);
|
||||||
|
|
||||||
void pushPixels(uint32_t num, uint16_t p);
|
void pushPixels(uint32_t num, uint16_t p);
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,18 @@ void setup()
|
||||||
tft.fillScreen(RA8875_BLACK);
|
tft.fillScreen(RA8875_BLACK);
|
||||||
|
|
||||||
tft.textMode();
|
tft.textMode();
|
||||||
|
// tft.textEnlarge(0);
|
||||||
|
// tft.textColor(RA8875_WHITE, RA8875_RED);
|
||||||
tft.textTransparent(RA8875_WHITE);
|
tft.textTransparent(RA8875_WHITE);
|
||||||
uint8_t string[14] = "Hello, World!";
|
uint8_t string[15] = "Hello, World! ";
|
||||||
tft.textWrite(string, 14);
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
|
tft.textWrite(string, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue