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;
41 static uint32_t size_as_rgb(uint32_t num_of_rgbw_pixels) {
46 num_of_rgbw_pixels = (num_of_rgbw_pixels * 4 + 2) / 3;
47 uint32_t extra = num_of_rgbw_pixels % 3 ? 1 : 0;
48 num_of_rgbw_pixels += extra;
49 return num_of_rgbw_pixels;
55 white_color_temp = kRGBWDefaultColorTemp;
56 rgbw_mode = kRGBWInvalid;
66 white_color_temp = kRGBWDefaultColorTemp;
67 rgbw_mode = kRGBWExactColors;
77 white_color_temp = kRGBWDefaultColorTemp;
78 rgbw_mode = kRGBWNullWhitePixel;
86typedef void (*rgb_2_rgbw_function)(uint16_t w_color_temperature, uint8_t r,
87 uint8_t g, uint8_t b, uint8_t r_scale,
88 uint8_t g_scale, uint8_t b_scale,
89 uint8_t *out_r, uint8_t *out_g,
90 uint8_t *out_b, uint8_t *out_w);
106 uint8_t b, uint8_t r_scale, uint8_t g_scale,
107 uint8_t b_scale, uint8_t *out_r, uint8_t *out_g,
108 uint8_t *out_b, uint8_t *out_w);
119 uint8_t g, uint8_t b, uint8_t r_scale,
120 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
121 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
129 uint8_t g, uint8_t b, uint8_t r_scale,
130 uint8_t g_scale, uint8_t b_scale,
131 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b,
136 uint8_t g, uint8_t b, uint8_t r_scale,
137 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
138 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
140void rgb_2_rgbw_user_function(uint16_t w_color_temperature, uint8_t r,
141 uint8_t g, uint8_t b, uint8_t r_scale,
142 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
143 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
145void set_rgb_2_rgbw_function(rgb_2_rgbw_function func);
151 RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g,
152 uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale,
153 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
156 case kRGBWNullWhitePixel:
158 g_scale, b_scale, out_r, out_g, out_b,
161 case kRGBWExactColors:
163 b_scale, out_r, out_g, out_b, out_w);
165 case kRGBWBoostedWhite:
167 b_scale, out_r, out_g, out_b, out_w);
169 case kRGBWMaxBrightness:
171 g_scale, b_scale, out_r, out_g, out_b, out_w);
173 case kRGBWUserFunction:
174 rgb_2_rgbw_user_function(w_color_temperature, r, g, b, r_scale, g_scale,
175 b_scale, out_r, out_g, out_b, out_w);
179 b_scale, out_r, out_g, out_b, out_w);
183template <RGBW_MODE MODE>
184FASTLED_FORCE_INLINE
void
185rgb_2_rgbw(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b,
186 uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
187 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
189 rgb_2_rgbw(MODE, w_color_temperature, r, g, b, r_scale, g_scale, b_scale,
190 out_r, out_g, out_b, out_w);
199void rgbw_partial_reorder(
EOrderW w_placement, uint8_t b0, uint8_t b1,
200 uint8_t b2, uint8_t w, uint8_t *out_b0,
201 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.