diff options
author | M-AS <matthewtransformer@hotmail.com> | 2019-03-17 13:38:51 -0400 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-03-17 10:38:51 -0700 |
commit | 221ac2eabbc73c9d59583c6d78c779bbfec0d7bc (patch) | |
tree | 3f50380b649631b2d9c30bd1ce745cf82d8b973b /quantum/rgb_matrix.c | |
parent | d8df01ca5e43b6322ba2ef5c7613a871ce69282c (diff) | |
download | qmk_firmware-221ac2eabbc73c9d59583c6d78c779bbfec0d7bc.tar.gz |
New RGB Matrix effect: Single color reactive (#5330)
* Adds new RGB Matrix effect: rgb_matrix_config'd reactive LEDs
* [Docs] Adds disable for new effect
* [Docs] Added new effect to list of effects
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r-- | quantum/rgb_matrix.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 2ed36304d..56a97e3c7 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -221,6 +221,20 @@ void rgb_matrix_solid_reactive(void) { } } +void rgb_matrix_solid_reactive_simple(void) +{ + HSV hsv = {.h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val}; + RGB rgb; + + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + uint16_t offset2 = g_key_hit[i] << 2; + offset2 = (offset2 <= 255) ? (255 - offset2) : 0; + hsv.v = offset2 * rgb_matrix_config.val / RGB_MATRIX_MAXIMUM_BRIGHTNESS; + rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } +} + // alphas = color1, mods = color2 void rgb_matrix_alphas_mods(void) { @@ -755,6 +769,11 @@ void rgb_matrix_task(void) { rgb_matrix_solid_reactive(); break; #endif + #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + case RGB_MATRIX_SOLID_REACTIVE_SIMPLE: + rgb_matrix_solid_reactive_simple(); + break; + #endif #ifndef DISABLE_RGB_MATRIX_SPLASH case RGB_MATRIX_SPLASH: rgb_matrix_splash(); |