FastLED  3.1
FastLED.h
Go to the documentation of this file.
1 #ifndef __INC_FASTSPI_LED2_H
2 #define __INC_FASTSPI_LED2_H
3 
6 
7 #define xstr(s) str(s)
8 #define str(s) #s
9 
10 #define FASTLED_VERSION 3001001
11 #ifndef FASTLED_INTERNAL
12 #warning FastLED version 3.001.001 (Not really a warning, just telling you here.)
13 #endif
14 
15 #ifndef __PROG_TYPES_COMPAT__
16 #define __PROG_TYPES_COMPAT__
17 #endif
18 
19 #ifdef SmartMatrix_h
20 #include<SmartMatrix.h>
21 #endif
22 
23 #ifdef DmxSimple_h
24 #include<DmxSimple.h>
25 #endif
26 
27 #ifdef DmxSerial_h
28 #include<DMXSerial.h>
29 #endif
30 
31 #include <stdint.h>
32 
33 #include "cpp_compat.h"
34 
35 #include "fastled_config.h"
36 #include "led_sysdefs.h"
37 
38 #include "bitswap.h"
39 #include "controller.h"
40 #include "fastpin.h"
41 #include "fastspi_types.h"
42 #include "./dmx.h"
43 
44 #include "platforms.h"
45 #include "fastled_progmem.h"
46 
47 #include "lib8tion.h"
48 #include "pixeltypes.h"
49 #include "hsv2rgb.h"
50 #include "colorutils.h"
51 #include "pixelset.h"
52 #include "colorpalettes.h"
53 
54 #include "noise.h"
55 #include "power_mgt.h"
56 
57 #include "fastspi.h"
58 #include "chipsets.h"
59 
60 FASTLED_NAMESPACE_BEGIN
61 
64  LPD8806,
65  WS2801,
66  WS2803,
67  SM16716,
68  P9813,
69  APA102,
70  SK9822,
71  DOTSTAR
72 };
73 
74 enum ESM { SMART_MATRIX };
75 enum OWS2811 { OCTOWS2811,OCTOWS2811_400 };
76 
77 #ifdef HAS_PIXIE
78 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PIXIE : public PixieController<DATA_PIN, RGB_ORDER> {};
79 #endif
80 
81 #ifdef FASTLED_HAS_CLOCKLESS
82 template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {};
83 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
84 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1812 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
85 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1809 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
86 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1804 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
87 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1803 : public TM1803Controller400Khz<DATA_PIN, RGB_ORDER> {};
88 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1903 : public UCS1903Controller400Khz<DATA_PIN, RGB_ORDER> {};
89 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1903B : public UCS1903BController800Khz<DATA_PIN, RGB_ORDER> {};
90 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS1904 : public UCS1904Controller800Khz<DATA_PIN, RGB_ORDER> {};
91 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS2903 : public UCS2903Controller<DATA_PIN, RGB_ORDER> {};
92 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
93 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
94 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Controller<DATA_PIN, RGB_ORDER> {};
95 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
96 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PL9823 : public PL9823Controller<DATA_PIN, RGB_ORDER> {};
97 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
98 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA104 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
99 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811_400 : public WS2811Controller400Khz<DATA_PIN, RGB_ORDER> {};
100 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205 : public GW6205Controller800Khz<DATA_PIN, RGB_ORDER> {};
101 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205_400 : public GW6205Controller400Khz<DATA_PIN, RGB_ORDER> {};
102 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886 : public LPD1886Controller1250Khz<DATA_PIN, RGB_ORDER> {};
103 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886_8BIT : public LPD1886Controller1250Khz_8bit<DATA_PIN, RGB_ORDER> {};
104 #ifdef DmxSimple_h
105 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class DMXSIMPLE : public DMXSimpleController<DATA_PIN, RGB_ORDER> {};
106 #endif
107 #ifdef DmxSerial_h
108 template<EOrder RGB_ORDER> class DMXSERIAL : public DMXSerialController<RGB_ORDER> {};
109 #endif
110 #endif
111 
112 enum EBlockChipsets {
113 #ifdef PORTA_FIRST_PIN
114  WS2811_PORTA,
115  WS2811_400_PORTA,
116  TM1803_PORTA,
117  UCS1903_PORTA,
118 #endif
119 #ifdef PORTB_FIRST_PIN
120  WS2811_PORTB,
121  WS2811_400_PORTB,
122  TM1803_PORTB,
123  UCS1903_PORTB,
124 #endif
125 #ifdef PORTC_FIRST_PIN
126  WS2811_PORTC,
127  WS2811_400_PORTC,
128  TM1803_PORTC,
129  UCS1903_PORTC,
130 #endif
131 #ifdef PORTD_FIRST_PIN
132  WS2811_PORTD,
133  WS2811_400_PORTD,
134  TM1803_PORTD,
135  UCS1903_PORTD,
136 #endif
137 #ifdef HAS_PORTDC
138  WS2811_PORTDC,
139  WS2811_400_PORTDC,
140  TM1803_PORTDC,
141  UCS1903_PORTDC,
142 #endif
143 };
144 
145 #if defined(LIB8_ATTINY)
146 #define NUM_CONTROLLERS 2
147 #else
148 #define NUM_CONTROLLERS 8
149 #endif
150 
151 typedef uint8_t (*power_func)(uint8_t scale, uint32_t data);
152 
157 class CFastLED {
158  // int m_nControllers;
159  uint8_t m_Scale;
160  uint16_t m_nFPS;
161  uint32_t m_nMinMicros;
162  uint32_t m_nPowerData;
163  power_func m_pPowerFunc;
164 
165 public:
166  CFastLED();
167 
168 
180  static CLEDController &addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0);
181 
183 
184  template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
203  switch(CHIPSET) {
204  case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
205  case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
206  case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
207  case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
208  case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
209  case DOTSTAR:
210  case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
211  case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
212  }
213  }
214 
215  template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
216  switch(CHIPSET) {
217  case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
218  case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
219  case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
220  case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
221  case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
222  case DOTSTAR:
223  case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
224  case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
225  }
226  }
227 
228  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) {
229  switch(CHIPSET) {
230  case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
231  case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
232  case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
233  case SM16716: { static SM16716Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
234  case P9813: { static P9813Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
235  case DOTSTAR:
236  case APA102: { static APA102Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
237  case SK9822: { static SK9822Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
238  }
239  }
240 
241 #ifdef SPI_DATA
242  template<ESPIChipsets CHIPSET> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
243  return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB>(data, nLedsOrOffset, nLedsIfOffset);
244  }
245 
246  template<ESPIChipsets CHIPSET, EOrder RGB_ORDER> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
247  return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER>(data, nLedsOrOffset, nLedsIfOffset);
248  }
249 
250  template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
251  return addLeds<CHIPSET, SPI_DATA, SPI_CLOCK, RGB_ORDER, SPI_DATA_RATE>(data, nLedsOrOffset, nLedsIfOffset);
252  }
253 
254 #endif
255 
256 
257 #ifdef FASTLED_HAS_CLOCKLESS
258 
260  template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER>
277  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
278  static CHIPSET<DATA_PIN, RGB_ORDER> c;
279  return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
280  }
281 
282  template<template<uint8_t DATA_PIN, EOrder RGB_ORDER> class CHIPSET, uint8_t DATA_PIN>
283  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
284  static CHIPSET<DATA_PIN, RGB> c;
285  return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
286  }
287 
288  template<template<uint8_t DATA_PIN> class CHIPSET, uint8_t DATA_PIN>
289  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
290  static CHIPSET<DATA_PIN> c;
291  return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
292  }
293 
294  #ifdef FASTSPI_USE_DMX_SIMPLE
295  template<EClocklessChipsets CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER=RGB>
296  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
297  {
298  switch(CHIPSET) {
299  case DMX: { static DMXController<DATA_PIN> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
300  }
301  }
302  #endif
303 
304 #endif
305 
307 
308  template<template<EOrder RGB_ORDER> class CHIPSET, EOrder RGB_ORDER>
325  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
326  static CHIPSET<RGB_ORDER> c;
327  return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
328  }
329 
330  template<template<EOrder RGB_ORDER> class CHIPSET>
331  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
332  static CHIPSET<RGB> c;
333  return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset);
334  }
335 
336 #ifdef USE_OCTOWS2811
337  template<OWS2811 CHIPSET, EOrder RGB_ORDER>
338  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
339  {
340  switch(CHIPSET) {
341  case OCTOWS2811: { static COctoWS2811Controller<RGB_ORDER> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
342  case OCTOWS2811_400: { static COctoWS2811Controller<RGB_ORDER,true> controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
343  }
344  }
345 
346  template<OWS2811 CHIPSET>
347  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
348  {
349  return addLeds<CHIPSET,GRB>(data,nLedsOrOffset,nLedsIfOffset);
350  }
351 
352 #endif
353 
354 #ifdef SmartMatrix_h
355  template<ESM CHIPSET>
356  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0)
357  {
358  switch(CHIPSET) {
359  case SMART_MATRIX: { static CSmartMatrixController controller; return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset); }
360  }
361  }
362 #endif
363 
364 
365 
366 #ifdef FASTLED_HAS_BLOCKLESS
367 
369 
370  template<EBlockChipsets CHIPSET, int NUM_LANES, EOrder RGB_ORDER>
387  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
388  switch(CHIPSET) {
389  #ifdef PORTA_FIRST_PIN
390  case WS2811_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
391  case WS2811_400_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
392  case TM1803_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
393  case UCS1903_PORTA: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTA_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
394  #endif
395  #ifdef PORTB_FIRST_PIN
396  case WS2811_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
397  case WS2811_400_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
398  case TM1803_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
399  case UCS1903_PORTB: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTB_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
400  #endif
401  #ifdef PORTC_FIRST_PIN
402  case WS2811_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
403  case WS2811_400_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
404  case TM1803_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
405  case UCS1903_PORTC: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTC_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
406  #endif
407  #ifdef PORTD_FIRST_PIN
408  case WS2811_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
409  case WS2811_400_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
410  case TM1803_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
411  case UCS1903_PORTD: return addLeds(new InlineBlockClocklessController<NUM_LANES, PORTD_FIRST_PIN, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
412  #endif
413  #ifdef HAS_PORTDC
414  case WS2811_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES,NS(320), NS(320), NS(640), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
415  case WS2811_400_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES,NS(800), NS(800), NS(900), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
416  case TM1803_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES, NS(700), NS(1100), NS(700), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
417  case UCS1903_PORTDC: return addLeds(new SixteenWayInlineBlockClocklessController<NUM_LANES, NS(500), NS(1500), NS(500), RGB_ORDER>(), data, nLedsOrOffset, nLedsIfOffset);
418  #endif
419  }
420  }
421 
422  template<EBlockChipsets CHIPSET, int NUM_LANES>
423  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
424  return addLeds<CHIPSET,NUM_LANES,GRB>(data,nLedsOrOffset,nLedsIfOffset);
425  }
427 #endif
428 
431  void setBrightness(uint8_t scale) { m_Scale = scale; }
432 
435  uint8_t getBrightness() { return m_Scale; }
436 
440  inline void setMaxPowerInVoltsAndMilliamps(uint8_t volts, uint32_t milliamps) { setMaxPowerInMilliWatts(volts * milliamps); }
441 
444  inline void setMaxPowerInMilliWatts(uint32_t milliwatts) { m_pPowerFunc = &calculate_max_brightness_for_power_mW; m_nPowerData = milliwatts; }
445 
448  void show(uint8_t scale);
449 
451  void show() { show(m_Scale); }
452 
455  void clear(boolean writeData = false);
456 
458  void clearData();
459 
463  void showColor(const struct CRGB & color, uint8_t scale);
464 
467  void showColor(const struct CRGB & color) { showColor(color, m_Scale); }
468 
473  void delay(unsigned long ms);
474 
478  void setTemperature(const struct CRGB & temp);
479 
483  void setCorrection(const struct CRGB & correction);
484 
488  void setDither(uint8_t ditherMode = BINARY_DITHER);
489 
497  void setMaxRefreshRate(uint16_t refresh, bool constrain=false);
498 
503  void countFPS(int nFrames=25);
504 
507  uint16_t getFPS() { return m_nFPS; }
508 
511  int count();
512 
515  CLEDController & operator[](int x);
516 
519  int size() { return (*this)[0].size(); }
520 
523  CRGB *leds() { return (*this)[0].leds(); }
524 };
525 
526 #define FastSPI_LED FastLED
527 #define FastSPI_LED2 FastLED
528 #ifndef LEDS
529 #define LEDS FastLED
530 #endif
531 
532 extern CFastLED FastLED;
533 
534 // Warnings for undefined things
535 #ifndef HAS_HARDWARE_PIN_SUPPORT
536 #warning "No pin/port mappings found, pin access will be slightly slower. See fastpin.h for info."
537 #define NO_HARDWARE_PIN_SUPPORT
538 #endif
539 
540 
541 FASTLED_NAMESPACE_END
542 
543 #endif
Functions for rotating bits/bytes.
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:325
Definition: FastLED.h:92
Representation of an RGB pixel (Red, Green, Blue)
Definition: pixeltypes.h:90
CLEDController & operator[](int x)
Get a reference to a registered controller.
Definition: FastLED.cpp:73
Base definition for an LED controller.
Definition: controller.h:38
int size()
Get the number of leds in the first controller.
Definition: FastLED.h:519
Definition: FastLED.h:94
contains definitions that can be used to configure FastLED at compile time
uint8_t getBrightness()
Get the current global brightness setting.
Definition: FastLED.h:435
contains definitions for the predefined color palettes supplied by FastLED.
LPD8806 controller class.
Definition: chipsets.h:81
Class base definitions for defining fast pin access.
Adafruit Pixie controller class.
Definition: chipsets.h:28
void setMaxPowerInVoltsAndMilliamps(uint8_t volts, uint32_t milliamps)
Set the maximum power to be used, given in volts and milliamps.
Definition: FastLED.h:440
int count()
Get how many controllers have been registered.
Definition: FastLED.cpp:63
High level controller interface for FastLED.
Definition: FastLED.h:157
static CLEDController & addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a clockless (aka 3wire, also DMX) based CLEDController instance to the world. ...
Definition: FastLED.h:277
Definition: FastLED.h:85
WS2801 controller class.
Definition: chipsets.h:122
void setDither(uint8_t ditherMode=BINARY_DITHER)
Set the dithering mode.
Definition: FastLED.cpp:152
uint8_t calculate_max_brightness_for_power_mW(const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
calculate_max_brightness_for_power_mW tells you the highest brightness level you can use and still st...
Definition: power_mgt.cpp:84
void setTemperature(const struct CRGB &temp)
Set a global color temperature.
Definition: FastLED.cpp:136
uint16_t getFPS()
Get the number of frames/second being written out.
Definition: FastLED.h:507
void setMaxPowerInMilliWatts(uint32_t milliwatts)
Set the maximum power to be used, given in milliwatts.
Definition: FastLED.h:444
SK9822 controller class.
Definition: chipsets.h:211
Definition: FastLED.h:84
CRGB * leds()
Get a pointer to led data for the first controller.
Definition: FastLED.h:523
contains the bulk of the definitions for the various LED chipsets supported.
Definition: FastLED.h:83
Definition: FastLED.h:78
void show()
Update all our controllers with the current led colors.
Definition: FastLED.h:451
void setCorrection(const struct CRGB &correction)
Set a global color correction.
Definition: FastLED.cpp:144
void showColor(const struct CRGB &color, uint8_t scale)
Set all leds on all controllers to the given color/scale.
Definition: FastLED.cpp:85
base definitions used by led controllers for writing out led data
P9813 controller class.
Definition: chipsets.h:274
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
Definition: FastLED.cpp:30
void setBrightness(uint8_t scale)
Set the global brightness scaling.
Definition: FastLED.h:431
Definition: FastLED.h:95
Noise functions provided by the library.
functions for color fill, paletters, blending, and more
void showColor(const struct CRGB &color)
Set all leds on all controllers to the given color.
Definition: FastLED.h:467
Definition: FastLED.h:86
APA102 controller class.
Definition: chipsets.h:158
void countFPS(int nFrames=25)
for debugging, will keep track of time between calls to countFPS, and every nFrames calls...
Definition: FastLED.cpp:205
ESPIChipsets
definitions for the spi chipset constants
Definition: FastLED.h:63
void clear(boolean writeData=false)
clear the leds, optionally wiping the local array of data as well
Definition: FastLED.cpp:105
Definition: FastLED.h:97
Definition: FastLED.h:98
void clearData()
clear out the local data array
Definition: FastLED.cpp:112
wrapper definitions to allow seamless use of PROGMEM in environmens that have it
void setMaxRefreshRate(uint16_t refresh, bool constrain=false)
Set the maximum refresh rate.
Definition: FastLED.cpp:218
void delay(unsigned long ms)
Delay for the given number of milliseconds.
Definition: FastLED.cpp:120
Definition: FastLED.h:96
SM16716 controller class.
Definition: chipsets.h:324
Definition: FastLED.h:87