Fix #417 and add for 135x240 display

Setup 135 is for TTGO T Display (ESP32)
Plus minor tweaks to avoid some warnings
This commit is contained in:
Bodmer
2019-10-07 17:56:11 +01:00
parent 9a84fb156b
commit d3210a7ee6
7 changed files with 59 additions and 8 deletions

View File

@@ -464,7 +464,13 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y)
{
if (!_created) return;
if (_bpp == 16) _tft->pushImage(x, y, _iwidth, _iheight, _img );
if (_bpp == 16)
{
bool oldSwapBytes = _tft->getSwapBytes();
_tft->setSwapBytes(false);
_tft->pushImage(x, y, _iwidth, _iheight, _img );
_tft->setSwapBytes(oldSwapBytes);
}
else _tft->pushImage(x, y, _dwidth, _dheight, _img8, (bool)(_bpp == 8));
}
@@ -478,7 +484,13 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y, uint16_t transp)
{
if (!_created) return;
if (_bpp == 16) _tft->pushImage(x, y, _iwidth, _iheight, _img, transp );
if (_bpp == 16)
{
bool oldSwapBytes = _tft->getSwapBytes();
_tft->setSwapBytes(false);
_tft->pushImage(x, y, _iwidth, _iheight, _img, transp );
_tft->setSwapBytes(oldSwapBytes);
}
else if (_bpp == 8)
{
transp = (uint8_t)((transp & 0xE000)>>8 | (transp & 0x0700)>>6 | (transp & 0x0018)>>3);
@@ -716,7 +728,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const u
uint32_t ww = (w+7) & 0xFFF8;
for (int32_t yp = 0; yp<h; yp++)
{
for (int32_t xp = 0; xp<ww; xp+=8)
for (uint32_t xp = 0; xp<ww; xp+=8)
{
uint8_t pbyte = pgm_read_byte(pdata++);
for (uint8_t xc = 0; xc < 8; xc++)

View File

@@ -35,9 +35,9 @@
// If it is a 16bit serial display we must transfer 16 bits every time
#ifdef RPI_ILI9486_DRIVER
#define CMD_BITS 16-1
#define CMD_BITS (16-1)
#else
#define CMD_BITS 8-1
#define CMD_BITS (8-1)
#endif
// Fast block write prototype

View File

@@ -49,6 +49,7 @@
//#include <User_Setups/Setup22_TTGO_T4.h> // Setup file for ESP32 and TTGO T4 (BTC) ILI9341 SPI bus TFT
//#include <User_Setups/Setup23_TTGO_TM.h> // Setup file for ESP32 and TTGO TM ST7789 SPI bus TFT
//#include <User_Setups/Setup24_ST7789.h> // Setup file configured for ST7789 240 x 240
//#include <User_Setups/Setup25_TTGO_T_Display.h> // Setup file for ESP32 and TTGO T-Display ST7789V SPI bus TFT
//#include <User_Setups/Setup43_ST7735.h> // Setup file configured for my ST7735S 80x160

View File

@@ -0,0 +1,38 @@
// Setup for the TTGO T4 ("Bitcoin Tracker") ESP32 board with 2.2" ILI9341 display
// See SetupX_Template.h for all options available
#define ST7789_DRIVER
#define TFT_WIDTH 135
#define TFT_HEIGHT 240
#define CGRAM_OFFSET // Library will add offsets required
//#define TFT_MISO -1
#define TFT_MOSI 19
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 16
#define TFT_RST 23
#define TFT_BL 4 // Display backlight control pin
#define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options
#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF
#define SMOOTH_FONT
//#define SPI_FREQUENCY 27000000
#define SPI_FREQUENCY 40000000 // Maximum for ILI9341
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V

View File

@@ -66,7 +66,7 @@ void loop() {
// start_angle = 0 - 359
// r = radius
int yinyang(int x, int y, int start_angle, int r)
void yinyang(int x, int y, int start_angle, int r)
{
int x1 = 0; // getCoord() will update these
int y1 = 0;

View File

@@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "1.4.16",
"version": "1.4.17",
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
"repository":

View File

@@ -1,5 +1,5 @@
name=TFT_eSPI
version=1.4.16
version=1.4.17
author=Bodmer
maintainer=Bodmer
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE