diff options
Diffstat (limited to 'keyboards/converter/usb_usb/keymaps/chriskopher/combo.c')
-rw-r--r-- | keyboards/converter/usb_usb/keymaps/chriskopher/combo.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c b/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c new file mode 100644 index 000000000..68a3eda04 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* Copyright 2020 Christopher Ko <[email protected]> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include "shared_enum.h" | ||
18 | |||
19 | #include "quantum.h" | ||
20 | |||
21 | enum combo_event { | ||
22 | SD_LAYER_COMBO, | ||
23 | KL_MEH_COMBO, | ||
24 | }; | ||
25 | |||
26 | const uint16_t PROGMEM sd_combo[] = {KC_S, KC_D, COMBO_END}; // Combo: S + D for SuperDuper mode | ||
27 | const uint16_t PROGMEM kl_combo[] = {KC_K, KC_L, COMBO_END}; // Combo: K + L for Meh modifier | ||
28 | |||
29 | // Register the combo action | ||
30 | combo_t key_combos[COMBO_COUNT] = { | ||
31 | [SD_LAYER_COMBO] = COMBO_ACTION(sd_combo), | ||
32 | [KL_MEH_COMBO] = COMBO_ACTION(kl_combo), | ||
33 | }; | ||
34 | |||
35 | // Called after a combo event is triggered | ||
36 | void process_combo_event(uint16_t combo_index, bool pressed) { | ||
37 | switch (combo_index) { | ||
38 | case SD_LAYER_COMBO: | ||
39 | if (pressed) { | ||
40 | layer_on(_SUPERDUPER); | ||
41 | } else { | ||
42 | layer_off(_SUPERDUPER); | ||
43 | } | ||
44 | break; | ||
45 | |||
46 | case KL_MEH_COMBO: | ||
47 | if (pressed) { | ||
48 | register_mods(MOD_MEH); | ||
49 | } else { | ||
50 | unregister_mods(MOD_MEH); | ||
51 | } | ||
52 | break; | ||
53 | } | ||
54 | } | ||