FastLED 3.9.15
|
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.
#include <FastLED.h>
Classes | |
struct | ClockedChipsetHelper |
Public Member Functions | |
CFastLED () | |
void | addListener (fl::EngineEvents::Listener *listener) |
void | clear (bool writeData=false) |
Clear the leds, wiping the local array of data. | |
void | clearData () |
Clear out the local data array. | |
int | count () |
Get how many controllers have been registered. | |
void | countFPS (int nFrames=25) |
For debugging, this will keep track of time between calls to countFPS(). | |
void | delay (unsigned long ms) |
Delay for the given number of milliseconds. | |
fl::u8 | getBrightness () |
Get the current global brightness setting. | |
fl::u16 | getFPS () |
Get the number of frames/second being written out. | |
CRGB * | leds () |
Get a pointer to led data for the first controller. | |
void | onEndFrame () |
CLEDController & | operator[] (int x) |
Get a reference to a registered controller. | |
void | removeListener (fl::EngineEvents::Listener *listener) |
void | setBrightness (fl::u8 scale) |
Set the global brightness scaling. | |
void | setCorrection (const struct CRGB &correction) |
Set a global color correction. | |
void | setDither (fl::u8 ditherMode=BINARY_DITHER) |
Set the dithering mode. | |
void | setMaxPowerInMilliWatts (fl::u32 milliwatts) |
Set the maximum power to be used, given in milliwatts. | |
void | setMaxPowerInVoltsAndMilliamps (fl::u8 volts, fl::u32 milliamps) |
Set the maximum power to be used, given in volts and milliamps. | |
void | setMaxRefreshRate (fl::u16 refresh, bool constrain=false) |
Set the maximum refresh rate. | |
void | setTemperature (const struct CRGB &temp) |
Set a global color temperature. | |
void | show () |
Update all our controllers with the current led colors. | |
void | show (fl::u8 scale) |
Update all our controllers with the current led colors, using the passed in brightness. | |
void | showColor (const struct CRGB &color) |
Set all leds on all controllers to the given color. | |
void | showColor (const struct CRGB &color, fl::u8 scale) |
Set all leds on all controllers to the given color/scale. | |
int | size () |
Get the number of leds in the first controller. | |
Static Public Member Functions | |
static CLEDController & | addLeds (CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) |
Add a CLEDController instance to the world. | |
Private Attributes | |
fl::u16 | m_nFPS |
tracking for current frames per second (FPS) value | |
fl::u32 | m_nMinMicros |
minimum µs between frames, used for capping frame rates | |
fl::u32 | m_nPowerData |
max power use parameter | |
power_func | m_pPowerFunc |
function for overriding brightness when using FastLED.show(); | |
fl::u8 | m_Scale |
the current global brightness scale setting | |
Manual Engine Events | |
When FASTLED_MANUAL_ENGINE_EVENTS is defined, these methods allow manual control of engine events. When FASTLED_MANUAL_ENGINE_EVENTS is not defined, these events are triggered automatically by show(). | |
void | onBeginFrame () |
Manually trigger the begin frame event. | |
void | onEndShowLeds () |
Manually trigger the end show LEDs event. | |
Adding SPI-based controllers | |||||||||||||||||
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.
| |||||||||||||||||
_FL_MAP_CLOCKED_CHIPSET (LPD6803, LPD6803Controller) _FL_MAP_CLOCKED_CHIPSET(LPD8806 | |||||||||||||||||
LPD8806Controller | _FL_MAP_CLOCKED_CHIPSET (WS2801, WS2801Controller) _FL_MAP_CLOCKED_CHIPSET(WS2803 | ||||||||||||||||
LPD8806Controller WS2803Controller | _FL_MAP_CLOCKED_CHIPSET (SM16716, SM16716Controller) _FL_MAP_CLOCKED_CHIPSET(P9813 | ||||||||||||||||
LPD8806Controller WS2803Controller P9813Controller | _FL_MAP_CLOCKED_CHIPSET (DOTSTAR, APA102Controller) _FL_MAP_CLOCKED_CHIPSET(APA102 | ||||||||||||||||
LPD8806Controller WS2803Controller P9813Controller APA102Controller | _FL_MAP_CLOCKED_CHIPSET (DOTSTARHD, APA102ControllerHD) _FL_MAP_CLOCKED_CHIPSET(APA102HD | ||||||||||||||||
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD | _FL_MAP_CLOCKED_CHIPSET (HD107, APA102Controller) _FL_MAP_CLOCKED_CHIPSET(HD107HD | ||||||||||||||||
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD | _FL_MAP_CLOCKED_CHIPSET (SK9822, SK9822Controller) _FL_MAP_CLOCKED_CHIPSET(SK9822HD | ||||||||||||||||
template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, EOrder RGB_ORDER, fl::u32 SPI_DATA_RATE> | |||||||||||||||||
LPD8806Controller WS2803Controller P9813Controller APA102Controller APA102ControllerHD APA102ControllerHD SK9822ControllerHD CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||||||
Add an SPI based CLEDController instance to the world. | |||||||||||||||||
template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN, EOrder RGB_ORDER> | |||||||||||||||||
CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||||||
template<ESPIChipsets CHIPSET, fl::u8 DATA_PIN, fl::u8 CLOCK_PIN> | |||||||||||||||||
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||||||
Add an SPI based CLEDController instance to the world. | |||||||||||||||||
Adding 3-wire led controllers | |||||||||||||
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
| |||||||||||||
template<template< fl::u8 DATA_PIN, EOrder RGB_ORDER > class CHIPSET, fl::u8 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< fl::u8 DATA_PIN, EOrder RGB_ORDER > class CHIPSET, fl::u8 DATA_PIN> | |||||||||||||
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||
Add a clockless based CLEDController instance to the world. | |||||||||||||
template<template< fl::u8 DATA_PIN > class CHIPSET, fl::u8 DATA_PIN> | |||||||||||||
static CLEDController & | addLeds (struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||
Add a clockless based CLEDController instance to the world. | |||||||||||||
template<template< fl::u8 DATA_PIN > class CHIPSET, fl::u8 DATA_PIN> | |||||||||||||
static CLEDController & | addLeds (class fl::Leds &leds, int nLedsOrOffset, int nLedsIfOffset=0) | ||||||||||||
Adding 3rd party library controllers | |||||||||||
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.
| |||||||||||
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. | |||||||||||
Adding parallel output controllers | |||||||||||||
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
| |||||||||||||
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. | |||||||||||||