Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Garcia <danielgarcia@gmail.com>2015-01-14 04:08:11 +0300
committerDaniel Garcia <danielgarcia@gmail.com>2015-01-14 04:08:11 +0300
commit92082af72db1f3c278b4b12f6bb38a951aaa9e07 (patch)
tree6a26a576f2cf04cf2338a3185172a4757ee48e9e
parente2b687810ea6fdd1e294cbc242b01605cf56a42b (diff)
Fix #107 - make sure our APA102 end buffer is complete.
-rw-r--r--chipsets.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/chipsets.h b/chipsets.h
index 95bd1d1c..581a756c 100644
--- a/chipsets.h
+++ b/chipsets.h
@@ -209,13 +209,13 @@ class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER,
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = BGR, uint8_t SPI_SPEED = DATA_RATE_MHZ(48)>
+template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = BGR, uint8_t SPI_SPEED = DATA_RATE_MHZ(24)>
class APA102Controller : public CLEDController {
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
SPI mSPI;
void startBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
- void endBoundary() { /*mSPI.writeWord(0xFFFF); mSPI.writeWord(0xFFFF); */}
+ void endBoundary(int nLeds) { int nBytes = (nLeds/16); do { mSPI.writeByte(0xFF); } while(nBytes--); }
inline void writeLed(uint8_t b0, uint8_t b1, uint8_t b2) __attribute__((always_inline)) {
mSPI.writeByte(0xFF); mSPI.writeByte(b0); mSPI.writeByte(b1); mSPI.writeByte(b2);
@@ -240,11 +240,11 @@ protected:
mSPI.select();
startBoundary();
- while(nLeds--) {
+ for(int i = 0; i < nLeds; i++) {
writeLed(pixels.loadAndScale0(), pixels.loadAndScale1(), pixels.loadAndScale2());
pixels.stepDithering();
}
- endBoundary();
+ endBoundary(nLeds);
mSPI.waitFully();
mSPI.release();
@@ -261,7 +261,7 @@ protected:
pixels.advanceData();
pixels.stepDithering();
}
- endBoundary();
+ endBoundary(nLeds);
mSPI.release();
}
@@ -278,7 +278,7 @@ protected:
pixels.advanceData();
pixels.stepDithering();
}
- endBoundary();
+ endBoundary(nLeds);
mSPI.release();
}