From 30e45c98252bb1d83ca1918bc4dcec4bc89fe695 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 10 May 2019 15:05:33 -0700 Subject: [PATCH 1/2] Added readcommand8 to GFX --- Adafruit_SPITFT.cpp | 23 +++++++++++++++++++++++ Adafruit_SPITFT.h | 1 + library.properties | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index 846b3d69..2bdfbb0a 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -1729,6 +1729,29 @@ void Adafruit_SPITFT::sendCommand(uint8_t commandByte, const uint8_t *dataBytes, SPI_END_TRANSACTION(); } +/*! + @brief Read 8 bits of data from display configuration memory (not RAM). + This is highly undocumented/supported and should be avoided, + function is only included because some of the examples use it. + @param command + The command register to read data from. + @param index + The byte index into the command to read from. + @return Unsigned 8-bit data read from display register. + */ +/**************************************************************************/ +uint8_t Adafruit_SPITFT::readcommand8(uint8_t commandByte, uint8_t index) { + uint8_t result; + startWrite(); + SPI_DC_LOW(); // Command mode + spiWrite(commandByte); + SPI_DC_HIGH(); // Data mode + do { + result = spiRead(); + } while(index--); // Discard bytes up to index'th + endWrite(); + return result; +} // ------------------------------------------------------------------------- // Lowest-level hardware-interfacing functions. Many of these are inline and diff --git a/Adafruit_SPITFT.h b/Adafruit_SPITFT.h index 66342a22..b41868a5 100644 --- a/Adafruit_SPITFT.h +++ b/Adafruit_SPITFT.h @@ -189,6 +189,7 @@ class Adafruit_SPITFT : public Adafruit_GFX { void endWrite(void); void sendCommand(uint8_t commandByte, uint8_t *dataBytes = NULL, uint8_t numDataBytes = 0); void sendCommand(uint8_t commandByte, const uint8_t *dataBytes, uint8_t numDataBytes); + uint8_t readcommand8(uint8_t commandByte, uint8_t index = 0); // These functions require a chip-select and/or SPI transaction // around them. Higher-level graphics primitives might start a diff --git a/library.properties b/library.properties index 2bc14fd1..96adbc18 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.4.14 +version=1.5.0 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from. From c555f0b217c2290f4a7ff6ab44168265600c92ab Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 10 May 2019 15:21:53 -0700 Subject: [PATCH 2/2] Fixed paramter name for doxygen --- Adafruit_SPITFT.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index 2bdfbb0a..50982172 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -1733,7 +1733,7 @@ void Adafruit_SPITFT::sendCommand(uint8_t commandByte, const uint8_t *dataBytes, @brief Read 8 bits of data from display configuration memory (not RAM). This is highly undocumented/supported and should be avoided, function is only included because some of the examples use it. - @param command + @param commandByte The command register to read data from. @param index The byte index into the command to read from.