Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Oct 12, 2024
2 parents 9a42027 + ab82aca commit 992ac04
Show file tree
Hide file tree
Showing 210 changed files with 1,512 additions and 864 deletions.
19 changes: 0 additions & 19 deletions examples/TFT_eSPI_Sprite/TFT_eSPI_Sprite.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@



#include "esp_arduino_version.h"
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3,0,0)
#include <LilyGo_AMOLED.h> //To use LilyGo AMOLED series screens, please include <LilyGo_AMOLED.h>
#include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
#include "true_color.h"
Expand Down Expand Up @@ -256,20 +254,3 @@ unsigned int rainbow(uint8_t value)

return red << 11 | green << 6 | blue;
}

#else

#include <Arduino.h>

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("The current arduino version of TFT_eSPI does not support arduino 3.0, please change the version to below 3.0");
delay(1000);
}

#endif
18 changes: 0 additions & 18 deletions examples/TFT_eSPI_Sprite_ArcFill/TFT_eSPI_Sprite_ArcFill.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* 3. Use TFT_eSPI Sprite made by framebuffer , unnecessary calling during use tft.xxxx function
*
* */
#include "esp_arduino_version.h"
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3,0,0)
#include <LilyGo_AMOLED.h>
#include <LV_Helper.h>
#include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
Expand Down Expand Up @@ -209,20 +207,4 @@ unsigned int rainbow(uint8_t value)
return red << 11 | green << 5 | blue;
}

#else

#include <Arduino.h>

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("The current arduino version of TFT_eSPI does not support arduino 3.0, please change the version to below 3.0");
delay(1000);
}

#endif

19 changes: 0 additions & 19 deletions examples/TFT_eSPI_Sprite_RLE_Font/TFT_eSPI_Sprite_RLE_Font.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* resolution of TFT_eSPI. Do not change it here. Use fillRect.
* 3. Use TFT_eSPI Sprite made by framebuffer , unnecessary calling during use tft.xxxx function
*/
#include "esp_arduino_version.h"
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3,0,0)
#include <LilyGo_AMOLED.h>
#include <LV_Helper.h>
#include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
Expand Down Expand Up @@ -299,20 +297,3 @@ void loop()

delay(4000);;
}

#else

#include <Arduino.h>

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("The current arduino version of TFT_eSPI does not support arduino 3.0, please change the version to below 3.0");
delay(1000);
}

#endif
19 changes: 0 additions & 19 deletions examples/TFT_eSPI_Sprite_Rotation/TFT_eSPI_Sprite_Rotation.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @note Screen rotation only supports 2.41 Inch or 1.91-inch touch and non-touch versions
* @note Screen rotation only supports 2.41 Inch or 1.91-inch touch and non-touch versions
*/
#include "esp_arduino_version.h"
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3,0,0)
#include <LilyGo_AMOLED.h>
#include <LV_Helper.h>
#include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
Expand Down Expand Up @@ -75,20 +73,3 @@ void loop()
spr.setSwapBytes(1);
}


#else

#include <Arduino.h>

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("The current arduino version of TFT_eSPI does not support arduino 3.0, please change the version to below 3.0");
delay(1000);
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* resolution of TFT_eSPI. Do not change it here. Use fillRect.
* 3. Use TFT_eSPI Sprite made by framebuffer , unnecessary calling during use framebuffers.xxxx function
*/
#include "esp_arduino_version.h"
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3,0,0)
#include <LilyGo_AMOLED.h>
#include <LV_Helper.h>
#include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
Expand Down Expand Up @@ -398,20 +396,3 @@ void mediabuttons()
amoled.pushColors(0, 0, amoled.width(), amoled.height(), (uint16_t *)framebuffers.getPointer());

}

#else

#include <Arduino.h>

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.println("The current arduino version of TFT_eSPI does not support arduino 3.0, please change the version to below 3.0");
delay(1000);
}

#endif
1 change: 0 additions & 1 deletion libdeps/TFT_eSPI/.piopm

This file was deleted.

26 changes: 13 additions & 13 deletions libdeps/TFT_eSPI/Extensions/Smooth_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
6. Descent in pixels from baseline to bottom of "p"
Next are gCount sets of values for each glyph, each set comprises 7 int32t parameters (28 bytes):
1. Glyph Unicode stored as a 32 bit value
1. Glyph Unicode stored as a 32-bit value
2. Height of bitmap bounding box
3. Width of bitmap bounding box
4. gxAdvance for cursor (setWidth in Processing)
Expand All @@ -57,7 +57,7 @@ void TFT_eSPI::loadFont(String fontName, bool flash)
7. padding value, typically 0
The bitmaps start next at 24 + (28 * gCount) bytes from the start of the file.
Each pixel is 1 byte, an 8 bit Alpha value which represents the transparency from
Each pixel is 1 byte, an 8-bit Alpha value which represents the transparency from
0xFF foreground colour, 0x00 background. The library uses a linear interpolation
between the foreground and background RGB component colours. e.g.
pixelRed = ((fgRed * alpha) + (bgRed * (255 - alpha))/255
Expand Down Expand Up @@ -158,7 +158,7 @@ void TFT_eSPI::loadMetrics(void)
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() )
{
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
gHeight = (uint8_t*)ps_malloc( gFont.gCount ); // Height of glyph
gWidth = (uint8_t*)ps_malloc( gFont.gCount ); // Width of glyph
gxAdvance = (uint8_t*)ps_malloc( gFont.gCount ); // xAdvance - to move x cursor
Expand All @@ -169,7 +169,7 @@ void TFT_eSPI::loadMetrics(void)
else
#endif
{
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF)
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
gHeight = (uint8_t*)malloc( gFont.gCount ); // Height of glyph
gWidth = (uint8_t*)malloc( gFont.gCount ); // Width of glyph
gxAdvance = (uint8_t*)malloc( gFont.gCount ); // xAdvance - to move x cursor
Expand Down Expand Up @@ -308,26 +308,26 @@ void TFT_eSPI::unloadFont( void )

/***************************************************************************************
** Function name: readInt32
** Description: Get a 32 bit integer from the font file
** Description: Get a 32-bit integer from the font file
*************************************************************************************x*/
uint32_t TFT_eSPI::readInt32(void)
{
uint32_t val = 0;

#ifdef FONT_FS_AVAILABLE
if (fs_font) {
val = fontFile.read() << 24;
val |= fontFile.read() << 16;
val |= fontFile.read() << 8;
val |= fontFile.read();
val = (uint32_t)fontFile.read() << 24;
val |= (uint32_t)fontFile.read() << 16;
val |= (uint32_t)fontFile.read() << 8;
val |= (uint32_t)fontFile.read();
}
else
#endif
{
val = pgm_read_byte(fontPtr++) << 24;
val |= pgm_read_byte(fontPtr++) << 16;
val |= pgm_read_byte(fontPtr++) << 8;
val |= pgm_read_byte(fontPtr++);
val = (uint32_t)pgm_read_byte(fontPtr++) << 24;
val |= (uint32_t)pgm_read_byte(fontPtr++) << 16;
val |= (uint32_t)pgm_read_byte(fontPtr++) << 8;
val |= (uint32_t)pgm_read_byte(fontPtr++);
}

return val;
Expand Down
29 changes: 16 additions & 13 deletions libdeps/TFT_eSPI/Extensions/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
** Function name: createSprite
** Description: Create a sprite (bitmap) of defined width and height
***************************************************************************************/
// cast returned value to (uint8_t*) for 8 bit or (uint16_t*) for 16 bit colours
// cast returned value to (uint8_t*) for 8-bit or (uint16_t*) for 16-bit colours
void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
{

Expand Down Expand Up @@ -88,8 +88,6 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
_img8_2 = _img8 + (w * h + 1);
}

if ( (_bpp == 4) && (_colorMap == nullptr)) createPalette(default_4bit_palette);

// This is to make it clear what pointer size is expected to be used
// but casting in the user sketch is needed due to the use of void*
if ( (_bpp == 1) && (frames > 1) )
Expand All @@ -101,6 +99,8 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
if (_img8)
{
_created = true;
if ( (_bpp == 4) && (_colorMap == nullptr)) createPalette(default_4bit_palette);

rotation = 0;
setViewport(0, 0, _dwidth, _dheight);
setPivot(_iwidth/2, _iheight/2);
Expand Down Expand Up @@ -776,7 +776,7 @@ bool TFT_eSprite::pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y, uint16_t

if (transp == rp) {
if (pixel_count) {
dspr->pushImage(ox, y, pixel_count, 1, sline_buffer, _bpp);
dspr->pushImage(ox, y, pixel_count, 1, sline_buffer);
ox += pixel_count;
pixel_count = 0;
}
Expand Down Expand Up @@ -1104,7 +1104,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_
}
else if (_bpp == 4)
{
// The image is assumed to be 4 bit, where each byte corresponds to two pixels.
// The image is assumed to be 4-bit, where each byte corresponds to two pixels.
// much faster when aligned to a byte boundary, because the alternative is slower, requiring
// tedious bit operations.

Expand Down Expand Up @@ -1355,10 +1355,10 @@ void TFT_eSprite::writeColor(uint16_t color)
{
if (!_created ) return;

// Write 16 bit RGB 565 encoded colour to RAM
// Write 16-bit RGB 565 encoded colour to RAM
if (_bpp == 16) _img [_xptr + _yptr * _iwidth] = color;

// Write 8 bit RGB 332 encoded colour to RAM
// Write 8-bit RGB 332 encoded colour to RAM
else if (_bpp == 8) _img8[_xptr + _yptr * _iwidth] = (uint8_t) color;

else if (_bpp == 4)
Expand Down Expand Up @@ -1985,10 +1985,6 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
{
if ( _vpOoB || !_created ) return;

if ((x >= _vpW - _xDatum) || // Clip right
(y >= _vpH - _yDatum)) // Clip bottom
return;

if (c < 32) return;
#ifdef LOAD_GLCD
//>>>>>>>>>>>>>>>>>>
Expand All @@ -1997,10 +1993,17 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
#endif
//>>>>>>>>>>>>>>>>>>

if ((x >= _vpW - _xDatum) || // Clip right
(y >= _vpH - _yDatum)) // Clip bottom
return;

if (((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
return;

if (c > 255) return;
if (!_cp437 && c > 175) c++;

bool fillbg = (bg != color);

if ((size==1) && fillbg)
Expand Down Expand Up @@ -2135,7 +2138,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin

/***************************************************************************************
** Function name: drawChar
** Description: draw a unicode glyph into the sprite
** Description: draw a Unicode glyph into the sprite
***************************************************************************************/
// TODO: Rationalise with TFT_eSPI
// Any UTF-8 decoding must be done before calling drawChar()
Expand Down Expand Up @@ -2287,7 +2290,7 @@ int16_t TFT_eSprite::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t fo

uint8_t tnp = 0; // Temporary copy of np for while loop
uint8_t ts = textsize - 1; // Temporary copy of textsize
// 16 bit pixel count so maximum font size is equivalent to 180x180 pixels in area
// 16-bit pixel count so maximum font size is equivalent to 180x180 pixels in area
// w is total number of pixels to plot to fill character block
while (pc < w) {
line = pgm_read_byte((uint8_t *)flash_address);
Expand Down
Loading

0 comments on commit 992ac04

Please sign in to comment.