X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=quantum%2Frgb_matrix.c;h=d20daf5e45cb3684f14f2e10f5807399cdbbc12a;hb=3538955778c253e68779605cc67c27e15d195729;hp=a6a9549af4ce558d02546fcae6cb11c7252e7ac0;hpb=6b8be985551efc5a5f95dfea6dc1554352bc46e0;p=qmk_firmware.git diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index a6a9549af..d20daf5e4 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -32,6 +32,14 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; #endif +// Generic effect runners +#include "rgb_matrix_runners/effect_runner_dx_dy_dist.h" +#include "rgb_matrix_runners/effect_runner_dx_dy.h" +#include "rgb_matrix_runners/effect_runner_i.h" +#include "rgb_matrix_runners/effect_runner_sin_cos_i.h" +#include "rgb_matrix_runners/effect_runner_reactive.h" +#include "rgb_matrix_runners/effect_runner_reactive_splash.h" + // ------------------------------------------ // -----Begin rgb effect includes macros----- #define RGB_MATRIX_EFFECT(name) @@ -120,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); } @@ -131,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); } @@ -484,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); } @@ -553,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; }