mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-03 04:34:43 +02:00
Version update, minor tweaks and typos
This commit is contained in:
14
TFT_eSPI.cpp
14
TFT_eSPI.cpp
@@ -4228,9 +4228,19 @@ void TFT_eSprite::createSprite(int16_t w, int16_t h)
|
||||
|
||||
void TFT_eSprite::setColorDepth(int8_t b)
|
||||
{
|
||||
if (_created) deleteSprite();
|
||||
// Can't change an existing sprite's colour depth so delete it
|
||||
if (_created)
|
||||
{
|
||||
if (_bpp16) free(_img);
|
||||
else free(_img8);
|
||||
}
|
||||
|
||||
// Now define the new colour depth
|
||||
if ( b > 8 ) _bpp16 = true; // Bytes per pixel
|
||||
else _bpp16 = false;
|
||||
|
||||
// If it existed, re-create the sprite with the new colour depth
|
||||
if (_created) createSprite(_iwidth, _iheight);
|
||||
}
|
||||
|
||||
|
||||
@@ -4724,7 +4734,7 @@ void TFT_eSprite::drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color)
|
||||
color = (color >> 8) | (color << 8);
|
||||
while (w--) _img[_iwidth * y + x++] = (uint16_t) color;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
color = (color & 0xE000)>>8 | (color & 0x0700)>>6 | (color & 0x0018)>>3;
|
||||
//while (w--) _img8[_iwidth * y + x++] = (uint8_t) color;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Display all the fast rendering fonts.
|
||||
Display all the fast rendering fonts in a sprite
|
||||
|
||||
Make sure all the display driver and pin comnections are correct by
|
||||
editting the User_Setup.h file in the TFT_eSPI library folder.
|
||||
@@ -9,13 +9,10 @@
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
// Create a sprite 160 x 128 pixels (needs 40Kbytes of RAM!)
|
||||
// Specify sprite 160 x 128 pixels (needs 40Kbytes of RAM for 16 bit colour)
|
||||
#define IWIDTH 160
|
||||
#define IHEIGHT 128
|
||||
|
||||
// New background colour
|
||||
#define TFT_BROWN 0x38E0
|
||||
|
||||
// Pause in milliseconds between screens, change to 0 to time font rendering
|
||||
#define WAIT 500
|
||||
|
||||
@@ -34,6 +31,7 @@ void setup(void) {
|
||||
|
||||
tft.fillScreen(TFT_BLUE);
|
||||
|
||||
//img.setColorDepth(8); // Optionally set depth to 8 to reduce RAM use
|
||||
img.createSprite(IWIDTH, IHEIGHT);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
}
|
||||
@@ -125,7 +123,7 @@ void loop() {
|
||||
targetTime = millis();
|
||||
|
||||
img.setTextSize(1);
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.setTextColor(TFT_GREEN);
|
||||
|
||||
img.drawString(" !\"#$%&'()*+,-./0123456", 0, 0, 2);
|
||||
@@ -137,7 +135,7 @@ void loop() {
|
||||
img.drawChar(127, xpos, 64, 2);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.setTextColor(TFT_GREEN);
|
||||
|
||||
img.drawString(" !\"#$%&'()*+,-.", 0, 0, 4);
|
||||
@@ -147,7 +145,7 @@ void loop() {
|
||||
img.drawString("PQRSTUVWX", 0, 104, 4);
|
||||
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.drawString("YZ[\\]^_`abc", 0, 0, 4);
|
||||
img.drawString("defghijklmno", 0, 26, 4);
|
||||
img.drawString("pqrstuvwxyz", 0, 52, 4);
|
||||
@@ -156,7 +154,7 @@ void loop() {
|
||||
img.drawChar(127, xpos, 78, 4);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.setTextColor(TFT_BLUE);
|
||||
|
||||
img.drawString("012345", 0, 0, 6);
|
||||
@@ -164,29 +162,29 @@ void loop() {
|
||||
img.drawString("apm-:.", 0, 80, 6);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.setTextColor(TFT_RED);
|
||||
|
||||
img.drawString("0123", 0, 0, 7);
|
||||
img.drawString("4567", 0, 60, 7);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.drawString("890:.", 0, 0, 7);
|
||||
img.drawString("", 0, 60, 7);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.setTextColor(TFT_YELLOW);
|
||||
|
||||
img.drawString("0123", 0, 0, 8);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.drawString("4567", 0, 0, 8);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
img.fillSprite(TFT_BROWN);
|
||||
img.fillSprite(TFT_BLACK);
|
||||
img.drawString("890:.", 0, 0, 8);
|
||||
img.pushSprite(0, 0); delay(WAIT);
|
||||
|
||||
|
@@ -7,17 +7,21 @@
|
||||
Example for library:
|
||||
https://github.com/Bodmer/TFT_eSPI
|
||||
|
||||
A Sprite is notionally an invisibly graphics screen that is
|
||||
A Sprite is notionally an invisible graphics screen that is
|
||||
kept in the processors RAM. Graphics can be drawn into the
|
||||
Sprite just as it can be drawn directly to the screen. Once
|
||||
the Sprite is completed it can be plotted onto the screen in
|
||||
any position. If there is sufficient RAM then the Sprite can
|
||||
be the same size as the screen and used as a frame buffer.
|
||||
|
||||
The Sprite occupies (2 * width * height) bytes in RAM.
|
||||
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
||||
|
||||
On a ESP8266 Sprite sizes up to 126 x 160 can be accomodated,
|
||||
this size requires 40kBytes of RAM.
|
||||
this size requires 40kBytes of RAM for a 16 bit colour depth.
|
||||
|
||||
When 8 bit colour depth sprites are created they occupy
|
||||
(width * height) bytes in RAM, so larger sprites can be
|
||||
created, or the RAM required is halved.
|
||||
|
||||
*/
|
||||
|
||||
@@ -42,6 +46,9 @@ void setup()
|
||||
// Initialise the TFT registers
|
||||
tft.init();
|
||||
|
||||
// Optionally set colour depth to 8 or 16 bits, default is 16 if not spedified
|
||||
// spr.setColorDepth(8);
|
||||
|
||||
// Create a sprite of defined size
|
||||
spr.createSprite(WIDTH, HEIGHT);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
The sketch has been tested on a 320x240 ILI9341 based TFT, it
|
||||
coule be adapted for other screen sizes.
|
||||
|
||||
A Sprite is notionally an invisibly graphics screen that is
|
||||
A Sprite is notionally an invisible graphics screen that is
|
||||
kept in the processors RAM. Graphics can be drawn into the
|
||||
Sprite just as it can be drawn directly to the screen. Once
|
||||
the Sprite is completed it can be plotted onto the screen in
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "0.16.16",
|
||||
"version": "0.16.20",
|
||||
"keywords": "TFT, ESP8266, NodeMCU, ESP32, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486",
|
||||
"description": "A TFT SPI graphics library for ESP8266",
|
||||
"repository":
|
||||
|
@@ -1,5 +1,5 @@
|
||||
name=TFT_eSPI
|
||||
version=0.16.16
|
||||
version=0.16.20
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=A fast TFT library for ESP8266 processors and the Arduino IDE
|
||||
|
Reference in New Issue
Block a user