High level controller interface for FastLED.
This class manages controllers, global settings, and trackings such as brightness and refresh rates, and provides access functions for driving led data to controllers via the show() / showColor() / clear() methods. This is instantiated as a global object with the name FastLED.
Definition at line 354 of file FastLED.h.
|
void | addListener (fl::EngineEvents::Listener *listener) |
|
void | removeListener (fl::EngineEvents::Listener *listener) |
|
void | setBrightness (uint8_t scale) |
| Set the global brightness scaling.
|
|
uint8_t | getBrightness () |
| Get the current global brightness setting.
|
|
void | setMaxPowerInVoltsAndMilliamps (uint8_t volts, uint32_t milliamps) |
| Set the maximum power to be used, given in volts and milliamps.
|
|
void | setMaxPowerInMilliWatts (uint32_t milliwatts) |
| Set the maximum power to be used, given in milliwatts.
|
|
void | show (uint8_t scale) |
| Update all our controllers with the current led colors, using the passed in brightness.
|
|
void | show () |
| Update all our controllers with the current led colors.
|
|
void | clear (bool writeData=false) |
| Clear the leds, wiping the local array of data.
|
|
void | clearData () |
| Clear out the local data array.
|
|
void | showColor (const struct CRGB &color, uint8_t scale) |
| Set all leds on all controllers to the given color/scale.
|
|
void | showColor (const struct CRGB &color) |
| Set all leds on all controllers to the given color.
|
|
void | delay (unsigned long ms) |
| Delay for the given number of milliseconds.
|
|
void | setTemperature (const struct CRGB &temp) |
| Set a global color temperature.
|
|
void | setCorrection (const struct CRGB &correction) |
| Set a global color correction.
|
|
void | setDither (uint8_t ditherMode=BINARY_DITHER) |
| Set the dithering mode.
|
|
void | setMaxRefreshRate (uint16_t refresh, bool constrain=false) |
| Set the maximum refresh rate.
|
|
void | countFPS (int nFrames=25) |
| For debugging, this will keep track of time between calls to countFPS().
|
|
uint16_t | getFPS () |
| Get the number of frames/second being written out.
|
|
int | count () |
| Get how many controllers have been registered.
|
|
CLEDController & | operator[] (int x) |
| Get a reference to a registered controller.
|
|
int | size () |
| Get the number of leds in the first controller.
|
|
CRGB * | leds () |
| Get a pointer to led data for the first controller.
|
|
|
Add an SPI based CLEDController instance to the world.
There are two ways to call this method (as well as the other addLeds() variations). The first is with 2 arguments, in which case the arguments are a pointer to led data, and the number of leds used by this controller. The second is with 3 arguments, in which case the first argument is the same, the second argument is an offset into the CRGB data where this controller's CRGB data begins, and the third argument is the number of leds for this controller object.
- Parameters
-
data | base pointer to an array of CRGB data structures |
nLedsOrOffset | number of leds (3 argument version) or offset into the data array |
nLedsIfOffset | number of leds (4 argument version) |
- Template Parameters
-
CHIPSET | the chipset type |
DATA_PIN | the optional data pin for the leds (if omitted, will default to the first hardware SPI MOSI pin) |
CLOCK_PIN | the optional clock pin for the leds (if omitted, will default to the first hardware SPI clock pin) |
RGB_ORDER | the rgb ordering for the leds (e.g. what order red, green, and blue data is written out in) |
SPI_DATA_RATE | the data rate to drive the SPI clock at, defined using DATA_RATE_MHZ or DATA_RATE_KHZ macros |
- Returns
- a reference to the added controller
|
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) |
| Add an SPI based CLEDController instance to the world.
|
|
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER> |
CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
|
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add an SPI based CLEDController instance to the world.
|
|
|
Add a clockless (aka 3-wire, also DMX) based CLEDController instance to the world.
There are two ways to call this method (as well as the other addLeds() variations). The first is with 2 arguments, in which case the arguments are a pointer to led data, and the number of leds used by this controller. The second is with 3 arguments, in which case the first argument is the same, the second argument is an offset into the CRGB data where this controller's CRGB data begins, and the third argument is the number of leds for this controller object.
This method also takes 2 to 3 template parameters for identifying the specific chipset, data pin, RGB ordering, and SPI data rate
- Parameters
-
data | base pointer to an array of CRGB data structures |
nLedsOrOffset | number of leds (3 argument version) or offset into the data array |
nLedsIfOffset | number of leds (4 argument version) |
- Template Parameters
-
CHIPSET | the chipset type (required) |
DATA_PIN | the data pin for the leds (required) |
RGB_ORDER | the rgb ordering for the leds (e.g. what order red, green, and blue data is written out in) |
- Returns
- a reference to the added controller
|
template<template< uint8_t DATA_PIN, EOrder RGB_ORDER > class CHIPSET, uint8_t DATA_PIN, EOrder RGB_ORDER> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a clockless based CLEDController instance to the world.
|
|
template<template< uint8_t DATA_PIN, EOrder RGB_ORDER > class CHIPSET, uint8_t DATA_PIN> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a clockless based CLEDController instance to the world.
|
|
template<template< uint8_t DATA_PIN > class CHIPSET, uint8_t DATA_PIN> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a clockless based CLEDController instance to the world.
|
|
|
Add a 3rd party library based CLEDController instance to the world.
There are two ways to call this method (as well as the other addLeds() variations). The first is with 2 arguments, in which case the arguments are a pointer to led data, and the number of leds used by this controller. The second is with 3 arguments, in which case the first argument is the same, the second argument is an offset into the CRGB data where this controller's CRGB data begins, and the third argument is the number of leds for this controller object. This class includes the SmartMatrix and OctoWS2811 based controllers
This method also takes 1 to 2 template parameters for identifying the specific chipset and RGB ordering.
- Parameters
-
data | base pointer to an array of CRGB data structures |
nLedsOrOffset | number of leds (3 argument version) or offset into the data array |
nLedsIfOffset | number of leds (4 argument version) |
- Template Parameters
-
CHIPSET | the chipset type (required) |
RGB_ORDER | the rgb ordering for the leds (e.g. what order red, green, and blue data is written out in) |
- Returns
- a reference to the added controller
|
template<template< EOrder RGB_ORDER > class CHIPSET, EOrder RGB_ORDER> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a 3rd party library based CLEDController instance to the world.
|
|
template<template< EOrder RGB_ORDER > class CHIPSET> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a 3rd party library based CLEDController instance to the world.
|
|
template<OWS2811 CHIPSET, EOrder RGB_ORDER> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a OCTOWS2811 based CLEDController instance to the world.
|
|
template<OWS2811 CHIPSET> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a OCTOWS2811 library based CLEDController instance to the world.
|
|
template<SWS2812 CHIPSET, int DATA_PIN, EOrder RGB_ORDER> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a WS2812Serial library based CLEDController instance to the world.
|
|
template<ESM CHIPSET> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a SmartMatrix library based CLEDController instance to the world.
|
|
|
Add a block based CLEDController instance to the world.
There are two ways to call this method (as well as the other addLeds() variations). The first is with 2 arguments, in which case the arguments are a pointer to led data, and the number of leds used by this controller. The second is with 3 arguments, in which case the first argument is the same, the second argument is an offset into the CRGB data where this controller's CRGB data begins, and the third argument is the number of leds for this controller object.
This method also takes a 2 to 3 template parameters for identifying the specific chipset and rgb ordering RGB ordering, and SPI data rate
- Parameters
-
data | base pointer to an array of CRGB data structures |
nLedsOrOffset | number of leds (3 argument version) or offset into the data array |
nLedsIfOffset | number of leds (4 argument version) |
- Template Parameters
-
CHIPSET | the chipset/port type (required) |
NUM_LANES | how many parallel lanes of output to write |
RGB_ORDER | the rgb ordering for the leds (e.g. what order red, green, and blue data is written out in) |
- Returns
- a reference to the added controller
|
template<EBlockChipsets CHIPSET, int NUM_LANES, EOrder RGB_ORDER> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a block based parallel output CLEDController instance to the world.
|
|
template<EBlockChipsets CHIPSET, int NUM_LANES> |
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
| Add a block based parallel output CLEDController instance to the world.
|
|