2 #ifndef DISABLE_RGB_MATRIX_RAINDROPS
3 #include "rgb_matrix_types.h"
5 extern rgb_counters_t g_rgb_counters;
6 extern rgb_config_t rgb_matrix_config;
8 static void raindrops_set_color(int i) {
9 HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
11 // Take the shortest path between hues
12 int16_t deltaH = ((rgb_matrix_config.hue + 180) % 360 - rgb_matrix_config.hue) / 4;
15 } else if (deltaH < -127) {
19 hsv.h = rgb_matrix_config.hue + (deltaH * (rand() & 0x03));
20 RGB rgb = hsv_to_rgb(hsv);
21 rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
24 bool rgb_matrix_raindrops(effect_params_t* params) {
26 // Change one LED every tick, make sure speed is not 0
27 if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
28 raindrops_set_color(rand() % DRIVER_LED_TOTAL);
33 RGB_MATRIX_USE_LIMITS(led_min, led_max);
34 for (int i = led_min; i < led_max; i++) {
35 raindrops_set_color(i);
37 return led_max < DRIVER_LED_TOTAL;
40 #endif // DISABLE_RGB_MATRIX_RAINDROPS