Skip to content

Commit 9bdc390

Browse files
Fixes for WICED Feather hardware SPI
1 parent 8822904 commit 9bdc390

File tree

4 files changed

+2
-23
lines changed

4 files changed

+2
-23
lines changed

Adafruit_SPITFT.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h,
113113
#endif
114114
}
115115

116-
#if !defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?)
117116
/**************************************************************************/
118117
/*!
119118
@brief Instantiate Adafruit SPI display driver with hardware SPI
@@ -172,7 +171,6 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
172171
}
173172
#endif
174173
}
175-
#endif // !ARDUINO_STM32_FEATHER
176174

177175
/**************************************************************************/
178176
/*!
@@ -225,11 +223,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq) {
225223
/**************************************************************************/
226224
uint8_t Adafruit_SPITFT::spiRead() {
227225
if(_sclk < 0){
228-
#if defined(ARDUINO_STM32_FEATHER)
229-
return 0; // TODO
230-
#else
231226
return HSPI_READ();
232-
#endif
233227
}
234228
if(_miso < 0){
235229
return 0;

Adafruit_SPITFT.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#elif defined(ARDUINO_STM32_FEATHER)
2020
typedef volatile uint32 RwReg;
2121
#undef USE_FAST_PINIO
22+
typedef class HardwareSPI SPIClass;
2223
#elif defined(__OPENCR__) || defined (__OPENCM904__)
2324
#undef USE_FAST_PINIO
2425
#elif defined(ARDUINO_FEATHER52) || defined(__arm__)
@@ -38,10 +39,8 @@ class Adafruit_SPITFT : public Adafruit_GFX {
3839

3940
public:
4041
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1);
41-
#if !defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?)
4242
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1);
4343
Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass, int8_t _CS, int8_t _DC, int8_t _RST = -1);
44-
#endif
4544
virtual void begin(uint32_t freq) = 0; ///< Virtual begin() function to set SPI frequency, must be overridden in subclass. @param freq Maximum SPI hardware clock speed
4645

4746
void initSPI(uint32_t freq);
@@ -91,9 +90,7 @@ class Adafruit_SPITFT : public Adafruit_GFX {
9190
uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
9291

9392
protected:
94-
#if !defined(ARDUINO_STM32_FEATHER)
9593
SPIClass *_spi; ///< The SPI device we want to use (set in constructor)
96-
#endif
9794
uint32_t _freq; ///< SPI clock frequency (for hardware SPI)
9895
#if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32)
9996
int8_t _cs, _dc, _rst, _sclk, _mosi, _miso;

Adafruit_SPITFT_Macros.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ static inline uint8_t _avr_spi_read(void) {
9797
}
9898
#define HSPI_WRITE(b) {SPDR = (b); while(!(SPSR & _BV(SPIF)));}
9999
#define HSPI_READ() _avr_spi_read()
100-
#elif defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?)
101-
#define HSPI_WRITE(b) SSPI_WRITE(b)
102-
#define HSPI_READ() HSPI_WRITE(0)
103100
#else
104101
#define HSPI_WRITE(b) _spi->transfer((uint8_t)(b))
105102
#define HSPI_READ() HSPI_WRITE(0)
@@ -109,20 +106,11 @@ static inline uint8_t _avr_spi_read(void) {
109106
#define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ HSPI_WRITE(((uint8_t*)(c))[i+1]); HSPI_WRITE(((uint8_t*)(c))[i]); }
110107
#endif
111108

112-
#if defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?)
113-
#define SPI_BEGIN()
114-
#define SPI_BEGIN_TRANSACTION()
115-
#define SPI_END_TRANSACTION()
116-
#define SPI_WRITE16(s) SSPI_WRITE16(s);
117-
#define SPI_WRITE32(l) SSPI_WRITE32(l);
118-
#define SPI_WRITE_PIXELS(c,l) SSPI_WRITE_PIXELS(c,l);
119-
#else
120109
#define SPI_BEGIN() if(_sclk < 0){_spi->begin();}
121110
#define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();}
122111
#define SPI_END_TRANSACTION() if(_sclk < 0){HSPI_END_TRANSACTION();}
123112
#define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);}
124113
#define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);}
125114
#define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);}
126-
#endif
127115

128116
#endif // _ADAFRUIT_SPITFT_MACROS

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.3.2
2+
version=1.3.3
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)