Update TFT_eSPI to v2.5.43

This commit is contained in:
lewisxhe
2024-12-20 10:30:59 +08:00
parent 7f7f0022fe
commit 7abc5fb795
215 changed files with 3400 additions and 1114 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

@@ -12,7 +12,7 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 1 bit Sprite occupies (width * height)/8 bytes in RAM. So,
A 1-bit Sprite occupies (width * height)/8 bytes in RAM. So,
for example, a 320 x 240 pixel Sprite occupies 9600 bytes.
*/
// A new setBitmapColor(fg_color, bg_color) function allows
@@ -10,7 +10,7 @@
// screen very simple. The rotation is clockwise with increasing angle. The angle is in
// degrees, an angle of 0 means no Sprite rotation.
// The pushRotated() function works with 1, 4, 8 and 16 bit per pixel (bpp) Sprites.
// The pushRotated() function works with 1, 4, 8 and 16-bit per pixel (bpp) Sprites.
// The original Sprite is unchanged so can be plotted again at a different angle.
@@ -20,7 +20,7 @@
// For 1 bpp Sprites the foreground and background colours are defined with the
// function spr.setBitmapColor(foregroundColor, backgroundColor).
// For 4 bpp Sprites the colour map index is used instead of the 16 bit colour
// For 4 bpp Sprites the colour map index is used instead of the 16-bit colour
// e.g. spr.setTextColor(5); // Green text in default colour map
// See "Transparent_Sprite_Demo_4bit" example for default colour map details
@@ -14,7 +14,7 @@
// The rotation angle is in degrees, an angle of 0 means no Sprite rotation.
// The pushRotated() function works with 1, 8 and 16 bit per pixel (bpp) Sprites.
// The pushRotated() function works with 1, 8 and 16-bit per pixel (bpp) Sprites.
// For 1 bpp Sprites the foreground and background colours are defined with the
// member function setBitmapColor(foregroundColor, backgroundColor).
@@ -80,7 +80,7 @@ void setup()
// Send jpeg info to serial port
fex.jpegInfo("/Eye_80x64.jpg");
// Draw jpeg iamge in Sprite spr at 0,0
// Draw jpeg image in Sprite spr at 0,0
fex.drawJpeg("/Eye_80x64.jpg", 0 , 0, &spr);
}
@@ -105,7 +105,7 @@ void loop()
delay(1000);
// Push copies of Sprite rotated through increasing angles 0-360 degrees
// with 45 fegree increments
// with 45 degree increments
for (int16_t angle = 0; angle <= 360; angle += 45) {
spr.pushRotated(angle);
delay(500);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

@@ -9,7 +9,7 @@
#########################################################################
*/
// Specify sprite 160 x 128 pixels (needs 40Kbytes of RAM for 16 bit colour)
// Specify sprite 160 x 128 pixels (needs 40Kbytes of RAM for 16-bit colour)
#define IWIDTH 160
#define IHEIGHT 128
@@ -14,12 +14,12 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 16 bit 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 accommodated,
this size requires 40kBytes of RAM for a 16 bit colour depth.
this size requires 40kBytes of RAM for a 16-bit colour depth.
When 8 bit colour depth sprites are created they occupy
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.
@@ -1,9 +1,9 @@
/*
Sketch to show how a 4 bit Sprite is created, how to draw pixels
Sketch to show how a 4-bit Sprite is created, how to draw pixels
and text within the Sprite and then push the Sprite onto
the display screen.
The advantage of 4 bit sprites is:
The advantage of 4-bit sprites is:
1. Small memory footprint
2. Any set of 16 colours can be specified
3. Colours can be changed without redrawing in Sprite
@@ -21,7 +21,7 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 4 bit Sprite occupies (width * height)/2 bytes in RAM.
A 4-bit Sprite occupies (width * height)/2 bytes in RAM.
*/
@@ -64,7 +64,7 @@ void loop(void)
// Fill the whole sprite with color 0 (Sprite is in memory so not visible yet)
spr.fillSprite(0);
// create a color map with known colors (16 maximum for 4 bit Sprite
// create a color map with known colors (16 maximum for 4-bit Sprite
uint16_t cmap[16];
@@ -14,12 +14,12 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 16 bit 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 accommodated,
this size requires 40kBytes of RAM for a 16 bit color depth.
this size requires 40kBytes of RAM for a 16-bit color depth.
When 8 bit color depth sprites are created they occupy
When 8-bit color depth sprites are created they occupy
(width * height) bytes in RAM, so larger sprites can be
created, or the RAM required is halved.
@@ -39,7 +39,7 @@ TFT_eSPI tft = TFT_eSPI(); // Declare object "tft"
TFT_eSprite spr = TFT_eSprite(&tft); // Declare Sprite object "spr" with pointer to "tft" object
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
byte red = 31; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
byte state = 0;
@@ -99,7 +99,7 @@ void loop(void)
}
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow()
{
@@ -14,9 +14,9 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
A 16-bit Sprite occupies (2 * width * height) bytes in RAM.
An 8 bit Sprite occupies (width * height) bytes in RAM.
An 8-bit Sprite occupies (width * height) bytes in RAM.
*/
@@ -126,7 +126,7 @@ void numberBox(int num, int x, int y)
// Fill it with black
img.fillSprite(TFT_BLACK);
// Draw a backgorund of 2 filled triangles
// Draw a background of 2 filled triangles
img.fillTriangle( 0, 0, 0, 49, 40, 25, TFT_RED);
img.fillTriangle( 79, 0, 79, 49, 40, 25, TFT_DARKGREEN);
@@ -150,14 +150,14 @@ void numberBox(int num, int x, int y)
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{
// Value is expected to be in range 0-127
// The value is converted to a spectrum colour from 0 = red through to 127 = blue
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
@@ -3,7 +3,7 @@
This sketch scrolls a 1 bit per pixel (1 bpp) Sprite.
In a 1 bit Sprite any colour except TFT_BLACK turns a pixel "ON"
In a 1-bit Sprite any colour except TFT_BLACK turns a pixel "ON"
TFT_BLACK turns a pixel "OFF".
ON and OFF pixels can be set to any two colours before
@@ -24,7 +24,7 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 1 bit Sprite occupies (width * height)/8 bytes in RAM.
A 1-bit Sprite occupies (width * height)/8 bytes in RAM.
*/
@@ -1,5 +1,5 @@
/*
Sketch to show scrolling of the graphics in 4 bit sprites.
Sketch to show scrolling of the graphics in 4-bit sprites.
Scrolling in this way moves the pixels in a defined rectangle
within the Sprite. By default the whole sprite is scrolled.
The gap left by scrolling is filled with a defined colour.
@@ -14,7 +14,7 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 4 bit Sprite occupies (width * height)/2 bytes in RAM.
A 4-bit Sprite occupies (width * height)/2 bytes in RAM.
*/
#include <TFT_eSPI.h>
@@ -1,7 +1,7 @@
/*
Display "flicker free" scrolling text and updating number
This sketch uses 8 bit colour sprites to save RAM.
This sketch uses 8-bit colour sprites to save RAM.
Example for library:
https://github.com/Bodmer/TFT_eSPI
@@ -16,15 +16,15 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 16 bit colour Sprite occupies (2 * width * height) bytes.
A 16-bit colour Sprite occupies (2 * width * height) bytes.
An 8 bit colour Sprite occupies (width * height) bytes.
An 8-bit colour Sprite occupies (width * height) bytes.
On a ESP8266, 16 bit Sprite sizes up to 128 x 160 can be accommodated,
On a ESP8266, 16-bit Sprite sizes up to 128 x 160 can be accommodated,
this size requires 128*160*2 bytes (40kBytes) of RAM.
This sketch sets the colour depth to 8 bits so larger sprites can be
created. 8 bit colour sprites use half amount of RAM. If the colour
created. 8-bit colour sprites use half amount of RAM. If the colour
depth is not specified then 16 bits is assumed.
You need to make the sprite small enough to fit, with RAM spare for
@@ -137,7 +137,7 @@ void numberBox(int num, int x, int y)
// Fill it with black
img.fillSprite(TFT_BLACK);
// Draw a backgorund of 2 filled triangles
// Draw a background of 2 filled triangles
img.fillTriangle( 0, 0, 0, 49, 40, 25, TFT_RED);
img.fillTriangle( 79, 0, 79, 49, 40, 25, TFT_DARKGREEN);
@@ -161,14 +161,14 @@ void numberBox(int num, int x, int y)
// #########################################################################
// Return a 16 bit rainbow colour
// Return a 16-bit rainbow colour
// #########################################################################
unsigned int rainbow(byte value)
{
// Value is expected to be in range 0-127
// The value is converted to a spectrum colour from 0 = red through to 127 = blue
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
byte green = 0;// Green is the middle 6 bits
byte blue = 0; // Blue is the bottom 5 bits
@@ -1,5 +1,5 @@
// This **ONLY** works for 1 bpp Sprites due to lack of bounds checking in the
// Sprite pushImage() function for 8 and 16 bit Sprites (it is on the TO DO list)
// Sprite pushImage() function for 8 and 16-bit Sprites (it is on the TO DO list)
// Wrapping scroll example by Bodmer for the TFT_eSPI library
@@ -12,12 +12,12 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 16 bit 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 accommodated,
this size requires 40kBytes of RAM for a 16 bit colour depth.
this size requires 40kBytes of RAM for a 16-bit colour depth.
When 8 bit colour depth sprites are created they occupy
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.
*/
@@ -76,7 +76,7 @@ void loop() {
// #########################################################################
void drawStar(int x, int y, int star_color)
{
// Create an 8 bit sprite 70x 80 pixels (uses 5600 bytes of RAM)
// Create an 8-bit sprite 70x 80 pixels (uses 5600 bytes of RAM)
img.setColorDepth(8);
img.createSprite(70, 80);
@@ -113,7 +113,7 @@ void numberBox(int x, int y, float num )
#define IWIDTH 80
#define IHEIGHT 35
// Create a 8 bit sprite 80 pixels wide, 35 high (2800 bytes of RAM needed)
// Create a 8-bit sprite 80 pixels wide, 35 high (2800 bytes of RAM needed)
img.setColorDepth(8);
img.createSprite(IWIDTH, IHEIGHT);
@@ -1,5 +1,5 @@
/*
Sketch to show creation of a 4 bit sprite with a transparent
Sketch to show creation of a 4-bit sprite with a transparent
background, then plot it on the TFT. The palette setup and
palette update functions are also shown in this example.
@@ -13,11 +13,11 @@
any position. If there is sufficient RAM then the Sprite can
be the same size as the screen and used as a frame buffer.
A 4 bit Sprite occupies (width * height)/2 bytes in RAM.
A 4-bit Sprite occupies (width * height)/2 bytes in RAM.
For example the "star" 70x80 Sprite uses 2800 bytes.
*/
// This is the default palette for 4 bit colour sprites
// This is the default palette for 4-bit colour sprites
// which is built into the library. You can create your
// own palette (use a different array name!). The palette
// is captured and stored in RAM by the Sprite class so a
@@ -80,25 +80,25 @@ void loop() {
// spr.createPalette(default_4bit_palette, 12);
// After rendering a Sprite you can change the palette to increase the range of colours
// plotted to the screen to the full 16 bit set.
// plotted to the screen to the full 16-bit set.
// Change palette colour 11 to violet
spr.setPaletteColor(11, TFT_VIOLET);
uint16_t color15 = spr.getPaletteColor(15); // The 16 bit colour in a palette can be read back
uint16_t color15 = spr.getPaletteColor(15); // The 16-bit colour in a palette can be read back
// Draw 50 sprites containing a "transparent" colour
for (int i = 0; i < 50; i++)
{
int x = random(tft.width() - 70);
int y = random(tft.height() - 80);
int c = random(15); // Random colour 0-14 (4 bit index into color map). Leave 15 for transparent.
int c = random(15); // Random colour 0-14 (4-bit index into color map). Leave 15 for transparent.
drawStar(x, y, c);
}
delay(2000);
// Change the palette to a 16 bit grey scale colour
// Change the palette to a 16-bit grey scale colour
for (uint8_t i = 0; i < 16; i++) {
// (i*16+i) produces a value in range 0-255 for the RGB colours
// Red Green Blue