Skip to content

Commit 054d3ba

Browse files
Appease the ESP8266 compiler
1 parent c8bd1f4 commit 054d3ba

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

Adafruit_SPITFT.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
195202
Adafruit_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.

Adafruit_SPITFT.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ class Adafruit_SPITFT : public Adafruit_GFX {
130130
Adafruit_SPITFT(uint16_t w, uint16_t h,
131131
int8_t cs, int8_t dc, int8_t rst = -1);
132132

133+
#if !defined(ESP8266) // See notes in .cpp
133134
// Hardware SPI constructor using an arbitrary SPI peripheral: expects
134135
// width & height (rotation 0), SPIClass pointer, 2 signal pins (cs, dc)
135136
// and optional reset pin. cs is required but can be -1 if unused.
136137
Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
137138
int8_t cs, int8_t dc, int8_t rst = -1);
139+
#endif // end !ESP8266
138140

139141
// Parallel constructor: expects width & height (rotation 0), flag
140142
// indicating whether 16-bit (true) or 8-bit (false) interface, 3 signal

examples/mock_ili9341/mock_ili9341.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,4 @@ unsigned long testFilledRoundRects() {
362362
}
363363

364364
return micros() - start;
365-
}
365+
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit GFX Library
2-
version=1.4.1
2+
version=1.4.2
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.

0 commit comments

Comments
 (0)