From 5fa33d00208919573a88ed85a8f650df20dbcab0 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Fri, 17 May 2019 22:25:09 -0700 Subject: [PATCH 1/6] Add hooks for SPI data mode --- Adafruit_SPITFT.cpp | 30 +++++++++++++++++++----------- Adafruit_SPITFT.h | 6 +++++- library.properties | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index 5098217..c0213b6 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -500,12 +500,17 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth, is passed, will fall back on a device-specific value. Value is ignored when using software SPI or parallel connection. + @param mode SPI mode when using hardware SPI. MUST be one of the + values SPI_MODE0, SPI_MODE1, SPI_MODE2 or SPI_MODE3 + defined in SPI.h. Do NOT attempt to pass '0' for SPI_MODE0 + and so forth...the values are NOT the same! Use ONLY the + defines! (Pity it's not an enum.) @note Another anachronistically-named function; this is called even when the display connection is parallel (not SPI). Also, this could probably be made private...quite a few class functions were generously put in the public section. */ -void Adafruit_SPITFT::initSPI(uint32_t freq) { +void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) { if(!freq) freq = DEFAULT_SPI_FREQ; // If no freq specified, use default @@ -520,9 +525,10 @@ void Adafruit_SPITFT::initSPI(uint32_t freq) { if(connection == TFT_HARD_SPI) { #if defined(SPI_HAS_TRANSACTION) - hwspi.settings = SPISettings(freq, MSBFIRST, SPI_MODE0); + hwspi.settings = SPISettings(freq, MSBFIRST, spiMode); #else - hwspi._freq = freq; // Save freq value for later + hwspi._freq = freq; // Save freq value for later + hwspi._mode = spiMode; // Save spiMode value for later #endif // Call hwspi._spi->begin() ONLY if this is among the 'established' // SPI interfaces in variant.h. For DIY roll-your-own SERCOM SPIs, @@ -1024,14 +1030,14 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, lastFillLen = 0; if(block) { while(dma_busy); // Wait for last line to complete - #if defined(__SAMD51__) + #if defined(__SAMD51__) || defined(_SAMD21_) if(connection == TFT_HARD_SPI) { - // See SAMD51 note in writeColor() + // See SAMD51/21 note in writeColor() hwspi._spi->setDataMode(SPI_MODE0); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO } - #endif // end __SAMD51__ + #endif // end __SAMD51__ || _SAMD21_ } return; } @@ -1053,14 +1059,14 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, void Adafruit_SPITFT::dmaWait(void) { #if defined(USE_SPI_DMA) while(dma_busy); - #if defined(__SAMD51__) + #if defined(__SAMD51__) || defined(_SAMD21_) if(connection == TFT_HARD_SPI) { - // See SAMD51 note in writeColor() + // See SAMD51/21 note in writeColor() hwspi._spi->setDataMode(SPI_MODE0); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO } - #endif // end __SAMD51__ + #endif // end __SAMD51__ || _SAMD21_ #endif } @@ -1176,10 +1182,12 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) { // turns out to be MUCH slower on many graphics operations (as when // drawing lines, pixel-by-pixel), perhaps because it's a volatile // type and doesn't cache. Working on this. - #if defined(__SAMD51__) + #if defined(__SAMD51__) || defined(_SAMD21_) if(connection == TFT_HARD_SPI) { // SAMD51: SPI DMA seems to leave the SPI peripheral in a freaky // state on completion. Workaround is to explicitly set it back... + // (5/17/2019: apparently SAMD21 too, in certain cases, observed + // with ST7789 display.) hwspi._spi->setDataMode(SPI_MODE0); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO @@ -1782,7 +1790,7 @@ inline void Adafruit_SPITFT::SPI_BEGIN_TRANSACTION(void) { hwspi._spi->setClock(hwspi._freq); #endif hwspi._spi->setBitOrder(MSBFIRST); - hwspi._spi->setDataMode(SPI_MODE0); + hwspi._spi->setDataMode(hwspi._mode); #endif // end !SPI_HAS_TRANSACTION } } diff --git a/Adafruit_SPITFT.h b/Adafruit_SPITFT.h index b41868a..d8cf4e3 100644 --- a/Adafruit_SPITFT.h +++ b/Adafruit_SPITFT.h @@ -181,8 +181,11 @@ class Adafruit_SPITFT : public Adafruit_GFX { // Brief comments here...documented more thoroughly in .cpp file. // Subclass' begin() function invokes this to initialize hardware. + // freq=0 to use default SPI speed. spiMode must be one of the SPI_MODEn + // values defined in SPI.h, which are NOT the same as 0 for SPI_MODE0, + // 1 for SPI_MODE1, etc...use ONLY the SPI_MODEn defines! Only! // Name is outdated (interface may be parallel) but for compatibility: - void initSPI(uint32_t freq = 0); // 0 = use default SPI speed + void initSPI(uint32_t freq = 0, uint8_t spiMode = SPI_MODE0); // Chip select and/or hardware SPI transaction start as needed: void startWrite(void); // Chip deselect and/or hardware SPI transaction end as needed: @@ -392,6 +395,7 @@ class Adafruit_SPITFT : public Adafruit_GFX { SPISettings settings; ///< SPI transaction settings #else uint32_t _freq; ///< SPI bitrate (if no SPI transactions) + uint32_t _mode; ///< SPI data mode (if no SPI transactions) #endif } hwspi; ///< Hardware SPI values struct { // Values specific to SOFTWARE SPI: diff --git a/library.properties b/library.properties index 96adbc1..57990b1 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.5.0 +version=1.5.1 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from. From a103ad28a2a36a819a95ac6cf54fe55d279cef59 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Fri, 17 May 2019 23:32:23 -0700 Subject: [PATCH 2/6] Restore hwspi._mode at the end of all DMA transfers --- Adafruit_SPITFT.cpp | 8 ++++---- Adafruit_SPITFT.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index c0213b6..db24f2b 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -528,8 +528,8 @@ void Adafruit_SPITFT::initSPI(uint32_t freq, uint8_t spiMode) { hwspi.settings = SPISettings(freq, MSBFIRST, spiMode); #else hwspi._freq = freq; // Save freq value for later - hwspi._mode = spiMode; // Save spiMode value for later #endif + hwspi._mode = spiMode; // Save spiMode value for later // Call hwspi._spi->begin() ONLY if this is among the 'established' // SPI interfaces in variant.h. For DIY roll-your-own SERCOM SPIs, // begin() and pinPeripheral() calls MUST be made in one's calling @@ -1033,7 +1033,7 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len, #if defined(__SAMD51__) || defined(_SAMD21_) if(connection == TFT_HARD_SPI) { // See SAMD51/21 note in writeColor() - hwspi._spi->setDataMode(SPI_MODE0); + hwspi._spi->setDataMode(hwspi._mode); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO } @@ -1062,7 +1062,7 @@ void Adafruit_SPITFT::dmaWait(void) { #if defined(__SAMD51__) || defined(_SAMD21_) if(connection == TFT_HARD_SPI) { // See SAMD51/21 note in writeColor() - hwspi._spi->setDataMode(SPI_MODE0); + hwspi._spi->setDataMode(hwspi._mode); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO } @@ -1188,7 +1188,7 @@ void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) { // state on completion. Workaround is to explicitly set it back... // (5/17/2019: apparently SAMD21 too, in certain cases, observed // with ST7789 display.) - hwspi._spi->setDataMode(SPI_MODE0); + hwspi._spi->setDataMode(hwspi._mode); } else { pinPeripheral(tft8._wr, PIO_OUTPUT); // Switch WR back to GPIO } diff --git a/Adafruit_SPITFT.h b/Adafruit_SPITFT.h index d8cf4e3..cb62bc0 100644 --- a/Adafruit_SPITFT.h +++ b/Adafruit_SPITFT.h @@ -395,8 +395,8 @@ class Adafruit_SPITFT : public Adafruit_GFX { SPISettings settings; ///< SPI transaction settings #else uint32_t _freq; ///< SPI bitrate (if no SPI transactions) - uint32_t _mode; ///< SPI data mode (if no SPI transactions) #endif + uint32_t _mode; ///< SPI data mode (transactions or no) } hwspi; ///< Hardware SPI values struct { // Values specific to SOFTWARE SPI: #if defined(USE_FAST_PINIO) From b0dc94def73251b284c9ca608830f5f471e79c52 Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Wed, 29 May 2019 20:33:31 -0700 Subject: [PATCH 3/6] Inline some of the trivial functions, add byteSwap() for GFXcanvas16 --- Adafruit_GFX.cpp | 221 ++++++++------------------------------------- Adafruit_GFX.h | 157 +++++++++++++++++++++++++++----- library.properties | 2 +- 3 files changed, 176 insertions(+), 204 deletions(-) diff --git a/Adafruit_GFX.cpp b/Adafruit_GFX.cpp index 9d6edcf..e37c917 100755 --- a/Adafruit_GFX.cpp +++ b/Adafruit_GFX.cpp @@ -1179,38 +1179,6 @@ size_t Adafruit_GFX::write(uint8_t c) { return 1; } -/**************************************************************************/ -/*! - @brief Set text cursor location - @param x X coordinate in pixels - @param y Y coordinate in pixels -*/ -/**************************************************************************/ -void Adafruit_GFX::setCursor(int16_t x, int16_t y) { - cursor_x = x; - cursor_y = y; -} - -/**************************************************************************/ -/*! - @brief Get text cursor X location - @returns X coordinate in pixels -*/ -/**************************************************************************/ -int16_t Adafruit_GFX::getCursorX(void) const { - return cursor_x; -} - -/**************************************************************************/ -/*! - @brief Get text cursor Y location - @returns Y coordinate in pixels -*/ -/**************************************************************************/ -int16_t Adafruit_GFX::getCursorY(void) const { - return cursor_y; -} - /**************************************************************************/ /*! @brief Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger. @@ -1221,50 +1189,6 @@ void Adafruit_GFX::setTextSize(uint8_t s) { textsize = (s > 0) ? s : 1; } -/**************************************************************************/ -/*! - @brief Set text font color with transparant background - @param c 16-bit 5-6-5 Color to draw text with -*/ -/**************************************************************************/ -void Adafruit_GFX::setTextColor(uint16_t c) { - // For 'transparent' background, we'll set the bg - // to the same as fg instead of using a flag - textcolor = textbgcolor = c; -} - -/**************************************************************************/ -/*! - @brief Set text font color with custom background color - @param c 16-bit 5-6-5 Color to draw text with - @param b 16-bit 5-6-5 Color to draw background/fill with -*/ -/**************************************************************************/ -void Adafruit_GFX::setTextColor(uint16_t c, uint16_t b) { - textcolor = c; - textbgcolor = b; -} - -/**************************************************************************/ -/*! - @brief Whether text that is too long should 'wrap' around to the next line. - @param w Set true for wrapping, false for clipping -*/ -/**************************************************************************/ -void Adafruit_GFX::setTextWrap(boolean w) { - wrap = w; -} - -/**************************************************************************/ -/*! - @brief Get rotation setting for display - @returns 0 thru 3 corresponding to 4 cardinal rotations -*/ -/**************************************************************************/ -uint8_t Adafruit_GFX::getRotation(void) const { - return rotation; -} - /**************************************************************************/ /*! @brief Set rotation setting for display @@ -1287,22 +1211,6 @@ void Adafruit_GFX::setRotation(uint8_t x) { } } -/**************************************************************************/ -/*! - @brief Enable (or disable) Code Page 437-compatible charset. - There was an error in glcdfont.c for the longest time -- one character - (#176, the 'light shade' block) was missing -- this threw off the index - of every character that followed it. But a TON of code has been written - with the erroneous character indices. By default, the library uses the - original 'wrong' behavior and old sketches will still work. Pass 'true' - to this function to use correct CP437 character values in your code. - @param x Whether to enable (True) or not (False) -*/ -/**************************************************************************/ -void Adafruit_GFX::cp437(boolean x) { - _cp437 = x; -} - /**************************************************************************/ /*! @brief Set the font to display when print()ing, either custom or default @@ -1486,26 +1394,6 @@ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str, } } -/**************************************************************************/ -/*! - @brief Get width of the display, accounting for the current rotation - @returns Width in pixels -*/ -/**************************************************************************/ -int16_t Adafruit_GFX::width(void) const { - return _width; -} - -/**************************************************************************/ -/*! - @brief Get height of the display, accounting for the current rotation - @returns Height in pixels -*/ -/**************************************************************************/ -int16_t Adafruit_GFX::height(void) const { - return _height; -} - /**************************************************************************/ /*! @brief Invert the display (ideally using built-in hardware command) @@ -1617,10 +1505,10 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) { /**************************************************************************/ /*! - @brief Helper to let us know if a coordinate is within the bounds of the button + @brief Helper to let us know if a coordinate is within the bounds of the button @param x The X coordinate to check @param y The Y coordinate to check - @returns True if within button graphics outline + @returns True if within button graphics outline */ /**************************************************************************/ boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) { @@ -1628,25 +1516,6 @@ boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) { (y >= _y1) && (y < (int16_t) (_y1 + _h))); } -/**************************************************************************/ -/*! - @brief Sets the state of the button, should be done by some touch function - @param p True for pressed, false for not. -*/ -/**************************************************************************/ -void Adafruit_GFX_Button::press(boolean p) { - laststate = currstate; - currstate = p; -} - -/**************************************************************************/ -/*! - @brief Query whether the button is currently pressed - @returns True if pressed -*/ -/**************************************************************************/ -boolean Adafruit_GFX_Button::isPressed() { return currstate; } - /**************************************************************************/ /*! @brief Query whether the button was pressed since we last checked state @@ -1707,20 +1576,10 @@ GFXcanvas1::~GFXcanvas1(void) { /**************************************************************************/ /*! - @brief Get a pointer to the internal buffer memory - @returns A pointer to the allocated buffer -*/ -/**************************************************************************/ -uint8_t* GFXcanvas1::getBuffer(void) { - return buffer; -} - -/**************************************************************************/ -/*! - @brief Draw a pixel to the canvas framebuffer - @param x x coordinate - @param y y coordinate - @param color 16-bit 5-6-5 Color to fill with + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) { @@ -1765,8 +1624,8 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) { /**************************************************************************/ /*! - @brief Fill the framebuffer completely with one color - @param color 16-bit 5-6-5 Color to fill with + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas1::fillScreen(uint16_t color) { @@ -1799,23 +1658,12 @@ GFXcanvas8::~GFXcanvas8(void) { if(buffer) free(buffer); } - /**************************************************************************/ /*! - @brief Get a pointer to the internal buffer memory - @returns A pointer to the allocated buffer -*/ -/**************************************************************************/ -uint8_t* GFXcanvas8::getBuffer(void) { - return buffer; -} - -/**************************************************************************/ -/*! - @brief Draw a pixel to the canvas framebuffer - @param x x coordinate - @param y y coordinate - @param color 16-bit 5-6-5 Color to fill with + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) { @@ -1846,8 +1694,8 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) { /**************************************************************************/ /*! - @brief Fill the framebuffer completely with one color - @param color 16-bit 5-6-5 Color to fill with + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas8::fillScreen(uint16_t color) { @@ -1916,20 +1764,10 @@ GFXcanvas16::~GFXcanvas16(void) { /**************************************************************************/ /*! - @brief Get a pointer to the internal buffer memory - @returns A pointer to the allocated buffer -*/ -/**************************************************************************/ -uint16_t* GFXcanvas16::getBuffer(void) { - return buffer; -} - -/**************************************************************************/ -/*! - @brief Draw a pixel to the canvas framebuffer - @param x x coordinate - @param y y coordinate - @param color 16-bit 5-6-5 Color to fill with + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) { @@ -1960,8 +1798,8 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) { /**************************************************************************/ /*! - @brief Fill the framebuffer completely with one color - @param color 16-bit 5-6-5 Color to fill with + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with */ /**************************************************************************/ void GFXcanvas16::fillScreen(uint16_t color) { @@ -1976,3 +1814,22 @@ void GFXcanvas16::fillScreen(uint16_t color) { } } +/**************************************************************************/ +/*! + @brief Reverses the "endian-ness" of each 16-bit pixel within the + canvas; little-endian to big-endian, or big-endian to little. + Most microcontrollers (such as SAMD) are little-endian, while + most displays tend toward big-endianness. All the drawing + functions (including RGB bitmap drawing) take care of this + automatically, but some specialized code (usually involving + DMA) can benefit from having pixel data already in the + display-native order. Note that this does NOT convert to a + SPECIFIC endian-ness, it just flips the bytes within each word. +*/ +/**************************************************************************/ +void GFXcanvas16::byteSwap(void) { + if(buffer) { + uint32_t i, pixels = WIDTH * HEIGHT; + for(i=0; i= 100 virtual size_t write(uint8_t); @@ -116,14 +166,47 @@ class Adafruit_GFX : public Print { virtual void write(uint8_t); #endif - int16_t height(void) const; - int16_t width(void) const; + /************************************************************************/ + /*! + @brief Get width of the display, accounting for current rotation + @returns Width in pixels + */ + /************************************************************************/ + int16_t width(void) const { return _width; }; - uint8_t getRotation(void) const; + /************************************************************************/ + /*! + @brief Get height of the display, accounting for current rotation + @returns Height in pixels + */ + /************************************************************************/ + int16_t height(void) const { return _height; } - // get current cursor position (get rotation safe maximum values, using: width() for x, height() for y) - int16_t getCursorX(void) const; - int16_t getCursorY(void) const; + /************************************************************************/ + /*! + @brief Get rotation setting for display + @returns 0 thru 3 corresponding to 4 cardinal rotations + */ + /************************************************************************/ + uint8_t getRotation(void) const { return rotation; } + + // get current cursor position (get rotation safe maximum values, + // using: width() for x, height() for y) + /************************************************************************/ + /*! + @brief Get text cursor X location + @returns X coordinate in pixels + */ + /************************************************************************/ + int16_t getCursorX(void) const { return cursor_x; } + + /************************************************************************/ + /*! + @brief Get text cursor Y location + @returns Y coordinate in pixels + */ + /************************************************************************/ + int16_t getCursorY(void) const { return cursor_y; }; protected: void @@ -167,11 +250,25 @@ class Adafruit_GFX_Button { void drawButton(boolean inverted = false); boolean contains(int16_t x, int16_t y); - void press(boolean p); - boolean isPressed(); + /**********************************************************************/ + /*! + @brief Sets button state, should be done by some touch function + @param p True for pressed, false for not. + */ + /**********************************************************************/ + void press(boolean p) { laststate = currstate; currstate = p; } + boolean justPressed(); boolean justReleased(); + /**********************************************************************/ + /*! + @brief Query whether the button is currently pressed + @returns True if pressed + */ + /**********************************************************************/ + boolean isPressed(void) { return currstate; }; + private: Adafruit_GFX *_gfx; int16_t _x1, _y1; // Coordinates of top-left corner @@ -191,7 +288,13 @@ class GFXcanvas1 : public Adafruit_GFX { ~GFXcanvas1(void); void drawPixel(int16_t x, int16_t y, uint16_t color), fillScreen(uint16_t color); - uint8_t *getBuffer(void); + /**********************************************************************/ + /*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer + */ + /**********************************************************************/ + uint8_t *getBuffer(void) const { return buffer; } private: uint8_t *buffer; }; @@ -205,8 +308,13 @@ class GFXcanvas8 : public Adafruit_GFX { void drawPixel(int16_t x, int16_t y, uint16_t color), fillScreen(uint16_t color), writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - - uint8_t *getBuffer(void); + /**********************************************************************/ + /*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer + */ + /**********************************************************************/ + uint8_t *getBuffer(void) const { return buffer; } private: uint8_t *buffer; }; @@ -218,8 +326,15 @@ class GFXcanvas16 : public Adafruit_GFX { GFXcanvas16(uint16_t w, uint16_t h); ~GFXcanvas16(void); void drawPixel(int16_t x, int16_t y, uint16_t color), - fillScreen(uint16_t color); - uint16_t *getBuffer(void); + fillScreen(uint16_t color), + byteSwap(void); + /**********************************************************************/ + /*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer + */ + /**********************************************************************/ + uint16_t *getBuffer(void) const { return buffer; } private: uint16_t *buffer; }; diff --git a/library.properties b/library.properties index 57990b1..ec1757b 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.5.1 +version=1.5.2 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from. From 7214a0452db5b9eeab9d50fe8ab5518322e12c3f Mon Sep 17 00:00:00 2001 From: Phillip Burgess Date: Wed, 29 May 2019 20:42:31 -0700 Subject: [PATCH 4/6] Appease the Travis --- Adafruit_GFX.h | 2 +- Adafruit_SPITFT.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Adafruit_GFX.h b/Adafruit_GFX.h index 34cfe7e..2f2d2db 100755 --- a/Adafruit_GFX.h +++ b/Adafruit_GFX.h @@ -127,7 +127,7 @@ class Adafruit_GFX : public Print { /*! @brief Set text font color with custom background color @param c 16-bit 5-6-5 Color to draw text with - @param b 16-bit 5-6-5 Color to draw background/fill with + @param bg 16-bit 5-6-5 Color to draw background/fill with */ /**********************************************************************/ void setTextColor(uint16_t c, uint16_t bg) { diff --git a/Adafruit_SPITFT.cpp b/Adafruit_SPITFT.cpp index db24f2b..fcc4e08 100644 --- a/Adafruit_SPITFT.cpp +++ b/Adafruit_SPITFT.cpp @@ -496,15 +496,15 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth, /*! @brief Configure microcontroller pins for TFT interfacing. Typically called by a subclass' begin() function. - @param freq SPI frequency when using hardware SPI. If default (0) - is passed, will fall back on a device-specific value. - Value is ignored when using software SPI or parallel - connection. - @param mode SPI mode when using hardware SPI. MUST be one of the - values SPI_MODE0, SPI_MODE1, SPI_MODE2 or SPI_MODE3 - defined in SPI.h. Do NOT attempt to pass '0' for SPI_MODE0 - and so forth...the values are NOT the same! Use ONLY the - defines! (Pity it's not an enum.) + @param freq SPI frequency when using hardware SPI. If default (0) + is passed, will fall back on a device-specific value. + Value is ignored when using software SPI or parallel + connection. + @param spiMode SPI mode when using hardware SPI. MUST be one of the + values SPI_MODE0, SPI_MODE1, SPI_MODE2 or SPI_MODE3 + defined in SPI.h. Do NOT attempt to pass '0' for + SPI_MODE0 and so forth...the values are NOT the same! + Use ONLY the defines! (Pity it's not an enum.) @note Another anachronistically-named function; this is called even when the display connection is parallel (not SPI). Also, this could probably be made private...quite a few class functions From eabd1372915b2cd960611e4f5d05c9a58e7d6ad2 Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 1 Jun 2019 00:23:39 -0400 Subject: [PATCH 5/6] enable DMA on arcada boards --- Adafruit_SPITFT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adafruit_SPITFT.h b/Adafruit_SPITFT.h index cb62bc0..bd7ba65 100644 --- a/Adafruit_SPITFT.h +++ b/Adafruit_SPITFT.h @@ -66,7 +66,7 @@ typedef volatile PORT_t* PORTreg_t; ///< PORT register type #define DEFAULT_SPI_FREQ 16000000L ///< Hardware SPI default speed #endif -#if defined(ADAFRUIT_PYPORTAL) +#if defined(ADAFRUIT_PYPORTAL) || defined(ADAFRUIT_PYBADGE_M4_EXPRESS) || defined(ADAFRUIT_PYGAMER_M4_EXPRESS) #define USE_SPI_DMA ///< Auto DMA if using PyPortal #else //#define USE_SPI_DMA ///< If set, use DMA if available From 73cddc393d4f3ecef645982538ee4f68784c9f5e Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 1 Jun 2019 19:02:15 -0400 Subject: [PATCH 6/6] bump to speed up arcada --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index ec1757b..f5315ae 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.5.2 +version=1.5.3 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from.