df8a538489
* Userspace: muppetjones (#1) Add and update lily58 to work with userspace Add and update kyria keymap to work with userspace Add and update planck keymap with userspace Add etchamouse code and docs to userpace Add userspace Update mouse encoder for smoother movement. Encoder + mouse Added casemodes by andrewjrae * Rollback lily58 state reader and add missing GPL * Apply suggestions from code review Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Joel Challis <git@zvecr.com> * fix lily58 keymap * Updates to user and lily for muppetjones. Updated parameters for etchamouse for smoother mouse movement. Updated lily keymap and userspace to actually work together. * Update keyboards/lily58/keymaps/muppetjones/config.h Co-authored-by: Drashna Jaelre <drashna@live.com> * Updated keymaps and userspace * Little more cleanup. * Update keyboards/lily58/keymaps/muppetjones/rules.mk Co-authored-by: Ryan <fauxpark@gmail.com> * Rollback accidental libchibios update * Apply suggestions from code review Co-authored-by: Drashna Jaelre <drashna@live.com> * Update kyria keymap * Move kyria keymap to splitkb/kyria * Update planck keymap * Remove all changes to keyboards/lily58/lib/layer_state_reader.c * Update lily58 keymap * Recommended change * Update keymap readme * Update kyria keymap and userspace * Apply suggestions from code review Co-authored-by: Drashna Jaelre <drashna@live.com> * Renamed users/muppetjones/README.md to lc * Update keyboards/lily58/keymaps/muppetjones/config.h Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Ryan <fauxpark@gmail.com>
61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
# Dynamic Underglow Lighting Per-Layer
|
|
|
|
This bit of code allows you to define layer lighting that respects your current eeprom settings, e.g., brightness. It does this by storing the base state rgb
|
|
|
|
## Setup
|
|
|
|
1. Enable RGB underglow in your `rules.mk`
|
|
|
|
```
|
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
|
```
|
|
|
|
2. (Optional) Add RGB configuration to your `config.h`
|
|
|
|
```
|
|
#ifdef RGBLIGHT_ENABLE
|
|
// # define RGBLIGHT_ANIMATIONS
|
|
# define RGBLIGHT_HUE_STEP 8
|
|
# define RGBLIGHT_SAT_STEP 16
|
|
# define RGBLIGHT_VAL_STEP 16
|
|
# define RGBLIGHT_LIMIT_VAL 150
|
|
# define RGBLIGHT_SLEEP
|
|
// # define RGBLIGHT_LAYERS
|
|
#endif
|
|
```
|
|
|
|
3. Add `set_layer_hsv` function. This is where you define your layer-specific colors by setting the HSV properties on the `layer_color` pointer. This example uses the QMK RGB configuration parameters to keep the layer colors offset based on the current EEPROM HSV.
|
|
|
|
> NOTE: The HSV values should be between 0 and 255, but setting the modulus on saturation causes the lights to go white on my board. I _think_ this is due to overflow, but I haven't had the chance to try and resolve it yet.
|
|
|
|
|
|
```
|
|
#ifdef RGBLIGHT_ENABLE
|
|
void set_layer_hsv(layer_state_t state, HSV* layer_color) {
|
|
int32_t h = layer_color->h, s = layer_color->s, v = layer_color->v;
|
|
switch (get_highest_layer(state)) {
|
|
case _RAISE:
|
|
h += 2 * RGBLIGHT_HUE_STEP;
|
|
break;
|
|
case _LOWER:
|
|
h += -2 * RGBLIGHT_HUE_STEP;
|
|
break;
|
|
case _NAV:
|
|
h += 1 * RGBLIGHT_HUE_STEP;
|
|
break;
|
|
case _MOUSE:
|
|
h += -7 * RGBLIGHT_HUE_STEP;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
layer_color->h = h % 255;
|
|
layer_color->s = s;
|
|
layer_color->v = v % 255;
|
|
return;
|
|
}
|
|
#endif
|
|
```
|
|
|
|
4. (Optional) If you're using `post_process_record_user`, you'll need to change the name in your keymap to `post_process_record_keymap`. We use the user function to update the HSV state after one of the RGB keycodes is pressed.
|