ESP32 board packages complain about using -1 to define unused pins!
This commit is contained in:
Bodmer
2023-02-04 17:31:09 +00:00
parent 5ff4c2f1f4
commit 5886b2cb13

View File

@@ -533,25 +533,33 @@ TFT_eSPI::TFT_eSPI(int16_t w, int16_t h)
void TFT_eSPI::initBus(void) { void TFT_eSPI::initBus(void) {
#ifdef TFT_CS #ifdef TFT_CS
if (TFT_CS >= 0) {
pinMode(TFT_CS, OUTPUT); pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive) digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
}
#endif #endif
// Configure chip select for touchscreen controller if present // Configure chip select for touchscreen controller if present
#ifdef TOUCH_CS #ifdef TOUCH_CS
if (TOUCH_CS >= 0) {
pinMode(TOUCH_CS, OUTPUT); pinMode(TOUCH_CS, OUTPUT);
digitalWrite(TOUCH_CS, HIGH); // Chip select high (inactive) digitalWrite(TOUCH_CS, HIGH); // Chip select high (inactive)
}
#endif #endif
// In parallel mode and with the RP2040 processor, the TFT_WR line is handled in the PIO // In parallel mode and with the RP2040 processor, the TFT_WR line is handled in the PIO
#if defined (TFT_WR) && !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED) #if defined (TFT_WR) && !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED)
if (TFT_WR >= 0) {
pinMode(TFT_WR, OUTPUT); pinMode(TFT_WR, OUTPUT);
digitalWrite(TFT_WR, HIGH); // Set write strobe high (inactive) digitalWrite(TFT_WR, HIGH); // Set write strobe high (inactive)
}
#endif #endif
#ifdef TFT_DC #ifdef TFT_DC
if (TFT_DC >= 0) {
pinMode(TFT_DC, OUTPUT); pinMode(TFT_DC, OUTPUT);
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
}
#endif #endif
#ifdef TFT_RST #ifdef TFT_RST
@@ -564,8 +572,10 @@ void TFT_eSPI::initBus(void) {
#if defined (TFT_PARALLEL_8_BIT) #if defined (TFT_PARALLEL_8_BIT)
// Make sure read is high before we set the bus to output // Make sure read is high before we set the bus to output
if (TFT_RD >= 0) {
pinMode(TFT_RD, OUTPUT); pinMode(TFT_RD, OUTPUT);
digitalWrite(TFT_RD, HIGH); digitalWrite(TFT_RD, HIGH);
}
#if !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED)// PIO manages pins #if !defined (ARDUINO_ARCH_RP2040) && !defined (ARDUINO_ARCH_MBED)// PIO manages pins
// Set TFT data bus lines to output // Set TFT data bus lines to output
@@ -649,8 +659,10 @@ void TFT_eSPI::init(uint8_t tc)
#if defined (TFT_CS) && !defined(RP2040_PIO_INTERFACE) #if defined (TFT_CS) && !defined(RP2040_PIO_INTERFACE)
// Set to output once again in case MISO is used for CS // Set to output once again in case MISO is used for CS
if (TFT_CS >= 0) {
pinMode(TFT_CS, OUTPUT); pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive) digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
}
#elif defined (ARDUINO_ARCH_ESP8266) && !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_SPI) #elif defined (ARDUINO_ARCH_ESP8266) && !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_SPI)
spi.setHwCs(1); // Use hardware SS toggling spi.setHwCs(1); // Use hardware SS toggling
#endif #endif
@@ -658,8 +670,10 @@ void TFT_eSPI::init(uint8_t tc)
// Set to output once again in case MISO is used for DC // Set to output once again in case MISO is used for DC
#if defined (TFT_DC) && !defined(RP2040_PIO_INTERFACE) #if defined (TFT_DC) && !defined(RP2040_PIO_INTERFACE)
if (TFT_DC >= 0) {
pinMode(TFT_DC, OUTPUT); pinMode(TFT_DC, OUTPUT);
digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode digitalWrite(TFT_DC, HIGH); // Data/Command high = data mode
}
#endif #endif
_booted = false; _booted = false;
@@ -670,7 +684,9 @@ void TFT_eSPI::init(uint8_t tc)
#ifdef TFT_RST #ifdef TFT_RST
#if !defined(RP2040_PIO_INTERFACE) #if !defined(RP2040_PIO_INTERFACE)
// Set to output once again in case MISO is used for TFT_RST // Set to output once again in case MISO is used for TFT_RST
if (TFT_RST >= 0) {
pinMode(TFT_RST, OUTPUT); pinMode(TFT_RST, OUTPUT);
}
#endif #endif
if (TFT_RST >= 0) { if (TFT_RST >= 0) {
writecommand(0x00); // Put SPI bus in known state for TFT with CS tied low writecommand(0x00); // Put SPI bus in known state for TFT with CS tied low
@@ -768,13 +784,17 @@ void TFT_eSPI::init(uint8_t tc)
setRotation(rotation); setRotation(rotation);
#if defined (TFT_BL) && defined (TFT_BACKLIGHT_ON) #if defined (TFT_BL) && defined (TFT_BACKLIGHT_ON)
if (TFT_BL >= 0) {
pinMode(TFT_BL, OUTPUT); pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
}
#else #else
#if defined (TFT_BL) && defined (M5STACK) #if defined (TFT_BL) && defined (M5STACK)
// Turn on the back-light LED // Turn on the back-light LED
if (TFT_BL >= 0) {
pinMode(TFT_BL, OUTPUT); pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH); digitalWrite(TFT_BL, HIGH);
}
#endif #endif
#endif #endif
} }