qmk_firmware/keyboards/xelus/la_plus/rgb_matrix_kb.inc
Nick Brassel 2b00b846dc
Non-volatile memory data repository pattern (#24356)
* First batch of eeconfig conversions.

* Offset and length for datablocks.

* `via`, `dynamic_keymap`.

* Fix filename.

* Commentary.

* wilba leds

* satisfaction75

* satisfaction75

* more keyboard whack-a-mole

* satisfaction75

* omnikeyish

* more whack-a-mole

* `generic_features.mk` to automatically pick up nvm repositories

* thievery

* deferred variable resolve

* whitespace

* convert api to structs/unions

* convert api to structs/unions

* convert api to structs/unions

* fixups

* code-side docs

* code size fix

* rollback

* nvm_xxxxx_erase

* Updated location of eeconfig magic numbers so non-EEPROM nvm drivers can use them too.

* Fixup build.

* Fixup compilation error with encoders.

* Build fixes.

* Add `via_ci` keymap to onekey to exercise VIA bindings (and thus dynamic keymap et.al.), fixup compilation errors based on preprocessor+sizeof.

* Build failure rectification.
2025-03-21 23:38:34 +11:00

60 lines
1.7 KiB
C++

// 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_t hsv = rgb_matrix_config.hsv;
rgb_t 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) {
eeconfig_read_rgb_matrix(&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