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;
63 white_color_temp = kRGBWDefaultColorTemp;
64 rgbw_mode = kRGBWNullWhitePixel;
72typedef void (*rgb_2_rgbw_function)(uint16_t w_color_temperature, uint8_t r,
73 uint8_t g, uint8_t b, uint8_t r_scale,
74 uint8_t g_scale, uint8_t b_scale,
75 uint8_t *out_r, uint8_t *out_g,
76 uint8_t *out_b, uint8_t *out_w);
88void rgb_2_rgbw_exact(uint16_t w_color_temperature, uint8_t r, uint8_t g,
89 uint8_t b, uint8_t r_scale, uint8_t g_scale,
90 uint8_t b_scale, uint8_t *out_r, uint8_t *out_g,
91 uint8_t *out_b, uint8_t *out_w);
98void rgb_2_rgbw_max_brightness(uint16_t w_color_temperature, uint8_t r,
99 uint8_t g, uint8_t b, uint8_t r_scale,
100 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
101 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
105void rgb_2_rgbw_null_white_pixel(uint16_t w_color_temperature, uint8_t r,
106 uint8_t g, uint8_t b, uint8_t r_scale,
107 uint8_t g_scale, uint8_t b_scale,
108 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b,
112void rgb_2_rgbw_white_boosted(uint16_t w_color_temperature, uint8_t r,
113 uint8_t g, uint8_t b, uint8_t r_scale,
114 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
115 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
117void rgb_2_rgbw_user_function(uint16_t w_color_temperature, uint8_t r,
118 uint8_t g, uint8_t b, uint8_t r_scale,
119 uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
120 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w);
122void set_rgb_2_rgbw_function(rgb_2_rgbw_function func);
125FASTLED_FORCE_INLINE
void rgb_2_rgbw(
129 RGBW_MODE mode, uint16_t w_color_temperature, uint8_t r, uint8_t g,
130 uint8_t b, uint8_t r_scale, uint8_t g_scale, uint8_t b_scale,
131 uint8_t *out_r, uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
134 case kRGBWNullWhitePixel:
135 rgb_2_rgbw_null_white_pixel(w_color_temperature, r, g, b, r_scale,
136 g_scale, b_scale, out_r, out_g, out_b,
139 case kRGBWExactColors:
140 rgb_2_rgbw_exact(w_color_temperature, r, g, b, r_scale, g_scale,
141 b_scale, out_r, out_g, out_b, out_w);
143 case kRGBWBoostedWhite:
144 rgb_2_rgbw_white_boosted(w_color_temperature, r, g, b, r_scale, g_scale,
145 b_scale, out_r, out_g, out_b, out_w);
147 case kRGBWMaxBrightness:
148 rgb_2_rgbw_max_brightness(w_color_temperature, r, g, b, r_scale,
149 g_scale, b_scale, out_r, out_g, out_b, out_w);
151 case kRGBWUserFunction:
152 rgb_2_rgbw_user_function(w_color_temperature, r, g, b, r_scale, g_scale,
153 b_scale, out_r, out_g, out_b, out_w);
156 rgb_2_rgbw_null_white_pixel(w_color_temperature, r, g, b, r_scale, g_scale,
157 b_scale, out_r, out_g, out_b, out_w);
161template <RGBW_MODE MODE>
162FASTLED_FORCE_INLINE
void
163rgb_2_rgbw(uint16_t w_color_temperature, uint8_t r, uint8_t g, uint8_t b,
164 uint8_t r_scale, uint8_t g_scale, uint8_t b_scale, uint8_t *out_r,
165 uint8_t *out_g, uint8_t *out_b, uint8_t *out_w) {
167 rgb_2_rgbw(MODE, w_color_temperature, r, g, b, r_scale, g_scale, b_scale,
168 out_r, out_g, out_b, out_w);
177void rgbw_partial_reorder(EOrderW w_placement, uint8_t b0, uint8_t b1,
178 uint8_t b2, uint8_t w, uint8_t *out_b0,
179 uint8_t *out_b1, uint8_t *out_b2, uint8_t *out_b3);