FastLED 3.6.0
Loading...
Searching...
No Matches
CLEDController Class Referenceabstract

Detailed Description

Base definition for an LED controller.

Pretty much the methods that every LED controller object will make available. If you want to pass LED controllers around to methods, make them references to this type, keeps your code saner. However, most people won't be seeing/using these objects directly at all.

Note
That the methods for eventual checking of background writing of data (I'm looking at you, Teensy 3.0 DMA controller!) are not yet implemented.

Definition at line 61 of file controller.h.

#include <controller.h>

+ Inheritance diagram for CLEDController:

Public Member Functions

 CLEDController ()
 Create an led controller object, add it to the chain of controllers.
 
virtual void init ()=0
 Initialize the LED controller.
 
virtual void clearLeds (int nLeds)
 Clear out/zero out the given number of LEDs.
 
void show (const struct CRGB *data, int nLeds, uint8_t brightness)
 Write the passed in RGB data out to the LEDs managed by this controller.
 
void showColor (const struct CRGB &data, int nLeds, uint8_t brightness)
 Set all the LEDs to a given color.
 
void showLeds (uint8_t brightness=255)
 Write the data to the LEDs managed by this controller.
 
void showColor (const struct CRGB &data, uint8_t brightness=255)
 Set all the LEDs to a given color.
 
CLEDControllernext ()
 Get the next controller in the linked list after this one.
 
CLEDControllersetLeds (CRGB *data, int nLeds)
 Set the default array of LEDs to be used by this controller.
 
void clearLedData ()
 Zero out the LED data managed by this controller.
 
virtual int size ()
 How many LEDs does this controller manage?
 
virtual int lanes ()
 How many Lanes does this controller manage?
 
CRGBleds ()
 Pointer to the CRGB array for this controller.
 
CRGBoperator[] (int x)
 Reference to the n'th LED managed by the controller.
 
CLEDControllersetDither (uint8_t ditherMode=BINARY_DITHER)
 Set the dithering mode for this controller to use.
 
uint8_t getDither ()
 Get the dithering option currently set for this controller.
 
CLEDControllersetCorrection (CRGB correction)
 The color corrction to use for this controller, expressed as a CRGB object.
 
CLEDControllersetCorrection (LEDColorCorrection correction)
 The color corrction to use for this controller, expressed as a CRGB object.
 
CRGB getCorrection ()
 Get the correction value used by this controller.
 
CLEDControllersetTemperature (CRGB temperature)
 Set the color temperature, aka white point, for this controller.
 
CLEDControllersetTemperature (ColorTemperature temperature)
 Set the color temperature, aka white point, for this controller.
 
CRGB getTemperature ()
 Get the color temperature, aka whipe point, for this controller.
 
CRGB getAdjustment (uint8_t scale)
 Get the combined brightness/color adjustment for this controller.
 
virtual uint16_t getMaxRefreshRate () const
 Gets the maximum possible refresh rate of the strip.
 

Static Public Member Functions

static CLEDControllerhead ()
 Get the first LED controller in the linked list of controllers.
 
static CRGB computeAdjustment (uint8_t scale, const CRGB &colorCorrection, const CRGB &colorTemperature)
 Calculates the combined color adjustment to the LEDs at a given scale, color correction, and color temperature.
 

Protected Member Functions

virtual void showColor (const struct CRGB &data, int nLeds, CRGB scale)=0
 Set all the LEDs to a given color.
 
virtual void show (const struct CRGB *data, int nLeds, CRGB scale)=0
 Write the passed in RGB data out to the LEDs managed by this controller.
 

Protected Attributes

CRGBm_Data
 pointer to the LED data used by this controller
 
CLEDControllerm_pNext
 pointer to the next LED controller in the linked list
 
CRGB m_ColorCorrection
 CRGB object representing the color correction to apply to the strip on show()
 
CRGB m_ColorTemperature
 CRGB object representing the color temperature to apply to the strip on show()
 
EDitherMode m_DitherMode
 the current dither mode of the controller
 
int m_nLeds
 the number of LEDs in the LED data array
 

Static Protected Attributes

static CLEDControllerm_pHead = NULL
 pointer to the first LED controller in the linked list
 
static CLEDControllerm_pTail = NULL
 pointer to the last LED controller in the linked list
 

Friends

class CFastLED
 

Constructor & Destructor Documentation

◆ CLEDController()

CLEDController::CLEDController ( )
inline

Create an led controller object, add it to the chain of controllers.

Definition at line 87 of file controller.h.

Member Function Documentation

◆ clearLedData()

void CLEDController::clearLedData ( )
inline

Zero out the LED data managed by this controller.

Definition at line 157 of file controller.h.

◆ clearLeds()

virtual void CLEDController::clearLeds ( int  nLeds)
inlinevirtual

Clear out/zero out the given number of LEDs.

Parameters
nLedsthe number of LEDs to clear

Definition at line 99 of file controller.h.

◆ computeAdjustment()

static CRGB CLEDController::computeAdjustment ( uint8_t  scale,
const CRGB colorCorrection,
const CRGB colorTemperature 
)
inlinestatic

Calculates the combined color adjustment to the LEDs at a given scale, color correction, and color temperature.

Parameters
scalethe scale value for the RGB data (i.e. brightness)
colorCorrectioncolor correction to apply
colorTemperaturecolor temperature to apply
Returns
a CRGB object representing the adjustment, including color correction and color temperature

Definition at line 225 of file controller.h.

◆ getAdjustment()

CRGB CLEDController::getAdjustment ( uint8_t  scale)
inline

Get the combined brightness/color adjustment for this controller.

Parameters
scalethe brightness scale to get the correction for
Returns
a CRGB object representing the total adjustment, including color correction and color temperature

Definition at line 216 of file controller.h.

◆ getCorrection()

CRGB CLEDController::getCorrection ( )
inline

Get the correction value used by this controller.

Returns
the current color correction (CLEDController::m_ColorCorrection)

Definition at line 199 of file controller.h.

◆ getDither()

uint8_t CLEDController::getDither ( )
inline

Get the dithering option currently set for this controller.

Returns
the currently set dithering option (CLEDController::m_DitherMode)

Definition at line 187 of file controller.h.

◆ getMaxRefreshRate()

virtual uint16_t CLEDController::getMaxRefreshRate ( ) const
inlinevirtual

Gets the maximum possible refresh rate of the strip.

Returns
the maximum refresh rate, in frames per second (FPS)

Definition at line 249 of file controller.h.

◆ getTemperature()

CRGB CLEDController::getTemperature ( )
inline

Get the color temperature, aka whipe point, for this controller.

Returns
the current color temperature (CLEDController::m_ColorTemperature)

Definition at line 211 of file controller.h.

◆ head()

static CLEDController * CLEDController::head ( )
inlinestatic

Get the first LED controller in the linked list of controllers.

Returns
CLEDController::m_pHead

Definition at line 141 of file controller.h.

◆ init()

◆ lanes()

virtual int CLEDController::lanes ( )
inlinevirtual

How many Lanes does this controller manage?

Returns
1 for a non-Parallel controller

Reimplemented in CPixelLEDController< RGB_ORDER, LANES, MASK >, and CPixelLEDController< RGB >.

Definition at line 169 of file controller.h.

◆ leds()

CRGB * CLEDController::leds ( )
inline

Pointer to the CRGB array for this controller.

Returns
CLEDController::m_Data

Definition at line 173 of file controller.h.

◆ next()

CLEDController * CLEDController::next ( )
inline

Get the next controller in the linked list after this one.

Will return NULL at the end of the linked list.

Returns
CLEDController::m_pNext

Definition at line 145 of file controller.h.

◆ operator[]()

CRGB & CLEDController::operator[] ( int  x)
inline

Reference to the n'th LED managed by the controller.

Parameters
xthe LED number to retrieve
Returns
reference to CLEDController::m_Data[x]

Definition at line 178 of file controller.h.

◆ setCorrection() [1/2]

CLEDController & CLEDController::setCorrection ( CRGB  correction)
inline

The color corrction to use for this controller, expressed as a CRGB object.

Parameters
correctionthe color correction to set
Returns
a reference to the controller

Definition at line 192 of file controller.h.

◆ setCorrection() [2/2]

CLEDController & CLEDController::setCorrection ( LEDColorCorrection  correction)
inline

The color corrction to use for this controller, expressed as a CRGB object.

Parameters
correctionthe color correction to set
Returns
a reference to the controller

Definition at line 195 of file controller.h.

◆ setDither()

CLEDController & CLEDController::setDither ( uint8_t  ditherMode = BINARY_DITHER)
inline

Set the dithering mode for this controller to use.

Parameters
ditherModethe dithering mode to set
Returns
a reference to the controller

Definition at line 183 of file controller.h.

◆ setLeds()

CLEDController & CLEDController::setLeds ( CRGB data,
int  nLeds 
)
inline

Set the default array of LEDs to be used by this controller.

Parameters
datapointer to the LED data
nLedsthe number of LEDs in the LED data

Definition at line 150 of file controller.h.

◆ setTemperature() [1/2]

CLEDController & CLEDController::setTemperature ( ColorTemperature  temperature)
inline

Set the color temperature, aka white point, for this controller.

Parameters
temperaturethe color temperature to set
Returns
a reference to the controller

Definition at line 207 of file controller.h.

◆ setTemperature() [2/2]

CLEDController & CLEDController::setTemperature ( CRGB  temperature)
inline

Set the color temperature, aka white point, for this controller.

Parameters
temperaturethe color temperature to set
Returns
a reference to the controller

Definition at line 204 of file controller.h.

◆ show() [1/2]

virtual void CLEDController::show ( const struct CRGB data,
int  nLeds,
CRGB  scale 
)
protectedpure virtual

Write the passed in RGB data out to the LEDs managed by this controller.

Parameters
datathe rgb data to write out to the strip
nLedsthe number of LEDs being written out
scalethe rgb scaling to apply to each led before writing it out

Implemented in CPixelLEDController< RGB_ORDER, LANES, MASK >, and CPixelLEDController< RGB >.

◆ show() [2/2]

void CLEDController::show ( const struct CRGB data,
int  nLeds,
uint8_t  brightness 
)
inline

Write the passed in RGB data out to the LEDs managed by this controller.

Will scale for color correction and temperature. Can accept LED data not attached to this controller.

Parameters
datathe LED data to write to the strip
nLedsthe number of LEDs in the data array
brightnessthe brightness of the LEDs
See also
show(const struct CRGB*, int, CRGB)

Definition at line 108 of file controller.h.

◆ showColor() [1/3]

virtual void CLEDController::showColor ( const struct CRGB data,
int  nLeds,
CRGB  scale 
)
protectedpure virtual

Set all the LEDs to a given color.

Parameters
datathe CRGB color to set the LEDs to
nLedsthe number of LEDs to set to this color
scalethe rgb scaling value for outputting color

Implemented in CPixelLEDController< RGB_ORDER, LANES, MASK >, and CPixelLEDController< RGB >.

◆ showColor() [2/3]

void CLEDController::showColor ( const struct CRGB data,
int  nLeds,
uint8_t  brightness 
)
inline

Set all the LEDs to a given color.

Will scale for color correction and temperature. Can accept LED data not attached to this controller.

Parameters
datathe CRGB color to set the LEDs to
nLedsthe number of LEDs in the data array
brightnessthe brightness of the LEDs
See also
showColor(const struct CRGB&, int, CRGB)

Definition at line 119 of file controller.h.

◆ showColor() [3/3]

void CLEDController::showColor ( const struct CRGB data,
uint8_t  brightness = 255 
)
inline

Set all the LEDs to a given color.

Parameters
datathe CRGB color to set the LEDs to
brightnessthe brightness of the LEDs
See also
showColor(const struct CRGB&, int, CRGB)

Definition at line 135 of file controller.h.

◆ showLeds()

void CLEDController::showLeds ( uint8_t  brightness = 255)
inline

Write the data to the LEDs managed by this controller.

Parameters
brightnessthe brightness of the LEDs
See also
show(const struct CRGB*, int, uint8_t)

Definition at line 126 of file controller.h.

◆ size()

virtual int CLEDController::size ( )
inlinevirtual

How many LEDs does this controller manage?

Returns
CLEDController::m_nLeds

Definition at line 165 of file controller.h.

Friends And Related Symbol Documentation

◆ CFastLED

friend class CFastLED
friend

Definition at line 63 of file controller.h.

Member Data Documentation

◆ m_ColorCorrection

CRGB CLEDController::m_ColorCorrection
protected

CRGB object representing the color correction to apply to the strip on show()

See also
setCorrection

Definition at line 66 of file controller.h.

◆ m_ColorTemperature

CRGB CLEDController::m_ColorTemperature
protected

CRGB object representing the color temperature to apply to the strip on show()

See also
setTemperature

Definition at line 67 of file controller.h.

◆ m_Data

CRGB* CLEDController::m_Data
protected

pointer to the LED data used by this controller

Definition at line 64 of file controller.h.

◆ m_DitherMode

EDitherMode CLEDController::m_DitherMode
protected

the current dither mode of the controller

Definition at line 68 of file controller.h.

◆ m_nLeds

int CLEDController::m_nLeds
protected

the number of LEDs in the LED data array

Definition at line 69 of file controller.h.

◆ m_pHead

CLEDController * CLEDController::m_pHead = NULL
staticprotected

pointer to the first LED controller in the linked list

Definition at line 70 of file controller.h.

◆ m_pNext

CLEDController* CLEDController::m_pNext
protected

pointer to the next LED controller in the linked list

Definition at line 65 of file controller.h.

◆ m_pTail

CLEDController * CLEDController::m_pTail = NULL
staticprotected

pointer to the last LED controller in the linked list

Definition at line 71 of file controller.h.


The documentation for this class was generated from the following files: