]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Switching rgb_config_t to use HSV struct
authorRyan Caltabiano <rcalt2vt@gmail.com>
Mon, 20 May 2019 04:12:29 +0000 (23:12 -0500)
committerDrashna Jaelre <drashna@live.com>
Fri, 12 Jul 2019 14:39:35 +0000 (07:39 -0700)
42 files changed:
keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c
keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c
quantum/rgb_matrix.c
quantum/rgb_matrix_animations/alpha_mods_anim.h
quantum/rgb_matrix_animations/breathing_anim.h
quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h
quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
quantum/rgb_matrix_animations/colorband_sat_anim.h
quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h
quantum/rgb_matrix_animations/colorband_spiral_val_anim.h
quantum/rgb_matrix_animations/colorband_val_anim.h
quantum/rgb_matrix_animations/cycle_all_anim.h
quantum/rgb_matrix_animations/cycle_left_right_anim.h
quantum/rgb_matrix_animations/cycle_out_in_anim.h
quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h
quantum/rgb_matrix_animations/cycle_pinwheel_anim.h
quantum/rgb_matrix_animations/cycle_spiral_anim.h
quantum/rgb_matrix_animations/cycle_up_down_anim.h
quantum/rgb_matrix_animations/dual_beacon_anim.h
quantum/rgb_matrix_animations/gradient_up_down_anim.h
quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
quantum/rgb_matrix_animations/rainbow_beacon_anim.h
quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
quantum/rgb_matrix_animations/raindrops_anim.h
quantum/rgb_matrix_animations/solid_color_anim.h
quantum/rgb_matrix_animations/solid_reactive_anim.h
quantum/rgb_matrix_animations/solid_reactive_cross.h
quantum/rgb_matrix_animations/solid_reactive_nexus.h
quantum/rgb_matrix_animations/solid_reactive_simple_anim.h
quantum/rgb_matrix_animations/solid_reactive_wide.h
quantum/rgb_matrix_animations/solid_splash_anim.h
quantum/rgb_matrix_animations/splash_anim.h
quantum/rgb_matrix_animations/typing_heatmap_anim.h
quantum/rgb_matrix_runners/effect_runner_dx_dy.h
quantum/rgb_matrix_runners/effect_runner_dx_dy_dist.h
quantum/rgb_matrix_runners/effect_runner_i.h
quantum/rgb_matrix_runners/effect_runner_reactive.h
quantum/rgb_matrix_runners/effect_runner_reactive_splash.h
quantum/rgb_matrix_runners/effect_runner_sin_cos_i.h
quantum/rgb_matrix_types.h
users/xulkal/custom_oled.c

index 600ac861928057923488f536cd97c5b9ef0c9af7..a12358c8d9aaec82dac67160be7ffead8e09dc7d 100644 (file)
@@ -146,7 +146,7 @@ void rgb_matrix_indicators_user(void)
                        break;
 
                case _RGB: {
-                       HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
+                       HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
                        HSV hui = hsv;
                        HSV hud = hsv;
                        HSV sai = hsv;
index 11b4d70cab7367f02bbaeb470b01bbda482e8532..447b0aca1a2459bccd5ac1b9aeaac028ee6d87d2 100644 (file)
@@ -135,7 +135,7 @@ void rgb_matrix_indicators_user(void)
                        break;
 
                case _FNC: {
-                       HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
+                       HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
                        HSV hui = hsv;
                        HSV hud = hsv;
                        HSV sai = hsv;
index 98baf5cb5808e325da587d1dc0a748ba68757d17..d20daf5e45cb3684f14f2e10f5807399cdbbc12a 100644 (file)
@@ -128,9 +128,7 @@ void eeconfig_update_rgb_matrix_default(void) {
   dprintf("eeconfig_update_rgb_matrix_default\n");
   rgb_matrix_config.enable = 1;
   rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE;
-  rgb_matrix_config.hue = 0;
-  rgb_matrix_config.sat = UINT8_MAX;
-  rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
+  rgb_matrix_config.hsv = (HSV){ 0,  UINT8_MAX, RGB_MATRIX_MAXIMUM_BRIGHTNESS };
   rgb_matrix_config.speed = UINT8_MAX / 2;
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
@@ -139,9 +137,9 @@ void eeconfig_debug_rgb_matrix(void) {
   dprintf("rgb_matrix_config eprom\n");
   dprintf("rgb_matrix_config.enable = %d\n", rgb_matrix_config.enable);
   dprintf("rgb_matrix_config.mode = %d\n", rgb_matrix_config.mode);
-  dprintf("rgb_matrix_config.hue = %d\n", rgb_matrix_config.hue);
-  dprintf("rgb_matrix_config.sat = %d\n", rgb_matrix_config.sat);
-  dprintf("rgb_matrix_config.val = %d\n", rgb_matrix_config.val);
+  dprintf("rgb_matrix_config.hsv.h = %d\n", rgb_matrix_config.hsv.h);
+  dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s);
+  dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v);
   dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed);
 }
 
@@ -492,34 +490,34 @@ void rgb_matrix_step_reverse(void) {
 }
 
 void rgb_matrix_increase_hue(void) {
-  rgb_matrix_config.hue += RGB_MATRIX_HUE_STEP;
+  rgb_matrix_config.hsv.h += RGB_MATRIX_HUE_STEP;
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
 void rgb_matrix_decrease_hue(void) {
-  rgb_matrix_config.hue -= RGB_MATRIX_HUE_STEP;
+  rgb_matrix_config.hsv.h -= RGB_MATRIX_HUE_STEP;
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
 void rgb_matrix_increase_sat(void) {
-  rgb_matrix_config.sat = qadd8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP);
+  rgb_matrix_config.hsv.s = qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP);
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
 void rgb_matrix_decrease_sat(void) {
-  rgb_matrix_config.sat = qsub8(rgb_matrix_config.sat, RGB_MATRIX_SAT_STEP);
+  rgb_matrix_config.hsv.s = qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP);
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
 void rgb_matrix_increase_val(void) {
-  rgb_matrix_config.val = qadd8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP);
-  if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS)
-    rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
+  rgb_matrix_config.hsv.v = qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP);
+  if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS)
+    rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
 void rgb_matrix_decrease_val(void) {
-  rgb_matrix_config.val = qsub8(rgb_matrix_config.val, RGB_MATRIX_VAL_STEP);
+  rgb_matrix_config.hsv.v = qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP);
   eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
 }
 
@@ -561,9 +559,9 @@ void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
 }
 
 void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
-  rgb_matrix_config.hue = hue;
-  rgb_matrix_config.sat = sat;
-  rgb_matrix_config.val = val;
-  if (rgb_matrix_config.val > RGB_MATRIX_MAXIMUM_BRIGHTNESS)
-    rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
+  rgb_matrix_config.hsv.h = hue;
+  rgb_matrix_config.hsv.s = sat;
+  rgb_matrix_config.hsv.v = val;
+  if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS)
+    rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
 }
index 0fee19aefc6f9bf78ebe984d3ec7d99e358862a6..8df3356f611eaee3a0d62460aded23d198b22fae 100644 (file)
@@ -6,7 +6,7 @@ RGB_MATRIX_EFFECT(ALPHAS_MODS)
 bool ALPHAS_MODS(effect_params_t* params) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
+  HSV hsv = rgb_matrix_config.hsv;
   RGB rgb1 = hsv_to_rgb(hsv);
   hsv.h += rgb_matrix_config.speed;
   RGB rgb2 = hsv_to_rgb(hsv);
index c357b53031d5958a5996a9c7e427f0c63c45c906..0af7b42cf3f3f1a45851713a8514f5a93181c922 100644 (file)
@@ -5,9 +5,9 @@ RGB_MATRIX_EFFECT(BREATHING)
 bool BREATHING(effect_params_t* params) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
+  HSV hsv = rgb_matrix_config.hsv;
   uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8);
-  uint8_t val = scale8(abs8(sin8(time) - 128) * 2, rgb_matrix_config.val);
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, val };
+  hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
   RGB rgb = hsv_to_rgb(hsv);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
index 3739cde1f62063e4cc360be738ac66433d96c47d..4585c52716b95d12513acbc4afc7c7be0a627881 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_PINWHEEL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
-    hsv->s = scale8(rgb_matrix_config.sat - time - atan2_8(dy, dx) * 3, rgb_matrix_config.sat);
+static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
+    hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s);
+    return hsv;
 }
 
 bool BAND_PINWHEEL_SAT(effect_params_t* params) {
index 6e5871d7ec4d5cb238c2cc450ff15bb9dada3331..5cdb8734895b3103660dd5e02c31e44de5cd1f77 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_PINWHEEL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
-    hsv->v = scale8(rgb_matrix_config.val - time - atan2_8(dy, dx) * 3, rgb_matrix_config.val);
+static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
+    hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v);
+    return hsv;
 }
 
 bool BAND_PINWHEEL_VAL(effect_params_t* params) {
index bfa1085cb1a43ea3b5bd6c24d533893f7e8a8660..a5175f1cd98b0c94d4897b23ec0a926bb566d0bc 100644 (file)
@@ -2,9 +2,10 @@
 RGB_MATRIX_EFFECT(BAND_SAT)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_SAT_math(HSV* hsv, uint8_t i, uint8_t time) {
-    int16_t s = rgb_matrix_config.sat - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
-    hsv->s = scale8(s < 0 ? 0 : s, rgb_matrix_config.sat);
+static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) {
+    int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
+    hsv.s = scale8(s < 0 ? 0 : s, hsv.s);
+    return hsv;
 }
 
 bool BAND_SAT(effect_params_t* params) {
index 7db01c5f9ecb3b89031866ce9d31481ab6f432af..096c675de8d21811fb33a5e67b55886b87de62f2 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_SPIRAL_SAT_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
-    hsv->s = scale8(rgb_matrix_config.sat + dist - time - atan2_8(dy, dx), rgb_matrix_config.sat);
+static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
+    hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s);
+    return hsv;
 }
 
 bool BAND_SPIRAL_SAT(effect_params_t* params) {
index a16f8e2cea341656bdc4faa8df390a21c58ffe50..1d4cc0c84fe722647cbfd94ba21a22c5caa17543 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_SPIRAL_VAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
-    hsv->v = scale8(rgb_matrix_config.val + dist - time - atan2_8(dy, dx), rgb_matrix_config.val);
+static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
+    hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v);
+    return hsv;
 }
 
 bool BAND_SPIRAL_VAL(effect_params_t* params) {
index 4b76924db9fd8c2caf64ca38a925387560902b35..de0bbb47159aa5e382b8a589c659f5043d0f0fbc 100644 (file)
@@ -2,9 +2,10 @@
 RGB_MATRIX_EFFECT(BAND_VAL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void BAND_VAL_math(HSV* hsv, uint8_t i, uint8_t time) {
-    int16_t v = rgb_matrix_config.val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
-    hsv->v = scale8(v < 0 ? 0 : v, rgb_matrix_config.val);
+static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) {
+    int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
+    hsv.v = scale8(v < 0 ? 0 : v, hsv.v);
+    return hsv;
 }
 
 bool BAND_VAL(effect_params_t* params) {
index 380dbe05a483629ae27eaac822fbdb87809bcb0b..0c45aba8b13b34a1146289058f55f235a2a5e3bc 100644 (file)
@@ -2,9 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_ALL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_ALL_math(HSV* hsv, uint8_t i, uint8_t time)
-{
-    hsv->h = time;
+static HSV CYCLE_ALL_math(HSV hsv,  uint8_t i, uint8_t time){
+    hsv.h = time;
+    return hsv;
 }
 
 bool CYCLE_ALL(effect_params_t* params) {
index f270fb42ccd11d420172c38283cbabe4beda4625..d2e5b4fbdf5a356e1f1e8791510287f302ee014a 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_LEFT_RIGHT_math(HSV* hsv, uint8_t i, uint8_t time) {
-    hsv->h = g_led_config.point[i].x - time;
+static HSV CYCLE_LEFT_RIGHT_math(HSV hsv,  uint8_t i, uint8_t time) {
+    hsv.h = g_led_config.point[i].x - time;
+    return hsv;
 }
 
 bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
index 46c7efef258d3dc33dcc0541bb09a79dcb2a093e..fa7c3b09cf7543fdf0c00c73ef35f2875eb7739c 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_OUT_IN_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
-    hsv->h = 3 * dist / 2 + time;
+static HSV CYCLE_OUT_IN_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
+    hsv.h = 3 * dist / 2 + time;
+    return hsv;
 }
 
 bool CYCLE_OUT_IN(effect_params_t* params) {
index 2fdb4ba919303961e5618904618b579b7eceb7c6..74a2c9aa584b384edd019ae446a24fc84d50b320 100644 (file)
@@ -2,10 +2,11 @@
 RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_OUT_IN_DUAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
+static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t time) {
     dx = (k_rgb_matrix_center.x / 2) - abs8(dx);
     uint8_t dist = sqrt16(dx * dx + dy * dy);
-    hsv->h = 3 * dist + time;
+    hsv.h = 3 * dist + time;
+    return hsv;
 }
 
 bool CYCLE_OUT_IN_DUAL(effect_params_t* params) {
index 29e2d92c92c5b569087613270c6a41e54bebc072..54e222dc2e3777bd6b89e015b19df2639124d62d 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_PINWHEEL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t time) {
-    hsv->h = atan2_8(dy, dx) + time;
+static HSV CYCLE_PINWHEEL_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t time) {
+    hsv.h = atan2_8(dy, dx) + time;
+    return hsv;
 }
 
 bool CYCLE_PINWHEEL(effect_params_t* params) {
index a1354f60c19ac8a44dec2984df67f4d485566747..b27d7a83c7212b34f7b6f4226fe03e18eb2a9473 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_SPIRAL_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
-    hsv->h = dist - time - atan2_8(dy, dx);
+static HSV CYCLE_SPIRAL_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
+    hsv.h = dist - time - atan2_8(dy, dx);
+    return hsv;
 }
 
 bool CYCLE_SPIRAL(effect_params_t* params) {
index b3ef4cdf2e029a69ab625a0f3c945191c6bd5b57..4bf8ef2ae4a561dcaa4d9961410fe7141c111ab6 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void CYCLE_UP_DOWN_math(HSV* hsv, uint8_t i, uint8_t time) {
-    hsv->h = g_led_config.point[i].y - time;
+static HSV CYCLE_UP_DOWN_math(HSV hsv,  uint8_t i, uint8_t time) {
+    hsv.h = g_led_config.point[i].y - time;
+    return hsv;
 }
 
 bool CYCLE_UP_DOWN(effect_params_t* params) {
index d34f146a5b666dbfe9aa630a7ecf75e0ac8b11a6..336a41b2ce69e73edc371b1826833d1545f6dfbf 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(DUAL_BEACON)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void DUAL_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
-    hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128 + rgb_matrix_config.hue;
+static HSV DUAL_BEACON_math(HSV hsv,  int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
+    hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128;
+    return hsv;
 }
 
 bool DUAL_BEACON(effect_params_t* params) {
index d9fcd4d988cf5505f2f13571ff442a210272e2dd..12848ab4cc7d35586efb204cd8cadeb93d206b21 100644 (file)
@@ -5,13 +5,13 @@ RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
 bool GRADIENT_UP_DOWN(effect_params_t* params) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
+  HSV hsv = rgb_matrix_config.hsv;
   uint8_t scale = scale8(64, rgb_matrix_config.speed);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
     // The y range will be 0..64, map this to 0..4
     // Relies on hue being 8-bit and wrapping
-    hsv.h = rgb_matrix_config.hue + scale * (g_led_config.point[i].y >> 4);
+    hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4);
     RGB rgb = hsv_to_rgb(hsv);
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
index 8f0b1bd914c43371ee6917de70042d4c8468985d..bffa0a42d78542307f20e4b14452600c98f56508 100644 (file)
@@ -4,7 +4,7 @@ RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
 
 static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
   if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
-  HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
+  HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.hsv.v };
   RGB rgb = hsv_to_rgb(hsv);
   rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
 }
index 061cac837c6be55093bb52e9083c932cdf3c8179..f53c819a9e93cc897f41bfad12e6b0cf7c4b91ea 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(RAINBOW_BEACON)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void RAINBOW_BEACON_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
-    hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128 + rgb_matrix_config.hue;
+static HSV RAINBOW_BEACON_math(HSV hsv,  int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
+    hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128;
+    return hsv;
 }
 
 bool RAINBOW_BEACON(effect_params_t* params) {
index f406566fa16944a8cdac38909f960a86afc88821..e78c55e8dddee763317b7537d0abe131599e268c 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void RAINBOW_MOVING_CHEVRON_math(HSV* hsv, uint8_t i, uint8_t time) {
-    hsv->h = abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time) + rgb_matrix_config.hue;
+static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv,  uint8_t i, uint8_t time) {
+    hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time);
+    return hsv;
 }
 
 bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
index f19e9116d9882633ecd5d94f714bed674d989299..8298fec468dfe57ab71863070dd6a25b763dd774 100644 (file)
@@ -2,8 +2,9 @@
 RGB_MATRIX_EFFECT(PINWHEELS)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void PINWHEELS_math(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
-    hsv->h = ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128 + rgb_matrix_config.hue;
+static HSV PINWHEELS_math(HSV hsv,  int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
+    hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128;
+    return hsv;
 }
 
 bool PINWHEELS(effect_params_t* params) {
index 09d0d1df87c4d5606a110b56a382cb20501a582f..a4fed51658b75ca95e7ee7a36bc9185b292c92ed 100644 (file)
@@ -4,17 +4,17 @@ RGB_MATRIX_EFFECT(RAINDROPS)
 
 static void raindrops_set_color(int i, effect_params_t* params) {
   if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
-  HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
+  HSV hsv = { 0 , rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
 
   // Take the shortest path between hues
-  int16_t deltaH = ((rgb_matrix_config.hue + 180) % 360 - rgb_matrix_config.hue) / 4;
+  int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
   if (deltaH > 127) {
     deltaH -= 256;
   } else if (deltaH < -127) {
     deltaH += 256;
   }
 
-  hsv.h = rgb_matrix_config.hue + (deltaH * (rand() & 0x03));
+  hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
   RGB rgb = hsv_to_rgb(hsv);
   rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
 }
index 9376425598759ecd7d6c609ba2d0b635fdabbf93..6e406380350997c9cb963c1082ea796d529a982b 100644 (file)
@@ -4,8 +4,7 @@ RGB_MATRIX_EFFECT(SOLID_COLOR)
 bool SOLID_COLOR(effect_params_t* params) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
-  RGB rgb = hsv_to_rgb(hsv);
+  RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
index 762a95db313861455d608eb405d2d83d2494cc48..dd49b6530eb6fba8c4c30a773fda11474bce412a 100644 (file)
@@ -3,8 +3,9 @@
 RGB_MATRIX_EFFECT(SOLID_REACTIVE)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void SOLID_REACTIVE_math(HSV* hsv, uint16_t offset) {
-    hsv->h = rgb_matrix_config.hue + qsub8(130, offset);
+static HSV SOLID_REACTIVE_math(HSV hsv,  uint16_t offset) {
+    hsv.h += qsub8(130, offset);
+    return hsv;
 }
 
 bool SOLID_REACTIVE(effect_params_t* params) {
index 99f22c694e149a33bc9884a26a4c46266287d604..5b9cfcbd52549a26e79d980fe02c1636775bd6e1 100644 (file)
@@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
 
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void SOLID_REACTIVE_CROSS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+static HSV SOLID_REACTIVE_CROSS_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
     uint16_t effect = tick + dist;
     dx = dx < 0 ? dx * -1 : dx;
     dy = dy < 0 ? dy * -1 : dy;
@@ -20,7 +20,8 @@ static void SOLID_REACTIVE_CROSS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t
     effect += dx > dy ? dy : dx;
     if (effect > 255)
         effect = 255;
-    hsv->v = qadd8(hsv->v, 255 - effect);
+    hsv.v = qadd8(hsv.v, 255 - effect);
+    return hsv;
 }
 
 #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
index 8bebd042d2d49072b1eb682a1733a5c3963e0366..e90eaf4b289eb47c0c3e5e5926a28d7539afce78 100644 (file)
@@ -11,7 +11,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
 
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void SOLID_REACTIVE_NEXUS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
     uint16_t effect = tick - dist;
     if (effect > 255)
         effect = 255;
@@ -19,8 +19,9 @@ static void SOLID_REACTIVE_NEXUS_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t
         effect = 255;
     if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8))
         effect = 255;
-    hsv->v = qadd8(hsv->v, 255 - effect);
-    hsv->h = rgb_matrix_config.hue + dy / 4;
+    hsv.v = qadd8(hsv.v, 255 - effect);
+    hsv.h = rgb_matrix_config.hsv.h + dy / 4;
+    return hsv;
 }
 
 #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
index 36c6ec5277608aecc98a826fb5174fa07e4b509b..77c8ff672402eba3b3c43126055a1241e05964c7 100644 (file)
@@ -3,8 +3,9 @@
 RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void SOLID_REACTIVE_SIMPLE_math(HSV* hsv, uint16_t offset) {
-    hsv->v = scale8(255 - offset, rgb_matrix_config.val);
+static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv,  uint16_t offset) {
+    hsv.v = scale8(255 - offset, hsv.v);
+    return hsv;
 }
 
 bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
index 36edc475c872a0014f7e2b9b7468b1f8f56bbbcd..73779dfa74e83786e503abad5bbf6c6ba9007d50 100644 (file)
@@ -11,11 +11,12 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
 
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-static void SOLID_REACTIVE_WIDE_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+static HSV SOLID_REACTIVE_WIDE_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
     uint16_t effect = tick + dist * 5;
     if (effect > 255)
         effect = 255;
-    hsv->v = qadd8(hsv->v, 255 - effect);
+    hsv.v = qadd8(hsv.v, 255 - effect);
+    return hsv;
 }
 
 #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
index 84c99ff00c9d038b569fb58e3dd48c0b94bda8b7..441f35576b0f5b6997c8fc0ccc63d981d7c27faa 100644 (file)
@@ -11,11 +11,12 @@ RGB_MATRIX_EFFECT(SOLID_MULTISPLASH)
 
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-void SOLID_SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+HSV SOLID_SPLASH_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
     uint16_t effect = tick - dist;
     if (effect > 255)
         effect = 255;
-    hsv->v = qadd8(hsv->v, 255 - effect);
+    hsv.v = qadd8(hsv.v, 255 - effect);
+    return hsv;
 }
 
 #ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
index c4c05165359ac42caa393eeea127f82d7e3e32d9..19ccb256e957761a7b231e072da606ac23b2e676 100644 (file)
@@ -11,12 +11,13 @@ RGB_MATRIX_EFFECT(MULTISPLASH)
 
 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
 
-void SPLASH_math(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
+HSV SPLASH_math(HSV hsv,  int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) {
     uint16_t effect = tick - dist;
-      if (effect > 255)
+    if (effect > 255)
         effect = 255;
-      hsv->h += effect;
-      hsv->v = qadd8(hsv->v, 255 - effect);
+    hsv.h += effect;
+    hsv.v = qadd8(hsv.v, 255 - effect);
+    return hsv;
 }
 
 #ifndef DISABLE_RGB_MATRIX_SPLASH
index e6b34717b2f620115b459928ec75d59e9688ba20..374b7fea0cf105a60c3bdc6028fc4a8a510f47e8 100644 (file)
@@ -59,7 +59,7 @@ bool TYPING_HEATMAP(effect_params_t* params) {
       if (!HAS_ANY_FLAGS(g_led_config.flags[led[j]], params->flags))
         continue;
 
-      HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.sat, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.val) };
+      HSV hsv = { 170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v) };
       RGB rgb = hsv_to_rgb(hsv);
       rgb_matrix_set_color(led[j], rgb.r, rgb.g, rgb.b);
     }
index 43312629de17dfa630b5edc0b1d3eeeb5adc7e5c..9650c9a1316408561a24f43bebf476aaae0d926d 100644 (file)
@@ -1,18 +1,16 @@
 #pragma once
 
-typedef void (*dx_dy_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t time);
+typedef HSV (*dx_dy_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t time);
 
 bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
   uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
     int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
     int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
-    effect_func(&hsv, dx, dy, time);
-    RGB rgb = hsv_to_rgb(hsv);
+    RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
   return led_max < DRIVER_LED_TOTAL;
index a7310c8537203e99143c59202345bc0b88a3d6a4..eb0c4d8dd332f3457c10f45dd341fa54b28480a3 100644 (file)
@@ -1,19 +1,17 @@
 #pragma once
 
-typedef void (*dx_dy_dist_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
+typedef HSV (*dx_dy_dist_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time);
 
 bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
   uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
     int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
     int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
     uint8_t dist = sqrt16(dx * dx + dy * dy);
-    effect_func(&hsv, dx, dy, dist, time);
-    RGB rgb = hsv_to_rgb(hsv);
+    RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, dist, time));
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
   return led_max < DRIVER_LED_TOTAL;
index 85405ba1b6c222ed818a6a7aa5a8e0c6343dabc5..d4a7ef392aa1c0f962e0196a4daca78fcd5b26a7 100644 (file)
@@ -1,16 +1,14 @@
 #pragma once
 
-typedef void (*i_f)(HSV* hsv, uint8_t i, uint8_t time);
+typedef HSV (*i_f)(HSV hsv, uint8_t i, uint8_t time);
 
 bool effect_runner_i(effect_params_t* params, i_f effect_func) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
   uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
-    effect_func(&hsv, i, time);
-    RGB rgb = hsv_to_rgb(hsv);
+    RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
   return led_max < DRIVER_LED_TOTAL;
index 94cd7d5452f586e35aa6e002941cfb61de129d4e..9da2814ce8555c2a74ef504dc26e3c60f51283b1 100644 (file)
@@ -2,12 +2,11 @@
 
 #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 
-typedef void (*reactive_f)(HSV* hsv, uint16_t offset);
+typedef HSV (*reactive_f)(HSV hsv, uint16_t offset);
 
 bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
     RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
   uint16_t max_tick = 65535 / rgb_matrix_config.speed;
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
@@ -21,8 +20,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {
     }
 
     uint16_t  offset = scale16by8(tick, rgb_matrix_config.speed);
-    effect_func(&hsv, offset);
-    RGB rgb = hsv_to_rgb(hsv);
+    RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, offset));
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
   return led_max < DRIVER_LED_TOTAL;
index cb2b0d79435feb315a1de389988fa9eb167297a7..4f2059c99c383bbdc8f9ee81124c8a8a0db175b2 100644 (file)
@@ -2,25 +2,24 @@
 
 #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
 
-typedef void (*reactive_splash_f)(HSV* hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
+typedef HSV (*reactive_splash_f)(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick);
 
 bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, reactive_splash_f effect_func) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { 0, rgb_matrix_config.sat, 0 };
   uint8_t count = g_last_hit_tracker.count;
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
-    hsv.h = rgb_matrix_config.hue;
+    HSV hsv = rgb_matrix_config.hsv;
     hsv.v = 0;
     for (uint8_t j = start; j < count; j++) {
       int16_t dx = g_led_config.point[i].x - g_last_hit_tracker.x[j];
       int16_t dy = g_led_config.point[i].y - g_last_hit_tracker.y[j];
       uint8_t dist = sqrt16(dx * dx + dy * dy);
       uint16_t tick = scale16by8(g_last_hit_tracker.tick[j], rgb_matrix_config.speed);
-      effect_func(&hsv, dx, dy, dist, tick);
+      hsv = effect_func(hsv, dx, dy, dist, tick);
     }
-    hsv.v = scale8(hsv.v, rgb_matrix_config.val);
+    hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
     RGB rgb = hsv_to_rgb(hsv);
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
index 54e4c6d866579b829a4a91f35ba0735bb338c58e..e68a7a968c7abf874d61e482d276c13b16a9b0a0 100644 (file)
@@ -1,18 +1,16 @@
 #pragma once
 
-typedef void (*sin_cos_i_f)(HSV* hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
+typedef HSV (*sin_cos_i_f)(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time);
 
 bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {
   RGB_MATRIX_USE_LIMITS(led_min, led_max);
 
-  HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
   uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
   int8_t cos_value = cos8(time) - 128;
   int8_t sin_value = sin8(time) - 128;
   for (uint8_t i = led_min; i < led_max; i++) {
     RGB_MATRIX_TEST_LED_FLAGS();
-    effect_func(&hsv, cos_value, sin_value, i, time);
-    RGB rgb = hsv_to_rgb(hsv);
+    RGB rgb = hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
   }
   return led_max < DRIVER_LED_TOTAL;
index f890edd94f8e3af5dbe463a2f9f3c4d283b8cb21..04a84f4ac753bf9d9a55516730789155b238444f 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include "color.h"
 
 #if defined(__GNUC__)
 #define PACKED __attribute__ ((__packed__))
@@ -81,10 +82,8 @@ typedef union {
   struct PACKED {
     uint8_t  enable  :2;
     uint8_t  mode    :6;
-    uint8_t  hue     :8;
-    uint8_t  sat     :8;
-    uint8_t  val     :8;
-    uint8_t  speed   :8;//EECONFIG needs to be increased to support this
+    HSV      hsv;
+    uint8_t  speed;  //EECONFIG needs to be increased to support this
   };
 } rgb_config_t;
 
index d871e96f06090e8b51e393cb2aa943edc31b484f..7280ef7019fca7dd6c5b9069e6e5e67e94c9b20c 100644 (file)
@@ -80,7 +80,7 @@ static void render_status(void)
     oled_set_cursor(0, oled_max_lines() - 7);
     oled_write_P(PSTR("-----"), false);
     static char buffer[26] = {0};
-    snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val, rgb_matrix_config.speed, rgb_matrix_config.mode);
+    snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode);
     oled_write(buffer, false);
 #elif defined(RGBLIGHT_ENABLE)
     oled_set_cursor(0, oled_max_lines() - 7);
@@ -137,7 +137,7 @@ static void render_status(void)
 
 #if defined(RGB_MATRIX_ENABLE)
     static char buffer[20] = {0};
-    snprintf(buffer, sizeof(buffer), "    h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val);
+    snprintf(buffer, sizeof(buffer), "    h%3d s%3d v%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v);
     oled_write(buffer, false);
 #elif defined(RGBLIGHT_ENABLE)
     static char buffer[20] = {0};