19 static void loadAndScaleRGBW(
void* pixel_controller,
Rgbw rgbw, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* b3_out) {
20 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
21 pc->loadAndScaleRGBW(rgbw, b0_out, b1_out, b2_out, b3_out);
24 static void loadAndScaleRGB(
void* pixel_controller, uint8_t* r_out, uint8_t* g_out, uint8_t* b_out) {
25 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
26 pc->loadAndScaleRGB(r_out, g_out, b_out);
29 static void loadAndScale_APA102_HD(
void* pixel_controller, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* brightness_out) {
30 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
31 pc->loadAndScale_APA102_HD(b0_out, b1_out, b2_out, brightness_out);
34 static void loadAndScale_WS2816_HD(
void* pixel_controller, uint16_t *s0_out, uint16_t* s1_out, uint16_t* s2_out) {
35 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
36 pc->loadAndScale_WS2816_HD(s0_out, s1_out, s2_out);
39 static void stepDithering(
void* pixel_controller) {
40 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
44 static void advanceData(
void* pixel_controller) {
45 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
49 static int size(
void* pixel_controller) {
50 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
53 static bool has(
void* pixel_controller,
int n) {
54 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
59 #if FASTLED_HD_COLOR_MIXING
60 static void getHdScale(
void* pixel_controller, uint8_t* c0, uint8_t* c1, uint8_t* c2, uint8_t* brightness) {
61 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
62 pc->getHdScale(c0, c1, c2, brightness);
67typedef void (*loadAndScaleRGBWFunction)(
void* pixel_controller,
Rgbw rgbw, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* b3_out);
68typedef void (*loadAndScaleRGBFunction)(
void* pixel_controller, uint8_t* r_out, uint8_t* g_out, uint8_t* b_out);
69typedef void (*loadAndScale_APA102_HDFunction)(
void* pixel_controller, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* brightness_out);
70typedef void (*loadAndScale_WS2816_HDFunction)(
void* pixel_controller, uint16_t* b0_out, uint16_t* b1_out, uint16_t* b2_out);
76typedef void (*getHdScaleFunction)(
void* pixel_controller, uint8_t* c0, uint8_t* c1, uint8_t* c2, uint8_t* brightness);
87 template<
typename PixelControllerT>
89 : mPixelController(pc), mRgbw(rgbw) {
115 mLoadAndScaleRGBW = &Vtable::loadAndScaleRGBW;
116 mLoadAndScaleRGB = &Vtable::loadAndScaleRGB;
117 mLoadAndScale_APA102_HD = &Vtable::loadAndScale_APA102_HD;
118 mLoadAndScale_WS2816_HD = &Vtable::loadAndScale_WS2816_HD;
119 mStepDithering = &Vtable::stepDithering;
120 mAdvanceData = &Vtable::advanceData;
121 mSize = &Vtable::size;
123 #if FASTLED_HD_COLOR_MIXING
124 mGetHdScale = &Vtable::getHdScale;
128 bool has(
int n) {
return mHas(mPixelController, n); }
129 void loadAndScaleRGBW(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *w_out) {
130 mLoadAndScaleRGBW(mPixelController, mRgbw, b0_out, b1_out, b2_out, w_out);
132 void loadAndScaleRGB(uint8_t *r_out, uint8_t *g_out, uint8_t *b_out) {
133 mLoadAndScaleRGB(mPixelController, r_out, g_out, b_out);
135 void loadAndScale_APA102_HD(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *brightness_out) {
136 mLoadAndScale_APA102_HD(mPixelController, b0_out, b1_out, b2_out, brightness_out);
138 void loadAndScale_WS2816_HD(uint16_t *s0_out, uint16_t *s1_out, uint16_t *s2_out) {
139 mLoadAndScale_WS2816_HD(mPixelController, s0_out, s1_out, s2_out);
141 void stepDithering() { mStepDithering(mPixelController); }
142 void advanceData() { mAdvanceData(mPixelController); }
143 int size() {
return mSize(mPixelController); }
145 void set_rgbw(
Rgbw rgbw) { mRgbw = rgbw; }
146 Rgbw get_rgbw()
const {
return mRgbw; }
148 #if FASTLED_HD_COLOR_MIXING
149 void getHdScale(uint8_t* c0, uint8_t* c1, uint8_t* c2, uint8_t* brightness) {
150 mGetHdScale(mPixelController, c0, c1, c2, brightness);
156 void* mPixelController =
nullptr;
158 loadAndScaleRGBWFunction mLoadAndScaleRGBW =
nullptr;
159 loadAndScaleRGBFunction mLoadAndScaleRGB =
nullptr;
160 loadAndScale_APA102_HDFunction mLoadAndScale_APA102_HD =
nullptr;
161 loadAndScale_WS2816_HDFunction mLoadAndScale_WS2816_HD =
nullptr;
162 stepDitheringFunction mStepDithering =
nullptr;
163 advanceDataFunction mAdvanceData =
nullptr;
164 sizeFunction mSize =
nullptr;
165 hasFunction mHas =
nullptr;
166 #if FASTLED_HD_COLOR_MIXING
167 getHdScaleFunction mGetHdScale =
nullptr;