mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-02 12:14:40 +02:00
Support for ESP32 PSRAM added
If PSRAM is fitted and enabled the Sprites are now created in PSRAM. This makes multiple full screen buffers possible!
This commit is contained in:
@@ -67,7 +67,13 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
|||||||
// hence will run faster in normal circumstances.
|
// hence will run faster in normal circumstances.
|
||||||
if (_bpp == 16)
|
if (_bpp == 16)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||||
|
if ( psramFound() ) _img8_1 = ( uint8_t*) ps_calloc(w * h + 1, sizeof(uint16_t));
|
||||||
|
else
|
||||||
|
#endif
|
||||||
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint16_t));
|
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint16_t));
|
||||||
|
|
||||||
_img8_2 = _img8_1;
|
_img8_2 = _img8_1;
|
||||||
_img = (uint16_t*) _img8_1;
|
_img = (uint16_t*) _img8_1;
|
||||||
|
|
||||||
@@ -80,6 +86,10 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
|||||||
|
|
||||||
else if (_bpp == 8)
|
else if (_bpp == 8)
|
||||||
{
|
{
|
||||||
|
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||||
|
if ( psramFound() ) _img8_1 = ( uint8_t*) ps_calloc(w * h + 1, sizeof(uint8_t));
|
||||||
|
else
|
||||||
|
#endif
|
||||||
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint8_t));
|
_img8_1 = ( uint8_t*) calloc(w * h + 1, sizeof(uint8_t));
|
||||||
|
|
||||||
if (_img8_1)
|
if (_img8_1)
|
||||||
@@ -103,7 +113,11 @@ void* TFT_eSprite::createSprite(int16_t w, int16_t h, uint8_t frames)
|
|||||||
|
|
||||||
if (frames > 2) frames = 2; // Currently restricted to 2 frame buffers
|
if (frames > 2) frames = 2; // Currently restricted to 2 frame buffers
|
||||||
if (frames < 1) frames = 1;
|
if (frames < 1) frames = 1;
|
||||||
_img8 = ( uint8_t*) calloc(frames * (w>>3) * h + frames, sizeof(uint8_t)); // extra pixel added
|
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
|
||||||
|
if ( psramFound() ) _img8 = ( uint8_t*) ps_calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
_img8 = ( uint8_t*) calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
|
||||||
|
|
||||||
if (_img8)
|
if (_img8)
|
||||||
{
|
{
|
||||||
|
@@ -18,6 +18,8 @@ Drawing graphics into a sprite is very fast, for those familiar with the Adafrui
|
|||||||
|
|
||||||
Sprites can be plotted to the TFT with one colour being specified as "transparent", see Transparent_Sprite_Demo example.
|
Sprites can be plotted to the TFT with one colour being specified as "transparent", see Transparent_Sprite_Demo example.
|
||||||
|
|
||||||
|
IF an ESP32 board with SPIRAM (i.e. PSRAM) fitted then Sprites will use the PSRAM memory and large full screen buffer Sprites can be created. Full screen Sprites take longer to render (~45ms for a 320 x 240 16 bit Sprite), so bear that in mind.
|
||||||
|
|
||||||
The XPT2046 touch screen controller is supported. The SPI bus for the touch controller is shared with the TFT and only an additional chip select line is needed.
|
The XPT2046 touch screen controller is supported. The SPI bus for the touch controller is shared with the TFT and only an additional chip select line is needed.
|
||||||
|
|
||||||
The Button class from Adafruit_GFX is incorporated, with the enhancement that the button labels can be in any font.
|
The Button class from Adafruit_GFX is incorporated, with the enhancement that the button labels can be in any font.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TFT_eSPI",
|
"name": "TFT_eSPI",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789",
|
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789",
|
||||||
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
|
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
|
||||||
"repository":
|
"repository":
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=TFT_eSPI
|
name=TFT_eSPI
|
||||||
version=1.1.0
|
version=1.1.1
|
||||||
author=Bodmer
|
author=Bodmer
|
||||||
maintainer=Bodmer
|
maintainer=Bodmer
|
||||||
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
|
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
|
||||||
|
Reference in New Issue
Block a user