Skip to content

Commit 7b04012

Browse files
Move 0-length check to outside of DMA-specific code
1 parent c219790 commit 7b04012

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Adafruit_SPITFT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,13 @@ void Adafruit_SPITFT::writePixels(uint16_t *colors, uint32_t len) {
509509
/**************************************************************************/
510510
void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len) {
511511

512+
if(!len) return; // Avoid 0-byte transfers
513+
512514
uint8_t hi = color >> 8, lo = color;
513515

514516
if(_sclk < 0) { // Using hardware SPI
515517

516518
#ifdef USE_SPI_DMA
517-
if(!len) return; // DO NOT ANGER DMA WITH 0-BYTE TRANSFERS!
518519

519520
int i, d, numDescriptors;
520521
if(hi == lo) { // If high & low bytes are same...

0 commit comments

Comments
 (0)