diff options
author | danielgarcia@gmail.com <danielgarcia@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b> | 2013-06-02 21:14:37 +0400 |
---|---|---|
committer | danielgarcia@gmail.com <danielgarcia@gmail.com@4ad4ec5c-605d-bd5c-5796-512c9b60011b> | 2013-06-02 21:14:37 +0400 |
commit | 015b0924bd58553c68fcfd845ddde91a94c250c7 (patch) | |
tree | c7eb2cbde6b1662801bdfe20aca02b69cd5197d8 /chipsets.h | |
parent | 4644b6f769e2da7c74aa03ac778df8ff62a9d1a1 (diff) |
removing TLC code from this branch, went in the wrong place
Diffstat (limited to 'chipsets.h')
-rw-r--r-- | chipsets.h | 70 |
1 files changed, 0 insertions, 70 deletions
@@ -142,76 +142,6 @@ public: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // -// P9813 definition - takes data/clock/select pin values (N.B. should take an SPI definition?) -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(24)> -class P9813Controller : public CLEDController { - typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI; - SPI mSPI; - CMinWait<24> mWaitDelay; - - void writeBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); } - - inline void writeLed(const struct CRGB & data, uint8_t scale) __attribute__((always_inline)) { - // prep the byte - register uint8_t r = scale8(data[RGB_BYTE0(RGB_ORDER)], scale); - register uint8_t g = scale8(data[RGB_BYTE1(RGB_ORDER)], scale); - register uint8_t b = scale8(data[RGB_BYTE2(RGB_ORDER)], scale); - - register uint8_t top = 0xC0 | (~b & 0xC0) >> 2 | (~g & 0xC0) >> 4 | (~r & 0xC0); - mSPI.writeByte(top); mSPI.writeByte(b); mSPI.writeByte(g); mSPI.writeByte(r); - } - -public: - P9813Controller() {} - - virtual void init() { - mSPI.init(); - } - - virtual void clearLeds(int nLeds) { - showColor(CRGB(0,0,0), nLeds); - } - - virtual void showColor(const struct CRGB & data, int nLeds, uint8_t scale = 255) { - mSPI.select(); - - writeBoundary(); - while(nLeds--) { - writeLed(data, scale); - } - writeBoundary(); - - mSPI.waitFully(); - mSPI.release(); - mWaitDelay.mark(); - } - - virtual void show(const struct CRGB *data, int nLeds, uint8_t scale) { - mSPI.select(); - - writeBoundary(); - for(int i = 0; i < nLeds; i++) { - writeLed(data[i], scale); - } - writeBoundary(); - - mSPI.release(); - } - -#ifdef SUPPORT_ARGB - virtual void show(const struct CRGB *data, int nLeds, uint8_t scale) { - mWaitDelay.wait(); - mSPI.template writeBytes3<1, RGB_ORDER>((byte*)data, nLeds * 4, scale); - mWaitDelay.mark(); - } -#endif -}; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// // SM16716 definition - takes data/clock/select pin values (N.B. should take an SPI definition?) // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |