@@ -192,12 +192,27 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
192192 need to call subclass' begin() function, which in turn calls
193193 this library's initSPI() function to initialize pins.
194194*/
195+ #if defined(ESP8266) // See notes below
196+ Adafruit_SPITFT::Adafruit_SPITFT (uint16_t w, uint16_t h, int8_t cs,
197+ int8_t dc, int8_t rst) : Adafruit_GFX(w, h),
198+ connection(TFT_HARD_SPI), _rst(rst), _cs(cs), _dc(dc) {
199+ hwspi._spi = &SPI;
200+ }
201+ #else // !ESP8266
195202Adafruit_SPITFT::Adafruit_SPITFT (uint16_t w, uint16_t h, int8_t cs,
196203 int8_t dc, int8_t rst) : Adafruit_SPITFT(w, h, &SPI, cs, dc, rst) {
197204 // This just invokes the hardware SPI constructor below,
198205 // passing the default SPI device (&SPI).
199206}
207+ #endif // end !ESP8266
200208
209+ #if !defined(ESP8266)
210+ // ESP8266 compiler freaks out at this constructor -- it can't disambiguate
211+ // beteween the SPIClass pointer (argument #3) and a regular integer.
212+ // Solution here it to just not offer this variant on the ESP8266. You can
213+ // use the default hardware SPI peripheral, or you can use software SPI,
214+ // but if there's any library out there that creates a 'virtual' SPIClass
215+ // peripheral and drives it with software bitbanging, that's not supported.
201216/* !
202217 @brief Adafruit_SPITFT constructor for hardware SPI using a specific
203218 SPI peripheral.
@@ -275,6 +290,7 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
275290 #endif // end !HAS_PORT_SET_CLR
276291#endif // end USE_FAST_PINIO
277292}
293+ #endif // end !ESP8266
278294
279295/* !
280296 @brief Adafruit_SPITFT constructor for parallel display connection.
0 commit comments