diff options
author | Florian Didron <fdidron@users.noreply.github.com> | 2019-05-20 09:44:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-20 09:44:07 +0900 |
commit | 5cb5e04f13d4a61a95b75da4a378c2f8b25b96fc (patch) | |
tree | 379c5608794df988ccba7d83811ef05f6f15ce6b /quantum/rgb_matrix_animations/jellybean_raindrops_anim.h | |
parent | 689303e49f5ff1ca71df1d2d215148a8745539b8 (diff) | |
parent | 0554bced7c71fd60263931dbe85e08ac421fb5d3 (diff) |
Merge pull request #32 from zsa/per_key_matrix_effects_part_1
Update to RGB Matrix LED structure
Diffstat (limited to 'quantum/rgb_matrix_animations/jellybean_raindrops_anim.h')
-rw-r--r-- | quantum/rgb_matrix_animations/jellybean_raindrops_anim.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h index 01ff5c2306..8f0b1bd914 100644 --- a/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix_animations/jellybean_raindrops_anim.h @@ -1,30 +1,29 @@ -#pragma once #ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS) +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS -extern rgb_counters_t g_rgb_counters; -extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL]; -extern rgb_config_t rgb_matrix_config; - -static void jellybean_raindrops_set_color(int i) { +static void jellybean_raindrops_set_color(int i, effect_params_t* params) { + if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return; HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val }; RGB rgb = hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } -bool rgb_matrix_jellybean_raindrops(effect_params_t* params) { +bool JELLYBEAN_RAINDROPS(effect_params_t* params) { if (!params->init) { // Change one LED every tick, make sure speed is not 0 if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) { - jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL); + jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params); } return false; } RGB_MATRIX_USE_LIMITS(led_min, led_max); for (int i = led_min; i < led_max; i++) { - jellybean_raindrops_set_color(i); + jellybean_raindrops_set_color(i, params); } return led_max < DRIVER_LED_TOTAL; } +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS #endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS |