From 6526e34e7cf51e5c0c95920c2c4dcf1fb438340b Mon Sep 17 00:00:00 2001 From: Bodmer Date: Fri, 14 Apr 2017 15:45:40 +0100 Subject: [PATCH] Work around for D4 IDE bug A condition can exist where pin D4 is allocated a value of 0 The workaround is to define and use pin numbers in the PIN_Dx format --- TFT_eSPI.cpp | 6 +++--- User_Setup.h | 17 +++++++---------- User_Setup_Select.h | 26 ++++++++++++-------------- User_Setups/Setup1_ILI9341.h | 12 ++++-------- User_Setups/Setup2_ST7735.h | 12 ++++-------- User_Setups/Setup3_ILI9163.h | 12 ++++-------- User_Setups/Setup4_S6D02A1.h | 12 ++++-------- User_Setups/Setup5_RPi_ILI9486.h | 14 +++++--------- User_Setups/Setup6_RPi_Wr_ILI9486.h | 14 +++++--------- User_Setups/SetupX_Template.h | 12 ++++-------- library.json | 2 +- library.properties | 2 +- 12 files changed, 54 insertions(+), 87 deletions(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index b859954..ea28212 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -21,9 +21,9 @@ #include -#include -#include "pins_arduino.h" -#include "wiring_private.h" +//#include +//#include "pins_arduino.h" +//#include "wiring_private.h" #include // If it is a 16bit serial display we must transfer 16 bits every time diff --git a/User_Setup.h b/User_Setup.h index 3650ad9..af89cbe 100644 --- a/User_Setup.h +++ b/User_Setup.h @@ -75,13 +75,14 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### -// ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line) +// ModeMCU - 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_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V -//#define TFT_WR D2 // Write strobe for modified Raspberry Pi TFT only +//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only // ESP32 Dev board (planned, not supported yet) //#define TFT_CS 5 // Chip select control pin @@ -125,14 +126,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setup_Select.h b/User_Setup_Select.h index 220f2c3..de5c189 100644 --- a/User_Setup_Select.h +++ b/User_Setup_Select.h @@ -50,17 +50,15 @@ #include #endif -// Define the pins if needed (See Section 4 of User_Setup.h) -#ifdef DEFINE_DX_PINS - #define D0 16 - #define D1 5 - #define D2 4 - #define D3 0 - #define D4 2 - #define D5 14 - #define D6 12 - #define D7 13 - #define D8 15 - #define D9 3 - #define D10 1 -#endif +// These are the pins for all ESP8266 boards +#define PIN_D0 16 +#define PIN_D1 5 +#define PIN_D2 4 +#define PIN_D3 0 +#define PIN_D4 2 +#define PIN_D5 14 +#define PIN_D6 12 +#define PIN_D7 13 +#define PIN_D8 15 +#define PIN_D9 3 +#define PIN_D10 1 diff --git a/User_Setups/Setup1_ILI9341.h b/User_Setups/Setup1_ILI9341.h index 979ac59..b7d4628 100644 --- a/User_Setups/Setup1_ILI9341.h +++ b/User_Setups/Setup1_ILI9341.h @@ -67,9 +67,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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 // ESP32 Dev board (planned, not supported yet) @@ -114,14 +114,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/Setup2_ST7735.h b/User_Setups/Setup2_ST7735.h index c22948e..19f40c5 100644 --- a/User_Setups/Setup2_ST7735.h +++ b/User_Setups/Setup2_ST7735.h @@ -73,9 +73,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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 // ESP32 Dev board (planned, not test/supported yet) @@ -120,14 +120,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/Setup3_ILI9163.h b/User_Setups/Setup3_ILI9163.h index a13b90f..97c4132 100644 --- a/User_Setups/Setup3_ILI9163.h +++ b/User_Setups/Setup3_ILI9163.h @@ -56,9 +56,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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 // ESP32 Dev board (planned, not supported yet) @@ -103,14 +103,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/Setup4_S6D02A1.h b/User_Setups/Setup4_S6D02A1.h index fc980e1..72a6fe4 100644 --- a/User_Setups/Setup4_S6D02A1.h +++ b/User_Setups/Setup4_S6D02A1.h @@ -56,9 +56,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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 // ESP32 Dev board (planned, not supported yet) @@ -103,14 +103,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/Setup5_RPi_ILI9486.h b/User_Setups/Setup5_RPi_ILI9486.h index 32804cf..5517041 100644 --- a/User_Setups/Setup5_RPi_ILI9486.h +++ b/User_Setups/Setup5_RPi_ILI9486.h @@ -76,12 +76,12 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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_WR D2 // Write strobe for modified Raspberry Pi TFT only +//#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only // ESP32 Dev board (planned, not supported yet) //#define TFT_CS 5 // Chip select control pin @@ -125,14 +125,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/Setup6_RPi_Wr_ILI9486.h b/User_Setups/Setup6_RPi_Wr_ILI9486.h index c494ca1..c515b44 100644 --- a/User_Setups/Setup6_RPi_Wr_ILI9486.h +++ b/User_Setups/Setup6_RPi_Wr_ILI9486.h @@ -76,12 +76,12 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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_WR D2 // Write strobe for modified Raspberry Pi TFT only +#define TFT_WR PIN_D2 // Write strobe for modified Raspberry Pi TFT only // ESP32 Dev board (planned, not supported yet) //#define TFT_CS 5 // Chip select control pin @@ -125,14 +125,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/User_Setups/SetupX_Template.h b/User_Setups/SetupX_Template.h index 96505f2..fe4698a 100644 --- a/User_Setups/SetupX_Template.h +++ b/User_Setups/SetupX_Template.h @@ -74,9 +74,9 @@ // ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### // ModeMCU -#define TFT_CS D8 // Chip select control pin D8 -#define TFT_DC D3 // Data Command control pin -#define TFT_RST 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 // ESP32 Dev board (planned, not supported yet) @@ -121,14 +121,10 @@ // ################################################################################## // -// Section 4. Define Dx pin allocations if needed +// Section 4. Not used // // ################################################################################## -// Some board selections do not include the Dx format of the NodeMCU so -// uncomment the next line to ensure they are defined. - -// #define DEFINE_DX_PINS // ################################################################################## // diff --git a/library.json b/library.json index 677bd50..4215cc4 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "0.16.2", + "version": "0.16.3", "keywords": "ILI9341, ST7735, ESP8266, TFT", "description": "A TFT SPI graphics library for ESP8266", "repository": diff --git a/library.properties b/library.properties index a71f261..7b1ef6a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=0.16.2 +version=0.16.3 author=Bodmer maintainer=Bodmer sentence=A fast TFT library for ESP8266 processors and the Arduino IDE