From 24a8acec8fa868771b45d21856c41e51e27ea70d Mon Sep 17 00:00:00 2001 From: Luc Date: Sun, 30 Jun 2019 16:44:40 +0200 Subject: [PATCH] add vscode/platformIO support Update some libs --- .gitignore | 7 + .gitmodules | 3 + .vscode/extensions.json | 7 + .vscode/tasks.json | 13 ++ libraries/ESP32SSDP/examples/SSDP/SSDP.ino | 1 + libraries/TFT_eSPI/Extensions/Smooth_font.cpp | 71 +++++-- libraries/TFT_eSPI/Extensions/Smooth_font.h | 13 +- libraries/TFT_eSPI/Extensions/Sprite.cpp | 2 +- libraries/TFT_eSPI/Extensions/Touch.cpp | 2 +- .../TFT_eSPI/TFT_Drivers/ST7789_2_Defines.h | 143 ++++++++++++++ .../TFT_eSPI/TFT_Drivers/ST7789_2_Init.h | 22 +++ .../TFT_eSPI/TFT_Drivers/ST7789_2_Rotation.h | 48 +++++ libraries/TFT_eSPI/TFT_Drivers/ST7789_Init.h | 4 +- libraries/TFT_eSPI/TFT_eSPI.cpp | 99 ++++++---- libraries/TFT_eSPI/TFT_eSPI.h | 6 +- libraries/TFT_eSPI/User_Setup.h | 25 +-- libraries/TFT_eSPI/User_Setup_Select.h | 6 +- .../User_Setups/Setup10_RPi_touch_ILI9486.h | 2 +- .../TFT_eSPI/User_Setups/Setup18_ST7789.h | 11 +- .../TFT_eSPI/User_Setups/Setup21_ILI9488.h | 4 + .../TFT_eSPI/User_Setups/Setup24_ST7789.h | 53 ++++++ .../TFT_eSPI/User_Setups/SetupX_Template.h | 7 +- .../ESP32_Smooth_Font_SD.ino | 174 ++++++++++++++++++ .../data/Final-Frontier-28.vlw | Bin 0 -> 25287 bytes .../Colour_Test/Colour_Test.ino | 6 +- .../Read_User_Setup/Read_User_Setup.ino | 2 + libraries/TFT_eSPI/library.json | 2 +- libraries/TFT_eSPI/library.properties | 2 +- platformio.ini | 57 ++++++ 29 files changed, 705 insertions(+), 87 deletions(-) create mode 100644 .gitmodules create mode 100644 .vscode/extensions.json create mode 100644 .vscode/tasks.json create mode 100644 libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Defines.h create mode 100644 libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Init.h create mode 100644 libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Rotation.h create mode 100644 libraries/TFT_eSPI/User_Setups/Setup24_ST7789.h create mode 100644 libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/ESP32_Smooth_Font_SD.ino create mode 100644 libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/data/Final-Frontier-28.vlw create mode 100644 platformio.ini diff --git a/.gitignore b/.gitignore index 60723e05..cdb0f107 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ Thumbs.db +.DS_Store *.orig embedded/node_modules embedded/dist +.pio +.pioenvs +.piolibdeps +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..ffe586db --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ESP3D-WEBUI"] + path = ESP3D-WEBUI + url = https://github.com/luc-github/ESP3D-WEBUI diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..272828b5 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..30ef0e1e --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,13 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "install", + "path": "embedded/", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/libraries/ESP32SSDP/examples/SSDP/SSDP.ino b/libraries/ESP32SSDP/examples/SSDP/SSDP.ino index 8014a3a5..46f02438 100644 --- a/libraries/ESP32SSDP/examples/SSDP/SSDP.ino +++ b/libraries/ESP32SSDP/examples/SSDP/SSDP.ino @@ -36,6 +36,7 @@ void setup() { SSDP.setModelURL("http://www.meethue.com"); SSDP.setManufacturer("Royal Philips Electronics"); SSDP.setManufacturerURL("http://www.philips.com"); + SSDP.setDeviceType("upnp:rootdevice"); //to appear as root device SSDP.begin(); Serial.printf("Ready!\n"); diff --git a/libraries/TFT_eSPI/Extensions/Smooth_font.cpp b/libraries/TFT_eSPI/Extensions/Smooth_font.cpp index 6e5f89d1..ca1cb639 100644 --- a/libraries/TFT_eSPI/Extensions/Smooth_font.cpp +++ b/libraries/TFT_eSPI/Extensions/Smooth_font.cpp @@ -8,9 +8,18 @@ /*************************************************************************************** ** Function name: loadFont -** Description: loads parameters from a new font vlw file stored in SPIFFS +** Description: loads parameters from a new font vlw file *************************************************************************************x*/ -void TFT_eSPI::loadFont(String fontName) +void TFT_eSPI::loadFont(String fontName, fs::FS &ffs) +{ + fontFS = ffs; + loadFont(fontName, false); +} +/*************************************************************************************** +** Function name: loadFont +** Description: loads parameters from a new font vlw file +*************************************************************************************x*/ +void TFT_eSPI::loadFont(String fontName, bool flash) { /* The vlw font format does not appear to be documented anywhere, so some reverse @@ -74,15 +83,19 @@ void TFT_eSPI::loadFont(String fontName) */ - unloadFont(); - + spiffs = flash; + + if(spiffs) fontFS = SPIFFS; + + unloadFont(); + // Avoid a crash on the ESP32 if the file does not exist - if (SPIFFS.exists("/" + fontName + ".vlw") == false) { + if (fontFS.exists("/" + fontName + ".vlw") == false) { Serial.println("Font file " + fontName + " not found!"); return; } - fontFile = SPIFFS.open( "/" + fontName + ".vlw", "r"); + fontFile = fontFS.open( "/" + fontName + ".vlw", "r"); if(!fontFile) return; @@ -120,13 +133,28 @@ void TFT_eSPI::loadMetrics(uint16_t gCount) uint32_t headerPtr = 24; uint32_t bitmapPtr = 24 + gCount * 28; - gUnicode = (uint16_t*)malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF) - gHeight = (uint8_t*)malloc( gCount ); // Height of glyph - gWidth = (uint8_t*)malloc( gCount ); // Width of glyph - gxAdvance = (uint8_t*)malloc( gCount ); // xAdvance - to move x cursor - gdY = (int16_t*)malloc( gCount * 2); // offset from bitmap top edge from lowest point in any character - gdX = (int8_t*)malloc( gCount ); // offset for bitmap left edge relative to cursor X - gBitmap = (uint32_t*)malloc( gCount * 4); // seek pointer to glyph bitmap in SPIFFS file +#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT) + if ( psramFound() ) + { + gUnicode = (uint16_t*)ps_malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF) + gHeight = (uint8_t*)ps_malloc( gCount ); // Height of glyph + gWidth = (uint8_t*)ps_malloc( gCount ); // Width of glyph + gxAdvance = (uint8_t*)ps_malloc( gCount ); // xAdvance - to move x cursor + gdY = (int16_t*)ps_malloc( gCount * 2); // offset from bitmap top edge from lowest point in any character + gdX = (int8_t*)ps_malloc( gCount ); // offset for bitmap left edge relative to cursor X + gBitmap = (uint32_t*)ps_malloc( gCount * 4); // seek pointer to glyph bitmap in the file + } + else +#endif + { + gUnicode = (uint16_t*)malloc( gCount * 2); // Unicode 16 bit Basic Multilingual Plane (0-FFFF) + gHeight = (uint8_t*)malloc( gCount ); // Height of glyph + gWidth = (uint8_t*)malloc( gCount ); // Width of glyph + gxAdvance = (uint8_t*)malloc( gCount ); // xAdvance - to move x cursor + gdY = (int16_t*)malloc( gCount * 2); // offset from bitmap top edge from lowest point in any character + gdX = (int8_t*)malloc( gCount ); // offset for bitmap left edge relative to cursor X + gBitmap = (uint32_t*)malloc( gCount * 4); // seek pointer to glyph bitmap in the file + } #ifdef SHOW_ASCENT_DESCENT Serial.print("ascent = "); Serial.println(gFont.ascent); @@ -456,7 +484,19 @@ void TFT_eSPI::drawGlyph(uint16_t code) for (int y = 0; y < gHeight[gNum]; y++) { - fontFile.read(pbuffer, gWidth[gNum]); //2) && (font<9)) { // This is slower than above but is more convenient for the RLE fonts - flash_address = pgm_read_dword( pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *) ); + flash_address = pgm_read_dword( (const void*)pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *) ); width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode ); height= pgm_read_byte( &fontdata[font].height ); } diff --git a/libraries/TFT_eSPI/Extensions/Touch.cpp b/libraries/TFT_eSPI/Extensions/Touch.cpp index 3f451026..cb253bed 100644 --- a/libraries/TFT_eSPI/Extensions/Touch.cpp +++ b/libraries/TFT_eSPI/Extensions/Touch.cpp @@ -141,7 +141,7 @@ uint8_t TFT_eSPI::getTouch(uint16_t *x, uint16_t *y, uint16_t threshold){ convertRawXY(&x_tmp, &y_tmp); - if (x_tmp >= _width || y_tmp >= _height) return valid; + if (x_tmp >= _width || y_tmp >= _height) return false; _pressX = x_tmp; _pressY = y_tmp; diff --git a/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Defines.h b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Defines.h new file mode 100644 index 00000000..b777b69e --- /dev/null +++ b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Defines.h @@ -0,0 +1,143 @@ +// Change the width and height if required (defined in portrait mode) +// or use the constructor to over-ride defaults +#ifndef TFT_WIDTH + #define TFT_WIDTH 240 +#endif +#ifndef TFT_HEIGHT + #define TFT_HEIGHT 320 +#endif + +#if (TFT_HEIGHT == 240) && (TFT_WIDTH == 240) + #define CGRAM_OFFSET +#endif + +// Delay between some initialisation commands +#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked + + +// Generic commands used by TFT_eSPI.cpp +#define TFT_NOP 0x00 +#define TFT_SWRST 0x01 + +#define TFT_SLPIN 0x10 +#define TFT_SLPOUT 0x11 +#define TFT_NORON 0x13 + +#define TFT_INVOFF 0x20 +#define TFT_INVON 0x21 +#define TFT_DISPOFF 0x28 +#define TFT_DISPON 0x29 +#define TFT_CASET 0x2A +#define TFT_PASET 0x2B +#define TFT_RAMWR 0x2C +#define TFT_RAMRD 0x2E +#define TFT_MADCTL 0x36 +#define TFT_COLMOD 0x3A + +// Flags for TFT_MADCTL +#define TFT_MAD_MY 0x80 +#define TFT_MAD_MX 0x40 +#define TFT_MAD_MV 0x20 +#define TFT_MAD_ML 0x10 +#define TFT_MAD_RGB 0x00 +#define TFT_MAD_BGR 0x08 +#define TFT_MAD_MH 0x04 +#define TFT_MAD_SS 0x02 +#define TFT_MAD_GS 0x01 + +#ifdef TFT_RGB_ORDER + #if (TFT_RGB_ORDER == 1) + #define TFT_MAD_COLOR_ORDER TFT_MAD_RGB + #else + #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR + #endif +#else + #ifdef CGRAM_OFFSET + #define TFT_MAD_COLOR_ORDER TFT_MAD_BGR + #else + #define TFT_MAD_COLOR_ORDER TFT_MAD_RGB + #endif +#endif + +#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read + +#define ST_CMD_DELAY 0x80 // special signifier for command lists +#define ST7789_240x240_XSTART 0 +#define ST7789_240x240_YSTART 0 + +// ST7789 specific commands used in init +#define ST7789_NOP 0x00 +#define ST7789_SWRESET 0x01 +#define ST7789_RDDID 0x04 +#define ST7789_RDDST 0x09 + +#define ST7789_RDDPM 0x0A // Read display power mode +#define ST7789_RDD_MADCTL 0x0B // Read display MADCTL +#define ST7789_RDD_COLMOD 0x0C // Read display pixel format +#define ST7789_RDDIM 0x0D // Read display image mode +#define ST7789_RDDSM 0x0E // Read display signal mode +#define ST7789_RDDSR 0x0F // Read display self-diagnostic result (ST7789V) + +#define ST7789_SLPIN 0x10 +#define ST7789_SLPOUT 0x11 +#define ST7789_PTLON 0x12 +#define ST7789_NORON 0x13 + +#define ST7789_INVOFF 0x20 +#define ST7789_INVON 0x21 +#define ST7789_GAMSET 0x26 // Gamma set +#define ST7789_DISPOFF 0x28 +#define ST7789_DISPON 0x29 +#define ST7789_CASET 0x2A +#define ST7789_RASET 0x2B +#define ST7789_RAMWR 0x2C +#define ST7789_RGBSET 0x2D // Color setting for 4096, 64K and 262K colors +#define ST7789_RAMRD 0x2E + +#define ST7789_PTLAR 0x30 +#define ST7789_VSCRDEF 0x33 // Vertical scrolling definition (ST7789V) +#define ST7789_TEOFF 0x34 // Tearing effect line off +#define ST7789_TEON 0x35 // Tearing effect line on +#define ST7789_MADCTL 0x36 // Memory data access control +#define ST7789_IDMOFF 0x38 // Idle mode off +#define ST7789_IDMON 0x39 // Idle mode on +#define ST7789_RAMWRC 0x3C // Memory write continue (ST7789V) +#define ST7789_RAMRDC 0x3E // Memory read continue (ST7789V) +#define ST7789_COLMOD 0x3A + +#define ST7789_RAMCTRL 0xB0 // RAM control +#define ST7789_RGBCTRL 0xB1 // RGB control +#define ST7789_PORCTRL 0xB2 // Porch control +#define ST7789_FRCTRL1 0xB3 // Frame rate control +#define ST7789_PARCTRL 0xB5 // Partial mode control +#define ST7789_GCTRL 0xB7 // Gate control +#define ST7789_GTADJ 0xB8 // Gate on timing adjustment +#define ST7789_DGMEN 0xBA // Digital gamma enable +#define ST7789_VCOMS 0xBB // VCOMS setting +#define ST7789_LCMCTRL 0xC0 // LCM control +#define ST7789_IDSET 0xC1 // ID setting +#define ST7789_VDVVRHEN 0xC2 // VDV and VRH command enable +#define ST7789_VRHS 0xC3 // VRH set +#define ST7789_VDVSET 0xC4 // VDV setting +#define ST7789_VCMOFSET 0xC5 // VCOMS offset set +#define ST7789_FRCTR2 0xC6 // FR Control 2 +#define ST7789_CABCCTRL 0xC7 // CABC control +#define ST7789_REGSEL1 0xC8 // Register value section 1 +#define ST7789_REGSEL2 0xCA // Register value section 2 +#define ST7789_PWMFRSEL 0xCC // PWM frequency selection +#define ST7789_PWCTRL1 0xD0 // Power control 1 +#define ST7789_VAPVANEN 0xD2 // Enable VAP/VAN signal output +#define ST7789_CMD2EN 0xDF // Command 2 enable +#define ST7789_PVGAMCTRL 0xE0 // Positive voltage gamma control +#define ST7789_NVGAMCTRL 0xE1 // Negative voltage gamma control +#define ST7789_DGMLUTR 0xE2 // Digital gamma look-up table for red +#define ST7789_DGMLUTB 0xE3 // Digital gamma look-up table for blue +#define ST7789_GATECTRL 0xE4 // Gate control +#define ST7789_SPI2EN 0xE7 // SPI2 enable +#define ST7789_PWCTRL2 0xE8 // Power control 2 +#define ST7789_EQCTRL 0xE9 // Equalize time control +#define ST7789_PROMCTRL 0xEC // Program control +#define ST7789_PROMEN 0xFA // Program mode enable +#define ST7789_NVMSET 0xFC // NVM setting +#define ST7789_PROMACT 0xFE // Program action + diff --git a/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Init.h b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Init.h new file mode 100644 index 00000000..3cd9630b --- /dev/null +++ b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Init.h @@ -0,0 +1,22 @@ + +// This is the command sequence that initialises the ST7789 driver + +// Configure ST7789 display + +{ +static const uint8_t PROGMEM + st7789[] = { + 8, + TFT_SLPOUT, TFT_INIT_DELAY, 255, + TFT_COLMOD, 1+TFT_INIT_DELAY, 0x55, 10, + TFT_MADCTL, 1, 0x00, + TFT_CASET, 4, 0x00, 0x00, 0x00, 0xF0, + TFT_PASET, 4, 0x00, 0x00, 0x00, 0xF0, + TFT_INVON, TFT_INIT_DELAY, 10, + TFT_NORON, TFT_INIT_DELAY, 10, + TFT_DISPON, TFT_INIT_DELAY, 255 + }; + + commandList(st7789); +} +// End of ST7789 display configuration \ No newline at end of file diff --git a/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Rotation.h b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Rotation.h new file mode 100644 index 00000000..d25cc0c7 --- /dev/null +++ b/libraries/TFT_eSPI/TFT_Drivers/ST7789_2_Rotation.h @@ -0,0 +1,48 @@ + // This is the command sequence that rotates the ST7789 driver coordinate frame + + writecommand(TFT_MADCTL); + rotation = m % 4; + switch (rotation) { + case 0: // Portrait +#ifdef CGRAM_OFFSET + colstart = 0; + rowstart = 0; +#endif + writedata(TFT_MAD_COLOR_ORDER); + + _width = _init_width; + _height = _init_height; + break; + + case 1: // Landscape (Portrait + 90) +#ifdef CGRAM_OFFSET + colstart = 0; + rowstart = 0; +#endif + writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); + + _width = _init_height; + _height = _init_width; + break; + + case 2: // Inverter portrait +#ifdef CGRAM_OFFSET + colstart = 0; + rowstart = 80; +#endif + writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); + + _width = _init_width; + _height = _init_height; + break; + case 3: // Inverted landscape +#ifdef CGRAM_OFFSET + colstart = 80; + rowstart = 0; +#endif + writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); + + _width = _init_height; + _height = _init_width; + break; + } diff --git a/libraries/TFT_eSPI/TFT_Drivers/ST7789_Init.h b/libraries/TFT_eSPI/TFT_Drivers/ST7789_Init.h index cad01a30..d6b0b114 100644 --- a/libraries/TFT_eSPI/TFT_Drivers/ST7789_Init.h +++ b/libraries/TFT_eSPI/TFT_Drivers/ST7789_Init.h @@ -23,6 +23,7 @@ writecommand(ST7789_COLMOD); writedata(0x55); + delay(10); //--------------------------------ST7789V Frame rate setting----------------------------------// writecommand(ST7789_PORCTRL); @@ -92,7 +93,7 @@ writedata(0x1b); writedata(0x1e); - writecommand(ST7789_INVOFF); + writecommand(ST7789_INVON); writecommand(ST7789_CASET); // Column address set writedata(0x00); @@ -113,6 +114,7 @@ spi_begin(); writecommand(ST7789_DISPON); //Display on + delay(120); #ifdef TFT_BL // Turn on the back-light LED diff --git a/libraries/TFT_eSPI/TFT_eSPI.cpp b/libraries/TFT_eSPI/TFT_eSPI.cpp index 19af2272..ad27dcb7 100644 --- a/libraries/TFT_eSPI/TFT_eSPI.cpp +++ b/libraries/TFT_eSPI/TFT_eSPI.cpp @@ -21,11 +21,11 @@ #ifdef USE_HSPI_PORT SPIClass spi = SPIClass(HSPI); #else // use default VSPI port - SPIClass spi = SPIClass(VSPI); + SPIClass& spi = SPI; #endif #endif #else // ESP8266 - SPIClass spi = SPIClass(); + SPIClass& spi = SPI; #endif // SUPPORT_TRANSACTIONS is mandatory for ESP32 so the hal mutex is toggled @@ -228,6 +228,11 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h) _xpivot = 0; _ypivot = 0; + cspinmask = 0; + dcpinmask = 0; + wrpinmask = 0; + sclkpinmask = 0; + #ifdef LOAD_GLCD fontsloaded = 0x0002; // Bit 1 set #endif @@ -281,19 +286,19 @@ void TFT_eSPI::init(uint8_t tc) if (_booted) { #if !defined (ESP32) - #ifdef TFT_CS + #if defined (TFT_CS) && (TFT_CS >= 0) cspinmask = (uint32_t) digitalPinToBitMask(TFT_CS); #endif - #ifdef TFT_DC + #if defined (TFT_DC) && (TFT_DC >= 0) dcpinmask = (uint32_t) digitalPinToBitMask(TFT_DC); #endif - #ifdef TFT_WR + #if defined (TFT_WR) && (TFT_WR >= 0) wrpinmask = (uint32_t) digitalPinToBitMask(TFT_WR); #endif - #ifdef TFT_SCLK + #if defined (TFT_SCLK) && (TFT_SCLK >= 0) sclkpinmask = (uint32_t) digitalPinToBitMask(TFT_SCLK); #endif @@ -407,6 +412,9 @@ void TFT_eSPI::init(uint8_t tc) #elif defined (R61581_DRIVER) #include "TFT_Drivers/R61581_Init.h" +#elif defined (ST7789_2_DRIVER) + #include "TFT_Drivers/ST7789_2_Init.h" + #endif #ifdef TFT_INVERSION_ON @@ -477,6 +485,9 @@ void TFT_eSPI::setRotation(uint8_t m) #elif defined (R61581_DRIVER) #include "TFT_Drivers/R61581_Rotation.h" +#elif defined (ST7789_2_DRIVER) + #include "TFT_Drivers/ST7789_2_Rotation.h" + #endif delayMicroseconds(10); @@ -1561,7 +1572,7 @@ void TFT_eSPI::drawCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color) int32_t dy = r+r; int32_t p = -(r>>1); - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; // These are ordered to minimise coordinate changes in x or y @@ -1598,7 +1609,7 @@ void TFT_eSPI::drawCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color) } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1654,7 +1665,7 @@ void TFT_eSPI::fillCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color) int32_t dy = r+r; int32_t p = -(r>>1); - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; drawFastHLine(x0 - r, y0, dy+1, color); @@ -1680,7 +1691,7 @@ void TFT_eSPI::fillCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color) } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1736,7 +1747,7 @@ void TFT_eSPI::drawEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint1 int32_t fy2 = 4 * ry2; int32_t s; - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; for (x = 0, y = ry, s = 2*ry2+rx2*(1-2*ry); ry2*x <= rx2*y; x++) @@ -1772,7 +1783,7 @@ void TFT_eSPI::drawEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint1 } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1791,7 +1802,7 @@ void TFT_eSPI::fillEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint1 int32_t fy2 = 4 * ry2; int32_t s; - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; for (x = 0, y = ry, s = 2*ry2+rx2*(1-2*ry); ry2*x <= rx2*y; x++) @@ -1821,7 +1832,7 @@ void TFT_eSPI::fillEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint1 } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1842,7 +1853,7 @@ void TFT_eSPI::fillScreen(uint32_t color) // Draw a rectangle void TFT_eSPI::drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; drawFastHLine(x, y, w, color); @@ -1852,7 +1863,7 @@ void TFT_eSPI::drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t col drawFastVLine(x + w - 1, y+1, h-2, color); inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1863,7 +1874,7 @@ void TFT_eSPI::drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t col // Draw a rounded rectangle void TFT_eSPI::drawRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t r, uint32_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; // smarter version @@ -1878,7 +1889,7 @@ void TFT_eSPI::drawRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t drawCircleHelper(x + r , y + h - r - 1, r, 8, color); inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1889,7 +1900,7 @@ void TFT_eSPI::drawRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t // Fill a rounded rectangle, changed to horizontal lines (faster in sprites) void TFT_eSPI::fillRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t r, uint32_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; // smarter version @@ -1900,7 +1911,7 @@ void TFT_eSPI::fillRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t fillCircleHelper(x + r , y + r, r, 2, w - r - r - 1, color); inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1911,7 +1922,7 @@ void TFT_eSPI::fillRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t // Draw a triangle void TFT_eSPI::drawTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; drawLine(x0, y0, x1, y1, color); @@ -1919,7 +1930,7 @@ void TFT_eSPI::drawTriangle(int32_t x0, int32_t y0, int32_t x1, int32_t y1, int3 drawLine(x2, y2, x0, y0, color); inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -1953,7 +1964,7 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in return; } - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; int32_t @@ -2000,7 +2011,7 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -2010,7 +2021,7 @@ void TFT_eSPI::fillTriangle ( int32_t x0, int32_t y0, int32_t x1, int32_t y1, in ***************************************************************************************/ void TFT_eSPI::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; int32_t i, j, byteWidth = (w + 7) / 8; @@ -2024,7 +2035,7 @@ void TFT_eSPI::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -2034,7 +2045,7 @@ void TFT_eSPI::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w ***************************************************************************************/ void TFT_eSPI::drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; int32_t i, j, byteWidth = (w + 7) / 8; @@ -2048,7 +2059,7 @@ void TFT_eSPI::drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -2058,7 +2069,7 @@ void TFT_eSPI::drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t ***************************************************************************************/ void TFT_eSPI::drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bgcolor) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; int32_t i, j, byteWidth = (w + 7) / 8; @@ -2072,7 +2083,7 @@ void TFT_eSPI::drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } @@ -2480,7 +2491,7 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32 } else { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; for (int8_t i = 0; i < 6; i++ ) { uint8_t line; @@ -2505,7 +2516,7 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32 } } inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } //>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -2519,7 +2530,7 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32 // Filter out bad characters not present in font if ((c >= pgm_read_word(&gfxFont->first)) && (c <= pgm_read_word(&gfxFont->last ))) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; //>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -2643,7 +2654,7 @@ void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32 } #endif inTransaction = false; - spi_end(); + spi_end(); // Does nothing if Sprite class uses this function } #endif @@ -3378,7 +3389,7 @@ void TFT_eSPI::pushColors(uint8_t *data, uint32_t len) while (len--) {tft_Write_8(*data); data++;} #elif defined (ILI9488_DRIVER) uint16_t color; - while (len>1) {color = (*data++) | ((*data++)<<8); tft_Write_16(color); len-=2;} + while (len>1) {color = (*data++); color |= ((*data++)<<8); tft_Write_16(color); len-=2;} #else #if (SPI_FREQUENCY == 80000000) while ( len >=64 ) {spi.writePattern(data, 64, 1); data += 64; len -= 64; } @@ -3500,7 +3511,7 @@ void TFT_eSPI::pushColors(uint16_t *data, uint32_t len, bool swap) void TFT_eSPI::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; boolean steep = abs(y1 - y0) > abs(x1 - x0); if (steep) { @@ -4259,7 +4270,7 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font) { if ((font>2) && (font<9)) { - flash_address = pgm_read_dword( pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *) ); + flash_address = pgm_read_dword( (const void*)pgm_read_dword( &(fontdata[font].chartbl ) ) + uniCode*sizeof(void *) ); width = pgm_read_byte( (uint8_t *)pgm_read_dword( &(fontdata[font].widthtbl ) ) + uniCode ); height= pgm_read_byte( &fontdata[font].height ); } @@ -4278,7 +4289,7 @@ int16_t TFT_eSPI::drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font) if (x + width * textsize >= (int16_t)_width) return width * textsize ; if (textcolor == textbgcolor || textsize != 1) { - spi_begin(); + //spi_begin(); // Sprite class can use this function, avoiding spi_begin() inTransaction = true; for (int32_t i = 0; i < height; i++) @@ -5178,6 +5189,18 @@ void writeBlock(uint16_t color, uint32_t repeat) #endif +/*************************************************************************************** +** Function name: getSPIinstance +** Description: Get the instance of the SPI class (for ESP32 only) +***************************************************************************************/ +#ifndef ESP32_PARALLEL +SPIClass& TFT_eSPI::getSPIinstance(void) +{ + return spi; +} +#endif + + /*************************************************************************************** ** Function name: getSetup ** Description: Get the setup details for diagnostic and sketch access diff --git a/libraries/TFT_eSPI/TFT_eSPI.h b/libraries/TFT_eSPI/TFT_eSPI.h index cc937d75..75c12372 100644 --- a/libraries/TFT_eSPI/TFT_eSPI.h +++ b/libraries/TFT_eSPI/TFT_eSPI.h @@ -37,7 +37,7 @@ #define SPI_READ_FREQUENCY SPI_FREQUENCY #endif -#ifdef ST7789_DRIVER +#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER) #define TFT_SPI_MODE SPI_MODE3 #else #define TFT_SPI_MODE SPI_MODE0 @@ -334,7 +334,7 @@ // Convert swapped byte 16 bit colour to 18 bit and write in 3 bytes #define tft_Write_16S(C) spi.transfer(C & 0xF8); \ - spi.transfer((C & 0xE0)>>11 | (C & 0x07)<<5); \ + spi.transfer((C & 0xE000)>>11 | (C & 0x07)<<5); \ spi.transfer((C & 0x1F00)>>5) // Write 32 bits to TFT #define tft_Write_32(C) spi.write32(C) @@ -831,6 +831,8 @@ class TFT_eSPI : public Print { void getSetup(setup_t& tft_settings); // Sketch provides the instance to populate + static SPIClass& getSPIinstance(void); + int32_t cursor_x, cursor_y, padX; uint32_t textcolor, textbgcolor; diff --git a/libraries/TFT_eSPI/User_Setup.h b/libraries/TFT_eSPI/User_Setup.h index 3a09e7bd..3f446442 100644 --- a/libraries/TFT_eSPI/User_Setup.h +++ b/libraries/TFT_eSPI/User_Setup.h @@ -25,14 +25,15 @@ //#define ILI9481_DRIVER //#define ILI9486_DRIVER //#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high) -//#define ST7789_DRIVER // Define additional parameters below for this display +//#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display +//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display //#define R61581_DRIVER // Some displays support SPI reads via the MISO pin, other displays have a single // bi-directional SDA pin and the library will try to read this via the MOSI line. // To use the SDA line for reading data from the TFT uncomment the following line: -// #define TFT_SDA_READ // This option if for ESP32 ONLY, tested with ST7789 display only +// #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 display only // For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display // Try ONE option at a time to find the correct colour order for your display @@ -123,9 +124,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ###### // For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation -//#define TFT_CS PIN_D8 // Chip select control pin D8 -//#define TFT_DC PIN_D3 // Data Command control pin -//#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line) +#define TFT_CS PIN_D8 // Chip select control pin D8 +#define TFT_DC PIN_D3 // Data Command control pin +#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line) //#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V //#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin) @@ -156,17 +157,17 @@ // For ESP32 Dev board (only tested with ILI9341 display) // The hardware SPI can be mapped to any pins -#define TFT_MISO 19 -#define TFT_MOSI 23 -#define TFT_SCLK 18 -#define TFT_CS 15 // Chip select control pin -#define TFT_DC 2 // Data Command control pin +//#define TFT_MISO 19 +//#define TFT_MOSI 23 +//#define TFT_SCLK 18 +//#define TFT_CS 15 // Chip select control pin +//#define TFT_DC 2 // Data Command control pin //#define TFT_RST 4 // Reset pin (could connect to RST pin) -#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST +//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST //#define TFT_BL 32 // LED back-light (only for ST7789 with backlight control pin) -#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen +//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen //#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only diff --git a/libraries/TFT_eSPI/User_Setup_Select.h b/libraries/TFT_eSPI/User_Setup_Select.h index 69d27a0e..06568f17 100644 --- a/libraries/TFT_eSPI/User_Setup_Select.h +++ b/libraries/TFT_eSPI/User_Setup_Select.h @@ -39,13 +39,14 @@ //#include // Setup file configured for HX8357D (untested) //#include // Setup file for the ESP32 with parallel bus TFT //#include // Setup file for any Waveshare ePaper display -//#include // Setup file configured for HX8357D (untested) +//#include // Setup file configured for ST7789 //#include // Setup file for ESP8266 and ILI9488 SPI bus TFT //#include // Setup file for ESP32 and ILI9488 SPI bus TFT //#include // Setup file for ESP32 and TTGO T4 (BTC) ILI9341 SPI bus TFT //#include // Setup file for ESP32 and TTGO TM ST7789 SPI bus TFT +//#include // Setup file configured for ST7789 240 x 240 //#include // Setup file configured for my ST7735S 80x160 @@ -106,6 +107,9 @@ #elif defined (R61581_DRIVER) #include "TFT_Drivers/R61581_Defines.h" #define TFT_DRIVER 0x6158 +#elif defined (ST7789_2_DRIVER) + #include "TFT_Drivers/ST7789_2_Defines.h" + #define TFT_DRIVER 0x778B #elif defined (XYZZY_DRIVER) // <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE #include "TFT_Drivers/XYZZY_Defines.h" #define TFT_DRIVER 0x0000 diff --git a/libraries/TFT_eSPI/User_Setups/Setup10_RPi_touch_ILI9486.h b/libraries/TFT_eSPI/User_Setups/Setup10_RPi_touch_ILI9486.h index 8e59a6bc..ffe2f710 100644 --- a/libraries/TFT_eSPI/User_Setups/Setup10_RPi_touch_ILI9486.h +++ b/libraries/TFT_eSPI/User_Setups/Setup10_RPi_touch_ILI9486.h @@ -23,7 +23,7 @@ #define SMOOTH_FONT -#define SPI_FREQUENCY 20000000 +#define SPI_FREQUENCY 16000000 #define SPI_TOUCH_FREQUENCY 2500000 diff --git a/libraries/TFT_eSPI/User_Setups/Setup18_ST7789.h b/libraries/TFT_eSPI/User_Setups/Setup18_ST7789.h index 25d57a37..1f9be038 100644 --- a/libraries/TFT_eSPI/User_Setups/Setup18_ST7789.h +++ b/libraries/TFT_eSPI/User_Setups/Setup18_ST7789.h @@ -2,8 +2,17 @@ #define ST7789_DRIVER +// #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 display only -#define TFT_SDA_READ +// 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 + +// For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display +// Try ONE option at a time to find the correct colour order for your display +// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red // My ST7789 display has TCT_CS wired permananently low so the pin is not defined here diff --git a/libraries/TFT_eSPI/User_Setups/Setup21_ILI9488.h b/libraries/TFT_eSPI/User_Setups/Setup21_ILI9488.h index 1a39a023..358eef48 100644 --- a/libraries/TFT_eSPI/User_Setups/Setup21_ILI9488.h +++ b/libraries/TFT_eSPI/User_Setups/Setup21_ILI9488.h @@ -2,6 +2,7 @@ #define ILI9488_DRIVER +//#define TFT_INVERSION_OFF #define TFT_MISO 19 // (leave TFT SDO disconnected if other SPI devices share MISO) #define TFT_MOSI 23 @@ -27,4 +28,7 @@ // #define SPI_FREQUENCY 40000000 // #define SPI_FREQUENCY 80000000 +// Optional reduced SPI frequency for reading TFT +#define SPI_READ_FREQUENCY 16000000 + #define SPI_TOUCH_FREQUENCY 2500000 diff --git a/libraries/TFT_eSPI/User_Setups/Setup24_ST7789.h b/libraries/TFT_eSPI/User_Setups/Setup24_ST7789.h new file mode 100644 index 00000000..d75b7433 --- /dev/null +++ b/libraries/TFT_eSPI/User_Setups/Setup24_ST7789.h @@ -0,0 +1,53 @@ +// ST7789 240 x 240 display with no chip select line + +#define ST7789_DRIVER // Configure all registers + +#define TFT_WIDTH 240 +#define TFT_HEIGHT 240 + +//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red + +//#define TFT_INVERSION_ON +//#define TFT_INVERSION_OFF + +// DSTIKE stepup +//#define TFT_DC 23 +//#define TFT_RST 32 +//#define TFT_MOSI 26 +//#define TFT_SCLK 27 + +// Generic ESP32 setup +//#define TFT_MISO 19 +//#define TFT_MOSI 23 +//#define TFT_SCLK 18 +//#define TFT_CS -1 // Not connected +//#define TFT_DC 2 +//#define TFT_RST 4 // Connect reset to ensure display initialises + +// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation +#define TFT_CS -1 // Define as not used +#define TFT_DC PIN_D3 // Data Command control pin +#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line) + + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +#define SMOOTH_FONT + + +// #define SPI_FREQUENCY 27000000 +#define SPI_FREQUENCY 40000000 + +#define SPI_READ_FREQUENCY 20000000 + +#define SPI_TOUCH_FREQUENCY 2500000 + +// #define SUPPORT_TRANSACTIONS \ No newline at end of file diff --git a/libraries/TFT_eSPI/User_Setups/SetupX_Template.h b/libraries/TFT_eSPI/User_Setups/SetupX_Template.h index aa5037a8..534a6348 100644 --- a/libraries/TFT_eSPI/User_Setups/SetupX_Template.h +++ b/libraries/TFT_eSPI/User_Setups/SetupX_Template.h @@ -25,7 +25,8 @@ //#define ILI9481_DRIVER //#define ILI9486_DRIVER //#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high) -//#define ST7789_DRIVER // Define additional parameters below for this display +//#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display +//#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display //#define R61581_DRIVER // Some displays support SPI reads via the MISO pin, other displays have a single @@ -37,8 +38,8 @@ // For ST7789 ONLY, define the colour order IF the blue and red are swapped on your display // Try ONE option at a time to find the correct colour order for your display -// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue -// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red +// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue +// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red // For M5Stack ESP32 module with integrated ILI9341 display ONLY, remove // in line below diff --git a/libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/ESP32_Smooth_Font_SD.ino b/libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/ESP32_Smooth_Font_SD.ino new file mode 100644 index 00000000..c6dbb197 --- /dev/null +++ b/libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/ESP32_Smooth_Font_SD.ino @@ -0,0 +1,174 @@ +/* + Sketch to demonstrate using the print class with smooth fonts + that are saved onto an SD Card accessed by the SD library. + + For ESP32 only, GPIO 5 must be used for SD chip select. + This method of storing the fonts is NOT compatible with the ESP8266. + + Sketch is written for a 240 x 320 display + + Load the font file onto the root directory of the SD Card. The font files + used by this sketch can be found in the Data folder, press Ctrl+K to see it. + + The library supports 16 bit unicode characters: + https://en.wikipedia.org/wiki/Unicode_font + + The characters supported are in the in the Basic Multilingal Plane: + https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane + + Make sure all the display driver and pin connenctions are correct by + editting the User_Setup.h file in the TFT_eSPI library folder. + + ######################################################################### + ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ###### + ######################################################################### +*/ + +// Font file is stored on SD card +#include + +// Graphics and font library +#include +#include + +TFT_eSPI tft = TFT_eSPI(); // Invoke library + +// ------------------------------------------------------------------------- +// Setup +// ------------------------------------------------------------------------- +void setup(void) { + Serial.begin(115200); // Used for messages + + // Initialise the SD library before the TFT so the chip select is defined + if (!SD.begin()) { + Serial.println("Card Mount Failed"); + return; + } + uint8_t cardType = SD.cardType(); + + if (cardType == CARD_NONE) { + Serial.println("No SD card attached"); + return; + } + + Serial.print("SD Card Type: "); + if (cardType == CARD_MMC) { + Serial.println("MMC"); + } else if (cardType == CARD_SD) { + Serial.println("SDSC"); + } else if (cardType == CARD_SDHC) { + Serial.println("SDHC"); + } else { + Serial.println("UNKNOWN"); + } + + uint64_t cardSize = SD.cardSize() / (1024 * 1024); + Serial.printf("SD Card Size: %lluMB\n", cardSize); + + // Initialise the TFT after the SD card! + tft.init(); + tft.setRotation(1); + tft.fillScreen(TFT_BLACK); + + listDir(SD, "/", 0); + + Serial.println("SD and TFT initialisation done."); +} + +// ------------------------------------------------------------------------- +// Main loop +// ------------------------------------------------------------------------- +void loop() { + // Wrap test at right and bottom of screen + tft.setTextWrap(true, true); + + // Name of font file (library adds leading / and .vlw) + String fileName = "Final-Frontier-28"; + + // Font and background colour, background colour is used for anti-alias blending + tft.setTextColor(TFT_WHITE, TFT_BLACK); + + // Load the font + tft.loadFont(fileName, SD); // Use font stored on SD + + // Display all characters of the font + tft.showFont(2000); + + uint32_t dt = millis(); + + int count = 100; + + while (count--) + { + // Set "cursor" at top left corner of display (0,0) + // (cursor will move to next line automatically during printing with 'tft.println' + // or stay on the line is there is room for the text with tft.print) + tft.setCursor(0, 0); + + // Set the font colour to be white with a black background, set text size multiplier to 1 + tft.setTextColor(TFT_WHITE, TFT_BLACK); + + // We can now plot text on screen using the "print" class + tft.println("Hello World!"); + + // Set the font colour to be yellow + tft.setTextColor(TFT_YELLOW, TFT_BLACK); + tft.println(1234.56); + + // Set the font colour to be red + tft.setTextColor(TFT_RED, TFT_BLACK); + tft.println((uint32_t)3735928559, HEX); // Should print DEADBEEF + + // Set the font colour to be green with black background + tft.setTextColor(TFT_GREEN, TFT_BLACK); + tft.println("Anti-aliased font!"); + tft.println(""); + + // Test some print formatting functions + float fnumber = 123.45; + + // Set the font colour to be blue + tft.setTextColor(TFT_BLUE, TFT_BLACK); + tft.print("Float = "); tft.println(fnumber); // Print floating point number + tft.print("Binary = "); tft.println((int)fnumber, BIN); // Print as integer value in binary + tft.print("Hexadecimal = "); tft.println((int)fnumber, HEX); // Print as integer number in Hexadecimal + } + + Serial.println(millis()-dt); + + // Unload the font to recover used RAM + tft.unloadFont(); + + delay(10000); +} + +void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ + Serial.printf("Listing directory: %s\n", dirname); + + File root = fs.open(dirname); + if(!root){ + Serial.println("Failed to open directory"); + return; + } + if(!root.isDirectory()){ + Serial.println("Not a directory"); + return; + } + + File file = root.openNextFile(); + while(file){ + if(file.isDirectory()){ + Serial.print(" DIR : "); + Serial.println(file.name()); + if(levels){ + listDir(fs, file.name(), levels -1); + } + } else { + Serial.print(" FILE: "); + Serial.print(file.name()); + Serial.print(" SIZE: "); + Serial.println(file.size()); + } + file = root.openNextFile(); + } +} diff --git a/libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/data/Final-Frontier-28.vlw b/libraries/TFT_eSPI/examples/Smooth Fonts/ESP32_Smooth_Font_SD/data/Final-Frontier-28.vlw new file mode 100644 index 0000000000000000000000000000000000000000..2872fd554bbf34f5e1268770dd8ea3cf55cecdfd GIT binary patch literal 25287 zcmeHv4@jKdn%~*k=`^)-ZC&eHYsJ>4Hk(@4Hnpj>R@}O7n!46?H=CxZxURjaH=BA> zn{Jv0D-whtA`&DZA|fFO5+sE15fBlPAcBa9gdhZwAVGvd1{sE7x@UjC=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pwGe6} z(x6S?*Fa@VXun)IGFj%n(x1376pcQ={#2qW?$Gn@h?&!~d!>Cvb&>mOM0j#cbuO27 zT~_B=PT_qO?HKLGob#VLyG-|Miq#ON`H2+Ou$CIAhgIg;e02P6UHnbYfr=omc#WNo z?`~G&EB&(fQnqT=UDq4S4m%|){Ls;nvV9a~;NrsE#si07=3YMw5mmDqFg~fqVesM+ w%pJjBZs32b4g7*X82s^{{Jr1(>7V}O$LdFIKN;w~(>D0ifqOss@!+rgImw@Lr2qf` literal 0 HcmV?d00001 diff --git a/libraries/TFT_eSPI/examples/Test and diagnostics/Colour_Test/Colour_Test.ino b/libraries/TFT_eSPI/examples/Test and diagnostics/Colour_Test/Colour_Test.ino index fb65bb4e..ed7a0614 100644 --- a/libraries/TFT_eSPI/examples/Test and diagnostics/Colour_Test/Colour_Test.ino +++ b/libraries/TFT_eSPI/examples/Test and diagnostics/Colour_Test/Colour_Test.ino @@ -78,7 +78,7 @@ void setup(void) { tft.setTextColor(TFT_BLUE, TFT_BLACK); tft.println("Blue text"); - delay(10000); + delay(5000); } @@ -104,7 +104,7 @@ void loop() { tft.setTextColor(TFT_BLUE, TFT_BLACK); tft.println("Blue text"); - delay(10000); + delay(5000); // Binary inversion of colours @@ -128,5 +128,5 @@ void loop() { tft.setTextColor(TFT_BLUE, TFT_BLACK); tft.println("Blue text"); - delay(10000); + delay(5000); } diff --git a/libraries/TFT_eSPI/examples/Test and diagnostics/Read_User_Setup/Read_User_Setup.ino b/libraries/TFT_eSPI/examples/Test and diagnostics/Read_User_Setup/Read_User_Setup.ino index f13cb169..64855687 100644 --- a/libraries/TFT_eSPI/examples/Test and diagnostics/Read_User_Setup/Read_User_Setup.ino +++ b/libraries/TFT_eSPI/examples/Test and diagnostics/Read_User_Setup/Read_User_Setup.ino @@ -149,5 +149,7 @@ int8_t getPinName(int8_t pin) if (pin == 1) return 10; if (pin == 9) return 11; if (pin == 10) return 12; + + return -1; // Invalid pin } diff --git a/libraries/TFT_eSPI/library.json b/libraries/TFT_eSPI/library.json index da5bb7cc..c264ba96 100644 --- a/libraries/TFT_eSPI/library.json +++ b/libraries/TFT_eSPI/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "1.4.8", + "version": "1.4.11", "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": diff --git a/libraries/TFT_eSPI/library.properties b/libraries/TFT_eSPI/library.properties index a1b8621a..be98ae8a 100644 --- a/libraries/TFT_eSPI/library.properties +++ b/libraries/TFT_eSPI/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=1.4.8 +version=1.4.11 author=Bodmer maintainer=Bodmer sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 00000000..d4401207 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,57 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[platformio] +src_dir = esp3d +build_dir = .pioenvs +lib_dir = libraries +libdeps_dir = .piolibdeps +data_dir = esp3d/data + +[env:esp32dev] +platform = espressif32 +;theboard +board = esp32dev +framework = arduino +monitor_speed = 115200 +; set frequency to 240MHz +board_build.f_cpu = 240000000L +; set frequency to 80MHz +board_build.f_flash = 80000000L +board_build.flash_mode = qio +; None +build_flags = -DCORE_DEBUG_LEVEL=0 +board_build.partitions = min_spiffs.csv +upload_speed = 115200 +lib_ignore = + ESPAsyncTCP + +[env:esp8266] +platform = espressif8266 +board = esp12e +framework = arduino +monitor_speed = 115200 +; set frequency to 160MHz +board_build.f_cpu = 160000000L +; set frequency to 40MHz +board_build.f_flash = 40000000L +board_build.flash_mode = dio +upload_resetmethod = ck +build_flags = + -Wl,-Teagle.flash.4m2m.ld + -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY + -DNONOSDK221=1 + -DNDEBUG + -DVTABLES_IN_FLASH +upload_speed = 115200 +lib_ignore = + AsyncTCP + ESP32NetBIOS + ESP32SSPD