FastLED 3.9.7
|
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 71 of file pixel_controller.h.
#include <pixel_controller.h>
Public Types | |
enum | { kLanes = LANES , kMask = MASK } |
Public Member Functions | |
PixelIterator | as_iterator (const Rgbw &rgbw) |
void | disableColorAdjustment () |
PixelController (const PixelController &other) | |
Copy constructor. | |
template<EOrder RGB_ORDER_OTHER> | |
PixelController (const PixelController< RGB_ORDER_OTHER, LANES, MASK > &other) | |
template<typename PixelControllerT > | |
void | copy (const PixelControllerT &other) |
void | initOffsets (int len) |
Initialize the PixelController::mOffsets array based on the length of the strip. | |
PixelController (const uint8_t *d, int len, ColorAdjustment color_adjustment, EDitherMode dither, bool advance, uint8_t skip) | |
Constructor. | |
PixelController (const CRGB *d, int len, ColorAdjustment color_adjustment, EDitherMode dither) | |
Constructor. | |
PixelController (const CRGB &d, int len, ColorAdjustment color_adjustment, EDitherMode dither) | |
Constructor. | |
void | init_binary_dithering () |
Set up the values for binary dithering. | |
FASTLED_FORCE_INLINE 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()). | |
FASTLED_FORCE_INLINE int | size () |
Get the length of the LED strip. | |
FASTLED_FORCE_INLINE int | lanes () |
Get the number of lanes of the Controller. | |
FASTLED_FORCE_INLINE int | advanceBy () |
Get the amount to advance the pointer by. | |
FASTLED_FORCE_INLINE void | advanceData () |
Advance the data pointer forward, adjust position counter. | |
FASTLED_FORCE_INLINE void | stepDithering () |
Step the dithering forward. | |
FASTLED_FORCE_INLINE void | preStepFirstByteDithering () |
Some chipsets pre-cycle the first byte, which means we want to cycle byte 0's dithering separately. | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 (int lane, uint8_t scale) |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 (int lane, uint8_t scale) |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 (int lane, uint8_t scale) |
non-template alias of loadAndScale<2>() | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 (int lane, uint8_t scale) |
non-template alias of advanceAndLoadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 (int lane, uint8_t scale) |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 (int lane) |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 (int lane) |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 (int lane) |
non-template alias of loadAndScale<2>() | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 (int lane) |
non-template alias of advanceAndLoadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 (int lane) |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 () |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 () |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 () |
non-template alias of loadAndScale<2>() | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 () |
non-template alias of advanceAndLoadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 () |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE uint8_t | getScale0 () |
non-template alias of getscale<0>() | |
FASTLED_FORCE_INLINE uint8_t | getScale1 () |
non-template alias of getscale<1>() | |
FASTLED_FORCE_INLINE uint8_t | getScale2 () |
non-template alias of getscale<2>() | |
FASTLED_FORCE_INLINE void | loadAndScale_APA102_HD (uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *brightness_out) |
FASTLED_FORCE_INLINE void | loadAndScaleRGB (uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out) |
FASTLED_FORCE_INLINE void | loadAndScaleRGBW (Rgbw rgbw, uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *b3_out) |
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 FASTLED_FORCE_INLINE uint8_t | loadByte (PixelController &pc) |
Read a byte of LED data. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE uint8_t | loadByte (PixelController &pc, int lane) |
Read a byte of LED data for parallel output. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE uint8_t | dither (PixelController &pc, uint8_t b) |
Calculate a dither value using the per-channel dither data. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE uint8_t | dither (PixelController &, uint8_t b, uint8_t d) |
Calculate a dither value. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE uint8_t | scale (PixelController &pc, uint8_t b) |
Scale a value using the per-channel scale data. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale (PixelController &pc) |
A version of loadAndScale() that advances the output data pointer. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale (PixelController &pc, int lane) |
A version of loadAndScale() that advances the output data pointer. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE 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 FASTLED_FORCE_INLINE uint8_t | getd (PixelController &pc) |
Gets the dithering data for the provided output slot. | |
template<int SLOT> | |
static FASTLED_FORCE_INLINE 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 | |
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 | |
ColorAdjustment | mColorAdjustment |
anonymous enum |
Definition at line 81 of file pixel_controller.h.
|
inline |
Copy constructor.
other | the object to copy |
Definition at line 99 of file pixel_controller.h.
|
inline |
Definition at line 104 of file pixel_controller.h.
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
color_adjustment | LED scale values |
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 142 of file pixel_controller.h.
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
color_adjustment | LED scale values |
dither | dither setting for the LEDs |
Definition at line 157 of file pixel_controller.h.
|
inline |
Constructor.
d | pointer to LED data |
len | length of the LED data |
color_adjustment | LED scale values |
dither | dither setting for the LEDs |
Definition at line 171 of file pixel_controller.h.
|
inlinestatic |
A version of loadAndScale() that advances the output data pointer.
pc | reference to the pixel controller |
Definition at line 405 of file pixel_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 410 of file pixel_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 416 of file pixel_controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 463 of file pixel_controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 455 of file pixel_controller.h.
|
inline |
non-template alias of advanceAndLoadAndScale<0>()
Definition at line 449 of file pixel_controller.h.
|
inline |
Get the amount to advance the pointer by.
Definition at line 308 of file pixel_controller.h.
|
inline |
Advance the data pointer forward, adjust position counter.
Definition at line 311 of file pixel_controller.h.
|
inline |
Definition at line 86 of file pixel_controller.h.
|
inline |
Definition at line 109 of file pixel_controller.h.
|
inline |
Definition at line 90 of file pixel_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 354 of file pixel_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 348 of file pixel_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 291 of file pixel_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 431 of file pixel_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 438 of file pixel_controller.h.
|
inline |
non-template alias of getscale<0>()
Definition at line 466 of file pixel_controller.h.
|
inline |
non-template alias of getscale<1>()
Definition at line 467 of file pixel_controller.h.
|
inline |
non-template alias of getscale<2>()
Definition at line 468 of file pixel_controller.h.
|
inline |
Do we have n pixels left to process?
n | the number to check against |
Definition at line 282 of file pixel_controller.h.
|
inline |
Set up the values for binary dithering.
Definition at line 226 of file pixel_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 127 of file pixel_controller.h.
|
inline |
Get the number of lanes of the Controller.
Definition at line 304 of file pixel_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 379 of file pixel_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 385 of file pixel_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 393 of file pixel_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 400 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 460 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 452 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<0>()
Definition at line 446 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 461 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 453 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<1>()
Definition at line 447 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 462 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 454 of file pixel_controller.h.
|
inline |
non-template alias of loadAndScale<2>()
Definition at line 448 of file pixel_controller.h.
|
inline |
Definition at line 483 of file pixel_controller.h.
|
inline |
Definition at line 512 of file pixel_controller.h.
|
inline |
Definition at line 519 of file pixel_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 335 of file pixel_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 341 of file pixel_controller.h.
|
inline |
Some chipsets pre-cycle the first byte, which means we want to cycle byte 0's dithering separately.
Definition at line 324 of file pixel_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 367 of file pixel_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 361 of file pixel_controller.h.
|
inline |
Get the length of the LED strip.
Definition at line 300 of file pixel_controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 464 of file pixel_controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 456 of file pixel_controller.h.
|
inline |
stepDithering() and advanceAndLoadAndScale0()
Definition at line 450 of file pixel_controller.h.
|
inline |
Step the dithering forward.
Definition at line 315 of file pixel_controller.h.
uint8_t PixelController< RGB_ORDER, LANES, MASK >::d[3] |
values for the scaled dither signal
Definition at line 75 of file pixel_controller.h.
uint8_t PixelController< RGB_ORDER, LANES, MASK >::e[3] |
values for the scaled dither signal
Definition at line 76 of file pixel_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 77 of file pixel_controller.h.
ColorAdjustment PixelController< RGB_ORDER, LANES, MASK >::mColorAdjustment |
Definition at line 79 of file pixel_controller.h.
const uint8_t* PixelController< RGB_ORDER, LANES, MASK >::mData |
pointer to the underlying LED data
Definition at line 72 of file pixel_controller.h.
int PixelController< RGB_ORDER, LANES, MASK >::mLen |
number of LEDs in the data for one lane
Definition at line 73 of file pixel_controller.h.
int PixelController< RGB_ORDER, LANES, MASK >::mLenRemaining |
counter for the number of LEDs left to process
Definition at line 74 of file pixel_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 78 of file pixel_controller.h.