8#include "fl/force_inline.h"
25 kRGBWDefaultColorTemp = 6000,
29 explicit Rgbw(uint16_t white_color_temp = kRGBWDefaultColorTemp,
30 RGBW_MODE rgbw_mode = kRGBWExactColors,
31 EOrderW _w_placement = WDefault)
32 : white_color_temp(white_color_temp), w_placement(_w_placement),
33 rgbw_mode(rgbw_mode) {}
34 uint16_t white_color_temp = kRGBWDefaultColorTemp;
36 RGBW_MODE rgbw_mode = kRGBWExactColors;
37 FASTLED_FORCE_INLINE
bool active()
const {
38 return rgbw_mode != kRGBWInvalid;
44 white_color_temp = kRGBWDefaultColorTemp;
45 rgbw_mode = kRGBWInvalid;
55 white_color_temp = kRGBWDefaultColorTemp;
56 rgbw_mode = kRGBWExactColors;
66 white_color_temp = kRGBWDefaultColorTemp;
67 rgbw_mode = kRGBWNullWhitePixel;
75typedef void (*rgb_2_rgbw_function)(uint16_t w_color_temperature, uint8_t r,
76 uint8_t g, uint8_t b, uint8_t r_scale,
77 uint8_t g_scale, uint8_t b_scale,
78 uint8_t *out_r, uint8_t *out_g,
79 uint8_t *out_b, uint8_t *out_w);
95 uint8_t b, uint8_t r_scale, uint8_t g_scale,
96 uint8_t b_scale, uint8_t *out_r, uint8_t *out_g,
97 uint8_t *out_b, uint8_t *out_w);
108 uint8_t g, uint8_t b, uint8_t r_scale,
109 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
110 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
118 uint8_t g, uint8_t b, uint8_t r_scale,
119 uint8_t g_scale, uint8_t b_scale,
120 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b,
125 uint8_t g, uint8_t b, uint8_t r_scale,
126 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
127 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
129void rgb_2_rgbw_user_function(uint16_t w_color_temperature, uint8_t r,
130 uint8_t g, uint8_t b, uint8_t r_scale,
131 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
132 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
134void set_rgb_2_rgbw_function(rgb_2_rgbw_function func);
140 RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g,
141 uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale,
142 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
145 case kRGBWNullWhitePixel:
147 g_scale, b_scale, out_r, out_g, out_b,
150 case kRGBWExactColors:
152 b_scale, out_r, out_g, out_b, out_w);
154 case kRGBWBoostedWhite:
156 b_scale, out_r, out_g, out_b, out_w);
158 case kRGBWMaxBrightness:
160 g_scale, b_scale, out_r, out_g, out_b, out_w);
162 case kRGBWUserFunction:
163 rgb_2_rgbw_user_function(w_color_temperature, r, g, b, r_scale, g_scale,
164 b_scale, out_r, out_g, out_b, out_w);
168 b_scale, out_r, out_g, out_b, out_w);
172template <RGBW_MODE MODE>
173FASTLED_FORCE_INLINE
void
174rgb_2_rgbw(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b,
175 uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
176 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
178 rgb_2_rgbw(MODE, w_color_temperature, r, g, b, r_scale, g_scale, b_scale,
179 out_r, out_g, out_b, out_w);
188void rgbw_partial_reorder(
EOrderW w_placement, uint8_t b0, uint8_t b1,
189 uint8_t b2, uint8_t w, uint8_t *out_b0,
190 uint8_t *out_b1, uint8_t *out_b2, uint8_t *out_b3);
Defines color channel ordering enumerations.
Implements the FastLED namespace macros.
#define FASTLED_NAMESPACE_END
End of the FastLED namespace.
#define FASTLED_NAMESPACE_BEGIN
Start of the FastLED namespace.
void rgb_2_rgbw_null_white_pixel(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
Converts RGB to RGBW with the W channel set to black, always.
void rgb_2_rgbw_max_brightness(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
The minimum brigthness of the RGB channels is used to set the W channel.
void rgb_2_rgbw_white_boosted(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
Converts RGB to RGBW with a boosted white channel.
void rgb_2_rgbw_exact(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
Converts RGB to RGBW using a color transfer method from saturated color channels to white.
FASTLED_FORCE_INLINE void rgb_2_rgbw(RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w)
Converts RGB to RGBW using one of the functions.