FastLED 3.6.0
Loading...
Searching...
No Matches
FastLED.h
Go to the documentation of this file.
1#ifndef __INC_FASTSPI_LED2_H
2#define __INC_FASTSPI_LED2_H
3
6
7#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
8#define FASTLED_HAS_PRAGMA_MESSAGE
9#endif
10
16#define FASTLED_VERSION 3006000
17#ifndef FASTLED_INTERNAL
18# ifdef FASTLED_SHOW_VERSION
19# ifdef FASTLED_HAS_PRAGMA_MESSAGE
20# pragma message "FastLED version 3.006.000"
21# else
22# warning FastLED version 3.006.000 (Not really a warning, just telling you here.)
23# endif
24# endif
25#endif
26
27#ifndef __PROG_TYPES_COMPAT__
31#define __PROG_TYPES_COMPAT__
32#endif
33
34#ifdef SmartMatrix_h
35#include <SmartMatrix.h>
36#endif
37
38#ifdef DmxSimple_h
39#include <DmxSimple.h>
40#endif
41
42#ifdef DmxSerial_h
43#include <DMXSerial.h>
44#endif
45
46#include <stdint.h>
47
48#include "cpp_compat.h"
49
50#include "fastled_config.h"
51#include "led_sysdefs.h"
52
53// Utility functions
54#include "fastled_delay.h"
55#include "bitswap.h"
56
57#include "controller.h"
58#include "fastpin.h"
59#include "fastspi_types.h"
60#include "dmx.h"
61
62#include "platforms.h"
63#include "fastled_progmem.h"
64
65#include "lib8tion.h"
66#include "pixeltypes.h"
67#include "hsv2rgb.h"
68#include "colorutils.h"
69#include "pixelset.h"
70#include "colorpalettes.h"
71
72#include "noise.h"
73#include "power_mgt.h"
74
75#include "fastspi.h"
76#include "chipsets.h"
77
78FASTLED_NAMESPACE_BEGIN
79
90 DOTSTAR
91};
92
95enum ESM { SMART_MATRIX };
96
100enum OWS2811 { OCTOWS2811,OCTOWS2811_400, OCTOWS2813};
101
105enum SWS2812 { WS2812SERIAL };
106
107#ifdef HAS_PIXIE
108template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PIXIE : public PixieController<DATA_PIN, RGB_ORDER> {};
109#endif
110
111#ifdef FASTLED_HAS_CLOCKLESS
116
119template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {};
120template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SM16703 : public SM16703Controller<DATA_PIN, RGB_ORDER> {};
121template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
122template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1812 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
123template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1809 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
124template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1804 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
125template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1803 : public TM1803Controller400Khz<DATA_PIN, RGB_ORDER> {};
126template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1903 : public UCS1903Controller400Khz<DATA_PIN, RGB_ORDER> {};
127template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1903B : public UCS1903BController800Khz<DATA_PIN, RGB_ORDER> {};
128template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1904 : public UCS1904Controller800Khz<DATA_PIN, RGB_ORDER> {};
129template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS2903 : public UCS2903Controller<DATA_PIN, RGB_ORDER> {};
130template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
131template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2852 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
132template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
133template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GS1903 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
134template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Controller<DATA_PIN, RGB_ORDER> {};
135template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
136template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA106 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
137template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PL9823 : public PL9823Controller<DATA_PIN, RGB_ORDER> {};
138template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
139template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2813 : public WS2813Controller<DATA_PIN, RGB_ORDER> {};
140template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA104 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
141template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811_400 : public WS2811Controller400Khz<DATA_PIN, RGB_ORDER> {};
142template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GE8822 : public GE8822Controller800Khz<DATA_PIN, RGB_ORDER> {};
143template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205 : public GW6205Controller800Khz<DATA_PIN, RGB_ORDER> {};
144template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205_400 : public GW6205Controller400Khz<DATA_PIN, RGB_ORDER> {};
145template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886 : public LPD1886Controller1250Khz<DATA_PIN, RGB_ORDER> {};
146template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886_8BIT : public LPD1886Controller1250Khz_8bit<DATA_PIN, RGB_ORDER> {};
147#if defined(DmxSimple_h) || defined(FASTLED_DOXYGEN)
149template<uint8_t DATA_PIN, EOrder RGB_ORDER> class DMXSIMPLE : public DMXSimpleController<DATA_PIN, RGB_ORDER> {};
150#endif
151#if defined(DmxSerial_h) || defined(FASTLED_DOXYGEN)
153template<EOrder RGB_ORDER> class DMXSERIAL : public DMXSerialController<RGB_ORDER> {};
154#endif
155#endif
158
159
162#ifdef PORTA_FIRST_PIN
163 WS2811_PORTA,
164 WS2813_PORTA,
165 WS2811_400_PORTA,
166 TM1803_PORTA,
167 UCS1903_PORTA,
168#endif
169#ifdef PORTB_FIRST_PIN
170 WS2811_PORTB,
171 WS2813_PORTB,
172 WS2811_400_PORTB,
173 TM1803_PORTB,
174 UCS1903_PORTB,
175#endif
176#ifdef PORTC_FIRST_PIN
177 WS2811_PORTC,
178 WS2813_PORTC,
179 WS2811_400_PORTC,
180 TM1803_PORTC,
181 UCS1903_PORTC,
182#endif
183#ifdef PORTD_FIRST_PIN
184 WS2811_PORTD,
185 WS2813_PORTD,
186 WS2811_400_PORTD,
187 TM1803_PORTD,
188 UCS1903_PORTD,
189#endif
190#ifdef HAS_PORTDC
191 WS2811_PORTDC,
192 WS2813_PORTDC,
193 WS2811_400_PORTDC,
194 TM1803_PORTDC,
195 UCS1903_PORTDC,
196#endif
197};
198
199#if defined(LIB8_ATTINY)
200#define NUM_CONTROLLERS 2
201#else
204#define NUM_CONTROLLERS 8
205#endif
206
213typedef uint8_t (*power_func)(uint8_t scale, uint32_t data);
214
221class CFastLED {
222 // int m_nControllers;
223 uint8_t m_Scale;
224 uint16_t m_nFPS;
225 uint32_t m_nMinMicros;
226 uint32_t m_nPowerData;
227 power_func m_pPowerFunc;
228
229public:
230 CFastLED();
231
232
244 static CLEDController &addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0);
245
265
267 template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint32_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
268 switch(CHIPSET) {
269 case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
270 case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
271 case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
272 case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
273 case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
274 case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
275 case DOTSTAR:
276 case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
277 case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
278 }
279 }
280
282 template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
283 switch(CHIPSET) {
284 case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
285 case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
286 case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
287 case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
288 case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
289 case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
290 case DOTSTAR:
291 case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
292 case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
293 }
294 }
295
297 template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
298 switch(CHIPSET) {
299 case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
300 case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
301 case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
302 case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
303 case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
304 case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
305 case DOTSTAR:
306 case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
307 case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
308 }
309 }
310
311#ifdef SPI_DATA
312 template<ESPIChipsets CHIPSET> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
313 return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB>(data, nLedsOrOffset, nLedsIfOffset);
314 }
315
316 template<ESPIChipsets CHIPSET, EOrder RGB_ORDER> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
317 return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER>(data, nLedsOrOffset, nLedsIfOffset);
318 }
319
320 template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, uint32_t SPI_DATA_RATE> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
321 return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER, SPI_DATA_RATE>(data, nLedsOrOffset, nLedsIfOffset);
322 }
323
324#endif
326
327#ifdef FASTLED_HAS_CLOCKLESS
348
350 template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER>
351 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
352 static CHIPSET<DATA_PIN, RGB_ORDER> c;
353 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
354 }
355
357 template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN>
358 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
359 static CHIPSET<DATA_PIN, RGB> c;
360 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
361 }
362
364 template<template<uint8_t DATA_PIN> class CHIPSET, uint8_t DATA_PIN>
365 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
366 static CHIPSET<DATA_PIN> c;
367 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
368 }
369
370#if defined(__FASTLED_HAS_FIBCC) && (__FASTLED_HAS_FIBCC == 1)
371 template<uint8_t NUM_LANES, template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
372 static CLEDController &addLeds(struct CRGB *data, int nLeds) {
373 static __FIBCC<CHIPSET, DATA_PIN, NUM_LANES, RGB_ORDER> c;
374 return addLeds(&c, data, nLeds);
375 }
376#endif
377
378 #ifdef FASTSPI_USE_DMX_SIMPLE
379 template<EClocklessChipsets CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
380 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
381 {
382 switch(CHIPSET) {
383 case DMX: { static DMXController<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
384 }
385 }
386 #endif
388#endif
389
410
412 template<template<EOrder RGB_ORDER> class CHIPSET, EOrder RGB_ORDER>
413 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
414 static CHIPSET<RGB_ORDER> c;
415 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
416 }
417
419 template<template<EOrder RGB_ORDER> class CHIPSET>
420 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
421 static CHIPSET<RGB> c;
422 return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
423 }
424
425#ifdef USE_OCTOWS2811
429 template<OWS2811 CHIPSET, EOrder RGB_ORDER>
430 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
431 {
432 switch(CHIPSET) {
433 case OCTOWS2811: { static COctoWS2811Controller<RGB_ORDER,WS2811_800kHz> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
434 case OCTOWS2811_400: { static COctoWS2811Controller<RGB_ORDER,WS2811_400kHz> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
435#ifdef WS2813_800kHz
436 case OCTOWS2813: { static COctoWS2811Controller<RGB_ORDER,WS2813_800kHz> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
437#endif
438 }
439 }
440
444 template<OWS2811 CHIPSET>
445 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
446 {
447 return addLeds<CHIPSET,GRB>(data,nLedsOrOffset,nLedsIfOffset);
448 }
449
450#endif
451
452#ifdef USE_WS2812SERIAL
456 template<SWS2812 CHIPSET, int DATA_PIN, EOrder RGB_ORDER>
457 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
458 {
459 static CWS2812SerialController<DATA_PIN,RGB_ORDER> controller;
460 return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset);
461 }
462#endif
463
464#ifdef SmartMatrix_h
467 template<ESM CHIPSET>
468 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
469 {
470 switch(CHIPSET) {
471 case SMART_MATRIX: { static CSmartMatrixController controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
472 }
473 }
474#endif
476
477
478#ifdef FASTLED_HAS_BLOCKLESS
479
500
502 template<EBlockChipsets CHIPSET, int NUM_LANES, EOrder RGB_ORDER>
503 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
504 switch(CHIPSET) {
505 #ifdef PORTA_FIRST_PIN
506 case WS2811_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
507 case WS2811_400_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
508 case WS2813_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
509 case TM1803_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
510 case UCS1903_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
511 #endif
512 #ifdef PORTB_FIRST_PIN
513 case WS2811_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
514 case WS2811_400_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
515 case WS2813_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
516 case TM1803_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
517 case UCS1903_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
518 #endif
519 #ifdef PORTC_FIRST_PIN
520 case WS2811_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
521 case WS2811_400_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
522 case WS2813_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
523 case TM1803_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
524 case UCS1903_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
525 #endif
526 #ifdef PORTD_FIRST_PIN
527 case WS2811_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
528 case WS2811_400_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
529 case WS2813_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
530 case TM1803_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
531 case UCS1903_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
532 #endif
533 #ifdef HAS_PORTDC
534 case WS2811_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES,NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
535 case WS2811_400_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES,NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
536 case WS2813_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES, NS(320), NS(320), NS(640), RGB_ORDER, 0, false, 300>(), data, nLedsOrOffset, nLedsIfOffset);
537 case TM1803_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
538 case UCS1903_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
539 #endif
540 }
541 }
542
544 template<EBlockChipsets CHIPSET, int NUM_LANES>
545 static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
546 return addLeds<CHIPSET,NUM_LANES,GRB>(data,nLedsOrOffset,nLedsIfOffset);
547 }
549#endif
550
553 void setBrightness(uint8_t scale) { m_Scale = scale; }
554
557 uint8_t getBrightness() { return m_Scale; }
558
562 inline void setMaxPowerInVoltsAndMilliamps(uint8_t volts, uint32_t milliamps) { setMaxPowerInMilliWatts(volts * milliamps); }
563
566 inline void setMaxPowerInMilliWatts(uint32_t milliwatts) { m_pPowerFunc = &calculate_max_brightness_for_power_mW; m_nPowerData = milliwatts; }
567
570 void show(uint8_t scale);
571
573 void show() { show(m_Scale); }
574
578 void clear(bool writeData = false);
579
581 void clearData();
582
586 void showColor(const struct CRGB & color, uint8_t scale);
587
590 void showColor(const struct CRGB & color) { showColor(color, m_Scale); }
591
596 void delay(unsigned long ms);
597
601 void setTemperature(const struct CRGB & temp);
602
606 void setCorrection(const struct CRGB & correction);
607
611 void setDither(uint8_t ditherMode = BINARY_DITHER);
612
620 void setMaxRefreshRate(uint16_t refresh, bool constrain=false);
621
626 void countFPS(int nFrames=25);
627
630 uint16_t getFPS() { return m_nFPS; }
631
634 int count();
635
638 CLEDController & operator[](int x);
639
642 int size() { return (*this)[0].size(); }
643
646 CRGB *leds() { return (*this)[0].leds(); }
647};
648
650#define FastSPI_LED FastLED
652#define FastSPI_LED2 FastLED
653#ifndef LEDS
655#define LEDS FastLED
656#endif
657
659extern CFastLED FastLED;
660
664#ifndef HAS_HARDWARE_PIN_SUPPORT
665#warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info."
666#define NO_HARDWARE_PIN_SUPPORT
667#endif
668
669
670FASTLED_NAMESPACE_END
671
672#endif
SWS2812
WS2812Serial Library controller type.
Definition FastLED.h:105
OWS2811
Octo WS2811 LED Library controller types.
Definition FastLED.h:100
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:17
uint8_t(* power_func)(uint8_t scale, uint32_t data)
Typedef for a power consumption calculation function.
Definition FastLED.h:213
ESPIChipsets
LED chipsets with SPI interface.
Definition FastLED.h:81
@ P9813
P9813 LED chipset.
Definition FastLED.h:87
@ SK9822
SK9822 LED chipset.
Definition FastLED.h:89
@ WS2803
WS2803 LED chipset.
Definition FastLED.h:85
@ WS2801
WS2801 LED chipset.
Definition FastLED.h:84
@ DOTSTAR
APA102 LED chipset alias.
Definition FastLED.h:90
@ APA102
APA102 LED chipset.
Definition FastLED.h:88
@ LPD8806
LPD8806 LED chipset.
Definition FastLED.h:83
@ LPD6803
LPD6803 LED chipset.
Definition FastLED.h:82
@ SM16716
SM16716 LED chipset.
Definition FastLED.h:86
ESM
Smart Matrix Library controller type.
Definition FastLED.h:95
EBlockChipsets
Blockless output port enum.
Definition FastLED.h:161
Functions for doing a rotation of bits/bytes used by parallel output.
Contains the bulk of the definitions for the various LED chipsets supported.
APA102 controller class.
Definition chipsets.h:218
APA104 controller class.
Definition FastLED.h:140
APA106 controller class.
Definition FastLED.h:136
High level controller interface for FastLED.
Definition FastLED.h:221
int size()
Get the number of leds in the first controller.
Definition FastLED.h:642
void setMaxRefreshRate(uint16_t refresh, bool constrain=false)
Set the maximum refresh rate.
Definition FastLED.cpp:237
CRGB * leds()
Get a pointer to led data for the first controller.
Definition FastLED.h:646
void setTemperature(const struct CRGB &temp)
Set a global color temperature.
Definition FastLED.cpp:146
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add an SPI based CLEDController instance to the world.
Definition FastLED.h:282
void show()
Update all our controllers with the current led colors.
Definition FastLED.h:573
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add an SPI based CLEDController instance to the world.
Definition FastLED.h:297
void showColor(const struct CRGB &color)
Set all leds on all controllers to the given color.
Definition FastLED.h:590
void countFPS(int nFrames=25)
For debugging, this will keep track of time between calls to countFPS().
Definition FastLED.cpp:221
CLEDController & operator[](int x)
Get a reference to a registered controller.
Definition FastLED.cpp:85
void delay(unsigned long ms)
Delay for the given number of milliseconds.
Definition FastLED.cpp:132
void setBrightness(uint8_t scale)
Set the global brightness scaling.
Definition FastLED.h:553
void showColor(const struct CRGB &color, uint8_t scale)
Set all leds on all controllers to the given color/scale.
Definition FastLED.cpp:97
void setDither(uint8_t ditherMode=BINARY_DITHER)
Set the dithering mode.
Definition FastLED.cpp:162
void setMaxPowerInVoltsAndMilliamps(uint8_t volts, uint32_t milliamps)
Set the maximum power to be used, given in volts and milliamps.
Definition FastLED.h:562
uint16_t getFPS()
Get the number of frames/second being written out.
Definition FastLED.h:630
void setMaxPowerInMilliWatts(uint32_t milliwatts)
Set the maximum power to be used, given in milliwatts.
Definition FastLED.h:566
uint8_t getBrightness()
Get the current global brightness setting.
Definition FastLED.h:557
void clearData()
Clear out the local data array.
Definition FastLED.cpp:124
void setCorrection(const struct CRGB &correction)
Set a global color correction.
Definition FastLED.cpp:154
CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add an SPI based CLEDController instance to the world.
Definition FastLED.h:267
int count()
Get how many controllers have been registered.
Definition FastLED.cpp:75
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a 3rd party library based CLEDController instance to the world.
Definition FastLED.h:420
void clear(bool writeData=false)
Clear the leds, wiping the local array of data.
Definition FastLED.cpp:117
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a clockless based CLEDController instance to the world.
Definition FastLED.h:358
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition FastLED.cpp:42
Base definition for an LED controller.
Definition controller.h:61
DMX512 based LED controller class, using the DMXSerial library.
Definition FastLED.h:153
DMX512 based LED controller class, using the DmxSimple library.
Definition FastLED.h:149
DMX512 based LED controller class, using the DMXSerial library.
Definition dmx.h:65
DMX512 based LED controller class, using the DmxSimple library.
Definition dmx.h:29
GE8822 controller class.
Definition chipsets.h:493
GE8822 controller class. "
Definition FastLED.h:142
GS1903 controller class.
Definition FastLED.h:133
GW6205 controller class @ 400 KHz. "
Definition FastLED.h:144
GW6205 controller class @ 400 KHz.
Definition chipsets.h:589
UCS1904 controller class @ 800 KHz.
Definition chipsets.h:594
UCS1904 controller class @ 800 KHz. "
Definition FastLED.h:143
LPD1886 controller class. "
Definition FastLED.h:146
LPD1886 controller class.
Definition chipsets.h:503
LPD1886 controller class.
Definition chipsets.h:498
LPD1886 controller class. "
Definition FastLED.h:145
LPD6803 controller class (LPD1101).
Definition chipsets.h:167
LPD8806 controller class.
Definition chipsets.h:87
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:119
P9813 controller class.
Definition chipsets.h:357
PL9823 controller class.
Definition chipsets.h:599
PL9823 controller class. "
Definition FastLED.h:137
SK6812 controller class.
Definition chipsets.h:549
SK6812 controller class. "
Definition FastLED.h:134
SK6822 controller class.
Definition chipsets.h:539
SK6822 controller class.
Definition FastLED.h:135
SK9822 controller class.
Definition chipsets.h:283
SM16703 controller class.
Definition chipsets.h:544
SM16703 controller class. "
Definition FastLED.h:120
SM16716 controller class.
Definition chipsets.h:407
TM1803 controller class.
Definition chipsets.h:579
TM1803 controller class. "
Definition FastLED.h:125
TM1804 controller class.
Definition FastLED.h:124
TM1809 controller class.
Definition chipsets.h:574
TM1809 controller class. "
Definition FastLED.h:123
TM1812 controller class.
Definition FastLED.h:122
TM1829 controller class.
Definition chipsets.h:584
TM1829 controller class. "
Definition FastLED.h:121
UCS1903B controller class.
Definition chipsets.h:559
UCS1903B controller class. "
Definition FastLED.h:127
UCS1903 controller class @ 400 KHz.
Definition chipsets.h:554
UCS1903 controller class @ 400 KHz. "
Definition FastLED.h:126
UCS1904 controller class.
Definition chipsets.h:564
UCS1904 controller class. "
Definition FastLED.h:128
UCS2903 controller class.
Definition chipsets.h:569
UCS2903 controller class. "
Definition FastLED.h:129
WS2801 controller class.
Definition chipsets.h:129
WS2803 controller class.
Definition chipsets.h:156
WS2811 controller class @ 400 KHz. "
Definition FastLED.h:141
WS2811 controller class @ 400 KHz.
Definition chipsets.h:534
WS2811 controller class @ 800 KHz.
Definition chipsets.h:514
WS2811 controller class @ 800 KHz. "
Definition FastLED.h:138
WS2812B controller class.
Definition FastLED.h:132
WS2812 controller class @ 800 KHz.
Definition chipsets.h:509
WS2812 controller class @ 800 KHz. "
Definition FastLED.h:130
WS2813 controller class.
Definition chipsets.h:529
WS2813 controller class. "
Definition FastLED.h:139
WS2852 controller class.
Definition FastLED.h:131
Declarations for the predefined color palettes supplied by FastLED.
Utility functions for color fill, palettes, blending, and more.
base definitions used by led controllers for writing out led data
#define BINARY_DITHER
Enable dithering using binary dithering (only option)
Definition controller.h:46
Compatibility functions based on C++ version.
Defines the DMX512-based LED controllers.
Contains definitions that can be used to configure FastLED at compile time.
Utility functions and classes for managing delay cycles.
#define NS(_NS)
Convert from nanoseconds to number of clock cycles.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
Class base definitions for defining fast pin access.
Serial peripheral interface (SPI) definitions per platform.
Data types and constants used by SPI interfaces.
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
Definition pixeltypes.h:956
@ RGB
Red, Green, Blue (0012)
Definition pixeltypes.h:957
uint8_t calculate_max_brightness_for_power_mW(const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
Determines the highest brightness level you can use and still stay under the specified power budget f...
Definition power_mgt.cpp:94
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.
Functions to generate and fill arrays with noise.
Declares classes for managing logical groups of LEDs.
Definitions for pixel color data structs.
Determines which platforms headers to include.
Functions to limit the power used by FastLED.
Representation of an RGB pixel (Red, Green, Blue)
Definition pixeltypes.h:120