diff options
Diffstat (limited to 'users/horrortroll/led/flower_blooming/flower_blooming.h')
| -rw-r--r-- | users/horrortroll/led/flower_blooming/flower_blooming.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/users/horrortroll/led/flower_blooming/flower_blooming.h b/users/horrortroll/led/flower_blooming/flower_blooming.h new file mode 100644 index 0000000000..ccdaa70d97 --- /dev/null +++ b/users/horrortroll/led/flower_blooming/flower_blooming.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> | ||
| 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 | #pragma once | ||
| 18 | |||
| 19 | typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); | ||
| 20 | |||
| 21 | bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { | ||
| 22 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
| 23 | |||
| 24 | uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 10, 1)); | ||
| 25 | for (uint8_t i = led_min; i < led_max; i++) { | ||
| 26 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
| 27 | if (g_led_config.point[i].y > k_rgb_matrix_center.y) { | ||
| 28 | RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | ||
| 29 | rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); | ||
| 30 | } else { | ||
| 31 | RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); | ||
| 32 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | return rgb_matrix_check_finished_leds(led_max); | ||
| 36 | } | ||
