1#ifndef __INC_CHIPSETS_H
2#define __INC_CHIPSETS_H
6#include "fl/force_inline.h"
13#ifndef FASTLED_CLOCKLESS_USES_NANOSECONDS
14 #if defined(FASTLED_TEENSY4)
15 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 1
17 #include "third_party/espressif/led_strip/src/enabled.h"
20 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 1
22 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 0
25 #define FASTLED_CLOCKLESS_USES_NANOSECONDS 0
31#include "platforms/arm/k20/clockless_objectfled.h"
47#if defined(SoftwareSerial_h) || defined(__SoftwareSerial_h)
48#include <SoftwareSerial.h>
57template<u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
59 SoftwareSerial Serial;
63 PixieController() : Serial(-1, DATA_PIN) {}
75 while(pixels.
has(1)) {
111 CONTROLLER::MASK_VALUE> {
119 typedef CONTROLLER ControllerBaseT;
122 void *callBeginShowLeds(
int size) {
return ControllerBaseT::beginShowLeds(
size); }
123 void callShow(
CRGB *data,
int nLeds, uint8_t brightness) {
124 ControllerBaseT::show(data, nLeds, brightness);
126 void callEndShowLeds(
void *data) { ControllerBaseT::endShowLeds(data); }
130 static const int LANES = CONTROLLER::LANES_VALUE;
131 static const uint32_t MASK = CONTROLLER::MASK_VALUE;
134 static_assert(
RGB == CONTROLLER::RGB_ORDER_VALUE,
"The delegated controller MUST NOT do reordering");
141 virtual void *beginShowLeds(
int size)
override {
142 return mController.callBeginShowLeds(Rgbw::size_as_rgb(
size));
145 virtual void endShowLeds(
void *data)
override {
146 return mController.callEndShowLeds(data);
151 ensureBuffer(pixels.
size());
152 Rgbw rgbw = this->getRgbw();
153 uint8_t *data =
reinterpret_cast<uint8_t *
>(mRGBWPixels);
154 while (pixels.
has(1)) {
156 pixels.loadAndScaleRGBW(rgbw, data, data + 1, data + 2, data + 3);
170 mController.setCorrection(
CRGB(255, 255, 255));
171 mController.setTemperature(
CRGB(255, 255, 255));
174 mController.setEnabled(
true);
175 mController.callShow(mRGBWPixels, Rgbw::size_as_rgb(pixels.
size()), 255);
176 mController.setEnabled(
false);
181 void init()
override {
183 mController.setEnabled(
false);
186 void ensureBuffer(int32_t num_leds) {
187 if (num_leds != mNumRGBLeds) {
188 mNumRGBLeds = num_leds;
193 uint32_t new_size = Rgbw::size_as_rgb(num_leds);
194 delete[] mRGBWPixels;
195 mRGBWPixels =
new CRGB[new_size];
197 for (uint32_t i = 0; i < new_size; i++) {
198 mRGBWPixels[i] =
CRGB(0, 0, 0);
201 mController.setLeds(mRGBWPixels, new_size);
205 CRGB *mRGBWPixels =
nullptr;
206 int32_t mNumRGBLeds = 0;
207 int32_t mNumRGBWLeds = 0;
226template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(12) >
230 class LPD8806_ADJUST {
233 FASTLED_FORCE_INLINE
static uint8_t adjust(FASTLED_REGISTER uint8_t data) {
return ((data>>1) | 0x80) + ((data && (data<254)) & 0x01); }
234 FASTLED_FORCE_INLINE
static void postBlock(
int len,
void* context = NULL) {
235 SPI* pSPI =
static_cast<SPI*
>(context);
253 mSPI.template writePixels<0, LPD8806_ADJUST, RGB_ORDER>(pixels, &mSPI);
269template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(1)>
289 mSPI.template writePixels<0, DATA_NOP, RGB_ORDER>(pixels, NULL);
296template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(25)>
307template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(12)>
328 while(pixels.
has(1)) {
329 FASTLED_REGISTER uint16_t command;
340 endBoundary(pixels.
size());
359 uint8_t DATA_PIN, uint8_t CLOCK_PIN,
367 FiveBitGammaCorrectionMode GAMMA_CORRECTION_MODE = kFiveBitGammaCorrectionMode_Null,
368 uint32_t START_FRAME = 0x00000000,
369 uint32_t END_FRAME = 0xFF000000
375 void startBoundary() {
379 void endBoundary(
int nLeds) {
380 int nDWords = (nLeds/32);
381 const uint8_t b0 = uint8_t(END_FRAME >> 24 & 0x000000ff);
382 const uint8_t b1 = uint8_t(END_FRAME >> 16 & 0x000000ff);
383 const uint8_t b2 = uint8_t(END_FRAME >> 8 & 0x000000ff);
384 const uint8_t b3 = uint8_t(END_FRAME >> 0 & 0x000000ff);
393 FASTLED_FORCE_INLINE
void writeLed(uint8_t brightness, uint8_t b0, uint8_t b1, uint8_t b2) {
394#ifdef FASTLED_SPI_BYTE_ONLY
400 uint16_t b = 0xE000 | (brightness << 8) | (uint16_t)b0;
402 uint16_t w = b1 << 8;
408 FASTLED_FORCE_INLINE
void write2Bytes(uint8_t b1, uint8_t b2) {
409#ifdef FASTLED_SPI_BYTE_ONLY
427 switch (GAMMA_CORRECTION_MODE) {
428 case kFiveBitGammaCorrectionMode_Null: {
429 showPixelsDefault(pixels);
432 case kFiveBitGammaCorrectionMode_BitShift: {
433 showPixelsGammaBitShift(pixels);
441 static inline void getGlobalBrightnessAndScalingFactors(
443 uint8_t* out_s0, uint8_t* out_s1, uint8_t* out_s2, uint8_t* out_brightness) {
444#if FASTLED_HD_COLOR_MIXING
446 pixels.getHdScale(out_s0, out_s1, out_s2, &brightness);
448 static uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) {
449 const uint16_t run = in_max - in_min;
450 const uint16_t rise = out_max - out_min;
451 const uint16_t delta = x - in_min;
452 return (delta * rise) / run + out_min;
455 *out_brightness = Math::map(brightness, 0, 255, 0, 31);
459 pixels.loadAndScaleRGB(&s0, &s1, &s2);
460#if FASTLED_USE_GLOBAL_BRIGHTNESS == 1
462 const uint16_t maxBrightness = 0x1F;
463 uint16_t brightness = ((((uint16_t)max(max(s0, s1), s2) + 1) * maxBrightness - 1) >> 8) + 1;
464 s0 = (maxBrightness * s0 + (brightness >> 1)) / brightness;
465 s1 = (maxBrightness * s1 + (brightness >> 1)) / brightness;
466 s2 = (maxBrightness * s2 + (brightness >> 1)) / brightness;
468 const uint8_t brightness = 0x1F;
473 *out_brightness =
static_cast<uint8_t
>(brightness);
480 uint8_t s0, s1, s2, global_brightness;
481 getGlobalBrightnessAndScalingFactors(pixels, &s0, &s1, &s2, &global_brightness);
483 while (pixels.
has(1)) {
485 pixels.loadAndScaleRGB(&c0, &c1, &c2);
486 writeLed(global_brightness, c0, c1, c2);
490 endBoundary(pixels.
size());
499 while (pixels.
has(1)) {
501 uint8_t brightness, c0, c1, c2;
502 pixels.loadAndScale_APA102_HD(&c0, &c1, &c2, &brightness);
503 writeLed(brightness, c0, c1, c2);
507 endBoundary(pixels.
size());
534 kFiveBitGammaCorrectionMode_BitShift,
535 uint32_t(0x00000000),
536 uint32_t(0x00000000)> {
558 kFiveBitGammaCorrectionMode_Null,
580 kFiveBitGammaCorrectionMode_BitShift,
599 kFiveBitGammaCorrectionMode_Null,
630template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(10)>
637 FASTLED_FORCE_INLINE
void writeLed(uint8_t r, uint8_t g, uint8_t b) {
638 FASTLED_REGISTER uint8_t top = 0xC0 | ((~b & 0xC0) >> 2) | ((~g & 0xC0) >> 4) | ((~r & 0xC0) >> 6);
655 while(pixels.
has(1)) {
680template <u
int8_t DATA_PIN, u
int8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, u
int32_t SPI_SPEED = DATA_RATE_MHZ(16)>
688 mSPI.template writeBit<0>(0);
692 mSPI.template writeBit<0>(0);
713 mSPI.template writePixels<FLAG_START_BIT, DATA_NOP, RGB_ORDER>(pixels, NULL);
727#ifdef FASTLED_HAS_CLOCKLESS
752#if !defined(CLOCKLESS_FREQUENCY)
753 #define CLOCKLESS_FREQUENCY F_CPU
758#if defined(__LGT8F__) || (CLOCKLESS_FREQUENCY == 8000000 || CLOCKLESS_FREQUENCY == 16000000 || CLOCKLESS_FREQUENCY == 24000000) || defined(FASTLED_DOXYGEN)
762#define FMUL (CLOCKLESS_FREQUENCY/8000000)
766template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
771template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
776template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
782template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
787template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
788class WS2815Controller :
public ClocklessController<DATA_PIN, 2 * FMUL, 9 * FMUL, 4 * FMUL, RGB_ORDER> {};
792template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
797template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
802template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
807template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
808class WS2813Controller :
public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
812template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
817template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
818class SK6822Controller :
public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
822template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
823class SM16703Controller :
public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
827template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
828class SK6812Controller :
public ClocklessController<DATA_PIN, 3 * FMUL, 3 * FMUL, 4 * FMUL, RGB_ORDER> {};
832template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
837template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
842template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
847template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
848class UCS2903Controller :
public ClocklessController<DATA_PIN, 2 * FMUL, 6 * FMUL, 2 * FMUL, RGB_ORDER> {};
852template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
857template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
862template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
863class TM1829Controller800Khz :
public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER, 0, true, 500> {};
867template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
872template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
877template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
878class PL9823Controller :
public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
881template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
882class UCS1912Controller :
public ClocklessController<DATA_PIN, 2 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
891#ifdef FASTLED_LED_OVERCLOCK
892#warning "FASTLED_LED_OVERCLOCK has been changed to FASTLED_OVERCLOCK. Please update your code."
893#define FASTLED_OVERCLOCK FASTLED_LED_OVERCLOCK
896#ifndef FASTLED_OVERCLOCK
897#define FASTLED_OVERCLOCK 1.0
899#ifndef FASTLED_OVERCLOCK_SUPPRESS_WARNING
900#warning "FASTLED_OVERCLOCK is now active, #define FASTLED_OVERCLOCK_SUPPRESS_WARNING to disable this warning"
909#ifndef FASTLED_OVERCLOCK_WS2812
910#define FASTLED_OVERCLOCK_WS2812 FASTLED_OVERCLOCK
913#ifndef FASTLED_OVERCLOCK_WS2811
914#define FASTLED_OVERCLOCK_WS2811 FASTLED_OVERCLOCK
917#ifndef FASTLED_OVERCLOCK_WS2813
918#define FASTLED_OVERCLOCK_WS2813 FASTLED_OVERCLOCK
921#ifndef FASTLED_OVERCLOCK_WS2815
922#define FASTLED_OVERCLOCK_WS2815 FASTLED_OVERCLOCK
925#ifndef FASTLED_OVERCLOCK_SK6822
926#define FASTLED_OVERCLOCK_SK6822 FASTLED_OVERCLOCK
929#ifndef FASTLED_OVERCLOCK_SK6812
930#define FASTLED_OVERCLOCK_SK6812 FASTLED_OVERCLOCK
935#if FASTLED_CLOCKLESS_USES_NANOSECONDS
939#define C_NS(_NS) (((_NS * ((CLOCKLESS_FREQUENCY / 1000000L)) + 999)) / 1000)
945#define C_NS_WS2812(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2812)))
946#define C_NS_WS2811(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2811)))
947#define C_NS_WS2813(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2813)))
948#define C_NS_WS2815(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_WS2815)))
949#define C_NS_SK6822(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_SK6822)))
950#define C_NS_SK6812(_NS) (C_NS(int(_NS / FASTLED_OVERCLOCK_SK6812)))
983template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
984class GE8822Controller800Khz :
public ClocklessController<DATA_PIN, C_NS(350), C_NS(660), C_NS(350), RGB_ORDER, 4> {};
987template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
988class GW6205Controller400Khz :
public ClocklessController<DATA_PIN, C_NS(800), C_NS(800), C_NS(800), RGB_ORDER, 4> {};
991template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
992class GW6205Controller800Khz :
public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(400), RGB_ORDER, 4> {};
995template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
996class UCS1903Controller400Khz :
public ClocklessController<DATA_PIN, C_NS(500), C_NS(1500), C_NS(500), RGB_ORDER> {};
999template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1000class UCS1903BController800Khz :
public ClocklessController<DATA_PIN, C_NS(400), C_NS(450), C_NS(450), RGB_ORDER> {};
1003template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1004class UCS1904Controller800Khz :
public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(450), RGB_ORDER> {};
1007template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1008class UCS2903Controller :
public ClocklessController<DATA_PIN, C_NS(250), C_NS(750), C_NS(250), RGB_ORDER> {};
1011template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1012class TM1809Controller800Khz :
public ClocklessController<DATA_PIN, C_NS(350), C_NS(350), C_NS(450), RGB_ORDER> {};
1015template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1016class WS2811Controller800Khz :
public ClocklessController<DATA_PIN, C_NS_WS2811(320), C_NS_WS2811(320), C_NS_WS2811(640), RGB_ORDER> {};
1019template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1020class WS2813Controller :
public ClocklessController<DATA_PIN, C_NS_WS2813(320), C_NS_WS2813(320), C_NS_WS2813(640), RGB_ORDER> {};
1022#ifndef FASTLED_WS2812_T1
1023#define FASTLED_WS2812_T1 250
1026#ifndef FASTLED_WS2812_T2
1027#define FASTLED_WS2812_T2 625
1030#ifndef FASTLED_WS2812_T3
1031#define FASTLED_WS2812_T3 375
1035#if defined(__IMXRT1062__) && !defined(FASTLED_NOT_USES_OBJECTFLED)
1036#if defined(FASTLED_USES_OBJECTFLED)
1037#warning "FASTLED_USES_OBJECTFLED is now implicit for Teensy 4.0/4.1 for WS2812 and is no longer needed."
1039template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1041 public fl::ClocklessController_ObjectFLED_WS2812<
1045 typedef fl::ClocklessController_ObjectFLED_WS2812<DATA_PIN, RGB_ORDER> Base;
1048#elif defined(FASTLED_USES_ESP32S3_I2S)
1049#include "platforms/esp/32/clockless_i2s_esp32s3.h"
1050template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1052 public fl::ClocklessController_I2S_Esp32_WS2812<
1058template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1061 C_NS_WS2812(FASTLED_WS2812_T1),
1062 C_NS_WS2812(FASTLED_WS2812_T2),
1063 C_NS_WS2812(FASTLED_WS2812_T3),
1069template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1070class WS2811Controller400Khz :
public ClocklessController<DATA_PIN, C_NS_WS2811(800), C_NS_WS2811(800), C_NS_WS2811(900), RGB_ORDER> {};
1072template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1073class WS2815Controller :
public ClocklessController<DATA_PIN, C_NS_WS2815(250), C_NS_WS2815(1090), C_NS_WS2815(550), RGB_ORDER> {};
1076template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1077class TM1803Controller400Khz :
public ClocklessController<DATA_PIN, C_NS(700), C_NS(1100), C_NS(700), RGB_ORDER> {};
1079template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1080class TM1829Controller800Khz :
public ClocklessController<DATA_PIN, C_NS(340), C_NS(340), C_NS(550), RGB_ORDER, 0, true, 500> {};
1082template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1083class TM1829Controller1600Khz :
public ClocklessController<DATA_PIN, C_NS(100), C_NS(300), C_NS(200), RGB_ORDER, 0, true, 500> {};
1085template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1086class LPD1886Controller1250Khz :
public ClocklessController<DATA_PIN, C_NS(200), C_NS(400), C_NS(200), RGB_ORDER, 4> {};
1088template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1092template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1093class SK6822Controller :
public ClocklessController<DATA_PIN, C_NS_SK6822(375), C_NS_SK6822(1000), C_NS_SK6822(375), RGB_ORDER> {};
1095template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1096class SK6812Controller :
public ClocklessController<DATA_PIN, C_NS_SK6812(300), C_NS_SK6812(300), C_NS_SK6812(600), RGB_ORDER> {};
1098template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1099class SM16703Controller :
public ClocklessController<DATA_PIN, C_NS(300), C_NS(600), C_NS(300), RGB_ORDER> {};
1101template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1102class PL9823Controller :
public ClocklessController<DATA_PIN, C_NS(350), C_NS(1010), C_NS(350), RGB_ORDER> {};
1105template <u
int8_t DATA_PIN, EOrder RGB_ORDER = RGB>
1106class UCS1912Controller :
public ClocklessController<DATA_PIN, C_NS(250), C_NS(1000), C_NS(350), RGB_ORDER> {};
1114template <u
int8_t DATA_PIN, EOrder RGB_ORDER = GRB>
1117 WS2812Controller800Khz<DATA_PIN, RGB>::LANES_VALUE,
1118 WS2812Controller800Khz<DATA_PIN, RGB>::MASK_VALUE> {
1131 void *callBeginShowLeds(
int size) {
return ControllerBaseT::beginShowLeds(
size); }
1132 void callShow(
CRGB *data,
int nLeds, uint8_t brightness) {
1133 ControllerBaseT::show(data, nLeds, brightness);
1135 void callEndShowLeds(
void *data) { ControllerBaseT::endShowLeds(data); }
1138 static const int LANES = ControllerT::LANES_VALUE;
1139 static const uint32_t MASK = ControllerT::MASK_VALUE;
1143 mController.setLeds(
nullptr, 0);
1147 virtual void *beginShowLeds(
int size)
override {
1148 mController.setEnabled(
true);
1149 void *result = mController.callBeginShowLeds(2 *
size);
1150 mController.setEnabled(
false);
1154 virtual void endShowLeds(
void *data)
override {
1155 mController.setEnabled(
true);
1156 mController.callEndShowLeds(data);
1157 mController.setEnabled(
false);
1162 ensureBuffer(pixels.
size());
1165 size_t out_index = 0;
1166 while (pixels.
has(1)) {
1169 uint16_t s0, s1, s2;
1170 pixels.loadAndScale_WS2816_HD(&s0, &s1, &s2);
1171 uint8_t b0_hi = s0 >> 8;
1172 uint8_t b0_lo = s0 & 0xFF;
1173 uint8_t b1_hi = s1 >> 8;
1174 uint8_t b1_lo = s1 & 0xFF;
1175 uint8_t b2_hi = s2 >> 8;
1176 uint8_t b2_lo = s2 & 0xFF;
1178 mData[out_index] =
CRGB(b0_hi, b0_lo, b1_hi);
1179 mData[out_index + 1] =
CRGB(b1_lo, b2_hi, b2_lo);
1186 mController.setCorrection(
CRGB(255, 255, 255));
1187 mController.setTemperature(
CRGB(255, 255, 255));
1191 mController.setEnabled(
true);
1192#ifdef BOUNCE_SUBCLASS
1193 mController.callShow(mData, 2 * pixels.
size(), 255);
1195 mController.show(mData, 2 * pixels.
size(), 255);
1197 mController.setEnabled(
false);
1201 void init()
override {
1203 mController.setEnabled(
false);
1206 void ensureBuffer(
int size_8bit) {
1207 int size_16bit = 2 * size_8bit;
1208 if (mController.size() != size_16bit) {
1210 CRGB *new_leds =
new CRGB[size_16bit];
1212 mController.setLeds(new_leds, size_16bit);
APA102 high definition controller class.
virtual void init() override
Initialize the LED controller.
virtual void showPixels(PixelController< RGB_ORDER > &pixels) override
Send the LED data to the strip.
void select()
Select the SPI output (chip select)
static void writeWord(uint16_t w)
Write a word (two bytes) over SPI.
static void writeByte(uint8_t b)
Write a single byte over SPI.
void release()
Release the SPI chip select line.
static void writeBytesValueRaw(uint8_t value, int len)
Write multiple bytes of the given value over SPI, without selecting the interface.
static void waitFully()
Wait until the SPI subsystem is ready for more data to write.
void init()
Set the clock/data pins to output and make sure the chip select is released.
virtual int size()
How many LEDs does this controller manage?
virtual void init()=0
Initialize the LED controller.
Class to ensure that a minimum amount of time has kicked since the last time run - and delay if not e...
void mark()
Reset the timestamp that marks the start of the wait period.
void wait()
Blocking delay until WAIT time since mark() has passed.
Template extension of the CLEDController class.
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels)=0
Send the LED data to the strip.
DP1903 controller class @ 400 KHz.
DP1903 controller class @ 800 KHz.
GW6205 controller class @ 400 KHz.
UCS1904 controller class @ 800 KHz.
HD107 is just the APA102 with a default 40Mhz clock rate.
HD107HD is just the APA102HD with a default 40Mhz clock rate.
LPD1886 controller class.
LPD1886 controller class.
LPD6803 controller class (LPD1101).
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
virtual void init()
Initialize the LED controller.
LPD8806 controller class.
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
virtual void init()
Initialize the LED controller.
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
virtual void init()
Initialize the LED controller.
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels) override
Send the LED data to the strip.
SM16703 controller class.
SM16716 controller class.
virtual void init()
Initialize the LED controller.
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
UCS1903B controller class.
UCS1903 controller class @ 400 KHz.
UCS1904 controller class.
UCS2903 controller class.
virtual void showPixels(PixelController< RGB_ORDER > &pixels)
Send the LED data to the strip.
virtual void init()
Initialize the controller.
WS2811 controller class @ 400 KHz.
WS2811 controller class @ 800 KHz.
WS2812 controller class @ 800 KHz.
WS2815 controller class @ 400 KHz.
virtual void showPixels(PixelController< RGB_ORDER, LANES, MASK > &pixels) override
Send the LED data to the strip.
Defines the red, green, and blue (RGB) pixel struct.
#define DISABLE_DITHER
Disable dithering.
Defines color channel ordering enumerations.
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
@ RGB
Red, Green, Blue (0012)
@ GRB
Green, Red, Blue (0102)
#define DATA_RATE_MHZ(X)
Convert data rate from megahertz (MHz) to clock cycles per bit.
Declares functions for five-bit gamma correction.
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
Non-templated low level pixel data writing class.
Includes defintions for RGB and HSV pixels.
Representation of an RGB pixel (Red, Green, Blue)
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 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 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.