diff options
author | XScorpion2 <rcalt2vt@gmail.com> | 2019-05-19 11:09:06 -0500 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-05-19 09:09:06 -0700 |
commit | 0099bbf9a64a0b4df1093f528481bff39af2c80d (patch) | |
tree | f9198bfb1124992267915d2f75c1214c94235f4a | |
parent | ba26736d7e0679e87e34add2445cdae541e2a0b8 (diff) | |
download | qmk_firmware-0099bbf9a64a0b4df1093f528481bff39af2c80d.tar.gz qmk_firmware-0099bbf9a64a0b4df1093f528481bff39af2c80d.zip |
Single Color Band scrolling left to right effects (#5867)
-rw-r--r-- | docs/feature_rgb_matrix.md | 4 | ||||
-rw-r--r-- | quantum/rgb_matrix_animations/colorband_sat_anim.h | 21 | ||||
-rw-r--r-- | quantum/rgb_matrix_animations/colorband_val_anim.h | 21 | ||||
-rw-r--r-- | quantum/rgb_matrix_animations/rgb_matrix_effects.inc | 2 |
4 files changed, 48 insertions, 0 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 8347660df..df124ea0f 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -194,6 +194,8 @@ enum rgb_matrix_effects { | |||
194 | RGB_MATRIX_ALPHAS_MODS, // Static dual hue, speed is hue for secondary hue | 194 | RGB_MATRIX_ALPHAS_MODS, // Static dual hue, speed is hue for secondary hue |
195 | RGB_MATRIX_GRADIENT_UP_DOWN, // Static gradient top to bottom, speed controls how much gradient changes | 195 | RGB_MATRIX_GRADIENT_UP_DOWN, // Static gradient top to bottom, speed controls how much gradient changes |
196 | RGB_MATRIX_BREATHING, // Single hue brightness cycling animation | 196 | RGB_MATRIX_BREATHING, // Single hue brightness cycling animation |
197 | RGB_MATRIX_BAND_SAT, // Single hue band fading saturation scrolling left to right | ||
198 | RGB_MATRIX_BAND_VAL, // Single hue band fading brightness scrolling left to right | ||
197 | RGB_MATRIX_CYCLE_ALL, // Full keyboard solid hue cycling through full gradient | 199 | RGB_MATRIX_CYCLE_ALL, // Full keyboard solid hue cycling through full gradient |
198 | RGB_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right | 200 | RGB_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right |
199 | RGB_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom | 201 | RGB_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom |
@@ -235,6 +237,8 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con | |||
235 | |`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | | 237 | |`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` | |
236 | |`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | | 238 | |`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` | |
237 | |`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` | | 239 | |`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` | |
240 | |`#define DISABLE_RGB_MATRIX_BAND_SAT` |Disables `RGB_MATRIX_BAND_SAT` | | ||
241 | |`#define DISABLE_RGB_MATRIX_BAND_VAL` |Disables `RGB_MATRIX_BAND_VAL` | | ||
238 | |`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` | | 242 | |`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` | |
239 | |`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` | | 243 | |`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` | |
240 | |`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` | | 244 | |`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` | |
diff --git a/quantum/rgb_matrix_animations/colorband_sat_anim.h b/quantum/rgb_matrix_animations/colorband_sat_anim.h new file mode 100644 index 000000000..89773b6ce --- /dev/null +++ b/quantum/rgb_matrix_animations/colorband_sat_anim.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef DISABLE_RGB_MATRIX_BAND_SAT | ||
2 | RGB_MATRIX_EFFECT(BAND_SAT) | ||
3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
4 | |||
5 | bool BAND_SAT(effect_params_t* params) { | ||
6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | HSV hsv = { rgb_matrix_config.hue, 0, rgb_matrix_config.val }; | ||
9 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | ||
10 | for (uint8_t i = led_min; i < led_max; i++) { | ||
11 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
12 | int16_t s = rgb_matrix_config.sat - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | ||
13 | hsv.s = s < 0 ? 0 : s; | ||
14 | RGB rgb = hsv_to_rgb(hsv); | ||
15 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
16 | } | ||
17 | return led_max < DRIVER_LED_TOTAL; | ||
18 | } | ||
19 | |||
20 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
21 | #endif // DISABLE_RGB_MATRIX_BAND_SAT | ||
diff --git a/quantum/rgb_matrix_animations/colorband_val_anim.h b/quantum/rgb_matrix_animations/colorband_val_anim.h new file mode 100644 index 000000000..bf41cec91 --- /dev/null +++ b/quantum/rgb_matrix_animations/colorband_val_anim.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef DISABLE_RGB_MATRIX_BAND_VAL | ||
2 | RGB_MATRIX_EFFECT(BAND_VAL) | ||
3 | #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
4 | |||
5 | bool BAND_VAL(effect_params_t* params) { | ||
6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 }; | ||
9 | uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4); | ||
10 | for (uint8_t i = led_min; i < led_max; i++) { | ||
11 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
12 | int16_t v = rgb_matrix_config.val - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8; | ||
13 | hsv.v = v < 0 ? 0 : v; | ||
14 | RGB rgb = hsv_to_rgb(hsv); | ||
15 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
16 | } | ||
17 | return led_max < DRIVER_LED_TOTAL; | ||
18 | } | ||
19 | |||
20 | #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
21 | #endif // DISABLE_RGB_MATRIX_BAND_VAL | ||
diff --git a/quantum/rgb_matrix_animations/rgb_matrix_effects.inc b/quantum/rgb_matrix_animations/rgb_matrix_effects.inc index f05a415a5..4b01afaa3 100644 --- a/quantum/rgb_matrix_animations/rgb_matrix_effects.inc +++ b/quantum/rgb_matrix_animations/rgb_matrix_effects.inc | |||
@@ -3,6 +3,8 @@ | |||
3 | #include "rgb_matrix_animations/alpha_mods_anim.h" | 3 | #include "rgb_matrix_animations/alpha_mods_anim.h" |
4 | #include "rgb_matrix_animations/gradient_up_down_anim.h" | 4 | #include "rgb_matrix_animations/gradient_up_down_anim.h" |
5 | #include "rgb_matrix_animations/breathing_anim.h" | 5 | #include "rgb_matrix_animations/breathing_anim.h" |
6 | #include "rgb_matrix_animations/colorband_sat_anim.h" | ||
7 | #include "rgb_matrix_animations/colorband_val_anim.h" | ||
6 | #include "rgb_matrix_animations/cycle_all_anim.h" | 8 | #include "rgb_matrix_animations/cycle_all_anim.h" |
7 | #include "rgb_matrix_animations/cycle_left_right_anim.h" | 9 | #include "rgb_matrix_animations/cycle_left_right_anim.h" |
8 | #include "rgb_matrix_animations/cycle_up_down_anim.h" | 10 | #include "rgb_matrix_animations/cycle_up_down_anim.h" |