Skip to content

Commit 898773f

Browse files
Melissa LeBlanc-WilliamsMelissa LeBlanc-Williams
authored andcommitted
2 parents fe0683a + 0f3f657 commit 898773f

File tree

3 files changed

+55
-13
lines changed

3 files changed

+55
-13
lines changed

Adafruit_GFX.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ void Adafruit_GFX::fillTriangle(int16_t x0, int16_t y0,
662662
@param y Top left corner y coordinate
663663
@param bitmap byte array with monochrome bitmap
664664
@param w Width of bitmap in pixels
665-
@param h Hieght of bitmap in pixels
665+
@param h Height of bitmap in pixels
666666
@param color 16-bit 5-6-5 Color to draw with
667667
*/
668668
/**************************************************************************/
@@ -690,7 +690,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
690690
@param y Top left corner y coordinate
691691
@param bitmap byte array with monochrome bitmap
692692
@param w Width of bitmap in pixels
693-
@param h Hieght of bitmap in pixels
693+
@param h Height of bitmap in pixels
694694
@param color 16-bit 5-6-5 Color to draw pixels with
695695
@param bg 16-bit 5-6-5 Color to draw background with
696696
*/
@@ -720,7 +720,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
720720
@param y Top left corner y coordinate
721721
@param bitmap byte array with monochrome bitmap
722722
@param w Width of bitmap in pixels
723-
@param h Hieght of bitmap in pixels
723+
@param h Height of bitmap in pixels
724724
@param color 16-bit 5-6-5 Color to draw with
725725
*/
726726
/**************************************************************************/
@@ -748,7 +748,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
748748
@param y Top left corner y coordinate
749749
@param bitmap byte array with monochrome bitmap
750750
@param w Width of bitmap in pixels
751-
@param h Hieght of bitmap in pixels
751+
@param h Height of bitmap in pixels
752752
@param color 16-bit 5-6-5 Color to draw pixels with
753753
@param bg 16-bit 5-6-5 Color to draw background with
754754
*/
@@ -781,7 +781,7 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
781781
@param y Top left corner y coordinate
782782
@param bitmap byte array with monochrome bitmap
783783
@param w Width of bitmap in pixels
784-
@param h Hieght of bitmap in pixels
784+
@param h Height of bitmap in pixels
785785
@param color 16-bit 5-6-5 Color to draw pixels with
786786
*/
787787
/**************************************************************************/
@@ -813,7 +813,7 @@ void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
813813
@param y Top left corner y coordinate
814814
@param bitmap byte array with grayscale bitmap
815815
@param w Width of bitmap in pixels
816-
@param h Hieght of bitmap in pixels
816+
@param h Height of bitmap in pixels
817817
*/
818818
/**************************************************************************/
819819
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
@@ -835,7 +835,7 @@ void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,
835835
@param y Top left corner y coordinate
836836
@param bitmap byte array with grayscale bitmap
837837
@param w Width of bitmap in pixels
838-
@param h Hieght of bitmap in pixels
838+
@param h Height of bitmap in pixels
839839
*/
840840
/**************************************************************************/
841841
void Adafruit_GFX::drawGrayscaleBitmap(int16_t x, int16_t y,

Adafruit_SPITFT.cpp

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,16 @@ Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs,
255255
@param rst Arduino pin # for display reset (optional, display reset
256256
can be tied to MCU reset, default of -1 means unused).
257257
@return Adafruit_SPITFT object.
258-
@note Output pins are not initialized; application typically will
259-
need to call subclass' begin() function, which in turn calls
260-
this library's initSPI() function to initialize pins.
258+
@note Output pins are not initialized in constructor; application
259+
typically will need to call subclass' begin() function, which
260+
in turn calls this library's initSPI() function to initialize
261+
pins. EXCEPT...if you have built your own SERCOM SPI peripheral
262+
(calling the SPIClass constructor) rather than one of the
263+
built-in SPI devices (e.g. &SPI, &SPI1 and so forth), you will
264+
need to call the begin() function for your object as well as
265+
pinPeripheral() for the MOSI, MISO and SCK pins to configure
266+
GPIO manually. Do this BEFORE calling the display-specific
267+
begin or init function. Unfortunate but unavoidable.
261268
*/
262269
Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass,
263270
int8_t cs, int8_t dc, int8_t rst) : Adafruit_GFX(w, h),
@@ -517,8 +524,43 @@ void Adafruit_SPITFT::initSPI(uint32_t freq) {
517524
#else
518525
hwspi._freq = freq; // Save freq value for later
519526
#endif
520-
hwspi._spi->begin();
521-
527+
// Call hwspi._spi->begin() ONLY if this is among the 'established'
528+
// SPI interfaces in variant.h. For DIY roll-your-own SERCOM SPIs,
529+
// begin() and pinPeripheral() calls MUST be made in one's calling
530+
// code, BEFORE the screen-specific begin/init function is called.
531+
// Reason for this is that SPI::begin() makes its own calls to
532+
// pinPeripheral() based on g_APinDescription[n].ulPinType, which
533+
// on non-established SPI interface pins will always be PIO_DIGITAL
534+
// or similar, while we need PIO_SERCOM or PIO_SERCOM_ALT...it's
535+
// highly unique between devices and variants for each pin or
536+
// SERCOM so we can't make those calls ourselves here. And the SPI
537+
// device needs to be set up before calling this because it's
538+
// immediately followed with initialization commands. Blargh.
539+
if(
540+
#if !defined(SPI_INTERFACES_COUNT)
541+
1
542+
#endif
543+
#if SPI_INTERFACES_COUNT > 0
544+
(hwspi._spi == &SPI)
545+
#endif
546+
#if SPI_INTERFACES_COUNT > 1
547+
|| (hwspi._spi == &SPI1)
548+
#endif
549+
#if SPI_INTERFACES_COUNT > 2
550+
|| (hwspi._spi == &SPI2)
551+
#endif
552+
#if SPI_INTERFACES_COUNT > 3
553+
|| (hwspi._spi == &SPI3)
554+
#endif
555+
#if SPI_INTERFACES_COUNT > 4
556+
|| (hwspi._spi == &SPI4)
557+
#endif
558+
#if SPI_INTERFACES_COUNT > 5
559+
|| (hwspi._spi == &SPI5)
560+
#endif
561+
) {
562+
hwspi._spi->begin();
563+
}
522564
} else if(connection == TFT_SOFT_SPI) {
523565

524566
pinMode(swspi._mosi, OUTPUT);

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.4.11
2+
version=1.4.13
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)