diff options
author | QMK Bot <hello@qmk.fm> | 2021-07-03 08:07:02 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-07-03 08:07:02 +0000 |
commit | 8465d28d0fcf08139a13b54f2a1323874cf5a954 (patch) | |
tree | a2f1e8f46688b1fb2170797630c945960db302db /docs | |
parent | b45b9ed536151ded3ec8fd90d1d961632b8a2e73 (diff) | |
parent | fdf71f1aa7c4720b469d0e11ec8169796cdf3930 (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'docs')
-rw-r--r-- | docs/feature_rgb_matrix.md | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 4bd8e1eb98..675b7a1be0 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -694,6 +694,39 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } ``` +### Indicator Examples :id=indicator-examples + +Caps Lock indicator on alphanumeric flagged keys: +```c +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = led_min; i <= led_max; i++) { + if (g_led_config.flags[i] & LED_FLAG_KEYLIGHT) { + rgb_matrix_set_color(i, RGB_RED); + } + } + } +} +``` + +Layer indicator on all flagged keys: +```c +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + for (uint8_t i = led_min; i <= led_max; i++) { + switch(get_highest_layer(layer_state|default_layer_state)) { + case RAISE: + rgb_matrix_set_color(i, RGB_BLUE); + break; + case LOWER: + rgb_matrix_set_color(i, RGB_YELLOW); + break; + default: + break; + } + } +} +``` + ### Suspended state :id=suspended-state To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file. |