14 static void loadAndScaleRGBW(
void* pixel_controller,
Rgbw rgbw, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* b3_out) {
15 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
16 pc->loadAndScaleRGBW(rgbw, b0_out, b1_out, b2_out, b3_out);
19 static void loadAndScaleRGB(
void* pixel_controller, uint8_t* r_out, uint8_t* g_out, uint8_t* b_out) {
20 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
21 pc->loadAndScaleRGB(r_out, g_out, b_out);
24 static void loadAndScale_APA102_HD(
void* pixel_controller, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* brightness_out) {
25 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
26 pc->loadAndScale_APA102_HD(b0_out, b1_out, b2_out, brightness_out);
29 static void stepDithering(
void* pixel_controller) {
30 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
34 static void advanceData(
void* pixel_controller) {
35 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
39 static int size(
void* pixel_controller) {
40 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
43 static bool has(
void* pixel_controller,
int n) {
44 PixelControllerT* pc =
static_cast<PixelControllerT*
>(pixel_controller);
49typedef void (*loadAndScaleRGBWFunction)(
void* pixel_controller,
Rgbw rgbw, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* b3_out);
50typedef void (*loadAndScaleRGBFunction)(
void* pixel_controller, uint8_t* r_out, uint8_t* g_out, uint8_t* b_out);
51typedef void (*loadAndScale_APA102_HDFunction)(
void* pixel_controller, uint8_t* b0_out, uint8_t* b1_out, uint8_t* b2_out, uint8_t* brightness_out);
63 template<
typename PixelControllerT>
65 : mPixelController(pc), mRgbw(rgbw) {
91 mLoadAndScaleRGBW = &Vtable::loadAndScaleRGBW;
92 mLoadAndScaleRGB = &Vtable::loadAndScaleRGB;
93 mLoadAndScale_APA102_HD = &Vtable::loadAndScale_APA102_HD;
94 mStepDithering = &Vtable::stepDithering;
95 mAdvanceData = &Vtable::advanceData;
96 mSize = &Vtable::size;
100 bool has(
int n) {
return mHas(mPixelController, n); }
101 void loadAndScaleRGBW(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *w_out) {
102 mLoadAndScaleRGBW(mPixelController, mRgbw, b0_out, b1_out, b2_out, w_out);
104 void loadAndScaleRGB(uint8_t *r_out, uint8_t *g_out, uint8_t *b_out) {
105 mLoadAndScaleRGB(mPixelController, r_out, g_out, b_out);
107 void loadAndScale_APA102_HD(uint8_t *b0_out, uint8_t *b1_out, uint8_t *b2_out, uint8_t *brightness_out) {
108 mLoadAndScale_APA102_HD(mPixelController, b0_out, b1_out, b2_out, brightness_out);
110 void stepDithering() { mStepDithering(mPixelController); }
111 void advanceData() { mAdvanceData(mPixelController); }
112 int size() {
return mSize(mPixelController); }
114 void set_rgbw(
Rgbw rgbw) { mRgbw = rgbw; }
115 Rgbw get_rgbw()
const {
return mRgbw; }
119 void* mPixelController =
nullptr;
121 loadAndScaleRGBWFunction mLoadAndScaleRGBW =
nullptr;
122 loadAndScaleRGBFunction mLoadAndScaleRGB =
nullptr;
123 loadAndScale_APA102_HDFunction mLoadAndScale_APA102_HD =
nullptr;
124 stepDitheringFunction mStepDithering =
nullptr;
125 advanceDataFunction mAdvanceData =
nullptr;
126 sizeFunction mSize =
nullptr;
127 hasFunction mHas =
nullptr;