From 9bdc39045811e7954da99a316d8be91bb651c6cd Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Fri, 16 Nov 2018 22:09:07 -0800 Subject: [PATCH] Fixes for WICED Feather hardware SPI --- Adafruit_SPITFT.cpp | 6 ------ Adafruit_SPITFT.h | 5 +---- Adafruit_SPITFT_Macros.h | 12 ------------ library.properties | 2 +- 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index 7c1cfc0..036ebdb 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -113,7 +113,6 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, #endif } -#if !defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?) /**************************************************************************/ /*! @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, } #endif } -#endif // !ARDUINO_STM32_FEATHER /**************************************************************************/ /*! @@ -225,11 +223,7 @@ void Adafruit_SPITFT::initSPI(uint32_t freq) { /**************************************************************************/ uint8_t Adafruit_SPITFT::spiRead() { if(_sclk < 0){ -#if defined(ARDUINO_STM32_FEATHER) - return 0; // TODO -#else return HSPI_READ(); -#endif } if(_miso < 0){ return 0; diff --git a/Adafruit_SPITFT.h b/Adafruit_SPITFT.h index 1ed71a7..5973ae0 100644 --- a/Adafruit_SPITFT.h +++ b/Adafruit_SPITFT.h @@ -19,6 +19,7 @@ #elif defined(ARDUINO_STM32_FEATHER) typedef volatile uint32 RwReg; #undef USE_FAST_PINIO + typedef class HardwareSPI SPIClass; #elif defined(__OPENCR__) || defined (__OPENCM904__) #undef USE_FAST_PINIO #elif defined(ARDUINO_FEATHER52) || defined(__arm__) @@ -38,10 +39,8 @@ class Adafruit_SPITFT : public Adafruit_GFX { public: 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); -#if !defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?) Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1); Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass, int8_t _CS, int8_t _DC, int8_t _RST = -1); -#endif 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 void initSPI(uint32_t freq); @@ -91,9 +90,7 @@ class Adafruit_SPITFT : public Adafruit_GFX { uint16_t color565(uint8_t r, uint8_t g, uint8_t b); protected: -#if !defined(ARDUINO_STM32_FEATHER) SPIClass *_spi; ///< The SPI device we want to use (set in constructor) -#endif uint32_t _freq; ///< SPI clock frequency (for hardware SPI) #if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32) int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; diff --git a/Adafruit_SPITFT_Macros.h b/Adafruit_SPITFT_Macros.h index 587090c..1b5bd47 100644 --- a/Adafruit_SPITFT_Macros.h +++ b/Adafruit_SPITFT_Macros.h @@ -97,9 +97,6 @@ static inline uint8_t _avr_spi_read(void) { } #define HSPI_WRITE(b) {SPDR = (b); while(!(SPSR & _BV(SPIF)));} #define HSPI_READ() _avr_spi_read() - #elif defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?) - #define HSPI_WRITE(b) SSPI_WRITE(b) - #define HSPI_READ() HSPI_WRITE(0) #else #define HSPI_WRITE(b) _spi->transfer((uint8_t)(b)) #define HSPI_READ() HSPI_WRITE(0) @@ -109,20 +106,11 @@ static inline uint8_t _avr_spi_read(void) { #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]); } #endif -#if defined(ARDUINO_STM32_FEATHER) // No SPIClass on WICED (yet?) - #define SPI_BEGIN() - #define SPI_BEGIN_TRANSACTION() - #define SPI_END_TRANSACTION() - #define SPI_WRITE16(s) SSPI_WRITE16(s); - #define SPI_WRITE32(l) SSPI_WRITE32(l); - #define SPI_WRITE_PIXELS(c,l) SSPI_WRITE_PIXELS(c,l); -#else #define SPI_BEGIN() if(_sclk < 0){_spi->begin();} #define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();} #define SPI_END_TRANSACTION() if(_sclk < 0){HSPI_END_TRANSACTION();} #define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);} #define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);} #define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);} -#endif #endif // _ADAFRUIT_SPITFT_MACROS diff --git a/library.properties b/library.properties index 6c059a3..c52e544 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.3.2 +version=1.3.3 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.