FastLED 3.9.15
Loading...
Searching...
No Matches
chipsets.h
Go to the documentation of this file.
1#ifndef __INC_CHIPSETS_H
2#define __INC_CHIPSETS_H
3
4#include "pixeltypes.h"
6#include "fl/force_inline.h"
7#include "pixel_iterator.h"
8#include "crgb.h"
9#include "eorder.h"
10#include "fl/namespace.h"
11
12
13
14#ifndef FASTLED_CLOCKLESS_USES_NANOSECONDS
15 #if defined(FASTLED_TEENSY4)
16 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 1
17 #elif defined(ESP32)
19 // RMT 5.1 driver converts from nanoseconds to RMT ticks.
20 #if FASTLED_RMT5
21 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 1
22 #else
23 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 0
24 #endif
25 #else
26 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 0
27 #endif // FASTLED_TEENSY4
28#endif // FASTLED_CLOCKLESS_USES_NANOSECONDS
29
30
31#ifdef __IMXRT1062__
32#include "platforms/arm/k20/clockless_objectfled.h"
33#endif
34
37
38
39
44
45#if defined(ARDUINO) //&& defined(SoftwareSerial_h)
46
47
48#if defined(SoftwareSerial_h) || defined(__SoftwareSerial_h)
49#include <SoftwareSerial.h>
50
51#define HAS_PIXIE
52
54
58template<uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
59class PixieController : public CPixelLEDController<RGB_ORDER> {
60 SoftwareSerial Serial;
61 CMinWait<2000> mWait;
62
63public:
64 PixieController() : Serial(-1, DATA_PIN) {}
65
66protected:
68 virtual void init() {
69 Serial.begin(115200);
70 mWait.mark();
71 }
72
74 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
75 mWait.wait();
76 while(pixels.has(1)) {
77 uint8_t r = pixels.loadAndScale0();
78 Serial.write(r);
79 uint8_t g = pixels.loadAndScale1();
80 Serial.write(g);
81 uint8_t b = pixels.loadAndScale2();
82 Serial.write(b);
83 pixels.advanceData();
84 pixels.stepDithering();
85 }
86 mWait.mark();
87 }
88
89};
90
91// template<SoftwareSerial & STREAM, EOrder RGB_ORDER = RGB>
92// class PixieController : public PixieBaseController<STREAM, RGB_ORDER> {
93// public:
94// virtual void init() {
95// STREAM.begin(115200);
96// }
97// };
98
100#endif
101#endif
102
103// Emulution layer to support RGBW leds on RGB controllers. This works by creating
104// a side buffer dedicated for the RGBW data. The RGB data is then converted to RGBW
105// and sent to the delegate controller for rendering as if it were RGB data.
107
108template <
109 typename CONTROLLER,
110 EOrder RGB_ORDER = GRB> // Default on WS2812>
112 : public CPixelLEDController<RGB_ORDER, CONTROLLER::LANES_VALUE,
113 CONTROLLER::MASK_VALUE> {
114 public:
115 // ControllerT is a helper class. It subclasses the device controller class
116 // and has three methods to call the three protected methods we use.
117 // This is janky, but redeclaring public methods protected in a derived class
118 // is janky, too.
119
120 // N.B., byte order must be RGB.
121 typedef CONTROLLER ControllerBaseT;
122 class ControllerT : public CONTROLLER {
123 friend class RGBWEmulatedController<CONTROLLER, RGB_ORDER>;
124 void *callBeginShowLeds(int size) { return ControllerBaseT::beginShowLeds(size); }
125 void callShow(CRGB *data, int nLeds, uint8_t brightness) {
126 ControllerBaseT::show(data, nLeds, brightness);
127 }
128 void callEndShowLeds(void *data) { ControllerBaseT::endShowLeds(data); }
129 };
130
131
132 static const int LANES = CONTROLLER::LANES_VALUE;
133 static const uint32_t MASK = CONTROLLER::MASK_VALUE;
134
135 // The delegated controller must do no reordering.
136 static_assert(RGB == CONTROLLER::RGB_ORDER_VALUE, "The delegated controller MUST NOT do reordering");
137
139 this->setRgbw(rgbw);
140 };
142
143 virtual void *beginShowLeds(int size) override {
144 return mController.callBeginShowLeds(Rgbw::size_as_rgb(size));
145 }
146
147 virtual void endShowLeds(void *data) override {
148 return mController.callEndShowLeds(data);
149 }
150
152 // Ensure buffer is large enough
153 ensureBuffer(pixels.size());
154 Rgbw rgbw = this->getRgbw();
155 uint8_t *data = reinterpret_cast<uint8_t *>(mRGBWPixels);
156 while (pixels.has(1)) {
157 pixels.stepDithering();
158 pixels.loadAndScaleRGBW(rgbw, data, data + 1, data + 2, data + 3);
159 data += 4;
160 pixels.advanceData();
161 }
162
163 // Force the device controller to a state where it passes data through
164 // unmodified: color correction, color temperature, dither, and brightness
165 // (passed as an argument to show()). Temporarily enable the controller,
166 // show the LEDs, and disable it again.
167 //
168 // The device controller is in the global controller list, so if we
169 // don't keep it disabled, it will refresh again with unknown brightness,
170 // temperature, etc.
171
172 mController.setCorrection(CRGB(255, 255, 255));
173 mController.setTemperature(CRGB(255, 255, 255));
174 mController.setDither(DISABLE_DITHER);
175
176 mController.setEnabled(true);
177 mController.callShow(mRGBWPixels, Rgbw::size_as_rgb(pixels.size()), 255);
178 mController.setEnabled(false);
179 }
180
181 private:
182 // Needed by the interface.
183 void init() override {
184 mController.init();
185 mController.setEnabled(false);
186 }
187
188 void ensureBuffer(int32_t num_leds) {
189 if (num_leds != mNumRGBLeds) {
190 mNumRGBLeds = num_leds;
191 // The delegate controller expects the raw pixel byte data in multiples of 3.
192 // In the case of src data not a multiple of 3, then we need to
193 // add pad bytes so that the delegate controller doesn't walk off the end
194 // of the array and invoke a buffer overflow panic.
195 uint32_t new_size = Rgbw::size_as_rgb(num_leds);
196 delete[] mRGBWPixels;
197 mRGBWPixels = new CRGB[new_size];
198 // showPixels may never clear the last two pixels.
199 for (uint32_t i = 0; i < new_size; i++) {
200 mRGBWPixels[i] = CRGB(0, 0, 0);
201 }
202
203 mController.setLeds(mRGBWPixels, new_size);
204 }
205 }
206
207 CRGB *mRGBWPixels = nullptr;
208 int32_t mNumRGBLeds = 0;
209 int32_t mNumRGBWLeds = 0;
210 ControllerT mController; // Real controller.
211};
212
216
218//
219// LPD8806 controller class - takes data/clock/select pin values (N.B. should take an SPI definition?)
220//
222
228template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(12) >
229class LPD8806Controller : public CPixelLEDController<RGB_ORDER> {
231
233 public:
234 // LPD8806 spec wants the high bit of every rgb data byte sent out to be set.
235 FASTLED_FORCE_INLINE static uint8_t adjust(FASTLED_REGISTER uint8_t data) { return ((data>>1) | 0x80) + ((data && (data<254)) & 0x01); }
236 FASTLED_FORCE_INLINE static void postBlock(int len, void* context = NULL) {
237 SPI* pSPI = static_cast<SPI*>(context);
238 pSPI->writeBytesValueRaw(0, ((len*3+63)>>6));
239 }
240
241 };
242
244
245public:
247 virtual void init() {
248 mSPI.init();
249 }
250
251protected:
252
254 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
255 mSPI.template writePixels<0, LPD8806_ADJUST, RGB_ORDER>(pixels, &mSPI);
256 }
257};
258
259
261//
262// WS2801 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
263//
265
271template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(1)>
272class WS2801Controller : public CPixelLEDController<RGB_ORDER> {
276
277public:
279
281 virtual void init() {
282 mSPI.init();
283 mWaitDelay.mark();
284 }
285
286protected:
287
289 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
290 mWaitDelay.wait();
291 mSPI.template writePixels<0, DATA_NOP, RGB_ORDER>(pixels, NULL);
292 mWaitDelay.mark();
293 }
294};
295
298template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(25)>
299class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {};
300
309template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(12)>
310class LPD6803Controller : public CPixelLEDController<RGB_ORDER> {
313
314 void startBoundary() { mSPI.writeByte(0); mSPI.writeByte(0); mSPI.writeByte(0); mSPI.writeByte(0); }
315 void endBoundary(int nLeds) { int nDWords = (nLeds/32); do { mSPI.writeByte(0xFF); mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); } while(nDWords--); }
316
317public:
319
320 virtual void init() {
321 mSPI.init();
322 }
323
324protected:
326 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
327 mSPI.select();
328
330 while(pixels.has(1)) {
331 FASTLED_REGISTER uint16_t command;
332 command = 0x8000;
333 command |= (pixels.loadAndScale0() & 0xF8) << 7; // red is the high 5 bits
334 command |= (pixels.loadAndScale1() & 0xF8) << 2; // green is the middle 5 bits
335 mSPI.writeByte((command >> 8) & 0xFF);
336 command |= pixels.loadAndScale2() >> 3 ; // blue is the low 5 bits
337 mSPI.writeByte(command & 0xFF);
338
339 pixels.stepDithering();
340 pixels.advanceData();
341 }
342 endBoundary(pixels.size());
343 mSPI.waitFully();
344 mSPI.release();
345 }
346
347};
348
350//
351// APA102 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
352//
354
360template <
361 uint8_t DATA_PIN, uint8_t CLOCK_PIN,
362 EOrder RGB_ORDER = RGB,
363 // APA102 has a bug where long strip can't handle full speed due to clock degredation.
364 // This only affects long strips, but then again if you have a short strip does 6 mhz actually slow
365 // you down? Probably not. And you can always bump it up for speed. Therefore we are prioritizing
366 // "just works" over "fastest possible" here.
367 // https://www.pjrc.com/why-apa102-leds-have-trouble-at-24-mhz/
368 uint32_t SPI_SPEED = DATA_RATE_MHZ(6),
370 uint32_t START_FRAME = 0x00000000,
371 uint32_t END_FRAME = 0xFF000000
372>
373class APA102Controller : public CPixelLEDController<RGB_ORDER> {
376
378 mSPI.writeWord(START_FRAME >> 16);
379 mSPI.writeWord(START_FRAME & 0xFFFF);
380 }
381 void endBoundary(int nLeds) {
382 int nDWords = (nLeds/32);
383 const uint8_t b0 = uint8_t(END_FRAME >> 24 & 0x000000ff);
384 const uint8_t b1 = uint8_t(END_FRAME >> 16 & 0x000000ff);
385 const uint8_t b2 = uint8_t(END_FRAME >> 8 & 0x000000ff);
386 const uint8_t b3 = uint8_t(END_FRAME >> 0 & 0x000000ff);
387 do {
388 mSPI.writeByte(b0);
389 mSPI.writeByte(b1);
390 mSPI.writeByte(b2);
391 mSPI.writeByte(b3);
392 } while(nDWords--);
393 }
394
395 FASTLED_FORCE_INLINE void writeLed(uint8_t brightness, uint8_t b0, uint8_t b1, uint8_t b2) {
396#ifdef FASTLED_SPI_BYTE_ONLY
397 mSPI.writeByte(0xE0 | brightness);
398 mSPI.writeByte(b0);
399 mSPI.writeByte(b1);
400 mSPI.writeByte(b2);
401#else
402 uint16_t b = 0xE000 | (brightness << 8) | (uint16_t)b0;
403 mSPI.writeWord(b);
404 uint16_t w = b1 << 8;
405 w |= b2;
406 mSPI.writeWord(w);
407#endif
408 }
409
410 FASTLED_FORCE_INLINE void write2Bytes(uint8_t b1, uint8_t b2) {
411#ifdef FASTLED_SPI_BYTE_ONLY
412 mSPI.writeByte(b1);
413 mSPI.writeByte(b2);
414#else
415 mSPI.writeWord(uint16_t(b1) << 8 | b2);
416#endif
417 }
418
419public:
421
422 virtual void init() override {
423 mSPI.init();
424 }
425
426protected:
428 virtual void showPixels(PixelController<RGB_ORDER> & pixels) override {
429 switch (GAMMA_CORRECTION_MODE) {
431 showPixelsDefault(pixels);
432 break;
433 }
436 break;
437 }
438 }
439 }
440
441private:
442
445 uint8_t* out_s0, uint8_t* out_s1, uint8_t* out_s2, uint8_t* out_brightness) {
446#if FASTLED_HD_COLOR_MIXING
447 uint8_t brightness;
448 pixels.getHdScale(out_s0, out_s1, out_s2, &brightness);
449 struct Math {
450 static uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) {
451 const uint16_t run = in_max - in_min;
452 const uint16_t rise = out_max - out_min;
453 const uint16_t delta = x - in_min;
454 return (delta * rise) / run + out_min;
455 }
456 };
457 // *out_brightness = Math::map(brightness, 0, 255, 0, 31);
458 uint16_t bri = Math::map(brightness, 0, 255, 0, 31);
459 if (bri == 0 && brightness != 0) {
460 // Fixes https://github.com/FastLED/FastLED/issues/1908
461 bri = 1;
462 }
463 *out_brightness = static_cast<uint8_t>(bri);
464 return;
465#else
466 uint8_t s0, s1, s2;
467 pixels.loadAndScaleRGB(&s0, &s1, &s2);
468#if FASTLED_USE_GLOBAL_BRIGHTNESS == 1
469 // This function is pure magic.
470 const uint16_t maxBrightness = 0x1F;
471 uint16_t brightness = ((((uint16_t)max(max(s0, s1), s2) + 1) * maxBrightness - 1) >> 8) + 1;
472 s0 = (maxBrightness * s0 + (brightness >> 1)) / brightness;
473 s1 = (maxBrightness * s1 + (brightness >> 1)) / brightness;
474 s2 = (maxBrightness * s2 + (brightness >> 1)) / brightness;
475#else
476 const uint8_t brightness = 0x1F;
477#endif // FASTLED_USE_GLOBAL_BRIGHTNESS
478 *out_s0 = s0;
479 *out_s1 = s1;
480 *out_s2 = s2;
481 *out_brightness = static_cast<uint8_t>(brightness);
482#endif // FASTLED_HD_COLOR_MIXING
483 }
484
485 // Legacy showPixels implementation.
487 mSPI.select();
488 uint8_t s0, s1, s2, global_brightness;
489 getGlobalBrightnessAndScalingFactors(pixels, &s0, &s1, &s2, &global_brightness);
491 while (pixels.has(1)) {
492 uint8_t c0, c1, c2;
493 pixels.loadAndScaleRGB(&c0, &c1, &c2);
494 writeLed(global_brightness, c0, c1, c2);
495 pixels.stepDithering();
496 pixels.advanceData();
497 }
498 endBoundary(pixels.size());
499
500 mSPI.waitFully();
501 mSPI.release();
502 }
503
505 mSPI.select();
507 while (pixels.has(1)) {
508 // Load raw uncorrected r,g,b values.
509 uint8_t brightness, c0, c1, c2; // c0-c2 is the RGB data re-ordered for pixel
510 pixels.loadAndScale_APA102_HD(&c0, &c1, &c2, &brightness);
511 writeLed(brightness, c0, c1, c2);
512 pixels.stepDithering();
513 pixels.advanceData();
514 }
515 endBoundary(pixels.size());
516 mSPI.waitFully();
517 mSPI.release();
518 }
519};
520
526template <
527 uint8_t DATA_PIN,
528 uint8_t CLOCK_PIN,
529 EOrder RGB_ORDER = RGB,
530 // APA102 has a bug where long strip can't handle full speed due to clock degredation.
531 // This only affects long strips, but then again if you have a short strip does 6 mhz actually slow
532 // you down? Probably not. And you can always bump it up for speed. Therefore we are prioritizing
533 // "just works" over "fastest possible" here.
534 // https://www.pjrc.com/why-apa102-leds-have-trouble-at-24-mhz/
535 uint32_t SPI_SPEED = DATA_RATE_MHZ(6)
536>
538 DATA_PIN,
539 CLOCK_PIN,
540 RGB_ORDER,
541 SPI_SPEED,
542 fl::kFiveBitGammaCorrectionMode_BitShift,
543 uint32_t(0x00000000),
544 uint32_t(0x00000000)> {
545public:
548};
549
555template <
556 uint8_t DATA_PIN,
557 uint8_t CLOCK_PIN,
558 EOrder RGB_ORDER = RGB,
559 uint32_t SPI_SPEED = DATA_RATE_MHZ(12)
560>
562 DATA_PIN,
563 CLOCK_PIN,
564 RGB_ORDER,
565 SPI_SPEED,
566 fl::kFiveBitGammaCorrectionMode_Null,
567 0x00000000,
568 0x00000000
569> {
570};
571
577template <
578 uint8_t DATA_PIN,
579 uint8_t CLOCK_PIN,
580 EOrder RGB_ORDER = RGB,
581 uint32_t SPI_SPEED = DATA_RATE_MHZ(12)
582>
584 DATA_PIN,
585 CLOCK_PIN,
586 RGB_ORDER,
587 SPI_SPEED,
588 fl::kFiveBitGammaCorrectionMode_BitShift,
589 0x00000000,
590 0x00000000
591> {
592};
593
594
596template <
597 uint8_t DATA_PIN,
598 uint8_t CLOCK_PIN,
599 EOrder RGB_ORDER = RGB,
600 uint32_t SPI_SPEED = DATA_RATE_MHZ(40)
601>
603 DATA_PIN,
604 CLOCK_PIN,
605 RGB_ORDER,
606 SPI_SPEED,
607 fl::kFiveBitGammaCorrectionMode_Null,
608 0x00000000,
609 0x00000000
610> {};
611
613template <
614 uint8_t DATA_PIN,
615 uint8_t CLOCK_PIN,
616 EOrder RGB_ORDER = RGB,
617 uint32_t SPI_SPEED = DATA_RATE_MHZ(40)\
618>
620 DATA_PIN,
621 CLOCK_PIN,
622 RGB_ORDER,
623 SPI_SPEED> {
624};
625
626
628//
629// P9813 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
630//
632
638template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(10)>
639class P9813Controller : public CPixelLEDController<RGB_ORDER> {
642
643 void writeBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
644
645 FASTLED_FORCE_INLINE void writeLed(uint8_t r, uint8_t g, uint8_t b) {
646 FASTLED_REGISTER uint8_t top = 0xC0 | ((~b & 0xC0) >> 2) | ((~g & 0xC0) >> 4) | ((~r & 0xC0) >> 6);
647 mSPI.writeByte(top); mSPI.writeByte(b); mSPI.writeByte(g); mSPI.writeByte(r);
648 }
649
650public:
652
653 virtual void init() {
654 mSPI.init();
655 }
656
657protected:
659 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
660 mSPI.select();
661
663 while(pixels.has(1)) {
664 writeLed(pixels.loadAndScale0(), pixels.loadAndScale1(), pixels.loadAndScale2());
665 pixels.advanceData();
666 pixels.stepDithering();
667 }
669 mSPI.waitFully();
670
671 mSPI.release();
672 }
673
674};
675
676
678//
679// SM16716 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
680//
682
688template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint32_t SPI_SPEED = DATA_RATE_MHZ(16)>
689class SM16716Controller : public CPixelLEDController<RGB_ORDER> {
692
693 void writeHeader() {
694 // Write out 50 zeros to the spi line (6 blocks of 8 followed by two single bit writes)
695 mSPI.select();
696 mSPI.template writeBit<0>(0);
697 mSPI.writeByte(0);
698 mSPI.writeByte(0);
699 mSPI.writeByte(0);
700 mSPI.template writeBit<0>(0);
701 mSPI.writeByte(0);
702 mSPI.writeByte(0);
703 mSPI.writeByte(0);
704 mSPI.waitFully();
705 mSPI.release();
706 }
707
708public:
710
711 virtual void init() {
712 mSPI.init();
713 }
714
715protected:
717 virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
718 // Make sure the FLAG_START_BIT flag is set to ensure that an extra 1 bit is sent at the start
719 // of each triplet of bytes for rgb data
720 // writeHeader();
721 mSPI.template writePixels<FLAG_START_BIT, DATA_NOP, RGB_ORDER>(pixels, NULL);
722 writeHeader();
723 }
724
725};
726
728
729
731//
732// Clockless template instantiations - see clockless.h for how the timing values are used
733//
734
735#ifdef FASTLED_HAS_CLOCKLESS
757
758// Allow clock that clockless controller is based on to have different
759// frequency than the CPU.
760#if !defined(CLOCKLESS_FREQUENCY)
761 #define CLOCKLESS_FREQUENCY F_CPU
762#endif
763
764// We want to force all avr's to use the Trinket controller when running at 8Mhz, because even the 328's at 8Mhz
765// need the more tightly defined timeframes.
766#if defined(__LGT8F__) || (CLOCKLESS_FREQUENCY == 8000000 || CLOCKLESS_FREQUENCY == 16000000 || CLOCKLESS_FREQUENCY == 24000000) || defined(FASTLED_DOXYGEN) // || CLOCKLESS_FREQUENCY == 48000000 || CLOCKLESS_FREQUENCY == 96000000) // 125ns/clock
767
770#define FMUL (CLOCKLESS_FREQUENCY/8000000)
771
774template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
775class GE8822Controller800Khz : public ClocklessController<DATA_PIN, 3 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER, 4> {};
776
779template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
780class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 3 * FMUL, 2 * FMUL, RGB_ORDER, 4> {};
781
784template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
785class LPD1886Controller1250Khz_8bit : public ClocklessController<DATA_PIN, 2 * FMUL, 3 * FMUL, 2 * FMUL, RGB_ORDER> {};
786
790template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
791class WS2812Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER> {};
792
795template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
796class WS2815Controller : public ClocklessController<DATA_PIN, 2 * FMUL, 9 * FMUL, 4 * FMUL, RGB_ORDER> {};
797
800template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
801class WS2811Controller800Khz : public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
802
805template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
806class DP1903Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 8 * FMUL, 2 * FMUL, RGB_ORDER> {};
807
810template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
811class DP1903Controller400Khz : public ClocklessController<DATA_PIN, 4 * FMUL, 16 * FMUL, 4 * FMUL, RGB_ORDER> {};
812
815template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB> //not tested
816class WS2813Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
817
820template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
821class WS2811Controller400Khz : public ClocklessController<DATA_PIN, 4 * FMUL, 10 * FMUL, 6 * FMUL, RGB_ORDER> {};
822
825template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
826class SK6822Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
827
830template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
831class SM16703Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
832
835template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
836class SK6812Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 3 * FMUL, 4 * FMUL, RGB_ORDER> {};
837
840template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
841class UCS1903Controller400Khz : public ClocklessController<DATA_PIN, 4 * FMUL, 12 * FMUL, 4 * FMUL, RGB_ORDER> {};
842
845template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
846class UCS1903BController800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 4 * FMUL, 4 * FMUL, RGB_ORDER> {};
847
850template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
851class UCS1904Controller800Khz : public ClocklessController<DATA_PIN, 3 * FMUL, 3 * FMUL, 4 * FMUL, RGB_ORDER> {};
852
855template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
856class UCS2903Controller : public ClocklessController<DATA_PIN, 2 * FMUL, 6 * FMUL, 2 * FMUL, RGB_ORDER> {};
857
860template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
861class TM1809Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER> {};
862
865template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
866class TM1803Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 9 * FMUL, 6 * FMUL, RGB_ORDER> {};
867
870template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
871class TM1829Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER, 0, true, 500> {};
872
875template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
876class GW6205Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 7 * FMUL, 6 * FMUL, RGB_ORDER, 4> {};
877
880template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
881class GW6205Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 4 * FMUL, 4 * FMUL, RGB_ORDER, 4> {};
882
885template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
886class PL9823Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
887
888// UCS1912 - Note, never been tested, this is according to the datasheet
889template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
890class UCS1912Controller : public ClocklessController<DATA_PIN, 2 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
891
892
893#else
894
895// Allow overclocking of the clockless family of leds. 1.2 would be
896// 20% overclocking. In tests WS2812 can be overclocked at 20%, but
897// various manufacturers may be different. This is a global value
898// which is overridable by each supported chipset.
899#ifdef FASTLED_LED_OVERCLOCK
900#warning "FASTLED_LED_OVERCLOCK has been changed to FASTLED_OVERCLOCK. Please update your code."
901#define FASTLED_OVERCLOCK FASTLED_LED_OVERCLOCK
902#endif
903
904#ifndef FASTLED_OVERCLOCK
905#define FASTLED_OVERCLOCK 1.0
906#else
907#ifndef FASTLED_OVERCLOCK_SUPPRESS_WARNING
908#warning "FASTLED_OVERCLOCK is now active, #define FASTLED_OVERCLOCK_SUPPRESS_WARNING to disable this warning"
909#endif
910#endif
911
912// WS2812 can be overclocked pretty aggressively, however, there are
913// some excellent articles that you should read about WS2812 overclocking
914// and corruption for a large number of LEDs.
915// https://wp.josh.com/2014/05/16/why-you-should-give-your-neopixel-bits-room-to-breathe/
916// https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/
917#ifndef FASTLED_OVERCLOCK_WS2812
918#define FASTLED_OVERCLOCK_WS2812 FASTLED_OVERCLOCK
919#endif
920
921#ifndef FASTLED_OVERCLOCK_WS2811
922#define FASTLED_OVERCLOCK_WS2811 FASTLED_OVERCLOCK
923#endif
924
925#ifndef FASTLED_OVERCLOCK_WS2813
926#define FASTLED_OVERCLOCK_WS2813 FASTLED_OVERCLOCK
927#endif
928
929#ifndef FASTLED_OVERCLOCK_WS2815
930#define FASTLED_OVERCLOCK_WS2815 FASTLED_OVERCLOCK
931#endif
932
933#ifndef FASTLED_OVERCLOCK_SK6822
934#define FASTLED_OVERCLOCK_SK6822 FASTLED_OVERCLOCK
935#endif
936
937#ifndef FASTLED_OVERCLOCK_SK6812
938#define FASTLED_OVERCLOCK_SK6812 FASTLED_OVERCLOCK
939#endif
940
943#if FASTLED_CLOCKLESS_USES_NANOSECONDS
944// just use raw nanosecond values for the teensy4
945#define C_NS(_NS) _NS
946#else
947#define C_NS(_NS) (((_NS * ((CLOCKLESS_FREQUENCY / 1000000L)) + 999)) / 1000)
948#endif
949
950// Allow overclocking various LED chipsets in the clockless family.
951// Clocked chips like the APA102 don't need this because they allow
952// you to control the clock speed directly.
953#define C_NS_WS2812(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2812)))
954#define C_NS_WS2811(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2811)))
955#define C_NS_WS2813(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2813)))
956#define C_NS_WS2815(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2815)))
957#define C_NS_SK6822(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_SK6822)))
958#define C_NS_SK6812(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_SK6812)))
959
960
961
962// At T=0 : the line is raised hi to start a bit
963// At T=T1 : the line is dropped low to transmit a zero bit
964// At T=T1+T2 : the line is dropped low to transmit a one bit
965// At T=T1+T2+T3 : the cycle is concluded (next bit can be sent)
966//
967// Python script to calculate the values for T1, T2, and T3 for FastLED:
968// Note: there is a discussion on whether this python script is correct or not:
969// https://github.com/FastLED/FastLED/issues/1806
970//
971// print("Enter the values of T0H, T0L, T1H, T1L, in nanoseconds: ")
972// T0H = int(input(" T0H: "))
973// T0L = int(input(" T0L: "))
974// T1H = int(input(" T1H: "))
975// T1L = int(input(" T1L: "))
976//
977// duration = max(T0H + T0L, T1H + T1L)
978//
979// print("The max duration of the signal is: ", duration)
980//
981// T1 = T0H
982// T2 = T1H
983// T3 = duration - T0H - T0L
984//
985// print("T1: ", T1)
986// print("T2: ", T2)
987// print("T3: ", T3)
988
989
990// GE8822 - 350ns 660ns 350ns
991template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
992class GE8822Controller800Khz : public ClocklessController<DATA_PIN, C_NS(350), C_NS(660), C_NS(350), RGB_ORDER, 4> {};
993
994// GW6205@400khz - 800ns, 800ns, 800ns
995template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
996class GW6205Controller400Khz : public ClocklessController<DATA_PIN, C_NS(800), C_NS(800), C_NS(800), RGB_ORDER, 4> {};
997
998// GW6205@400khz - 400ns, 400ns, 400ns
999template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1000class GW6205Controller800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(400), RGB_ORDER, 4> {};
1001
1002// UCS1903 - 500ns, 1500ns, 500ns
1003template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1004class UCS1903Controller400Khz : public ClocklessController<DATA_PIN, C_NS(500), C_NS(1500), C_NS(500), RGB_ORDER> {};
1005
1006// UCS1903B - 400ns, 450ns, 450ns
1007template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1008class UCS1903BController800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(450), C_NS(450), RGB_ORDER> {};
1009
1010// UCS1904 - 400ns, 400ns, 450ns
1011template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1012class UCS1904Controller800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(450), RGB_ORDER> {};
1013
1014// UCS2903 - 250ns, 750ns, 250ns
1015template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1016class UCS2903Controller : public ClocklessController<DATA_PIN, C_NS(250), C_NS(750), C_NS(250), RGB_ORDER> {};
1017
1018// TM1809 - 350ns, 350ns, 550ns
1019template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1020class TM1809Controller800Khz : public ClocklessController<DATA_PIN, C_NS(350), C_NS(350), C_NS(450), RGB_ORDER> {};
1021
1022// WS2811 - 320ns, 320ns, 640ns
1023template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1024class WS2811Controller800Khz : public ClocklessController<DATA_PIN, C_NS_WS2811(320), C_NS_WS2811(320), C_NS_WS2811(640), RGB_ORDER> {};
1025
1026// WS2813 - 320ns, 320ns, 640ns
1027template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1028class WS2813Controller : public ClocklessController<DATA_PIN, C_NS_WS2813(320), C_NS_WS2813(320), C_NS_WS2813(640), RGB_ORDER> {};
1029
1030#ifndef FASTLED_WS2812_T1
1031#define FASTLED_WS2812_T1 250
1032#endif
1033
1034#ifndef FASTLED_WS2812_T2
1035#define FASTLED_WS2812_T2 625
1036#endif
1037
1038#ifndef FASTLED_WS2812_T3
1039#define FASTLED_WS2812_T3 375
1040#endif
1041
1042
1043#if defined(__IMXRT1062__) && !defined(FASTLED_NOT_USES_OBJECTFLED)
1044#if defined(FASTLED_USES_OBJECTFLED)
1045#warning "FASTLED_USES_OBJECTFLED is now implicit for Teensy 4.0/4.1 for WS2812 and is no longer needed."
1046#endif
1047template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1049 public fl::ClocklessController_ObjectFLED_WS2812<
1050 DATA_PIN,
1051 RGB_ORDER> {
1052 public:
1053 typedef fl::ClocklessController_ObjectFLED_WS2812<DATA_PIN, RGB_ORDER> Base;
1054 WS2812Controller800Khz(): Base(FASTLED_OVERCLOCK) {}
1055};
1056#elif defined(FASTLED_USES_ESP32S3_I2S)
1057#include "platforms/esp/32/clockless_i2s_esp32s3.h"
1058template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1060 public fl::ClocklessController_I2S_Esp32_WS2812<
1061 DATA_PIN,
1062 RGB_ORDER
1063 > {};
1064#else
1065// WS2812 - 250ns, 625ns, 375ns
1066template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1067class WS2812Controller800Khz : public ClocklessController<
1068 DATA_PIN,
1069 C_NS_WS2812(FASTLED_WS2812_T1),
1070 C_NS_WS2812(FASTLED_WS2812_T2),
1071 C_NS_WS2812(FASTLED_WS2812_T3),
1072 RGB_ORDER> {};
1073#endif // defined(FASTLED_USES_OBJECTFLED)
1074
1075
1076// WS2811@400khz - 800ns, 800ns, 900ns
1077template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1078class WS2811Controller400Khz : public ClocklessController<DATA_PIN, C_NS_WS2811(800), C_NS_WS2811(800), C_NS_WS2811(900), RGB_ORDER> {};
1079
1080template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1081class WS2815Controller : public ClocklessController<DATA_PIN, C_NS_WS2815(250), C_NS_WS2815(1090), C_NS_WS2815(550), RGB_ORDER> {};
1082
1083// 750NS, 750NS, 750NS
1084template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1085class TM1803Controller400Khz : public ClocklessController<DATA_PIN, C_NS(700), C_NS(1100), C_NS(700), RGB_ORDER> {};
1086
1087template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1088class TM1829Controller800Khz : public ClocklessController<DATA_PIN, C_NS(340), C_NS(340), C_NS(550), RGB_ORDER, 0, true, 500> {};
1089
1090template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1091class TM1829Controller1600Khz : public ClocklessController<DATA_PIN, C_NS(100), C_NS(300), C_NS(200), RGB_ORDER, 0, true, 500> {};
1092
1093template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1094class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, C_NS(200), C_NS(400), C_NS(200), RGB_ORDER, 4> {};
1095
1096template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1097class LPD1886Controller1250Khz_8bit : public ClocklessController<DATA_PIN, C_NS(200), C_NS(400), C_NS(200), RGB_ORDER> {};
1098
1099
1100template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1101class SK6822Controller : public ClocklessController<DATA_PIN, C_NS_SK6822(375), C_NS_SK6822(1000), C_NS_SK6822(375), RGB_ORDER> {};
1102
1103template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1104class SK6812Controller : public ClocklessController<DATA_PIN, C_NS_SK6812(300), C_NS_SK6812(300), C_NS_SK6812(600), RGB_ORDER> {};
1105
1106template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1107class SM16703Controller : public ClocklessController<DATA_PIN, C_NS(300), C_NS(600), C_NS(300), RGB_ORDER> {};
1108
1109template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1110class PL9823Controller : public ClocklessController<DATA_PIN, C_NS(350), C_NS(1010), C_NS(350), RGB_ORDER> {};
1111
1112// UCS1912 - Note, never been tested, this is according to the datasheet
1113template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1114class UCS1912Controller : public ClocklessController<DATA_PIN, C_NS(250), C_NS(1000), C_NS(350), RGB_ORDER> {};
1115#endif
1117
1118
1119// WS2816 - is an emulated controller that emits 48 bit pixels by forwarding
1120// them to a platform specific WS2812 controller. The WS2812 controller
1121// has to output twice as many 24 bit pixels.
1122template <uint8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1124 : public CPixelLEDController<RGB_ORDER,
1125 WS2812Controller800Khz<DATA_PIN, RGB>::LANES_VALUE,
1126 WS2812Controller800Khz<DATA_PIN, RGB>::MASK_VALUE> {
1127
1128public:
1129
1130 // ControllerT is a helper class. It subclasses the device controller class
1131 // and has three methods to call the three protected methods we use.
1132 // This is janky, but redeclaring public methods protected in a derived class
1133 // is janky, too.
1134
1135 // N.B., byte order must be RGB.
1138 friend class WS2816Controller<DATA_PIN, RGB_ORDER>;
1139 void *callBeginShowLeds(int size) { return ControllerBaseT::beginShowLeds(size); }
1140 void callShow(CRGB *data, int nLeds, uint8_t brightness) {
1141 ControllerBaseT::show(data, nLeds, brightness);
1142 }
1143 void callEndShowLeds(void *data) { ControllerBaseT::endShowLeds(data); }
1144 };
1145
1146 static const int LANES = ControllerT::LANES_VALUE;
1147 static const uint32_t MASK = ControllerT::MASK_VALUE;
1148
1151 mController.setLeds(nullptr, 0);
1152 delete [] mData;
1153 }
1154
1155 virtual void *beginShowLeds(int size) override {
1156 mController.setEnabled(true);
1157 void *result = mController.callBeginShowLeds(2 * size);
1158 mController.setEnabled(false);
1159 return result;
1160 }
1161
1162 virtual void endShowLeds(void *data) override {
1163 mController.setEnabled(true);
1164 mController.callEndShowLeds(data);
1165 mController.setEnabled(false);
1166 }
1167
1169 // Ensure buffer is large enough
1170 ensureBuffer(pixels.size());
1171
1172 // expand and copy all the pixels
1173 size_t out_index = 0;
1174 while (pixels.has(1)) {
1175 pixels.stepDithering();
1176
1177 uint16_t s0, s1, s2;
1178 pixels.loadAndScale_WS2816_HD(&s0, &s1, &s2);
1179 uint8_t b0_hi = s0 >> 8;
1180 uint8_t b0_lo = s0 & 0xFF;
1181 uint8_t b1_hi = s1 >> 8;
1182 uint8_t b1_lo = s1 & 0xFF;
1183 uint8_t b2_hi = s2 >> 8;
1184 uint8_t b2_lo = s2 & 0xFF;
1185
1186 mData[out_index] = CRGB(b0_hi, b0_lo, b1_hi);
1187 mData[out_index + 1] = CRGB(b1_lo, b2_hi, b2_lo);
1188
1189 pixels.advanceData();
1190 out_index += 2;
1191 }
1192
1193 // ensure device controller won't modify color values
1194 mController.setCorrection(CRGB(255, 255, 255));
1195 mController.setTemperature(CRGB(255, 255, 255));
1196 mController.setDither(DISABLE_DITHER);
1197
1198 // output the data stream
1199 mController.setEnabled(true);
1200#ifdef BOUNCE_SUBCLASS
1201 mController.callShow(mData, 2 * pixels.size(), 255);
1202#else
1203 mController.show(mData, 2 * pixels.size(), 255);
1204#endif
1205 mController.setEnabled(false);
1206 }
1207
1208private:
1209 void init() override {
1210 mController.init();
1211 mController.setEnabled(false);
1212 }
1213
1214 void ensureBuffer(int size_8bit) {
1215 int size_16bit = 2 * size_8bit;
1216 if (mController.size() != size_16bit) {
1217 delete [] mData;
1218 CRGB *new_leds = new CRGB[size_16bit];
1219 mData = new_leds;
1220 mController.setLeds(new_leds, size_16bit);
1221 }
1222 }
1223
1226};
1227
1228
1229#endif
1231
1233
1234#endif
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
UISlider brightness("Brightness", 255, 0, 255, 1)
#define FASTLED_OVERCLOCK
Definition Overclock.ino:15
Rgbw rgbw
void showPixelsGammaBitShift(PixelController< RGB_ORDER > &pixels)
Definition chipsets.h:504
virtual void init() override
Initialize the LED controller.
Definition chipsets.h:422
FASTLED_FORCE_INLINE void write2Bytes(uint8_t b1, uint8_t b2)
Definition chipsets.h:410
static void getGlobalBrightnessAndScalingFactors(PixelController< RGB_ORDER > &pixels, uint8_t *out_s0, uint8_t *out_s1, uint8_t *out_s2, uint8_t *out_brightness)
Definition chipsets.h:443
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:374
FASTLED_FORCE_INLINE void writeLed(uint8_t brightness, uint8_t b0, uint8_t b1, uint8_t b2)
Definition chipsets.h:395
virtual void showPixels(PixelController< RGB_ORDER > &pixels) override
Send the LED data to the strip.
Definition chipsets.h:428
void showPixelsDefault(PixelController< RGB_ORDER > &pixels)
Definition chipsets.h:486
void startBoundary()
Definition chipsets.h:377
void endBoundary(int nLeds)
Definition chipsets.h:381
APA102ControllerHD()=default
APA102ControllerHD(const APA102ControllerHD &)=delete
static void writeBytesValueRaw(uint8_t value, int len)
Write multiple bytes of the given value over SPI, without selecting the interface.
virtual int size()
How many LEDs does this controller manage?
Rgbw getRgbw() const
CLEDController & setRgbw(const Rgbw &arg=RgbwDefault::value())
virtual void init()=0
Initialize the LED controller.
void mark()
Reset the timestamp that marks the start of the wait period.
void wait()
Blocking delay until WAIT time since mark() has passed.
Class to ensure that a minimum amount of time has kicked since the last time run - and delay if not e...
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels)=0
Send the LED data to the strip.
Template extension of the CLEDController class.
DP1903 controller class @ 400 KHz.
Definition chipsets.h:811
DP1903 controller class @ 800 KHz.
Definition chipsets.h:806
GE8822 controller class.
Definition chipsets.h:775
GW6205 controller class @ 400 KHz.
Definition chipsets.h:876
UCS1904 controller class @ 800 KHz.
Definition chipsets.h:881
HD107 is just the APA102 with a default 40Mhz clock rate.
Definition chipsets.h:610
HD107HD is just the APA102HD with a default 40Mhz clock rate.
Definition chipsets.h:623
LPD1886 controller class.
Definition chipsets.h:785
LPD1886 controller class.
Definition chipsets.h:780
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition chipsets.h:326
void startBoundary()
Definition chipsets.h:314
virtual void init()
Initialize the LED controller.
Definition chipsets.h:320
void endBoundary(int nLeds)
Definition chipsets.h:315
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:311
static FASTLED_FORCE_INLINE uint8_t adjust(FASTLED_REGISTER uint8_t data)
Definition chipsets.h:235
static FASTLED_FORCE_INLINE void postBlock(int len, void *context=NULL)
Definition chipsets.h:236
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition chipsets.h:254
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:230
virtual void init()
Initialize the LED controller.
Definition chipsets.h:247
FASTLED_FORCE_INLINE void writeLed(uint8_t r, uint8_t g, uint8_t b)
Definition chipsets.h:645
void writeBoundary()
Definition chipsets.h:643
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:640
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition chipsets.h:659
virtual void init()
Initialize the LED controller.
Definition chipsets.h:653
PL9823 controller class.
Definition chipsets.h:886
void callShow(CRGB *data, int nLeds, uint8_t brightness)
Definition chipsets.h:125
virtual void * beginShowLeds(int size) override
Definition chipsets.h:143
ControllerT mController
Definition chipsets.h:210
void init() override
Initialize the LED controller.
Definition chipsets.h:183
static const int LANES
Definition chipsets.h:132
virtual void endShowLeds(void *data) override
Definition chipsets.h:147
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels) override
Send the LED data to the strip.
Definition chipsets.h:151
void ensureBuffer(int32_t num_leds)
Definition chipsets.h:188
RGBWEmulatedController(const Rgbw &rgbw=RgbwDefault())
Definition chipsets.h:138
static const uint32_t MASK
Definition chipsets.h:133
CONTROLLER ControllerBaseT
Definition chipsets.h:121
SK6812 controller class.
Definition chipsets.h:836
SK6822 controller class.
Definition chipsets.h:826
SK9822 controller class.
Definition chipsets.h:591
SK9822 controller class.
Definition chipsets.h:569
SM16703 controller class.
Definition chipsets.h:831
virtual void init()
Initialize the LED controller.
Definition chipsets.h:711
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition chipsets.h:717
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:690
Hardware SPI output.
Definition fastspi.h:51
TM1803 controller class.
Definition chipsets.h:866
TM1809 controller class.
Definition chipsets.h:861
TM1829 controller class.
Definition chipsets.h:871
UCS1903B controller class.
Definition chipsets.h:846
UCS1903 controller class @ 400 KHz.
Definition chipsets.h:841
UCS1904 controller class.
Definition chipsets.h:851
UCS2903 controller class.
Definition chipsets.h:856
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
Definition chipsets.h:289
SPIOutput< DATA_PIN, CLOCK_PIN, SPI_SPEED > SPI
Definition chipsets.h:273
virtual void init()
Initialize the controller.
Definition chipsets.h:281
CMinWait< 1000 > mWaitDelay
Definition chipsets.h:275
WS2803 controller class.
Definition chipsets.h:299
WS2811 controller class @ 400 KHz.
Definition chipsets.h:821
WS2811 controller class @ 800 KHz.
Definition chipsets.h:801
WS2812 controller class @ 800 KHz.
Definition chipsets.h:791
WS2813 controller class.
Definition chipsets.h:816
WS2815 controller class @ 400 KHz.
Definition chipsets.h:796
void * callBeginShowLeds(int size)
Definition chipsets.h:1139
void callEndShowLeds(void *data)
Definition chipsets.h:1143
void callShow(CRGB *data, int nLeds, uint8_t brightness)
Definition chipsets.h:1140
static const uint32_t MASK
Definition chipsets.h:1147
void ensureBuffer(int size_8bit)
Definition chipsets.h:1214
ControllerT mController
Definition chipsets.h:1225
static const int LANES
Definition chipsets.h:1146
virtual void * beginShowLeds(int size) override
Definition chipsets.h:1155
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels) override
Send the LED data to the strip.
Definition chipsets.h:1168
void init() override
Initialize the LED controller.
Definition chipsets.h:1209
WS2812Controller800Khz< DATA_PIN, RGB > ControllerBaseT
Definition chipsets.h:1136
virtual void endShowLeds(void *data) override
Definition chipsets.h:1162
Defines the red, green, and blue (RGB) pixel struct.
#define DISABLE_DITHER
Disable dithering.
Definition dither_mode.h:11
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
Definition eorder.h:14
@ RGB
Red, Green, Blue (0012)
Definition eorder.h:15
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
Defines color channel ordering enumerations.
#define DATA_RATE_MHZ(X)
Convert data rate from megahertz (MHz) to clock cycles per bit.
Definition fastspi.h:25
Declares functions for five-bit gamma correction.
#define FASTLED_FORCE_INLINE
Definition force_inline.h:7
#define FASTLED_REGISTER
Helper macro to replace the deprecated 'register' keyword if we're using modern C++ where it's been r...
Definition register.h:9
#define FASTLED_NAMESPACE_END
Definition namespace.h:22
Implements the FastLED namespace macros.
FiveBitGammaCorrectionMode
@ kFiveBitGammaCorrectionMode_Null
@ kFiveBitGammaCorrectionMode_BitShift
Non-templated low level pixel data writing class.
Includes defintions for RGB and HSV pixels.
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54
FASTLED_FORCE_INLINE void loadAndScale_WS2816_HD(uint16_t *s0_out, uint16_t *s1_out, uint16_t *s2_out)
FASTLED_FORCE_INLINE void loadAndScale_APA102_HD(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *brightness_out)
FASTLED_FORCE_INLINE uint8_t loadAndScale1(int lane, uint8_t scale)
non-template alias of loadAndScale<1>()
FASTLED_FORCE_INLINE uint8_t loadAndScale2(int lane, uint8_t scale)
non-template alias of loadAndScale<2>()
FASTLED_FORCE_INLINE void loadAndScaleRGB(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out)
FASTLED_FORCE_INLINE uint8_t loadAndScale0(int lane, uint8_t scale)
non-template alias of loadAndScale<0>()
FASTLED_FORCE_INLINE int size()
Get the length of the LED strip.
FASTLED_FORCE_INLINE void loadAndScaleRGBW(Rgbw rgbw, uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *b3_out)
FASTLED_FORCE_INLINE void advanceData()
Advance the data pointer forward, adjust position counter.
FASTLED_FORCE_INLINE bool has(int n)
Do we have n pixels left to process?
FASTLED_FORCE_INLINE void stepDithering()
Step the dithering forward.
Pixel controller class.
static uint32_t size_as_rgb(uint32_t num_of_rgbw_pixels)
Definition rgbw.h:41
Definition rgbw.h:28