Allow init() to be called in sketch to reset and re-initialise TFT

Solution to Issue #85
This commit is contained in:
Bodmer
2018-01-27 19:22:42 +00:00
parent 139fe8dc4c
commit f3190fde71
4 changed files with 27 additions and 17 deletions

View File

@@ -123,6 +123,8 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
locked = true; // ESP32 transaction mutex lock flags
inTransaction = false;
_booted = true;
addr_row = 0xFFFF;
addr_col = 0xFFFF;
@@ -168,6 +170,8 @@ void TFT_eSPI::begin(void)
** Description: Reset, then initialise the TFT display registers
***************************************************************************************/
void TFT_eSPI::init(void)
{
if (_booted)
{
#if !defined (ESP32)
#ifdef TFT_CS
@@ -224,6 +228,10 @@ void TFT_eSPI::init(void)
pinMode(TFT_DC, OUTPUT);
#endif
_booted = false;
} // end of: if just _booted
// Toggle RST low to reset
#ifdef TFT_RST
if (TFT_RST >= 0) {
@@ -234,13 +242,13 @@ void TFT_eSPI::init(void)
digitalWrite(TFT_RST, HIGH);
delay(150);
}
#endif
#else
// Or use the software reset
spi_begin();
writecommand(TFT_SWRST); // Software reset
spi_end();
delay(5); // Wait for software reset to complete
delay(120); // Wait for software reset to complete
#endif
spi_begin();
@@ -264,6 +272,7 @@ void TFT_eSPI::init(void)
spi_end();
setRotation(rotation);
}

View File

@@ -516,6 +516,7 @@ class TFT_eSPI : public Print {
bool textwrap; // If set, 'wrap' text at right edge of display
bool _swapBytes; // Swap the byte order for TFT pushImage()
bool locked, inTransaction; // Transaction and mutex lock flags for ESP32
bool _booted;
int32_t _lastColor;

View File

@@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "0.18.12",
"version": "0.18.13",
"keywords": "TFT, ESP8266, NodeMCU, ESP32, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486",
"description": "A TFT SPI graphics library for ESP8266",
"repository":

View File

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