aboutsummaryrefslogtreecommitdiff
path: root/docs/custom_quantum_functions.md
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2020-07-16 14:27:55 +0200
committerGitHub <noreply@github.com>2020-07-16 22:27:55 +1000
commit61b64bb82a93c6d1441f07655a5e20b59a15fd29 (patch)
tree6821f6754bdcafd91fb16556f08e2e7ebf361bdf /docs/custom_quantum_functions.md
parentf11437aef392dc44573bf45a738ae758784d2f1b (diff)
downloadqmk_firmware-61b64bb82a93c6d1441f07655a5e20b59a15fd29.tar.gz
qmk_firmware-61b64bb82a93c6d1441f07655a5e20b59a15fd29.zip
Redefine IS_LAYER_ON/OFF() as aliases for existing layer functions (#6352)
* Add IS_LAYER_ON_STATE()/IS_LAYER_OFF_STATE() macros * Add docs for IS_LAYER_ON/OFF(_STATE) macros * Remove IS_LAYER_ON/OFF_STATE redefinition in userspace * Run clang-format on quantum/quantum.h * Redefine IS_LAYER_ON/OFF(_STATE) as aliases of existing layer functions Also update relevant doc entries. Needs testing to check if this breaks existing IS_LAYER_ON/OFF usage in certain edge cases (namely calling the macros with 0). * Reformat layer check function docs
Diffstat (limited to 'docs/custom_quantum_functions.md')
-rw-r--r--docs/custom_quantum_functions.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 6eb144af7..e15126c42 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -319,7 +319,7 @@ This runs code every time that the layers get changed. This can be useful for l
319 319
320### Example `layer_state_set_*` Implementation 320### Example `layer_state_set_*` Implementation
321 321
322This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example 322This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example.
323 323
324```c 324```c
325layer_state_t layer_state_set_user(layer_state_t state) { 325layer_state_t layer_state_set_user(layer_state_t state) {
@@ -343,6 +343,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
343 return state; 343 return state;
344} 344}
345``` 345```
346
347Use the `IS_LAYER_ON_STATE(state, layer)` and `IS_LAYER_OFF_STATE(state, layer)` macros to check the status of a particular layer.
348
349Outside of `layer_state_set_*` functions, you can use the `IS_LAYER_ON(layer)` and `IS_LAYER_OFF(layer)` macros to check global layer state.
350
346### `layer_state_set_*` Function Documentation 351### `layer_state_set_*` Function Documentation
347 352
348* Keyboard/Revision: `layer_state_t layer_state_set_kb(layer_state_t state)` 353* Keyboard/Revision: `layer_state_t layer_state_set_kb(layer_state_t state)`