Commit 41dea61b authored by Bodmer's avatar Bodmer

Correct #263, add setup file for 160x80 TFT, add invert option

Fixed bug where wrong wodth was returned for 1bpp Sprite
Improved speed for copying a 1bpp Sprite into another 1bpp Sprite (
affects Sprite pushImage() function only)
Added option to setup for colour inversion
parent 1a5e34b6
......@@ -340,17 +340,16 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, uint32_t w, uint32_t h, uint1
y = _dheight - tx - 1;
}
uint8_t* pdata = (uint8_t*) data;
uint8_t* pdata = (uint8_t* ) data;
uint32_t ww = (w+7) & 0xFFF8;
for (int32_t yp = 0; yp<h; yp++)
{
for (int32_t xp = 0; xp<ww; xp+=8)
uint32_t yw = (yp * ww)>>3;
uint32_t yyp = y + yp;
for (int32_t xp = 0; xp<w; xp++)
{
uint8_t pbyte = *pdata++;
for (uint8_t xc = 0; xc < 8; xc++)
{
if (xp+xc<w) drawPixel(x+xp+xc, y+yp, (pbyte<<xc) & 0x80);
}
uint16_t readPixel = (pdata[(xp>>3) + yw] & (0x80 >> (xp & 0x7)) );
drawPixel(x+xp, yyp, readPixel);
}
}
}
......@@ -732,7 +731,7 @@ int16_t TFT_eSprite::width(void)
if (_rotation == 1 || _rotation == 3) return _dheight;
return _bitwidth;
return _dwidth;
}
......
......@@ -366,6 +366,14 @@ void TFT_eSPI::init(uint8_t tc)
#endif
#ifdef TFT_INVERSION_ON
writecommand(TFT_INVON);
#endif
#ifdef TFT_INVERSION_OFF
writecommand(TFT_INVOFF);
#endif
spi_end();
setRotation(rotation);
......
......@@ -65,6 +65,11 @@
// #define ST7735_BLACKTAB
// #define ST7735_REDTAB160x80 // For 160 x 80 display (24 offset) (https://www.aliexpress.com/item/ShengYang-1pcs-IPS-0-96-inch-7P-SPI-HD-65K-Full-Color-OLED-Module-ST7735-Drive/32918394604.html)
// If colours are inverted (white shows as black) then uncomment one of the next
// 2 lines try both options, one of the options should correct the inversion.
//#define TFT_INVERSION_ON
//#define TFT_INVERSION_OFF
// ##################################################################################
//
// Section 1. Define the pins that are used to interface with the display here
......
This diff is collapsed.
{
"name": "TFT_eSPI",
"version": "1.3.8",
"version": "1.3.9",
"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",
"repository":
......
name=TFT_eSPI
version=1.3.8
version=1.3.9
author=Bodmer
maintainer=Bodmer
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment