]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
[Keymap] Drashna Corne Keyboard updates (#5903)
[qmk_firmware.git] / quantum / rgb_matrix_animations / colorband_pinwheel_val_anim.h
1 #ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
2 RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
3 #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
4
5 bool BAND_PINWHEEL_VAL(effect_params_t* params) {
6   RGB_MATRIX_USE_LIMITS(led_min, led_max);
7
8   HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
9   uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 2);
10   for (uint8_t i = led_min; i < led_max; i++) {
11     RGB_MATRIX_TEST_LED_FLAGS();
12     int16_t dx = g_led_config.point[i].x - 112;
13     int16_t dy = g_led_config.point[i].y - 32;
14     hsv.v = rgb_matrix_config.val - time - atan2_8(dy, dx) * 3;
15     RGB rgb = hsv_to_rgb(hsv);
16     rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
17   }
18   return led_max < DRIVER_LED_TOTAL;
19 }
20
21 #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
22 #endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL