Spi pattern fix (#502)

* Add files via upload

Calls to writePattern() don't send the desired number of bytes when the pattern size doesn't divide evenly into the hardware FIFO size (e.g. sending 18-bit RGB data, 11 patterns take 63 bytes, so 1/64th of the data is never sent).

* Add files via upload

Remove white space changes.
This commit is contained in:
Glen McGillan 2017-07-31 12:50:57 -07:00 committed by Me No Dev
parent b3fdfda914
commit 2eaf846134

View File

@ -242,11 +242,12 @@ void SPIClass::writePattern(uint8_t * data, uint8_t size, uint32_t repeat)
uint32_t byte = (size * repeat); uint32_t byte = (size * repeat);
uint8_t r = (64 / size); uint8_t r = (64 / size);
const uint8_t max_bytes_FIFO = r * size; // Max number of whole patterns (in bytes) that can fit into the hardware FIFO
while(byte) { while(byte) {
if(byte > 64) { if(byte > max_bytes_FIFO) {
writePattern_(data, size, r); writePattern_(data, size, r);
byte -= 64; byte -= max_bytes_FIFO;
} else { } else {
writePattern_(data, size, (byte / size)); writePattern_(data, size, (byte / size));
byte = 0; byte = 0;