From 0845d8c7cbaa7c1b6e5982c014c16aa4e1be9833 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 22 Mar 2018 03:15:16 -0700 Subject: [PATCH] Add software SPI constructor This constructor exists in the underlying Adafruit_ST7735 library and is promised by the TFT library reference page but was not provided by the TFT library. --- src/TFT.cpp | 9 +++++++++ src/TFT.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/TFT.cpp b/src/TFT.cpp index 1bdf7ed..bb6f197 100644 --- a/src/TFT.cpp +++ b/src/TFT.cpp @@ -35,6 +35,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. TFT EsploraTFT(7, 0, 1); #endif +TFT::TFT(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST) + : Adafruit_ST7735(CS, RS, SID, SCLK, RST) +{ + // as we already know the orientation (landscape, therefore rotated), + // set default width and height without need to call begin() first. + _width = ST7735_TFTHEIGHT; + _height = ST7735_TFTWIDTH; +} + TFT::TFT(uint8_t CS, uint8_t RS, uint8_t RST) : Adafruit_ST7735(CS, RS, RST) { diff --git a/src/TFT.h b/src/TFT.h index 16791d6..65157fb 100644 --- a/src/TFT.h +++ b/src/TFT.h @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /// @author Enrico Gueli class TFT : public Adafruit_ST7735 { public: + TFT(uint8_t CS, uint8_t RS, uint8_t SID, uint8_t SCLK, uint8_t RST); TFT(uint8_t CS, uint8_t RS, uint8_t RST); void begin();