diff --git a/Adafruit_RA8875.cpp b/Adafruit_RA8875.cpp index 3037cd8..8126912 100644 --- a/Adafruit_RA8875.cpp +++ b/Adafruit_RA8875.cpp @@ -291,6 +291,31 @@ void Adafruit_RA8875::textTransparent(uint16_t foreColor) 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 diff --git a/Adafruit_RA8875.h b/Adafruit_RA8875.h index f4afb68..acf4d27 100644 --- a/Adafruit_RA8875.h +++ b/Adafruit_RA8875.h @@ -64,6 +64,7 @@ class Adafruit_RA8875 : public Adafruit_GFX { void textMode(void); void textColor(uint16_t foreColor, uint16_t bgColor); void textTransparent(uint16_t foreColor); + void textEnlarge(uint8_t scale); void textWrite(uint8_t* buffer, uint16_t len); void pushPixels(uint32_t num, uint16_t p); diff --git a/examples/textmode/textmode.ino b/examples/textmode/textmode.ino index e0d4096..acf1cc0 100644 --- a/examples/textmode/textmode.ino +++ b/examples/textmode/textmode.ino @@ -27,9 +27,18 @@ void setup() tft.fillScreen(RA8875_BLACK); tft.textMode(); + // tft.textEnlarge(0); + // tft.textColor(RA8875_WHITE, RA8875_RED); tft.textTransparent(RA8875_WHITE); - uint8_t string[14] = "Hello, World!"; - tft.textWrite(string, 14); + uint8_t string[15] = "Hello, World! "; + 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()