Skip to content

Commit d44c3f4

Browse files
authored
SPI: writePattern() should not call setDataBits(0) (#8636)
resolves #8635
1 parent 06f34ed commit d44c3f4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries/SPI/SPI.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,11 @@ void SPIClass::writePattern(const uint8_t * data, uint8_t size, uint32_t repeat)
515515
}
516516
}
517517
//End orig
518-
setDataBits(repeatRem * 8);
519-
SPI1CMD |= SPIBUSY;
520-
while(SPI1CMD & SPIBUSY) {}
518+
if (repeatRem) {
519+
setDataBits(repeatRem * 8);
520+
SPI1CMD |= SPIBUSY;
521+
while(SPI1CMD & SPIBUSY) {}
522+
}
521523

522524
SPI1U = SPIUMOSI | SPIUDUPLEX | SPIUSSE;
523525
}

0 commit comments

Comments
 (0)