1
0
Fork 0

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
This commit is contained in:
Konstantin Đorđević 2020-07-16 14:27:55 +02:00 committed by GitHub
parent f11437aef3
commit 61b64bb82a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 14 deletions

View file

@ -319,7 +319,7 @@ This runs code every time that the layers get changed. This can be useful for l
### Example `layer_state_set_*` Implementation
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example.
```c
layer_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) {
return state;
}
```
Use the `IS_LAYER_ON_STATE(state, layer)` and `IS_LAYER_OFF_STATE(state, layer)` macros to check the status of a particular layer.
Outside of `layer_state_set_*` functions, you can use the `IS_LAYER_ON(layer)` and `IS_LAYER_OFF(layer)` macros to check global layer state.
### `layer_state_set_*` Function Documentation
* Keyboard/Revision: `layer_state_t layer_state_set_kb(layer_state_t state)`