diff options
author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2021-12-15 05:53:36 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 10:53:36 -0800 |
commit | 58fbafeeabc21e1f850b0e4672b5f1e4a5359ce5 (patch) | |
tree | af8661826080d54361b5aa89508ec63f89a85603 /keyboards/xelus/la_plus/rgb_matrix_kb.inc | |
parent | 99b35940bc4166eae3853c9e2fa94bd2be72742e (diff) |
[Keyboard] Add La+ (#15460)
Diffstat (limited to 'keyboards/xelus/la_plus/rgb_matrix_kb.inc')
-rw-r--r-- | keyboards/xelus/la_plus/rgb_matrix_kb.inc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/keyboards/xelus/la_plus/rgb_matrix_kb.inc b/keyboards/xelus/la_plus/rgb_matrix_kb.inc new file mode 100644 index 0000000000..aee484cdb8 --- /dev/null +++ b/keyboards/xelus/la_plus/rgb_matrix_kb.inc @@ -0,0 +1,59 @@ +// Step 1. +// Declare custom effects using the RGB_MATRIX_EFFECT macro +// (note the lack of semicolon after the macro!) +RGB_MATRIX_EFFECT(startup_animation_dots) +RGB_MATRIX_EFFECT(startup_animation_solid) + +// Step 2. +// Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "eeprom.h" +#include "eeconfig.h" + +static void startup_animation_setleds(effect_params_t* params, bool dots) { + uint8_t factor = 5; + HSV hsv = rgb_matrix_config.hsv; + RGB rgb = rgb_matrix_hsv_to_rgb(hsv); + if (dots) { + rgb_matrix_set_color_all(0, 0, 0); + } + int32_t num = (g_rgb_timer & (0b11111 << factor)) >> factor; + + if (num == 17 || num == 18 || num == 19 || + num == 20 || num == 21) { + if (dots == true) { + for (int i = 0; i < 28; i++) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + return; + } else if (num == 0 || num == 1 || num == 2) { + return; + } else if (num >= 22) { + eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); + rgb_matrix_mode_noeeprom(rgb_matrix_config.mode); + return; + } + + int32_t num2 = (27/2) + num - 2; + int32_t num1 = 27 - num2; +#ifdef CONSOLE_ENABLE + uprintf("num: %u\n", num); + uprintf("num1: %u\n", num1); + uprintf("num2: %u\n", num2); +#endif + rgb_matrix_set_color(num1, rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(num2, rgb.r, rgb.g, rgb.b); +} + +static bool startup_animation_dots(effect_params_t* params) { + startup_animation_setleds(params, true); + return false; +} +static bool startup_animation_solid(effect_params_t* params) { + startup_animation_setleds(params, false); + return false; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS |