diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2014-02-11 01:39:42 +0400 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2014-02-11 01:39:42 +0400 |
commit | a10b38d220b6c28ba8abaed6aff6ed9bc03e6f6b (patch) | |
tree | 78235f1c3cacd857ca60e8cb6fb9c07ef1aee2a0 | |
parent | 46661e13e10f707f9ca19d57b627b89d7d09fec0 (diff) |
Preliminary test support for the GW6205 dropping 4 0 bits after the 8 bits of rgb data. Note: this is just writing out 8bit data to a 12bit chipset. Next step will be filling in the low 4 bits from scaling results (if applicable), then finally real CRGB16 support
-rw-r--r-- | FastLED.h | 6 | ||||
-rw-r--r-- | chipsets.h | 14 | ||||
-rw-r--r-- | clockless_avr.h | 36 | ||||
-rw-r--r-- | examples/Blink/Blink.ino | 2 | ||||
-rw-r--r-- | examples/Cylon/Cylon.ino | 2 | ||||
-rw-r--r-- | examples/FirstLight/FirstLight.ino | 2 | ||||
-rw-r--r-- | examples/RGBCalibrate/RGBCalibrate.ino | 2 |
7 files changed, 59 insertions, 5 deletions
@@ -29,6 +29,8 @@ enum EClocklessChipsets { UCS1903B, WS2811_400, NEOPIXEL, + GW6205, + GW6205_400, TM1829 }; @@ -113,6 +115,8 @@ public: case WS2811: { static WS2811Controller800Khz<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } case NEOPIXEL: { static WS2811Controller800Khz<DATA_PIN, GRB> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } case WS2811_400: { static WS2811Controller400Khz<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } + case GW6205: { static GW6205Controller800Khz<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } + case GW6205_400: { static GW6205Controller400Khz<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } } return NULL; } @@ -134,6 +138,8 @@ public: case NEOPIXEL: case WS2811: { static WS2811Controller800Khz<DATA_PIN, RGB_ORDER> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } case WS2811_400: { static WS2811Controller400Khz<DATA_PIN, RGB_ORDER> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } + case GW6205: { static GW6205Controller800Khz<DATA_PIN, RGB_ORDER> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } + case GW6205_400: { static GW6205Controller400Khz<DATA_PIN, RGB_ORDER> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); } } return NULL; } @@ -338,6 +338,20 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> class TM1803Controller400Khz : public ClocklessController<DATA_PIN, 12, 12, 12, RGB_ORDER> {}; #else +// GW6205@400khz - 800ns, 800ns, 800ns +template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> +class GW6205Controller400Khz : public ClocklessController<DATA_PIN, NS(800), NS(800), NS(800), RGB_ORDER, 4> {}; +#if NO_TIME(800, 800, 800) +#warning "Not enough clock cycles available for the GW6205@400khz" +#endif + +// GW6205@400khz - 400ns, 400ns, 400ns +template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> +class GW6205Controller800Khz : public ClocklessController<DATA_PIN, NS(400), NS(400), NS(400), RGB_ORDER, 4> {}; +#if NO_TIME(400, 400, 400) +#warning "Not enough clock cycles available for the GW6205@400khz" +#endif + // UCS1903 - 500ns, 1500ns, 500ns template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB> class UCS1903Controller400Khz : public ClocklessController<DATA_PIN, NS(500), NS(1500), NS(500), RGB_ORDER> {}; diff --git a/clockless_avr.h b/clockless_avr.h index a822fb4e..887188b3 100644 --- a/clockless_avr.h +++ b/clockless_avr.h @@ -6,7 +6,7 @@ // Definition for a single channel clockless controller for the avr family of chips, like those used in // the arduino and teensy 2.x. Note that there is a special case for hardware-mul-less versions of the avr, // which are tracked in clockless_trinket.h -template <uint8_t DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, bool FLIP = false, int WAIT_TIME = 50> +template <uint8_t DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 50> class ClocklessController : public CLEDController { typedef typename FastPin<DATA_PIN>::port_ptr_t data_ptr_t; typedef typename FastPin<DATA_PIN>::port_t data_t; @@ -125,6 +125,14 @@ public: INLINE_SCALE(c, scale); bitSetLast<5, 1>(port, hi, lo, b); + if(XTRA0 > 0) { + for(register byte x=XTRA0; x; x--) { + bitSetLast<4,4>(port, hi, lo, b); + b <<=1; + } + delaycycles<1>(); + } + for(register byte x=5; x; x--) { bitSetLast<7, 4>(port, hi, lo, c); c <<= 1; @@ -145,9 +153,17 @@ public: INLINE_SCALE(d, scale); bitSetLast<5, 1>(port, hi, lo, c); + if(XTRA0 > 0) { + for(register byte x=XTRA0; x; x--) { + bitSetLast<4,4>(port, hi, lo, c); + c <<=1; + } + delaycycles<1>(); + } + for(register byte x=5; x; x--) { - bitSetLast<7, 4>(port, hi, lo, d); - d <<= 1; + bitSetLast<7, 4>(port, hi, lo, c); + c <<= 1; } delaycycles<1>(); // Leave an extra 2 clocks for the next byte load @@ -162,7 +178,19 @@ public: delaycycles<1>(); } INLINE_SCALE(b, scale); - bitSetLast<5, 6>(port, hi, lo, d); + + if(XTRA0 > 0) { + bitSetLast<5, 1>(port, hi, lo, d); + for(register byte x=XTRA0-1; x; x--) { + bitSetLast<4,4>(port, hi, lo, d); + d <<=1; + } + delaycycles<1>(); + bitSetLast<4,6>(port,hi,lo,d); + } else { + bitSetLast<5,6>(port, hi, lo, d); + } + } cleanup_R1(); } diff --git a/examples/Blink/Blink.ino b/examples/Blink/Blink.ino index 1d7f1fa7..fb0d90d8 100644 --- a/examples/Blink/Blink.ino +++ b/examples/Blink/Blink.ino @@ -23,6 +23,8 @@ void setup() { // FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS); FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS); diff --git a/examples/Cylon/Cylon.ino b/examples/Cylon/Cylon.ino index bec878c5..8d133da2 100644 --- a/examples/Cylon/Cylon.ino +++ b/examples/Cylon/Cylon.ino @@ -40,4 +40,4 @@ void loop() { // Wait a little bit before we loop around and do it again delay(30); } -}
\ No newline at end of file +} diff --git a/examples/FirstLight/FirstLight.ino b/examples/FirstLight/FirstLight.ino index 1572dad6..ebd58f13 100644 --- a/examples/FirstLight/FirstLight.ino +++ b/examples/FirstLight/FirstLight.ino @@ -37,6 +37,8 @@ void setup() { // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS); FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); diff --git a/examples/RGBCalibrate/RGBCalibrate.ino b/examples/RGBCalibrate/RGBCalibrate.ino index 7be08c7c..59c1dd4f 100644 --- a/examples/RGBCalibrate/RGBCalibrate.ino +++ b/examples/RGBCalibrate/RGBCalibrate.ino @@ -43,6 +43,8 @@ void setup() { // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS); + // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); |