diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2016-01-24 00:50:11 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2016-01-24 00:50:11 +0300 |
commit | 1e21888813ddd280e59d3d2711569a14dee16771 (patch) | |
tree | 5d5df97f9a8bd63dace309f8c4620e083a20fde9 | |
parent | 13401c37cf93be6c9ebed19452a44c4718ee9467 (diff) |
Make the OctoWS2811 controller use the new pixel led controller
-rw-r--r-- | chipsets.h | 6 | ||||
-rw-r--r-- | platforms/arm/k20/octows2811_controller.h | 38 |
2 files changed, 5 insertions, 39 deletions
@@ -131,12 +131,6 @@ public: mWaitDelay.mark(); } - virtual void clearLeds(int nLeds) { - mWaitDelay.wait(); - mSPI.writeBytesValue(0, nLeds*3); - mWaitDelay.mark(); - } - protected: virtual void showPixels(PixelController<RGB_ORDER> & pixels) { diff --git a/platforms/arm/k20/octows2811_controller.h b/platforms/arm/k20/octows2811_controller.h index ebd1ff39..ce959228 100644 --- a/platforms/arm/k20/octows2811_controller.h +++ b/platforms/arm/k20/octows2811_controller.h @@ -8,7 +8,7 @@ FASTLED_NAMESPACE_BEGIN template<EOrder RGB_ORDER = GRB, boolean SLOW=false> -class COctoWS2811Controller : public CLEDController { +class COctoWS2811Controller : public CPixelLEDController<RGB_ORDER, 8, 0xFF> { OctoWS2811 *pocto; uint8_t *drawbuffer,*framebuffer; @@ -34,45 +34,16 @@ public: virtual void init() { /* do nothing yet */ } - virtual void clearLeds(int nLeds) { - _init(nLeds); - showColor(CRGB(0,0,0),nLeds,CRGB(0,0,0)); - } - - virtual void showColor(const struct CRGB & data, int nLeds, CRGB scale) { - _init(nLeds); - // Get our pixel values - PixelController<RGB_ORDER> pixels(data, nLeds, scale, getDither()); - uint8_t ball[3][8]; - memset(ball[0],pixels.loadAndScale0(),8); - memset(ball[1],pixels.loadAndScale1(),8); - memset(ball[2],pixels.loadAndScale2(),8); - - uint8_t bout[24]; - transpose8x1_MSB(ball[0],bout); - transpose8x1_MSB(ball[1],bout+8); - transpose8x1_MSB(ball[2],bout+16); - - uint8_t *pdata = drawbuffer; - while(nLeds--) { - memcpy(pdata,bout,24); - pdata += 24; - } - - pocto->show(); - } - typedef union { uint8_t bytes[8]; uint32_t raw[2]; } Lines; - virtual void show(const struct CRGB *rgbdata, int nLeds, CRGB scale) { - _init(nLeds); - PixelController<RGB_ORDER,8,0xFF> pixels(rgbdata,nLeds, scale, getDither() ); + virtual void showPixels(PixelController<RGB_ORDER, 8, 0xFF> & pixels) { + _init(pixels.size()); uint8_t *pData = drawbuffer; - while(nLeds--) { + while(pixels.has(1)) { Lines b; for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale0(i); } @@ -87,6 +58,7 @@ public: pocto->show(); } + }; FASTLED_NAMESPACE_END |