From 02ad58422e3ebb00fa6ff37531a5076f2964a132 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 12 Jun 2024 02:59:18 +1000 Subject: [PATCH 1/2] Slight clarification of LED/RGB Matrix custom effect docs --- docs/features/led_matrix.md | 21 ++++++++++----------- docs/features/rgb_matrix.md | 12 ++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/features/led_matrix.md b/docs/features/led_matrix.md index fee7b139bce1..c24334d7a96e 100644 --- a/docs/features/led_matrix.md +++ b/docs/features/led_matrix.md @@ -300,18 +300,11 @@ These modes introduce additional logic that can increase firmware size. ## Custom LED Matrix Effects {#custom-led-matrix-effects} -By setting `LED_MATRIX_CUSTOM_USER` (and/or `LED_MATRIX_CUSTOM_KB`) in `rules.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files. +By setting `LED_MATRIX_CUSTOM_USER = yes` in `rules.mk`, new effects can be defined directly from your keymap or userspace, without having to edit any QMK core files. To declare new effects, create a `led_matrix_user.inc` file in the user keymap directory or userspace folder. -To declare new effects, create a new `led_matrix_user/kb.inc` that looks something like this: - -`led_matrix_user.inc` should go in the root of the keymap directory. -`led_matrix_kb.inc` should go in the root of the keyboard directory. - -To use custom effects in your code, simply prepend `LED_MATRIX_CUSTOM_` to the effect name specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with: - -```c -led_matrix_mode(led_MATRIX_CUSTOM_my_cool_effect); -``` +::: tip +Hardware maintainers who want to limit custom effects to a specific keyboard can create a `led_matrix_kb.inc` file in the root of the keyboard directory, and add `LED_MATRIX_CUSTOM_KB = yes` to the keyboard level `rules.mk`. +::: ```c // !!! DO NOT ADD #pragma once !!! // @@ -356,6 +349,12 @@ static bool my_cool_effect2(effect_params_t* params) { #endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS ``` +To switch to your custom effect programmatically, simply call `led_matrix_mode()` and prepend `LED_MATRIX_CUSTOM_` to the effect name your specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with: + +```c +led_matrix_mode(led_MATRIX_CUSTOM_my_cool_effect); +``` + For inspiration and examples, check out the built-in effects under `quantum/led_matrix/animations/`. diff --git a/docs/features/rgb_matrix.md b/docs/features/rgb_matrix.md index f7f693f239fa..448d1cdfb56c 100644 --- a/docs/features/rgb_matrix.md +++ b/docs/features/rgb_matrix.md @@ -807,12 +807,6 @@ By setting `RGB_MATRIX_CUSTOM_USER = yes` in `rules.mk`, new effects can be defi Hardware maintainers who want to limit custom effects to a specific keyboard can create a `rgb_matrix_kb.inc` file in the root of the keyboard directory, and add `RGB_MATRIX_CUSTOM_KB = yes` to the keyboard level `rules.mk`. ::: -To use custom effects in your code, simply prepend `RGB_MATRIX_CUSTOM_` to the effect name specified in `RGB_MATRIX_EFFECT()`. For example, an effect declared as `RGB_MATRIX_EFFECT(my_cool_effect)` would be referenced with: - -```c -rgb_matrix_mode(RGB_MATRIX_CUSTOM_my_cool_effect); -``` - ```c // !!! DO NOT ADD #pragma once !!! // @@ -856,6 +850,12 @@ static bool my_cool_effect2(effect_params_t* params) { #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS ``` +To switch to your custom effect programmatically, simply call `rgb_matrix_mode()` and prepend `RGB_MATRIX_CUSTOM_` to the effect name you specified in `RGB_MATRIX_EFFECT()`. For example, an effect declared as `RGB_MATRIX_EFFECT(my_cool_effect)` would be referenced with: + +```c +rgb_matrix_mode(RGB_MATRIX_CUSTOM_my_cool_effect); +``` + For inspiration and examples, check out the built-in effects under `quantum/rgb_matrix/animations/`. From df5858489de6303e2c16ab1aa4fdb83041360208 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 12 Jun 2024 03:05:09 +1000 Subject: [PATCH 2/2] Fix typo --- docs/features/led_matrix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/led_matrix.md b/docs/features/led_matrix.md index c24334d7a96e..164cbc0f5fc0 100644 --- a/docs/features/led_matrix.md +++ b/docs/features/led_matrix.md @@ -352,7 +352,7 @@ static bool my_cool_effect2(effect_params_t* params) { To switch to your custom effect programmatically, simply call `led_matrix_mode()` and prepend `LED_MATRIX_CUSTOM_` to the effect name your specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with: ```c -led_matrix_mode(led_MATRIX_CUSTOM_my_cool_effect); +led_matrix_mode(LED_MATRIX_CUSTOM_my_cool_effect); ``` For inspiration and examples, check out the built-in effects under `quantum/led_matrix/animations/`.