diff options
| author | Ryan <fauxpark@gmail.com> | 2024-06-13 21:59:46 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-13 21:59:46 +1000 |
| commit | c4a74be7f02ec64033638e93a49924df20fb2e57 (patch) | |
| tree | 316591afc43709e873dea3f6733454f1f37d1194 /quantum/process_keycode/process_underglow.c | |
| parent | dafbb92f4ea851a498bec2edd35cede469ee9504 (diff) | |
Add process_keycode handlers for new RGB Matrix and Underglow keycodes (#23896)
Diffstat (limited to 'quantum/process_keycode/process_underglow.c')
| -rw-r--r-- | quantum/process_keycode/process_underglow.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_underglow.c b/quantum/process_keycode/process_underglow.c new file mode 100644 index 0000000000..779672ac07 --- /dev/null +++ b/quantum/process_keycode/process_underglow.c | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | // Copyright 2024 QMK | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "process_underglow.h" | ||
| 5 | #include "rgblight.h" | ||
| 6 | #include "action_util.h" | ||
| 7 | #include "keycodes.h" | ||
| 8 | #include "modifiers.h" | ||
| 9 | |||
| 10 | bool process_underglow(uint16_t keycode, keyrecord_t *record) { | ||
| 11 | if (record->event.pressed) { | ||
| 12 | uint8_t shifted = get_mods() & MOD_MASK_SHIFT; | ||
| 13 | switch (keycode) { | ||
| 14 | case QK_UNDERGLOW_TOGGLE: | ||
| 15 | rgblight_toggle(); | ||
| 16 | return false; | ||
| 17 | case QK_UNDERGLOW_MODE_NEXT: | ||
| 18 | if (shifted) { | ||
| 19 | rgblight_step_reverse(); | ||
| 20 | } else { | ||
| 21 | rgblight_step(); | ||
| 22 | } | ||
| 23 | return false; | ||
| 24 | case QK_UNDERGLOW_MODE_PREVIOUS: | ||
| 25 | if (shifted) { | ||
| 26 | rgblight_step(); | ||
| 27 | } else { | ||
| 28 | rgblight_step_reverse(); | ||
| 29 | } | ||
| 30 | return false; | ||
| 31 | case QK_UNDERGLOW_HUE_UP: | ||
| 32 | if (shifted) { | ||
| 33 | rgblight_decrease_hue(); | ||
| 34 | } else { | ||
| 35 | rgblight_increase_hue(); | ||
| 36 | } | ||
| 37 | return false; | ||
| 38 | case QK_UNDERGLOW_HUE_DOWN: | ||
| 39 | if (shifted) { | ||
| 40 | rgblight_increase_hue(); | ||
| 41 | } else { | ||
| 42 | rgblight_decrease_hue(); | ||
| 43 | } | ||
| 44 | return false; | ||
| 45 | case QK_UNDERGLOW_SATURATION_UP: | ||
| 46 | if (shifted) { | ||
| 47 | rgblight_decrease_sat(); | ||
| 48 | } else { | ||
| 49 | rgblight_increase_sat(); | ||
| 50 | } | ||
| 51 | return false; | ||
| 52 | case QK_UNDERGLOW_SATURATION_DOWN: | ||
| 53 | if (shifted) { | ||
| 54 | rgblight_increase_sat(); | ||
| 55 | } else { | ||
| 56 | rgblight_decrease_sat(); | ||
| 57 | } | ||
| 58 | return false; | ||
| 59 | case QK_UNDERGLOW_VALUE_UP: | ||
| 60 | if (shifted) { | ||
| 61 | rgblight_decrease_val(); | ||
| 62 | } else { | ||
| 63 | rgblight_increase_val(); | ||
| 64 | } | ||
| 65 | return false; | ||
| 66 | case QK_UNDERGLOW_VALUE_DOWN: | ||
| 67 | if (shifted) { | ||
| 68 | rgblight_increase_hue(); | ||
| 69 | } else { | ||
| 70 | rgblight_decrease_hue(); | ||
| 71 | } | ||
| 72 | return false; | ||
| 73 | case QK_UNDERGLOW_SPEED_UP: | ||
| 74 | if (shifted) { | ||
| 75 | rgblight_decrease_speed(); | ||
| 76 | } else { | ||
| 77 | rgblight_increase_speed(); | ||
| 78 | } | ||
| 79 | return false; | ||
| 80 | case QK_UNDERGLOW_SPEED_DOWN: | ||
| 81 | if (shifted) { | ||
| 82 | rgblight_increase_speed(); | ||
| 83 | } else { | ||
| 84 | rgblight_decrease_speed(); | ||
| 85 | } | ||
| 86 | return false; | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | return true; | ||
| 91 | } | ||
