diff options
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-rw-r--r-- | docs/feature_rgb_matrix.md | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index d07c02e184..536609b39a 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -415,7 +415,10 @@ All RGB keycodes are currently shared with the RGBLIGHT system: * `RGB_MODE_*` keycodes will generally work, but not all of the modes are currently mapped to the correct effects for the RGB Matrix system. -`RGB_MODE_PLAIN`, `RGB_MODE_BREATHE`, `RGB_MODE_RAINBOW`, and `RGB_MATRIX_SWIRL` are the only ones that are mapped properly. The rest don't have a direct equivalent, and are not mapped. +`RGB_MODE_PLAIN`, `RGB_MODE_BREATHE`, `RGB_MODE_RAINBOW`, and `RGB_MODE_SWIRL` are the only ones that are mapped properly. The rest don't have a direct equivalent, and are not mapped. + +?> `RGB_*` keycodes cannot be used with functions like `tap_code16(RGB_HUD)` as they're not USB HID keycodes. If you wish to replicate similar behaviour in custom code within your firmware (e.g. inside `encoder_update_user()` or `process_record_user()`), the equivalent [RGB functions](#functions-idfunctions) should be used instead. + !> By default, if you have both the [RGB Light](feature_rgblight.md) and the RGB Matrix feature enabled, these keycodes will work for both features, at the same time. You can disable the keycode functionality by defining the `*_DISABLE_KEYCODES` option for the specific feature. @@ -554,12 +557,9 @@ In order to change the delay of temperature decrease define ## Custom RGB Matrix Effects :id=custom-rgb-matrix-effects -By setting `RGB_MATRIX_CUSTOM_USER` (and/or `RGB_MATRIX_CUSTOM_KB`) in `rules.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files. +By setting `RGB_MATRIX_CUSTOM_USER = yes` in `rules.mk`, new effects can be defined directly from your keymap or userspace, without having to edit any QMK core files. To declare new effects, create a `rgb_matrix_user.inc` file in the user keymap directory or userspace folder. -To declare new effects, create a new `rgb_matrix_user/kb.inc` that looks something like this: - -`rgb_matrix_user.inc` should go in the root of the keymap directory. -`rgb_matrix_kb.inc` should go in the root of the keyboard directory. +?> Hardware maintainers who want to limit custom effects to a specific keyboard can create a `rgb_matrix_kb.inc` file in the root of the keyboard directory, and add `RGB_MATRIX_CUSTOM_KB = yes` to the keyboard level `rules.mk`. To use custom effects in your code, simply prepend `RGB_MATRIX_CUSTOM_` to the effect name specified in `RGB_MATRIX_EFFECT()`. For example, an effect declared as `RGB_MATRIX_EFFECT(my_cool_effect)` would be referenced with: @@ -790,6 +790,28 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } ``` +Layer indicator with only configured keys: +```c +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (get_highest_layer(layer_state) > 0) { + uint8_t layer = get_highest_layer(layer_state); + + for (uint8_t row = 0; row < MATRIX_ROWS; ++row) { + for (uint8_t col = 0; col < MATRIX_COLS; ++col) { + uint8_t index = g_led_config.matrix_co[row][col]; + + if (index >= led_min && index <= led_max && index != NO_LED && + keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) { + rgb_matrix_set_color(index, RGB_GREEN); + } + } + } + } +} +``` + +?> Split keyboards will require layer state data syncing with `#define SPLIT_LAYER_STATE_ENABLE`. See [Data Sync Options](feature_split_keyboard?id=data-sync-options) for more details. + #### Examples :id=indicator-examples This example sets the modifiers to be a specific color based on the layer state. You can use a switch case here, instead, if you would like. This uses HSV and then converts to RGB, because this allows the brightness to be limited (important when using the WS2812 driver). @@ -829,6 +851,8 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } ``` +!> RGB indicators on split keyboards will require state information synced to the slave half (e.g. `#define SPLIT_LAYER_STATE_ENABLE`). See [data sync options](feature_split_keyboard.md#data-sync-options) for more details. + #### Indicators without RGB Matrix Effect If you want to just use RGB indicators without RGB matrix effect, it is not possible to disable the latter because toggling RGB off will disable everything. You can workaround it with solid effect and colors off using this init function: |