aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Y <76888457+filterpaper@users.noreply.github.com>2021-11-02 07:40:25 +0800
committerGitHub <noreply@github.com>2021-11-02 10:40:25 +1100
commit2173b5373c9d8d1b37d7b130e7a6c613ffc2ffaa (patch)
treedbe49a838ce389d5083ea871145c981dc1dbc52b
parent0c725017638ec86011191bf835735fb6c569d298 (diff)
downloadqmk_firmware-2173b5373c9d8d1b37d7b130e7a6c613ffc2ffaa.tar.gz
qmk_firmware-2173b5373c9d8d1b37d7b130e7a6c613ffc2ffaa.zip
Add Pixel Rain RGB Matrix effect (#14155)
* Add Pixel animation header file * Add Pixel animation to documentation * Add Pixel animation to core include file * Remove unintended spaces * Remove seeding of PRNG * Increase frequency of lit keys Co-authored-by: filterpaper <filterpaper@localhost>
-rw-r--r--docs/feature_rgb_matrix.md2
-rw-r--r--quantum/rgb_matrix/animations/pixel_rain_anim.h44
-rw-r--r--quantum/rgb_matrix/animations/rgb_matrix_effects.inc1
3 files changed, 47 insertions, 0 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index cad7c50f1..6370c637a 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -454,6 +454,7 @@ enum rgb_matrix_effects {
454 RGB_MATRIX_HUE_PENDULUM, // Hue shifts up a slight ammount in a wave to the right, then back to the left 454 RGB_MATRIX_HUE_PENDULUM, // Hue shifts up a slight ammount in a wave to the right, then back to the left
455 RGB_MATRIX_HUE_WAVE, // Hue shifts up a slight ammount and then back down in a wave to the right 455 RGB_MATRIX_HUE_WAVE, // Hue shifts up a slight ammount and then back down in a wave to the right
456 RGB_MATRIX_FRACTAL, // Single hue fractal filled keys pulsing horizontally out to edges 456 RGB_MATRIX_FRACTAL, // Single hue fractal filled keys pulsing horizontally out to edges
457 RGB_MATRIX_PIXEL_RAIN, // Randomly light keys with random hues
457#if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 458#if define(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
458 RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM! 459 RGB_MATRIX_TYPING_HEATMAP, // How hot is your WPM!
459 RGB_MATRIX_DIGITAL_RAIN, // That famous computer simulation 460 RGB_MATRIX_DIGITAL_RAIN, // That famous computer simulation
@@ -508,6 +509,7 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
508|`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` | 509|`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` |
509|`#define DISABLE_RGB_MATRIX_HUE_WAVE` |Disables `RGB_MATRIX_HUE_WAVE` | 510|`#define DISABLE_RGB_MATRIX_HUE_WAVE` |Disables `RGB_MATRIX_HUE_WAVE` |
510|`#define DISABLE_RGB_MATRIX_FRACTAL` |Disables `RGB_MATRIX_FRACTAL` | 511|`#define DISABLE_RGB_MATRIX_FRACTAL` |Disables `RGB_MATRIX_FRACTAL` |
512|`#define DISABLE_RGB_MATRIX_PIXEL_RAIN ` |Disables `RGB_MATRIX_PIXEL_RAIN ` |
511|`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` | 513|`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` |
512|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` | 514|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` |
513|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` | 515|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |
diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h
new file mode 100644
index 000000000..0209d3303
--- /dev/null
+++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h
@@ -0,0 +1,44 @@
1/* Copyright (C) 2021 @filterpaper
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifdef ENABLE_RGB_MATRIX_PIXEL_RAIN
18RGB_MATRIX_EFFECT(PIXEL_RAIN)
19# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
20
21static bool PIXEL_RAIN(effect_params_t* params) {
22 static uint32_t wait_timer = 0;
23 if (wait_timer > g_rgb_timer) { return false; }
24
25 inline uint32_t interval(void) { return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); }
26
27 bool rain_pixel(uint8_t i, effect_params_t* params, bool off) {
28 if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) { return true; }
29 if (off) {
30 rgb_matrix_set_color(i, 0,0,0);
31 } else {
32 HSV hsv = {random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v};
33 RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
34 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
35 }
36 wait_timer = g_rgb_timer + interval();
37 return false;
38 }
39
40 return rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2);
41}
42
43# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
44#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN
diff --git a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
index 33d2b4228..8ecf4367f 100644
--- a/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
+++ b/quantum/rgb_matrix/animations/rgb_matrix_effects.inc
@@ -27,6 +27,7 @@
27#include "hue_pendulum_anim.h" 27#include "hue_pendulum_anim.h"
28#include "hue_wave_anim.h" 28#include "hue_wave_anim.h"
29#include "fractal_anim.h" 29#include "fractal_anim.h"
30#include "pixel_rain_anim.h"
30#include "typing_heatmap_anim.h" 31#include "typing_heatmap_anim.h"
31#include "digital_rain_anim.h" 32#include "digital_rain_anim.h"
32#include "solid_reactive_simple_anim.h" 33#include "solid_reactive_simple_anim.h"