1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/users/drashna/rgb
Drashna Jaelre 4a87af0e9a
[Keymap] Drashna updates for 0.19 (#19175)
* Fix up bastardkb boards since blackpill support is officially added.
  * Check for blackpill version, not elite c.
  * Add checks in chibiOS config since multiple ARM controllers supported.
  * Rework rules.mk for keymaps to better handle arm vs avr support
* Start moving away from `matrix_*_*` functions.
  * `housekeeping_task_*` instead of `matrix_scan_*`
  * `keyboard_(pre|post)_init_*` instead of `matrix_init_*` 
* Add ℂℴmⅈℂ unicode input method.
* Clean up unicode code to be more compact and flexible.
* Remove/move Pro Micro LED commands to userspace and better filter them
* Fixup OLED code
  * Use newer quantum keycode functions/preprocessors rather than manual bit manipulation
  * Make unicode mode render much more compact/simple.
* Make qmk secrets more self contained
* Remove custom implementation of split watchdog
2022-11-29 11:43:42 -08:00
..
readme.md [Keymap] Reorganization, cleanup and readmes for drashna code (#15617) 2021-12-29 20:17:34 -08:00
rgb_matrix_config.h Change {LED,RGB}_DISABLE_TIMEOUT to {LED,RGB}_MATRIX_TIMEOUT (#18415) 2022-09-26 14:40:15 +10:00
rgb_matrix_stuff.c Fix Per Key LED Indicator Callbacks (#18450) 2022-10-04 15:24:22 -07:00
rgb_matrix_stuff.h [Keymap] Reorganization, cleanup and readmes for drashna code (#15617) 2021-12-29 20:17:34 -08:00
rgb_stuff.c [Keymap] Updates to drashna Keymaps and Userspace (#17543) 2022-07-02 19:55:46 -07:00
rgb_stuff.h [Keymap] Reorganization, cleanup and readmes for drashna code (#15617) 2021-12-29 20:17:34 -08:00
rgblight_config.h [Keymap] Drashna updates for 0.19 (#19175) 2022-11-29 11:43:42 -08:00

RGB

Custom RGB code can be disabled by setting CUSTOM_RGBLIGHT = no or CUSTOM_RGB_MATRIX = no in your rules.mk

RGB Light

Layer Indication Code

At least for RGB Light, the layer_state_set function is used to detect the current highest layer, and change the underglow based on that layer.

This works for both the regular layers, and for the default layers, too.

I use the sethsv variants of the commands, so that different modes can be used, as well.

RGB Matrix uses a custom, per board implementation, at the moment.

RGB Light Startup Animation

On startup, if enabled, the board will cycle through the entire hue wheel, starting and ending on the default layer color.

void keyboard_post_init_rgb(void) {
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_STARTUP_ANIMATION)
    if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); }
    if (rgblight_config.enable) {
        layer_state_set_user(layer_state);
        uint16_t old_hue = rgblight_config.hue;
        rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
        for (uint16_t i = 255; i > 0; i--) {
            rgblight_sethsv_noeeprom( ( i + old_hue) % 255, 255, 255);
            matrix_scan();
            wait_ms(10);
        }
    }
#endif
    layer_state_set_user(layer_state);
}

This could probably benefit from some cleanup and better handling.

RGB Matrix

Idle Animation

This feature can be toggled with the RGB_IDL keycode.

This sets the mode to the Heatmap Animation when typing, but will switch to the cycle in animations when idle.

Layer Indication

This sets the modifier keys to indicate the current layer state, with the option to override the behavior.