diff options
author | Albert Y <76888457+filterpaper@users.noreply.github.com> | 2021-07-03 16:07:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-03 01:07:01 -0700 |
commit | fdf71f1aa7c4720b469d0e11ec8169796cdf3930 (patch) | |
tree | 7ff9ef327c976c4ef5061a8fe883a325916dd8ff /docs/feature_rgb_matrix.md | |
parent | 4b285d3f50cf2aaf74683b63f6150e106a3237b0 (diff) | |
download | qmk_firmware-fdf71f1aa7c4720b469d0e11ec8169796cdf3930.tar.gz qmk_firmware-fdf71f1aa7c4720b469d0e11ec8169796cdf3930.zip |
[Docs] RGB Matrix Caps Lock and Layer indicator example (#13367)
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: filterpaper <filterpaper@localhost>
Diffstat (limited to 'docs/feature_rgb_matrix.md')
-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 bfb3688b6..08d5c9c4c 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -624,6 +624,39 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | |||
624 | } | 624 | } |
625 | ``` | 625 | ``` |
626 | 626 | ||
627 | ### Indicator Examples :id=indicator-examples | ||
628 | |||
629 | Caps Lock indicator on alphanumeric flagged keys: | ||
630 | ```c | ||
631 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | ||
632 | if (host_keyboard_led_state().caps_lock) { | ||
633 | for (uint8_t i = led_min; i <= led_max; i++) { | ||
634 | if (g_led_config.flags[i] & LED_FLAG_KEYLIGHT) { | ||
635 | rgb_matrix_set_color(i, RGB_RED); | ||
636 | } | ||
637 | } | ||
638 | } | ||
639 | } | ||
640 | ``` | ||
641 | |||
642 | Layer indicator on all flagged keys: | ||
643 | ```c | ||
644 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { | ||
645 | for (uint8_t i = led_min; i <= led_max; i++) { | ||
646 | switch(get_highest_layer(layer_state|default_layer_state)) { | ||
647 | case RAISE: | ||
648 | rgb_matrix_set_color(i, RGB_BLUE); | ||
649 | break; | ||
650 | case LOWER: | ||
651 | rgb_matrix_set_color(i, RGB_YELLOW); | ||
652 | break; | ||
653 | default: | ||
654 | break; | ||
655 | } | ||
656 | } | ||
657 | } | ||
658 | ``` | ||
659 | |||
627 | ### Suspended state :id=suspended-state | 660 | ### Suspended state :id=suspended-state |
628 | To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file. | 661 | To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file. |
629 | 662 | ||