summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shields <daniel.shields@bcs.org>2018-09-28 09:33:51 +0100
committerJack Humbert <jack.humb@gmail.com>2018-10-01 12:54:37 -0400
commitda6c58175a74e4bb5a6c67f7e8b63567c14800d7 (patch)
tree6dbc76f4b18db052386e22f18af9ff8d43fb9a41
parentb3f6aa9480a5ddb0b0ba0d611d988121c0ff848b (diff)
Make digital rain RGB matrix effect #define configurable.
-rw-r--r--docs/feature_rgb_matrix.md1
-rw-r--r--keyboards/model01/keymaps/dshields/config.h1
-rw-r--r--keyboards/planck/keymaps/dshields/config.h1
-rw-r--r--quantum/rgb_matrix.c8
4 files changed, 9 insertions, 2 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 4f827f8dc9..809d034bdc 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -140,6 +140,7 @@ These are the effects that are currently available:
RGB_MATRIX_RAINBOW_PINWHEELS,
RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
RGB_MATRIX_JELLYBEAN_RAINDROPS,
+ RGB_MATRIX_DIGITAL_RAIN,
#ifdef RGB_MATRIX_KEYPRESSES
RGB_MATRIX_SOLID_REACTIVE,
RGB_MATRIX_SPLASH,
diff --git a/keyboards/model01/keymaps/dshields/config.h b/keyboards/model01/keymaps/dshields/config.h
index 4d609e4368..4de2d3cbb3 100644
--- a/keyboards/model01/keymaps/dshields/config.h
+++ b/keyboards/model01/keymaps/dshields/config.h
@@ -1,5 +1,6 @@
#pragma once
+#define RGB_DIGITAL_RAIN_DROPS 18
#define USB_MAX_POWER_CONSUMPTION 100
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 3000
diff --git a/keyboards/planck/keymaps/dshields/config.h b/keyboards/planck/keymaps/dshields/config.h
index b149530b8d..512e2fbc64 100644
--- a/keyboards/planck/keymaps/dshields/config.h
+++ b/keyboards/planck/keymaps/dshields/config.h
@@ -1,5 +1,6 @@
#pragma once
+#define RGB_DIGITAL_RAIN_DROPS 24
#define USB_MAX_POWER_CONSUMPTION 100
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 3000
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index b282284a13..f0c2ddfdfb 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -50,6 +50,11 @@ rgb_config_t rgb_matrix_config;
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255
#endif
+#ifndef RGB_DIGITAL_RAIN_DROPS
+ // lower the number for denser effect/wider keyboard
+ #define RGB_DIGITAL_RAIN_DROPS 24
+#endif
+
bool g_suspend_state = false;
// Global tick at 20 Hz
@@ -466,7 +471,6 @@ void rgb_matrix_jellybean_raindrops( bool initialize ) {
void rgb_matrix_digital_rain( const bool initialize ) {
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
const uint8_t drop_ticks = 28;
- const uint8_t new_drop_probability = 24;
const uint8_t pure_green_intensity = 0xd0;
const uint8_t max_brightness_boost = 0xc0;
const uint8_t max_intensity = 0xff;
@@ -481,7 +485,7 @@ void rgb_matrix_digital_rain( const bool initialize ) {
}
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- if (row == 0 && drop == 0 && rand() < RAND_MAX / new_drop_probability) {
+ if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
// top row, pixels have just fallen and we're
// making a new rain drop in this column
map[col][row] = max_intensity;