FastLED 3.9.15
|
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 | |
PixelController (const CRGB &d, int len, ColorAdjustment color_adjustment, EDitherMode dither) | |
Constructor. | |
PixelController (const CRGB *d, int len, ColorAdjustment color_adjustment, EDitherMode dither) | |
Constructor. | |
PixelController (const PixelController &other) | |
Copy constructor. | |
template<EOrder RGB_ORDER_OTHER> | |
PixelController (const PixelController< RGB_ORDER_OTHER, LANES, MASK > &other) | |
PixelController (const uint8_t *d, int len, ColorAdjustment color_adjustment, EDitherMode dither, bool advance, uint8_t skip) | |
Constructor. | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 () |
non-template alias of advanceAndLoadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 (int lane) |
non-template alias of advanceAndLoadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | advanceAndLoadAndScale0 (int lane, uint8_t scale) |
non-template alias of advanceAndLoadAndScale<0>() | |
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 PixelIterator | as_iterator (const Rgbw &rgbw) |
template<typename PixelControllerT> | |
void | copy (const PixelControllerT &other) |
void | disableColorAdjustment () |
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 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 bool | has (int n) |
Do we have n pixels left to process? | |
void | init_binary_dithering () |
Set up the values for binary dithering. | |
void | initOffsets (int len) |
Initialize the PixelController::mOffsets array based on the length of the strip. | |
FASTLED_FORCE_INLINE int | lanes () |
Get the number of lanes of the Controller. | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 () |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 (int lane) |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale0 (int lane, uint8_t scale) |
non-template alias of loadAndScale<0>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 () |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 (int lane) |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale1 (int lane, uint8_t scale) |
non-template alias of loadAndScale<1>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 () |
non-template alias of loadAndScale<2>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 (int lane) |
non-template alias of loadAndScale<2>() | |
FASTLED_FORCE_INLINE uint8_t | loadAndScale2 (int lane, uint8_t scale) |
non-template alias of loadAndScale<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 | loadAndScale_WS2816_HD (uint16_t *s0_out, uint16_t *s1_out, uint16_t *s2_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) |
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 int | size () |
Get the length of the LED strip. | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 () |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 (int lane) |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE uint8_t | stepAdvanceAndLoadAndScale0 (int lane, uint8_t scale) |
stepDithering() and advanceAndLoadAndScale0() | |
FASTLED_FORCE_INLINE void | stepDithering () |
Step the dithering forward. | |
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 | |
uint8_t | d [3] |
values for the scaled dither signal | |
uint8_t | e [3] |
values for the unscaled dither signal | |
int8_t | mAdvance |
how many bytes to advance the pointer by each time. For CRGB this is 3. | |
ColorAdjustment | mColorAdjustment |
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 | |
int | mOffsets [LANES] |
the number of bytes to offset each lane from the starting pointer | |