diff options
Diffstat (limited to 'quantum/rgb_matrix/animations/breathing_anim.h')
-rw-r--r-- | quantum/rgb_matrix/animations/breathing_anim.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h new file mode 100644 index 000000000..340bd93e5 --- /dev/null +++ b/quantum/rgb_matrix/animations/breathing_anim.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef DISABLE_RGB_MATRIX_BREATHING | ||
2 | RGB_MATRIX_EFFECT(BREATHING) | ||
3 | # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
4 | |||
5 | bool BREATHING(effect_params_t* params) { | ||
6 | RGB_MATRIX_USE_LIMITS(led_min, led_max); | ||
7 | |||
8 | HSV hsv = rgb_matrix_config.hsv; | ||
9 | uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8); | ||
10 | hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); | ||
11 | RGB rgb = rgb_matrix_hsv_to_rgb(hsv); | ||
12 | for (uint8_t i = led_min; i < led_max; i++) { | ||
13 | RGB_MATRIX_TEST_LED_FLAGS(); | ||
14 | rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
15 | } | ||
16 | return led_max < DRIVER_LED_TOTAL; | ||
17 | } | ||
18 | |||
19 | # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS | ||
20 | #endif // DISABLE_RGB_MATRIX_BREATHING | ||