|
@@ -297,8 +297,8 @@ This runs code every time that the layers get changed. This can be useful for l
|
|
|
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example
|
|
|
|
|
|
```c
|
|
|
-uint32_t layer_state_set_user(uint32_t state) {
|
|
|
- switch (biton32(state)) {
|
|
|
+layer_state_t layer_state_set_user(layer_state_t state) {
|
|
|
+ switch (get_highest_layer(state)) {
|
|
|
case _RAISE:
|
|
|
rgblight_setrgb (0x00, 0x00, 0xFF);
|
|
|
break;
|
|
@@ -320,8 +320,8 @@ uint32_t layer_state_set_user(uint32_t state) {
|
|
|
```
|
|
|
### `layer_state_set_*` Function Documentation
|
|
|
|
|
|
-* Keyboard/Revision: `uint32_t layer_state_set_kb(uint32_t state)`
|
|
|
-* Keymap: `uint32_t layer_state_set_user(uint32_t state)`
|
|
|
+* Keyboard/Revision: `layer_state_t layer_state_set_kb(layer_state_t state)`
|
|
|
+* Keymap: `layer_state_t layer_state_set_user(layer_state_t state)`
|
|
|
|
|
|
|
|
|
The `state` is the bitmask of the active layers, as explained in the [Keymap Overview](keymap.md#keymap-layer-status)
|
|
@@ -377,8 +377,8 @@ void keyboard_post_init_user(void) {
|
|
|
The above function will use the EEPROM config immediately after reading it, to set the default layer's RGB color. The "raw" value of it is converted in a usable structure based on the "union" that you created above.
|
|
|
|
|
|
```c
|
|
|
-uint32_t layer_state_set_user(uint32_t state) {
|
|
|
- switch (biton32(state)) {
|
|
|
+layer_state_t layer_state_set_user(layer_state_t state) {
|
|
|
+ switch (get_highest_layer(state)) {
|
|
|
case _RAISE:
|
|
|
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
|
|
|
break;
|