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