diff options
Diffstat (limited to 'quantum/process_keycode/process_combo.h')
| -rw-r--r-- | quantum/process_keycode/process_combo.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h new file mode 100644 index 000000000..a5dbd788a --- /dev/null +++ b/quantum/process_keycode/process_combo.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* Copyright 2016 Jack Humbert | ||
| 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 | #ifndef PROCESS_COMBO_H | ||
| 18 | #define PROCESS_COMBO_H | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include "progmem.h" | ||
| 22 | #include "quantum.h" | ||
| 23 | |||
| 24 | typedef struct | ||
| 25 | { | ||
| 26 | const uint16_t *keys; | ||
| 27 | uint16_t keycode; | ||
| 28 | #ifdef EXTRA_EXTRA_LONG_COMBOS | ||
| 29 | uint32_t state; | ||
| 30 | #elif EXTRA_LONG_COMBOS | ||
| 31 | uint16_t state; | ||
| 32 | #else | ||
| 33 | uint8_t state; | ||
| 34 | #endif | ||
| 35 | uint16_t timer; | ||
| 36 | #ifdef COMBO_ALLOW_ACTION_KEYS | ||
| 37 | keyrecord_t prev_record; | ||
| 38 | #else | ||
| 39 | uint16_t prev_key; | ||
| 40 | #endif | ||
| 41 | } combo_t; | ||
| 42 | |||
| 43 | |||
| 44 | #define COMBO(ck, ca) {.keys = &(ck)[0], .keycode = (ca)} | ||
| 45 | #define COMBO_ACTION(ck) {.keys = &(ck)[0]} | ||
| 46 | |||
| 47 | #define COMBO_END 0 | ||
| 48 | #ifndef COMBO_COUNT | ||
| 49 | #define COMBO_COUNT 0 | ||
| 50 | #endif | ||
| 51 | #ifndef COMBO_TERM | ||
| 52 | #define COMBO_TERM TAPPING_TERM | ||
| 53 | #endif | ||
| 54 | |||
| 55 | bool process_combo(uint16_t keycode, keyrecord_t *record); | ||
| 56 | void matrix_scan_combo(void); | ||
| 57 | void process_combo_event(uint8_t combo_index, bool pressed); | ||
| 58 | |||
| 59 | #endif | ||
