diff options
author | Ryan <fauxpark@gmail.com> | 2022-02-11 13:31:19 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 02:31:19 +0000 |
commit | 2bc4a216dfbb83a6d2b57da397d370210087cff5 (patch) | |
tree | 9a16383f77159d03bd4ec5ca4ad8918f766ea16b /keyboards/maxr1998/pulse4k/keymaps/default | |
parent | 63c310f6fd205e6332d69a718b2a295ee7792675 (diff) | |
download | qmk_firmware-2bc4a216dfbb83a6d2b57da397d370210087cff5.tar.gz qmk_firmware-2bc4a216dfbb83a6d2b57da397d370210087cff5.zip |
maxr1998/pulse4k: Move Combo code to keymap level (#16301)
* maxr1998/pulse4k: Move Combo code to keymap level
* Reorder code
Diffstat (limited to 'keyboards/maxr1998/pulse4k/keymaps/default')
-rw-r--r-- | keyboards/maxr1998/pulse4k/keymaps/default/keymap.c | 40 | ||||
-rw-r--r-- | keyboards/maxr1998/pulse4k/keymaps/default/rules.mk | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/keyboards/maxr1998/pulse4k/keymaps/default/keymap.c b/keyboards/maxr1998/pulse4k/keymaps/default/keymap.c index 1ed4b5f1af..243a96ba74 100644 --- a/keyboards/maxr1998/pulse4k/keymaps/default/keymap.c +++ b/keyboards/maxr1998/pulse4k/keymaps/default/keymap.c @@ -21,6 +21,10 @@ enum layers { DEFAULT }; +enum combo_events { + LED_ADJUST +}; + const uint16_t PROGMEM led_adjust_combo[] = {KC_LEFT, KC_RGHT, COMBO_END}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -29,3 +33,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LEFT, KC_DOWN, KC_RGHT ) }; + +combo_t key_combos[COMBO_COUNT] = { + [LED_ADJUST] = COMBO_ACTION(led_adjust_combo) +}; + +bool led_adjust_active = false; + +void process_combo_event(uint16_t combo_index, bool pressed) { + if (combo_index == LED_ADJUST) { + led_adjust_active = pressed; + } +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (led_adjust_active) { + if (clockwise) { + rgblight_increase_val(); + } else { + rgblight_decrease_val(); + } + return false; + } + } else if (index == 1) { + if (led_adjust_active) { + if (clockwise) { + rgblight_increase_hue(); + } else { + rgblight_decrease_hue(); + } + return false; + } + } + + return true; +} diff --git a/keyboards/maxr1998/pulse4k/keymaps/default/rules.mk b/keyboards/maxr1998/pulse4k/keymaps/default/rules.mk new file mode 100644 index 0000000000..ab1e438182 --- /dev/null +++ b/keyboards/maxr1998/pulse4k/keymaps/default/rules.mk @@ -0,0 +1 @@ +COMBO_ENABLE = yes |