Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB Matrix Caps Lock and Layer indicator example #13367

Merged
merged 8 commits into from
Jul 3, 2021
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/feature_rgb_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,37 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
```

### Indicator Examples :id=indicator-examples

Caps Lock indicator on alpha numberic flagged keys:
filterpaper marked this conversation as resolved.
Show resolved Hide resolved
```c
void rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; ++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_user(void) {
switch(get_highest_layer(layer_state|default_layer_state)) {
case RAISE:
rgb_matrix_set_color_all(RGB_BLUE);
break;
case LOWER:
rgb_matrix_set_color_all(RGB_YELLOW);
break;
default:
break;
}
filterpaper marked this conversation as resolved.
Show resolved Hide resolved
}
```

### 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.

Expand Down