aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-03-24 18:54:38 -0700
committerGitHub <noreply@github.com>2020-03-24 18:54:38 -0700
commit5075a1d9e4bdc4af6563f3805f567913e36f7159 (patch)
tree7a42fa0e87ac0ae0ea8578dd373087da50c48c53 /docs
parent3587e20e7016792846d351925706da04e9442420 (diff)
downloadqmk_firmware-5075a1d9e4bdc4af6563f3805f567913e36f7159.tar.gz
qmk_firmware-5075a1d9e4bdc4af6563f3805f567913e36f7159.zip
[Docs] Update RGB Matrix docs with function refs (#8367)
* [Docs] Update RGB Matrix docs with function refs * Fix up code samples * suggestions by noroadsleft * Fix small typo Co-authored-by: James Young <xxiinophobia@yahoo.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/feature_rgb_matrix.md82
1 files changed, 76 insertions, 6 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 7bc219347..2cec55ee7 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -396,18 +396,88 @@ The EEPROM for it is currently shared with the RGBLIGHT system (it's generally a
396 396
397Where `28` is an unused index from `eeconfig.h`. 397Where `28` is an unused index from `eeconfig.h`.
398 398
399## Suspended state :id=suspended-state 399## Functions :id=functions
400
401### Direct Operation :id=direct-operation
402|Function |Description |
403|--------------------------------------------|-------------|
404|`rgb_matrix_set_color_all(r, g, b)` |Set all of the LEDs to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
405|`rgb_matrix_set_color(index, r, g, b)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255, and `index` is between 0 and `DRIVER_LED_TOTAL` (not written to EEPROM) |
406
407### Disable/Enable Effects :id=disable-enable-effects
408|Function |Description |
409|--------------------------------------------|-------------|
410|`rgb_matrix_toggle()` |Toggle effect range LEDs between on and off |
411|`rgb_matrix_toggle_noeeprom()` |Toggle effect range LEDs between on and off (not written to EEPROM) |
412|`rgb_matrix_enable()` |Turn effect range LEDs on, based on their previous state |
413|`rgb_matrix_enable_noeeprom()` |Turn effect range LEDs on, based on their previous state (not written to EEPROM) |
414|`rgb_matrix_disable()` |Turn effect range LEDs off |
415|`rgb_matrix_disable_noeeprom()` |Turn effect range LEDs off (not written to EEPROM) |
416
417### Change Effect Mode :id=change-effect-mode
418|Function |Description |
419|--------------------------------------------|-------------|
420|`rgb_matrix_mode(mode)` |Set the mode, if RGB animations are enabled |
421|`rgb_matrix_mode_noeeprom(mode)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
422|`rgb_matrix_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
423|`rgb_matrix_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
424|`rgb_matrix_increase_speed()` |Increases the speed of the animations |
425|`rgb_matrix_decrease_speed()` |Decreases the speed of the animations |
426
427### Change Color :id=change-color
428|Function |Description |
429|--------------------------------------------|-------------|
430|`rgb_matrix_increase_hue()` |Increase the hue for effect range LEDs. This wraps around at maximum hue |
431|`rgb_matrix_decrease_hue()` |Decrease the hue for effect range LEDs. This wraps around at minimum hue |
432|`rgb_matrix_increase_sat()` |Increase the saturation for effect range LEDs. This wraps around at maximum saturation |
433|`rgb_matrix_decrease_sat()` |Decrease the saturation for effect range LEDs. This wraps around at minimum saturation |
434|`rgb_matrix_increase_val()` |Increase the value for effect range LEDs. This wraps around at maximum value |
435|`rgb_matrix_decrease_val()` |Decrease the value for effect range LEDs. This wraps around at minimum value |
436|`rgb_matrix_sethsv(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 |
437|`rgb_matrix_sethsv_noeeprom(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
438
439### Query Current Status :id=query-current-status
440|Function |Description |
441|-----------------------|-----------------|
442|`rgb_matrix_get_mode()` |Get current mode |
443|`rgb_matrix_get_hue()` |Get current hue |
444|`rgb_matrix_get_sat()` |Get current sat |
445|`rgb_matrix_get_val()` |Get current val |
446
447## Callbacks :id=callbacks
448
449### Indicators :id=indicators
450
451If you want to set custom indicators, such as an LED for Caps Lock, or layer indication, you can use the `rgb_matrix_indicators_kb` or `rgb_matrix_indicators_user` function for that:
452```c
453void rgb_matrix_indicators_kb(void) {
454 rgb_matrix_set_color(index, red, green, blue);
455}
456```
400 457
401To use the suspend feature, add this to your `<keyboard>.c`: 458### Suspended state :id=suspended-state
459To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
402 460
461Additionally add this to your `<keyboard>.c`:
462
463```c
464void suspend_power_down_kb(void) {
465 rgb_matrix_set_suspend_state(true);
466 suspend_power_down_user();
467}
468
469void suspend_wakeup_init_kb(void) {
470 rgb_matrix_set_suspend_state(false);
471 suspend_wakeup_init_user();
472}
473```
474or add this to your `keymap.c`:
403```c 475```c
404void suspend_power_down_kb(void) 476void suspend_power_down_user(void) {
405{
406 rgb_matrix_set_suspend_state(true); 477 rgb_matrix_set_suspend_state(true);
407} 478}
408 479
409void suspend_wakeup_init_kb(void) 480void suspend_wakeup_init_user(void) {
410{
411 rgb_matrix_set_suspend_state(false); 481 rgb_matrix_set_suspend_state(false);
412} 482}
413``` 483```