5#include "force_inline.h"
22 kRGBWDefaultColorTemp = 6000,
26 explicit Rgbw(uint16_t white_color_temp = kRGBWDefaultColorTemp,
27 RGBW_MODE rgbw_mode = kRGBWExactColors,
28 EOrderW _w_placement = WDefault)
29 : white_color_temp(white_color_temp), w_placement(_w_placement),
30 rgbw_mode(rgbw_mode) {}
31 uint16_t white_color_temp = kRGBWDefaultColorTemp;
32 EOrderW w_placement = WDefault;
33 RGBW_MODE rgbw_mode = kRGBWExactColors;
34 FASTLED_FORCE_INLINE
bool active()
const {
35 return rgbw_mode != kRGBWInvalid;
41 white_color_temp = kRGBWDefaultColorTemp;
42 rgbw_mode = kRGBWInvalid;
52 white_color_temp = kRGBWDefaultColorTemp;
53 rgbw_mode = kRGBWExactColors;
61typedef void (*rgb_2_rgbw_function)(uint16_t w_color_temperature, uint8_t r,
62 uint8_t g, uint8_t b, uint8_t r_scale,
63 uint8_t g_scale, uint8_t b_scale,
64 uint8_t *out_r, uint8_t *out_g,
65 uint8_t *out_b, uint8_t *out_w);
77void rgb_2_rgbw_exact(uint16_t w_color_temperature, uint8_t r, uint8_t g,
78 uint8_t b, uint8_t r_scale, uint8_t g_scale,
79 uint8_t b_scale, uint8_t *out_r, uint8_t *out_g,
80 uint8_t *out_b, uint8_t *out_w);
87void rgb_2_rgbw_max_brightness(uint16_t w_color_temperature, uint8_t r,
88 uint8_t g, uint8_t b, uint8_t r_scale,
89 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
90 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
94void rgb_2_rgbw_null_white_pixel(uint16_t w_color_temperature, uint8_t r,
95 uint8_t g, uint8_t b, uint8_t r_scale,
96 uint8_t g_scale, uint8_t b_scale,
97 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b,
101void rgb_2_rgbw_white_boosted(uint16_t w_color_temperature, uint8_t r,
102 uint8_t g, uint8_t b, uint8_t r_scale,
103 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
104 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
106void rgb_2_rgbw_user_function(uint16_t w_color_temperature, uint8_t r,
107 uint8_t g, uint8_t b, uint8_t r_scale,
108 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
109 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
111void set_rgb_2_rgbw_function(rgb_2_rgbw_function func);
114FASTLED_FORCE_INLINE
void rgb_2_rgbw(
118 RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g,
119 uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale,
120 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
123 case kRGBWNullWhitePixel:
124 rgb_2_rgbw_null_white_pixel(w_color_temperature, r, g, b, r_scale,
125 g_scale, b_scale, out_r, out_g, out_b,
128 case kRGBWExactColors:
129 rgb_2_rgbw_exact(w_color_temperature, r, g, b, r_scale, g_scale,
130 b_scale, out_r, out_g, out_b, out_w);
132 case kRGBWBoostedWhite:
133 rgb_2_rgbw_white_boosted(w_color_temperature, r, g, b, r_scale, g_scale,
134 b_scale, out_r, out_g, out_b, out_w);
136 case kRGBWMaxBrightness:
137 rgb_2_rgbw_max_brightness(w_color_temperature, r, g, b, r_scale,
138 g_scale, b_scale, out_r, out_g, out_b, out_w);
140 case kRGBWUserFunction:
141 rgb_2_rgbw_user_function(w_color_temperature, r, g, b, r_scale, g_scale,
142 b_scale, out_r, out_g, out_b, out_w);
145 rgb_2_rgbw_null_white_pixel(w_color_temperature, r, g, b, r_scale, g_scale,
146 b_scale, out_r, out_g, out_b, out_w);
150template <RGBW_MODE MODE>
151FASTLED_FORCE_INLINE
void
152rgb_2_rgbw(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b,
153 uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
154 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
156 rgb_2_rgbw(MODE, w_color_temperature, r, g, b, r_scale, g_scale, b_scale,
157 out_r, out_g, out_b, out_w);
166void rgbw_partial_reorder(EOrderW w_placement, uint8_t b0, uint8_t b1,
167 uint8_t b2, uint8_t w, uint8_t *out_b0,
168 uint8_t *out_b1, uint8_t *out_b2, uint8_t *out_b3);