FastLED 3.6.0
|
Pixel controller class.
This is the class that we use to centralize pixel access in a block of data, including support for things like RGB reordering, scaling, dithering, skipping (for ARGB data), and eventually, we will centralize 8/12/16 conversions here as well.
RGB_ORDER | the rgb ordering for the LEDs (e.g. what order red, green, and blue data is written out in) |
LANES | how many parallel lanes of output to write |
MASK | bitmask for the output lanes |
Definition at line 259 of file controller.h.
#include <controller.h>
Public Member Functions | |
PixelController (const PixelController &other) | |
Copy constructor. | |
void | initOffsets (int len) |
Initialize the PixelController::mOffsets array based on the length of the strip. | |
PixelController (const uint8_t *d, int len, CRGB &s, EDitherMode dither=BINARY_DITHER, bool advance=true, uint8_t skip=0) | |
Constructor. | |
PixelController (const CRGB *d, int len, CRGB &s, EDitherMode dither=BINARY_DITHER) | |
Constructor. | |
PixelController (const CRGB &d, int len, CRGB &s, EDitherMode dither=BINARY_DITHER) | |
Constructor. | |
void | init_binary_dithering () |
Set up the values for binary dithering. | |
bool | has (int n) |
Do we have n pixels left to process? | |
void | enable_dithering (EDitherMode dither) |
Toggle dithering enable If dithering is set to enabled, this will re-init the dithering values (init_binary_dithering()). | |
int | size () |
Get the length of the LED strip. | |
int | lanes () |
Get the number of lanes of the Controller. | |
int | advanceBy () |
Get the amount to advance the pointer by. | |
void | advanceData () |
Advance the data pointer forward, adjust position counter. | |
void | stepDithering () |
Step the dithering forward. | |
void | preStepFirstByteDithering () |
Some chipsets pre-cycle the first byte, which means we want to cycle byte 0's dithering separately. | |
uint8_t | loadAndScale0 (int lane, uint8_t scale) |
non-template alias of loadAndScale<0>() | |
uint8_t | loadAndScale1 (int lane, uint8_t scale) |
non-template alias of loadAndScale<1>() | |
uint8_t | loadAndScale2 (int lane, uint8_t scale) |
non-template alias of loadAndScale<2>() | |
uint8_t | advanceAndLoadAndScale0 (int lane, uint8_t scale) |
non-template alias of advanceAndLoadAndScale<0>() | |
uint8_t | stepAdvanceAndLoadAndScale0 (int lane, uint8_t scale) |
stepDithering() and advanceAndLoadAndScale0() | |
uint8_t | loadAndScale0 (int lane) |
non-template alias of loadAndScale<0>() | |
uint8_t | loadAndScale1 (int lane) |
non-template alias of loadAndScale<1>() | |
uint8_t | loadAndScale2 (int lane) |
non-template alias of loadAndScale<2>() | |
uint8_t | advanceAndLoadAndScale0 (int lane) |
non-template alias of advanceAndLoadAndScale<0>() | |
uint8_t | stepAdvanceAndLoadAndScale0 (int lane) |
stepDithering() and advanceAndLoadAndScale0() | |
uint8_t | loadAndScale0 () |
non-template alias of loadAndScale<0>() | |
uint8_t | loadAndScale1 () |
non-template alias of loadAndScale<1>() | |
uint8_t | loadAndScale2 () |
non-template alias of loadAndScale<2>() | |
uint8_t | advanceAndLoadAndScale0 () |
non-template alias of advanceAndLoadAndScale<0>() | |
uint8_t | stepAdvanceAndLoadAndScale0 () |
stepDithering() and advanceAndLoadAndScale0() | |
uint8_t | getScale0 () |
non-template alias of getscale<0>() | |
uint8_t | getScale1 () |
non-template alias of getscale<1>() | |
uint8_t | getScale2 () |
non-template alias of getscale<2>() | |
Static Public Member Functions | |
Template'd static functions for output | |
These functions are used for retrieving LED data for the LED chipset output controllers. | |
template<int SLOT> | |
static uint8_t | loadByte (PixelController &pc) |
Read a byte of LED data. | |
template<int SLOT> | |
static uint8_t | loadByte (PixelController &pc, int lane) |
Read a byte of LED data for parallel output. | |
template<int SLOT> | |
static uint8_t | dither (PixelController &pc, uint8_t b) |
Calculate a dither value using the per-channel dither data. | |
template<int SLOT> | |
static uint8_t | dither (PixelController &, uint8_t b, uint8_t d) |
Calculate a dither value. | |
template<int SLOT> | |
static uint8_t | scale (PixelController &pc, uint8_t b) |
Scale a value using the per-channel scale data. | |
template<int SLOT> | |
static uint8_t | scale (PixelController &, uint8_t b, uint8_t scale) |
Scale a value. | |
Composite shortcut functions for loading, dithering, and scaling | |
These composite functions will load color data, dither it, and scale it all at once so that it's ready for the output controller to send to the LEDs. | |
template<int SLOT> | |
static uint8_t | loadAndScale (PixelController &pc) |
Loads, dithers, and scales a single byte for a given output slot, using class dither and scale values. | |
template<int SLOT> | |
static uint8_t | loadAndScale (PixelController &pc, int lane) |
Loads, dithers, and scales a single byte for a given output slot and lane, using class dither and scale values. | |
template<int SLOT> | |
static uint8_t | loadAndScale (PixelController &pc, int lane, uint8_t d, uint8_t scale) |
Loads, dithers, and scales a single byte for a given output slot and lane. | |
template<int SLOT> | |
static uint8_t | loadAndScale (PixelController &pc, int lane, uint8_t scale) |
Loads and scales a single byte for a given output slot and lane. | |
template<int SLOT> | |
static uint8_t | advanceAndLoadAndScale (PixelController &pc) |
A version of loadAndScale() that advances the output data pointer. | |
template<int SLOT> | |
static uint8_t | advanceAndLoadAndScale (PixelController &pc, int lane) |
A version of loadAndScale() that advances the output data pointer. | |
template<int SLOT> | |
static uint8_t | advanceAndLoadAndScale (PixelController &pc, int lane, uint8_t scale) |
A version of loadAndScale() that advances the output data pointer without dithering. | |
Data retrieval functions | |
These functions retrieve channel-specific data from the class, arranged in output order. | |
template<int SLOT> | |
static uint8_t | getd (PixelController &pc) |
Gets the dithering data for the provided output slot. | |
template<int SLOT> | |
static uint8_t | getscale (PixelController &pc) |
Gets the scale data for the provided output slot. | |
Public Attributes | |
const uint8_t * | mData |
pointer to the underlying LED data | |
int | mLen |
number of LEDs in the data for one lane | |
int | mLenRemaining |
counter for the number of LEDs left to process | |
uint8_t | d [3] |
values for the scaled dither signal | |
uint8_t | e [3] |
values for the scaled dither signal | |
CRGB | mScale |
the per-channel scale values, provided by a color correction function such as CLEDController::computeAdjustment() | |
int8_t | mAdvance |
how many bytes to advance the pointer by each time. For CRGB this is 3. | |
int | mOffsets [LANES] |
the number of bytes to offset each lane from the starting pointer | |
|
inline |
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
s | LED scale values, as CRGB struct |
dither | dither setting for the LEDs |
advance | whether the pointer (d) should advance per LED |
skip | if the pointer is advancing, how many bytes to skip in addition to 3 |
Definition at line 302 of file controller.h.
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
s | LED scale values, as CRGB struct |
dither | dither setting for the LEDs |
Definition at line 314 of file controller.h.
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
s | LED scale values, as CRGB struct |
dither | dither setting for the LEDs |
Definition at line 325 of file controller.h.
|
inlinestatic |
A version of loadAndScale() that advances the output data pointer.
pc | reference to the pixel controller |
Definition at line 548 of file controller.h.
|
inlinestatic |
A version of loadAndScale() that advances the output data pointer.
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
Definition at line 553 of file controller.h.
|
inlinestatic |
A version of loadAndScale() that advances the output data pointer without dithering.
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
scale | the scale data for the byte |
Definition at line 559 of file controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 604 of file controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 598 of file controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 592 of file controller.h.
|
inline |
Get the amount to advance the pointer by.
Definition at line 454 of file controller.h.
|
inline |
Advance the data pointer forward, adjust position counter.
Definition at line 457 of file controller.h.
|
inlinestatic |
Calculate a dither value.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
b | the color byte to dither |
d | dither data |
Definition at line 498 of file controller.h.
|
inlinestatic |
Calculate a dither value using the per-channel dither data.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
b | the color byte to dither |
Definition at line 493 of file controller.h.
|
inline |
Toggle dithering enable If dithering is set to enabled, this will re-init the dithering values (init_binary_dithering()).
Otherwise it will clear the stored dithering data.
dither | the dither setting |
Definition at line 437 of file controller.h.
|
inlinestatic |
Gets the dithering data for the provided output slot.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
Definition at line 574 of file controller.h.
|
inlinestatic |
Gets the scale data for the provided output slot.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
Definition at line 581 of file controller.h.
|
inline |
non-template alias of getscale<0>()
Definition at line 607 of file controller.h.
|
inline |
non-template alias of getscale<1>()
Definition at line 608 of file controller.h.
|
inline |
non-template alias of getscale<2>()
Definition at line 609 of file controller.h.
|
inline |
Do we have n pixels left to process?
n | the number to check against |
Definition at line 428 of file controller.h.
|
inline |
Set up the values for binary dithering.
Definition at line 372 of file controller.h.
|
inline |
Initialize the PixelController::mOffsets array based on the length of the strip.
len | the number of LEDs in one lane of the strip |
Definition at line 287 of file controller.h.
|
inline |
Get the number of lanes of the Controller.
Definition at line 450 of file controller.h.
|
inlinestatic |
Loads, dithers, and scales a single byte for a given output slot, using class dither and scale values.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
Definition at line 522 of file controller.h.
|
inlinestatic |
Loads, dithers, and scales a single byte for a given output slot and lane, using class dither and scale values.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
Definition at line 528 of file controller.h.
|
inlinestatic |
Loads, dithers, and scales a single byte for a given output slot and lane.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
d | the dither data for the byte |
scale | the scale data for the byte |
Definition at line 536 of file controller.h.
|
inlinestatic |
Loads and scales a single byte for a given output slot and lane.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
scale | the scale data for the byte |
Definition at line 543 of file controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 601 of file controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 595 of file controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 589 of file controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 602 of file controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 596 of file controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 590 of file controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 603 of file controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 597 of file controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 591 of file controller.h.
|
inlinestatic |
Read a byte of LED data.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
Definition at line 481 of file controller.h.
|
inlinestatic |
Read a byte of LED data for parallel output.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
lane | the parallel output lane to read the byte for |
Definition at line 486 of file controller.h.
|
inline |
Some chipsets pre-cycle the first byte, which means we want to cycle byte 0's dithering separately.
Definition at line 470 of file controller.h.
|
inlinestatic |
Scale a value.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
b | the byte to scale |
scale | the scale value |
Definition at line 510 of file controller.h.
|
inlinestatic |
Scale a value using the per-channel scale data.
SLOT | The data slot in the output stream. This is used to select which byte of the output stream is being processed. |
pc | reference to the pixel controller |
b | the color byte to scale |
Definition at line 505 of file controller.h.
|
inline |
Get the length of the LED strip.
Definition at line 446 of file controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 605 of file controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 599 of file controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 593 of file controller.h.
|
inline |
Step the dithering forward.
Definition at line 461 of file controller.h.
uint8_t PixelController< RGB_ORDER, LANES, MASK >::d[3] |
values for the scaled dither signal
Definition at line 263 of file controller.h.
uint8_t PixelController< RGB_ORDER, LANES, MASK >::e[3] |
values for the scaled dither signal
Definition at line 264 of file controller.h.
int8_t PixelController< RGB_ORDER, LANES, MASK >::mAdvance |
how many bytes to advance the pointer by each time. For CRGB this is 3.
Definition at line 266 of file controller.h.
const uint8_t* PixelController< RGB_ORDER, LANES, MASK >::mData |
pointer to the underlying LED data
Definition at line 260 of file controller.h.
int PixelController< RGB_ORDER, LANES, MASK >::mLen |
number of LEDs in the data for one lane
Definition at line 261 of file controller.h.
int PixelController< RGB_ORDER, LANES, MASK >::mLenRemaining |
counter for the number of LEDs left to process
Definition at line 262 of file controller.h.
int PixelController< RGB_ORDER, LANES, MASK >::mOffsets[LANES] |
the number of bytes to offset each lane from the starting pointer
Definition at line 267 of file controller.h.
CRGB PixelController< RGB_ORDER, LANES, MASK >::mScale |
the per-channel scale values, provided by a color correction function such as CLEDController::computeAdjustment()
Definition at line 265 of file controller.h.