summaryrefslogtreecommitdiff
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
parent3587e20e7016792846d351925706da04e9442420 (diff)
[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>
-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 7bc2193472..2cec55ee77 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
Where `28` is an unused index from `eeconfig.h`.
-## Suspended state :id=suspended-state
+## Functions :id=functions
+
+### Direct Operation :id=direct-operation
+|Function |Description |
+|--------------------------------------------|-------------|
+|`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) |
+|`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) |
+
+### Disable/Enable Effects :id=disable-enable-effects
+|Function |Description |
+|--------------------------------------------|-------------|
+|`rgb_matrix_toggle()` |Toggle effect range LEDs between on and off |
+|`rgb_matrix_toggle_noeeprom()` |Toggle effect range LEDs between on and off (not written to EEPROM) |
+|`rgb_matrix_enable()` |Turn effect range LEDs on, based on their previous state |
+|`rgb_matrix_enable_noeeprom()` |Turn effect range LEDs on, based on their previous state (not written to EEPROM) |
+|`rgb_matrix_disable()` |Turn effect range LEDs off |
+|`rgb_matrix_disable_noeeprom()` |Turn effect range LEDs off (not written to EEPROM) |
+
+### Change Effect Mode :id=change-effect-mode
+|Function |Description |
+|--------------------------------------------|-------------|
+|`rgb_matrix_mode(mode)` |Set the mode, if RGB animations are enabled |
+|`rgb_matrix_mode_noeeprom(mode)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
+|`rgb_matrix_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
+|`rgb_matrix_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
+|`rgb_matrix_increase_speed()` |Increases the speed of the animations |
+|`rgb_matrix_decrease_speed()` |Decreases the speed of the animations |
+
+### Change Color :id=change-color
+|Function |Description |
+|--------------------------------------------|-------------|
+|`rgb_matrix_increase_hue()` |Increase the hue for effect range LEDs. This wraps around at maximum hue |
+|`rgb_matrix_decrease_hue()` |Decrease the hue for effect range LEDs. This wraps around at minimum hue |
+|`rgb_matrix_increase_sat()` |Increase the saturation for effect range LEDs. This wraps around at maximum saturation |
+|`rgb_matrix_decrease_sat()` |Decrease the saturation for effect range LEDs. This wraps around at minimum saturation |
+|`rgb_matrix_increase_val()` |Increase the value for effect range LEDs. This wraps around at maximum value |
+|`rgb_matrix_decrease_val()` |Decrease the value for effect range LEDs. This wraps around at minimum value |
+|`rgb_matrix_sethsv(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 |
+|`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) |
+
+### Query Current Status :id=query-current-status
+|Function |Description |
+|-----------------------|-----------------|
+|`rgb_matrix_get_mode()` |Get current mode |
+|`rgb_matrix_get_hue()` |Get current hue |
+|`rgb_matrix_get_sat()` |Get current sat |
+|`rgb_matrix_get_val()` |Get current val |
+
+## Callbacks :id=callbacks
+
+### Indicators :id=indicators
+
+If 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:
+```c
+void rgb_matrix_indicators_kb(void) {
+ rgb_matrix_set_color(index, red, green, blue);
+}
+```
-To use the suspend feature, add this to your `<keyboard>.c`:
+### 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.
+Additionally add this to your `<keyboard>.c`:
+
+```c
+void suspend_power_down_kb(void) {
+ rgb_matrix_set_suspend_state(true);
+ suspend_power_down_user();
+}
+
+void suspend_wakeup_init_kb(void) {
+ rgb_matrix_set_suspend_state(false);
+ suspend_wakeup_init_user();
+}
+```
+or add this to your `keymap.c`:
```c
-void suspend_power_down_kb(void)
-{
+void suspend_power_down_user(void) {
rgb_matrix_set_suspend_state(true);
}
-void suspend_wakeup_init_kb(void)
-{
+void suspend_wakeup_init_user(void) {
rgb_matrix_set_suspend_state(false);
}
```