4#ifndef __INC_FASTSPI_LED2_H
5#define __INC_FASTSPI_LED2_H
11#include "platforms/is_platform.h"
28#if defined(FL_IS_GCC) || defined(FL_IS_CLANG)
29#define FASTLED_HAS_PRAGMA_MESSAGE
37#define FASTLED_VERSION 3010004
38#ifndef FASTLED_INTERNAL
39# ifdef FASTLED_SHOW_VERSION
40# ifdef FASTLED_HAS_PRAGMA_MESSAGE
41# pragma message "FastLED version 3.010.003"
43# warning FastLED version 3.010.003 (Not really a warning, just telling you here.)
48#if defined(FASTLED_ESP32_I2S) && !defined(FASTLED_INTERNAL)
49#include "platforms/esp/esp_version.h"
50#if defined(ESP_IDF_VERSION_MAJOR) && ESP_IDF_VERSION_MAJOR >= 5
51#warning "ESP32 I2S Driver: ESP-IDF 5.x detected. This driver may not work reliably with ESP-IDF 5.x+. Consider using RMT driver instead or staying on ESP-IDF 4.x. See ESP32_I2S_ISSUES.md for details. Report issues at: https://github.com/FastLED/FastLED/issues"
62#if defined(FL_IS_ESP32)
63#include "platforms/esp/esp_version.h"
64#include "platforms/esp/32/feature_flags/enabled.h"
65#if FASTLED_RMT5 == 0 && FASTLED_ESP32_HAS_RMT && !defined(ESP32_ARDUINO_NO_RGB_BUILTIN)
66#error "ESP-IDF 5.x+ with legacy RMT4 driver detected: Please define ESP32_ARDUINO_NO_RGB_BUILTIN=1 to prevent conflicts with Arduino's neopixelWrite() function. Add '-DESP32_ARDUINO_NO_RGB_BUILTIN=1' to your build flags or use '-DFASTLED_RMT5=1' to enable RMT5 driver."
71#if !defined(FASTLED_FAKE_SPI_FORWARDS_TO_FAKE_CLOCKLESS)
72#if defined(FL_IS_WASM)
73#define FASTLED_FAKE_SPI_FORWARDS_TO_FAKE_CLOCKLESS 1
75#define FASTLED_FAKE_SPI_FORWARDS_TO_FAKE_CLOCKLESS 0
81#if !defined(FASTLED_HAS_CHANNELS)
82#if defined(FL_IS_ESP32) || defined(FL_IS_TEENSY_4X) || \
83 defined(FL_IS_RP) || defined(FL_IS_STM32) || \
84 defined(FL_IS_SAMD) || defined(FL_IS_NRF52)
85#define FASTLED_HAS_CHANNELS 1
87#define FASTLED_HAS_CHANNELS 0
95#if !defined(FASTLED_SPI_USES_CHANNEL_API)
96#if FASTLED_HAS_CHANNELS && (defined(FL_IS_ESP32) || defined(FL_IS_TEENSY_4X))
97#define FASTLED_SPI_USES_CHANNEL_API 1
99#define FASTLED_SPI_USES_CHANNEL_API 0
103#ifndef __PROG_TYPES_COMPAT__
107#define __PROG_TYPES_COMPAT__
111#include "platforms/wasm/js.h"
112#include "platforms/wasm/led_sysdefs_wasm.h"
113#include "platforms/wasm/compiler/Arduino.h"
114#include "platforms/wasm/js_fetch.h"
119#include <SmartMatrix.h>
125#include <DmxSimple.h>
131#include <DMXSerial.h>
137#include <OctoWS2811.h>
211#include "platforms/ldf_headers.h"
221#if !defined(FL_IS_TEENSY)
288template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
class PIXIE :
public PixieController<DATA_PIN, RGB_ORDER> {};
291#ifdef FL_CLOCKLESS_CONTROLLER_DEFINED
299template<fl::u8 DATA_PIN>
class NEOPIXEL :
public WS2812Controller800Khz<DATA_PIN, GRB> {};
303template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
304class SM16703 :
public SM16703Controller<DATA_PIN, RGB_ORDER> {};
308template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
309class SM16824E :
public SM16824EController<DATA_PIN, RGB_ORDER> {};
313template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
314class TM1829 :
public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
321template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
322class TX1813N1 :
public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
326template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
327class TM1812 :
public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
331template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
332class TM1809 :
public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
336template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
337class TM1804 :
public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
341template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
342class TM1803 :
public TM1803Controller400Khz<DATA_PIN, RGB_ORDER> {};
346template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
347class UCS1903 :
public UCS1903Controller400Khz<DATA_PIN, RGB_ORDER> {};
351template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
352class UCS1903B :
public UCS1903BController800Khz<DATA_PIN, RGB_ORDER> {};
356template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
357class UCS1904 :
public UCS1904Controller800Khz<DATA_PIN, RGB_ORDER> {};
361template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
362class UCS2903 :
public UCS2903Controller<DATA_PIN, RGB_ORDER> {};
366template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
367class UCS7604 :
public UCS7604Controller8bit<DATA_PIN, RGB_ORDER> {};
371template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
372class UCS7604HD :
public UCS7604Controller16bit<DATA_PIN, RGB_ORDER> {};
377template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
378class UCS7604HD_1600 :
public UCS7604Controller16bit1600<DATA_PIN, RGB_ORDER> {};
382template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
383class WS2812 :
public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
386template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
387class WS2815 :
public WS2815Controller<DATA_PIN, RGB_ORDER> {};
390template <fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
391class WS2816 :
public WS2816Controller<DATA_PIN, RGB_ORDER> {};
395template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
396class WS2852 :
public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
400template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
401class WS2812B :
public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
405template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
406class WS2812BMiniV3 :
public WS2812BMiniV3Controller<DATA_PIN, RGB_ORDER> {};
410template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
411class WS2812BV5 :
public WS2812BV5Controller<DATA_PIN, RGB_ORDER> {};
415template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
416class GS1903 :
public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
420template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
421class SK6812 :
public SK6812Controller<DATA_PIN, RGB_ORDER> {};
432template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
433class SK6812WWA :
public SK6812Controller<DATA_PIN, RGB_ORDER> {};
437template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
438class SK6822 :
public SK6822Controller<DATA_PIN, RGB_ORDER> {};
442template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
443class APA106 :
public SK6822Controller<DATA_PIN, RGB_ORDER> {};
447template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
448class PL9823 :
public PL9823Controller<DATA_PIN, RGB_ORDER> {};
452template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
453class WS2811 :
public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
457template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
458class WS2813 :
public WS2813Controller<DATA_PIN, RGB_ORDER> {};
462template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
463class APA104 :
public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
467template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
468class WS2811_400 :
public WS2811Controller400Khz<DATA_PIN, RGB_ORDER> {};
472template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
473class GE8822 :
public GE8822Controller800Khz<DATA_PIN, RGB_ORDER> {};
477template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
478class GW6205 :
public GW6205Controller800Khz<DATA_PIN, RGB_ORDER> {};
482template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
483class GW6205_400 :
public GW6205Controller400Khz<DATA_PIN, RGB_ORDER> {};
487template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
488class LPD1886 :
public LPD1886Controller1250Khz<DATA_PIN, RGB_ORDER> {};
492template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
493class LPD1886_8BIT :
public LPD1886Controller1250Khz_8bit<DATA_PIN, RGB_ORDER> {};
496template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
497class UCS1912 :
public UCS1912Controller<DATA_PIN, RGB_ORDER> {};
499#if defined(DmxSimple_h) || defined(FASTLED_DOXYGEN)
501template<fl::u8 DATA_PIN, fl::EOrder RGB_ORDER>
class DMXSIMPLE :
public DMXSimpleController<DATA_PIN, RGB_ORDER> {};
503#if defined(DmxSerial_h) || defined(FASTLED_DOXYGEN)
514#ifdef PORTA_FIRST_PIN
521#ifdef PORTB_FIRST_PIN
528#ifdef PORTC_FIRST_PIN
535#ifdef PORTD_FIRST_PIN
590 return static_cast<ClearFlags>(
static_cast<fl::u32
>(a) |
static_cast<fl::u32
>(b));
595 return static_cast<ClearFlags>(
static_cast<fl::u32
>(a) &
static_cast<fl::u32
>(b));
709 static void add(fl::ChannelPtr channel);
895 static void remove(fl::ChannelPtr channel);
931 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN>
939 #define _FL_MAP_CLOCKED_CHIPSET(CHIPSET_ENUM, CONTROLLER_CLASS) \
940 template<fl::u8 DATA_PIN, fl::u8 CLOCK_PIN> \
941 struct ClockedChipsetHelper<CHIPSET_ENUM, DATA_PIN, CLOCK_PIN> { \
942 static const bool IS_VALID = true; \
943 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN> ControllerType; \
945 template<fl::EOrder RGB_ORDER> \
946 struct CONTROLLER_CLASS_WITH_ORDER { \
947 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN, RGB_ORDER> ControllerType; \
950 template<fl::EOrder RGB_ORDER, fl::u32 FREQ> \
951 struct CONTROLLER_CLASS_WITH_ORDER_AND_FREQ { \
952 typedef CONTROLLER_CLASS<DATA_PIN, CLOCK_PIN, RGB_ORDER, FREQ> ControllerType; \
982 #if FASTLED_FAKE_SPI_FORWARDS_TO_FAKE_CLOCKLESS
986 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE, fl::Bus B = fl::Bus::AUTO>
::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
993 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::Bus B = fl::Bus::AUTO> static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1000 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1006 #elif FASTLED_SPI_USES_CHANNEL_API
1009 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE, fl::Bus B = fl::Bus::AUTO>
1012 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
1013 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
1017 fl::ChannelConfig config(spiCfg, fl::span<CRGB>(data + nOffset, nLeds),
RGB_ORDER);
1018 config.options.mBus =
B;
1019 static fl::ChannelPtr sChannel;
1021 sChannel =
add(config);
1027 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::Bus B = fl::Bus::AUTO>
1028 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1030 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
1031 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
1039 fl::ChannelConfig config(spiCfg, fl::span<CRGB>(data + nOffset, nLeds), order);
1040 config.options.mBus =
B;
1041 static fl::ChannelPtr sChannel;
1043 sChannel =
add(config);
1049 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1052 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
1053 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
1057 fl::ChannelConfig config(spiCfg, fl::span<CRGB>(data + nOffset, nLeds),
RGB_ORDER);
1058 config.options.mBus =
B;
1059 static fl::ChannelPtr sChannel;
1061 sChannel =
add(config);
1069 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE, fl::Bus B = fl::Bus::AUTO>
::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1074 typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER_AND_FREQ<RGB_ORDER, SPI_DATA_RATE>::ControllerType ControllerTypeWithFreq;
1075 static ControllerTypeWithFreq c;
1076 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
1080 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::Bus B = fl::Bus::AUTO> static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1084 typedef typename CHIP::ControllerType ControllerType;
1085 static ControllerType c;
1086 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
1090 template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1095 typedef typename CHIP::template CONTROLLER_CLASS_WITH_ORDER<RGB_ORDER>::ControllerType ControllerTypeWithOrder;
1096 static ControllerTypeWithOrder c;
1097 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
1103 template<ESPIChipsets CHIPSET, fl::Bus B = fl::Bus::AUTO> static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1107 template<ESPIChipsets CHIPSET, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO> static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1111 template<ESPIChipsets CHIPSET, fl::EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE, fl::Bus B = fl::Bus::AUTO> static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1118#ifdef FL_CLOCKLESS_CONTROLLER_DEFINED
1122 template<
typename ControllerType>
1123 static inline ::CLEDController& addLedsImpl(ControllerType*
controller,
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset) {
1125 return addLeds(pLed, data, nLedsOrOffset, nLedsIfOffset);
1150 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1153 return addLedsImpl(&c, data, nLedsOrOffset, nLedsIfOffset);
1158 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1161 return addLedsImpl(&c, data, nLedsOrOffset, nLedsIfOffset);
1166 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1169 return addLedsImpl(&c, data, nLedsOrOffset, nLedsIfOffset);
1173 static ::CLEDController &
addLeds(fl::Leds&
leds,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1178#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1)
1180 static ::CLEDController &
addLeds(
CRGB *data,
int nLeds) {
1182 static fl::__FIBCC<CHIPSET, DATA_PIN, NUM_LANES, RGB_ORDER> c;
1183 return addLeds(&c, data, nLeds);
1187 #ifdef FASTSPI_USE_DMX_SIMPLE
1188 template<EClocklessChipsets CHIPSET, fl::u8 DATA_PIN, fl::EOrder RGB_ORDER=RGB, fl::Bus B = fl::Bus::AUTO>
1189 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0)
1223 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1226 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
1231 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1234 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
1237#ifdef USE_OCTOWS2811
1241 template<OWS2811 CHIPSET, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1242 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0)
1257 template<OWS2811 CHIPSET, fl::Bus B = fl::Bus::AUTO>
1258 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0)
1265#ifdef USE_WS2812SERIAL
1269 template<SWS2812 CHIPSET,
int DATA_PIN, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1270 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0)
1273 static CWS2812SerialController<DATA_PIN,RGB_ORDER>
controller;
1281 template<ESM CHIPSET, fl::Bus B = fl::Bus::AUTO>
1282 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0)
1293#ifdef FASTLED_HAS_BLOCKLESS
1317 template<EBlockChipsets CHIPSET,
int NUM_LANES, fl::EOrder RGB_ORDER, fl::Bus B = fl::Bus::AUTO>
1318 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1321 #ifdef PORTA_FIRST_PIN
1322 case WS2811_PORTA:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, fl::TIMING_WS2811_800KHZ_LEGACY, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1323 case WS2811_400_PORTA:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, fl::TIMING_WS2811_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1324 case WS2813_PORTA:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, fl::TIMING_WS2813, RGB_ORDER, 0, false>(), data, nLedsOrOffset, nLedsIfOffset);
1325 case TM1803_PORTA:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, fl::TIMING_TM1803_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1326 case UCS1903_PORTA:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, fl::TIMING_UCS1903_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1328 #ifdef PORTB_FIRST_PIN
1329 case WS2811_PORTB:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, fl::TIMING_WS2811_800KHZ_LEGACY, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1330 case WS2811_400_PORTB:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, fl::TIMING_WS2811_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1331 case WS2813_PORTB:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, fl::TIMING_WS2813, RGB_ORDER, 0, false>(), data, nLedsOrOffset, nLedsIfOffset);
1332 case TM1803_PORTB:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, fl::TIMING_TM1803_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1333 case UCS1903_PORTB:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, fl::TIMING_UCS1903_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1335 #ifdef PORTC_FIRST_PIN
1336 case WS2811_PORTC:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, fl::TIMING_WS2811_800KHZ_LEGACY, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1337 case WS2811_400_PORTC:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, fl::TIMING_WS2811_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1338 case WS2813_PORTC:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, fl::TIMING_WS2813, RGB_ORDER, 0, false>(), data, nLedsOrOffset, nLedsIfOffset);
1339 case TM1803_PORTC:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, fl::TIMING_TM1803_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1340 case UCS1903_PORTC:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, fl::TIMING_UCS1903_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1342 #ifdef PORTD_FIRST_PIN
1343 case WS2811_PORTD:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, fl::TIMING_WS2811_800KHZ_LEGACY, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1344 case WS2811_400_PORTD:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, fl::TIMING_WS2811_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1345 case WS2813_PORTD:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, fl::TIMING_WS2813, RGB_ORDER, 0, false>(), data, nLedsOrOffset, nLedsIfOffset);
1346 case TM1803_PORTD:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, fl::TIMING_TM1803_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1347 case UCS1903_PORTD:
return addLeds(
new fl::InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, fl::TIMING_UCS1903_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1350 case WS2811_PORTDC:
return addLeds(
new fl::SixteenWayInlineBlockClocklessController<NUM_LANES, fl::TIMING_WS2811_800KHZ_LEGACY, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1351 case WS2811_400_PORTDC:
return addLeds(
new fl::SixteenWayInlineBlockClocklessController<NUM_LANES, fl::TIMING_WS2811_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1352 case WS2813_PORTDC:
return addLeds(
new fl::SixteenWayInlineBlockClocklessController<NUM_LANES, fl::TIMING_WS2813, RGB_ORDER, 0, false>(), data, nLedsOrOffset, nLedsIfOffset);
1353 case TM1803_PORTDC:
return addLeds(
new fl::SixteenWayInlineBlockClocklessController<NUM_LANES, fl::TIMING_TM1803_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1354 case UCS1903_PORTDC:
return addLeds(
new fl::SixteenWayInlineBlockClocklessController<NUM_LANES, fl::TIMING_UCS1903_400KHZ, RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
1360 template<EBlockChipsets CHIPSET,
int NUM_LANES, fl::Bus B = fl::Bus::AUTO>
1361 static ::CLEDController &
addLeds(
CRGB *data,
int nLedsOrOffset,
int nLedsIfOffset = 0) {
1385 void setDriverEnabled(
const char* name,
bool enabled);
1450 bool wait(fl::u32 timeout_ms);
1657 void clear(
bool writeData =
false);
1698 void delay(
unsigned long ms);
1752#define FastSPI_LED FastLED
1754#define FastSPI_LED2 FastLED
1766#ifndef HAS_HARDWARE_PIN_SUPPORT
1767#warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info."
1768#define NO_HARDWARE_PIN_SUPPORT
1777#if !defined(FASTLED_INTERNAL) && !defined(FASTLED_LEAN_AND_MEAN)
1829#if defined(FASTLED_STUB_IMPL)
1841#define FASTLED_TITLE(text) fl::UITitle g_title(text)
1842#define FASTLED_DESCRIPTION(text) fl::UIDescription g_description(text)
1843#define FASTLED_HELP(text) fl::UIHelp g_help(text)
1874#ifndef FASTLED_LOOP_RUNS_ASYNC
1875#define FASTLED_LOOP_RUNS_ASYNC 0
1878#if FASTLED_LOOP_RUNS_ASYNC == 1
1883 void loop() { sketch_loop(); fl::task::run(); } \
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
#define _FL_MAP_CLOCKED_CHIPSET(CHIPSET_ENUM, CONTROLLER_CLASS)
ClearFlags
Flags for FastLED.clear() to control what state gets cleared/reset.
@ CHANNELS
Remove all channels from controller list.
@ CHANNEL_ENGINES
Clear all channel drivers from ChannelManager.
@ POWER_SETTINGS
Reset power management (setMaxPowerInMilliWatts)
@ FPS_COUNTER
Reset FPS tracking counter to 0.
@ NONE
Clear nothing (no-op)
@ REFRESH_RATE
Reset refresh rate limiting to unlimited.
ClearFlags & operator|=(ClearFlags &a, ClearFlags b)
Enable bitwise OR assignment for ClearFlags.
SWS2812
WS2812Serial Library controller type.
ClearFlags operator|(ClearFlags a, ClearFlags b)
Enable bitwise OR for ClearFlags.
OWS2811
Octo WS2811 LED Library controller types.
ClearFlags operator&(ClearFlags a, ClearFlags b)
Enable bitwise AND for ClearFlags.
ESPIChipsets
Backwards compatibility enum - allows old code to use unscoped names (e.g., APA102 instead of fl::Spi...
@ APA102HD
APA102 LED chipset with 5-bit gamma correction.
@ P9813
P9813 LED chipset.
@ SK9822HD
SK9822 LED chipset with 5-bit gamma correction.
@ SK9822
SK9822 LED chipset.
@ WS2803
WS2803 LED chipset.
@ HD107
Same as APA102, but in turbo 40-mhz mode.
@ WS2801
WS2801 LED chipset.
@ DOTSTAR
APA102 LED chipset alias.
@ APA102
APA102 LED chipset.
@ LPD8806
LPD8806 LED chipset.
@ HD107HD
Same as APA102HD, but in turbo 40-mhz mode.
@ LPD6803
LPD6803 LED chipset.
@ DOTSTARHD
APA102HD LED chipset alias.
@ SM16716
SM16716 LED chipset.
@ HD108
16-bit variant of HD107, always gamma corrected. No SD (standard definition) option available - all H...
ESM
Smart Matrix Library controller type.
EBlockChipsets
Blockless output port enum.
fl::u8(* power_func)(fl::u8 scale, fl::u32 data)
Typedef for a power consumption calculation function.
CLEDController * controller
fl::UISlider scale("Scale", 4,.1, 4,.1)
Functions for doing a rotation of bits/bytes used by parallel output.
Compile-time identifier for an LED channel transmission bus.
Per-driver traits keyed on fl::Bus.
ESP32-P4 Parallel IO (PARLIO) LED channel.
Phase 3b templated channel facade – Channel<Bus, Chipset> with compile-time bus/chipset enforcement.
Multi-lane SPI interface for LED output Hardware (SPI_HW): 1-8 parallel data lanes Software (SPI_BITB...
Contains the bulk of the definitions for the various LED chipsets supported.
APA102 high definition controller class.
static void enableAllDrivers()
Enroll every channel driver available on this platform with ChannelManager.
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
fl::u32 getEstimatedPowerInMilliWatts(bool apply_limiter=true) const
Get estimated power consumption in milliwatts.
_FL_MAP_CLOCKED_CHIPSET(LPD6803, LPD6803Controller) _FL_MAP_CLOCKED_CHIPSET(LPD8806
static fl::vector< fl::ChannelPtr > & channels()
stored ChannelPtrs to keep them alive
int size()
Get the number of leds in the first controller.
void setMaxPowerInVoltsAndMilliamps(fl::u8 volts, fl::u32 milliamps)
Set the maximum power to be used, given in volts and milliamps.
CRGB * leds()
Get a pointer to led data for the first controller.
bool isDriverEnabled(const char *name) const
Check if a driver is enabled by name.
void setPowerModel(const PowerModelRGBWW &model)
void onEndShowLeds()
Manually trigger the end show LEDs event.
void setMaxRefreshRate(fl::u16 refresh, bool constrain=false)
Set the maximum refresh rate.
static fl::RxChannelPtr addRx(const fl::RxChannelConfig &config)
Add an RX channel with runtime configuration.
void setTemperature(const CRGB &temp)
Set a global color temperature.
void setRgbwColorimetricProfile(const fl::DiodeProfile *profile) FL_NOEXCEPT
Install a user-supplied RGBW diode chromaticity profile for the colorimetric modes.
void show()
Update all our controllers with the current led colors.
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822Controller fl::u8 fl::u8 fl::EOrder fl::u32 SPI_DATA_RATE
void showColor(const CRGB &color)
Set all leds on all controllers to the given color.
void onBeginFrame()
Manually trigger the begin frame event.
static void remove(fl::ChannelPtr channel)
Remove a channel from the LED controller list.
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822Controller fl::u8 fl::u8 fl::EOrder fl::u32 fl::Bus B
void setWaitSpinBudgetUs(fl::u32 budget_us) FL_NOEXCEPT
Override the channel-manager tiered-wait spin budget (microseconds).
void showColor(const CRGB &color, fl::u8 scale)
Set all leds on all controllers to the given color/scale.
void removeListener(fl::EngineEvents::Listener *listener)
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822Controller fl::u8 fl::u8 fl::EOrder RGB_ORDER
void setPowerModel(const PowerModelRGB &model)
float getPowerScalingExponent() const
Get the configured brightness-to-power response exponent.
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
CLEDController & operator[](int x)
Get a reference to a registered controller.
void setMaxPowerInMilliWatts(fl::u32 milliwatts)
Set the maximum power to be used, given in milliwatts.
void delay(unsigned long ms)
Delay for the given number of milliseconds.
void setExclusiveDriver() FL_NOEXCEPT
Register a single driver at a priority above the platform default (compile-time TU-linking variant).
void setPowerScalingExponent(float exponent)
Set a non-linear brightness-to-power response exponent.
static void _setWaitSpinBudgetUs(fl::u32 budget_us) FL_NOEXCEPT
fl::u32 getWaitSpinBudgetUs() const FL_NOEXCEPT
Get the current tiered-wait spin budget (microseconds).
fl::u8 mScale
the current global brightness scale setting
void setDither(fl::u8 ditherMode=BINARY_DITHER)
Set the dithering mode.
fl::size getDriverCount() const
Get count of registered channel drivers.
static fl::Watchdog & watchdog()
Access the unified cross-platform watchdog timer.
fl::u32 mNPowerData
max power use parameter
static fl::u32 _getWaitSpinBudgetUs() FL_NOEXCEPT
fl::u16 mNFPS
tracking for current frames per second (FPS) value
const fl::DiodeProfile * getRgbwColorimetricProfile() const FL_NOEXCEPT
Currently active RGBW colorimetric profile (defaults to &fl::kRgbwDefaultProfile).
void setInputGamut(fl::DiodeProfile *profile, fl::InputGamut g) FL_NOEXCEPT
Reconfigure profile's input gamut to one of the named source chromaticity sets (Native / Rec709 / Rec...
fl::u32 mNMinMicros
minimum µs between frames, used for capping frame rates
void init()
Initialize platform-specific subsystems.
static void add(fl::ChannelPtr channel)
Add a Channel-based LED controller (from ChannelPtr)
void clearData()
Clear out the local data array.
void addListener(fl::EngineEvents::Listener *listener)
void setInputGamut(fl::DiodeProfile *profile, fl::InputGamut g, const float white_xy[2]) FL_NOEXCEPT
Same as above with an explicit input white-point override.
PowerModelRGB getPowerModel() const
Get current RGB power model.
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822Controller fl::u8 fl::u8 CLOCK_PIN
int count()
Get how many controllers have been registered.
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822Controller fl::u8 DATA_PIN
void setPowerModel(const PowerModelRGBW &model)
void wait()
Wait for all channel bus transmissions to complete.
void clear(bool writeData=false)
Clear the leds, wiping the local array of data.
void setCorrection(const CRGB &correction)
Set a global color correction.
fl::u16 getFPS()
Get the number of frames/second being written out.
::CLEDController & addLeds(::CLEDController *pLed, CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
fl::span< const fl::DriverInfo > getDriverInfos() const
Get full state of all registered channel drivers.
static fl::ChannelEvents & channelEvents()
Access the channel event system.
High level controller interface for FastLED.
DMX512 based LED controller class, using the DMXSerial library.
DMX512 based LED controller class, using the DmxSimple library.
LPD6803 controller class (LPD1101).
LPD8806 controller class.
SM16716 controller class.
void setExclusiveDriver() FL_NOEXCEPT
Register a single driver at a priority above the platform default and disable all others (compile-tim...
static void removeListener(Listener *listener) FL_NOEXCEPT
static void addListener(Listener *listener, int priority=0) FL_NOEXCEPT
Unified cross-platform watchdog interface.
fl::CLEDController CLEDController
Declarations for the predefined color palettes supplied by FastLED.
Compatibility functions based on C++ version.
#define BINARY_DITHER
Enable dithering using binary dithering (only option)
FastLED dynamic library interface - lightweight header for external callers.
Defines the DMX512-based LED controllers.
Task executor — runs registered task runners and manages the run loop.
Contains definitions that can be used to configure FastLED at compile time.
Utility functions and classes for managing delay cycles.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
Backward compatibility header - use fl/fastpin.h directly.
Serial peripheral interface (SPI) definitions per platform.
Data types and constants used by SPI interfaces.
Functions for red, green, blue, white (RGBW) output.
Internal FastLED header for implementation files.
fl::u8 calculate_max_brightness_for_power_mW(const CRGB *ledbuffer, fl::u16 numLeds, fl::u8 target_brightness, fl::u32 max_power_mW)
Determines the highest brightness level you can use and still stay under the specified power budget f...
void set_power_model(const PowerModelRGB &model)
Set custom RGB LED power consumption model.
float get_power_scaling_exponent()
Get the current brightness-to-power response exponent.
void set_power_scaling_exponent(float exponent)
Set a non-linear brightness-to-power response exponent.
PowerModelRGB get_power_model()
Get current RGB power model.
Functions to convert from the HSV colorspace to the RGB colorspace.
Determines which platform system definitions to include.
Fast, efficient 8-bit math functions specifically designed for high-performance LED programming.
Centralized logging categories for FastLED hardware interfaces and subsystems.
Unified manager for channel drivers with priority-based fallback.
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
void set_rgbw_colorimetric_profile(const DiodeProfile *profile) FL_NOEXCEPT
const DiodeProfile * get_rgbw_colorimetric_profile() FL_NOEXCEPT
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Bus
Driver identifier for compile-time bus selection.
@ AUTO
Sentinel: defer to DefaultBus<Chipset>::value.
constexpr T radians(T deg) FL_NOEXCEPT
ChannelManager & channelManager()
Get the global ChannelManager singleton instance.
void busKeepAlive() FL_NOEXCEPT
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
enable_if<!is_integral< T >::value, T >::type round(T value) FL_NOEXCEPT
SpiChipset
LED chipsets with SPI interface (clocked protocols) Modern type-safe enum class - prefer this for new...
@ SM16716
SM16716 LED chipset.
@ LPD6803
LPD6803 LED chipset.
@ APA102HD
APA102 LED chipset with 5-bit gamma correction.
@ HD107
Same as APA102, but in turbo 40-mhz mode.
@ DOTSTARHD
APA102HD LED chipset alias.
@ SK9822HD
SK9822 LED chipset with 5-bit gamma correction.
@ SK9822
SK9822 LED chipset.
@ DOTSTAR
APA102 LED chipset alias.
@ P9813
P9813 LED chipset.
@ APA102
APA102 LED chipset.
@ HD108
16-bit variant of HD107, always gamma corrected. No SD (standard definition) option available - all H...
@ LPD8806
LPD8806 LED chipset.
@ WS2803
WS2803 LED chipset.
@ WS2801
WS2801 LED chipset.
@ HD107HD
Same as APA102HD, but in turbo 40-mhz mode.
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT
constexpr T degrees(T rad) FL_NOEXCEPT
void set_input_gamut(DiodeProfile *profile, InputGamut g, const float white_xy[2]) FL_NOEXCEPT
Base definition for an LED controller.
Functions to generate and fill arrays with noise.
Declares classes for managing logical groups of LEDs.
Includes defintions for RGB and HSV pixels.
Functions to limit the power used by FastLED.
Common RX interfaces and shared types.
#define FL_STATIC_ASSERT(...)
SPI LED chipset enumeration.
Portable compile-time assertion wrapper.
static const bool IS_VALID
RGB LED power consumption model Used for standard 3-channel LEDs (WS2812, WS2812B,...
RGBW LED power consumption model.
RGBWW LED power consumption model (RGB + Cool White + Warm White)
Configuration for a single LED channel.
Singleton event router for Channel lifecycle events.
static SpiEncoder spiEncoderForChipset(SpiChipset chipset, u32 speed_hz_override=0) FL_NOEXCEPT
Look up the default SpiEncoder for a given chipset.
Aggregator header for the fl/ui/ family of per-element UI types.
Unified cross-platform Watchdog Timer API for FastLED.