diff options
author | Drashna Jaelre <drashna@live.com> | 2021-07-26 17:59:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-26 17:59:49 -0700 |
commit | eb46c954dcf99d842967cc6095827316ffddd291 (patch) | |
tree | 69f0a5ade629b63731c246888c0e067312e0970f /users/drashna/rgb_matrix_stuff.c | |
parent | 368efb5d2b834d995ba24cd23349327bab02918b (diff) |
[Keymap] Drashna's Defaults cleanup (#13722)
Diffstat (limited to 'users/drashna/rgb_matrix_stuff.c')
-rw-r--r-- | users/drashna/rgb_matrix_stuff.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c index 9fbe6214bf..5adbd8ab1b 100644 --- a/users/drashna/rgb_matrix_stuff.c +++ b/users/drashna/rgb_matrix_stuff.c @@ -28,24 +28,30 @@ static uint32_t hypno_timer; void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) { HSV hsv = {hue, sat, val}; - if (hsv.v > rgb_matrix_get_val()) { hsv.v = rgb_matrix_get_val(); } + if (hsv.v > rgb_matrix_get_val()) { + hsv.v = rgb_matrix_get_val(); + } switch (mode) { - case 1: // breathing + case 1: // breathing { uint16_t time = scale16by8(g_rgb_timer, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { - if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } + if (HAS_FLAGS(g_led_config.flags[i], led_type)) { + RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); + } } break; } - default: // Solid Color + default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { - if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } + if (HAS_FLAGS(g_led_config.flags[i], led_type)) { + RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); + } } break; } @@ -56,30 +62,38 @@ __attribute__((weak)) void rgb_matrix_indicator_keymap(void) {} void matrix_scan_rgb_matrix(void) { #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) - if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) { rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); } + if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); + } #endif rgb_matrix_indicator_keymap(); } void keyboard_post_init_rgb_matrix(void) { #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) - if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); } + if (userspace_config.rgb_matrix_idle_anim) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); + } #endif } bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) hypno_timer = sync_timer_read32(); - if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); } + if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); + } #endif switch (keycode) { - case RGB_IDL: // This allows me to use underglow as layer indication, or as normal + case RGB_IDL: // This allows me to use underglow as layer indication, or as normal #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) if (record->event.pressed) { userspace_config.rgb_matrix_idle_anim ^= 1; dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim); eeconfig_update_user(userspace_config.raw); - if (userspace_config.rgb_matrix_idle_anim) { rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); } + if (userspace_config.rgb_matrix_idle_anim) { + rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); + } } #endif break; |