diff options
Diffstat (limited to 'quantum/process_keycode/process_combo.h')
| -rw-r--r-- | quantum/process_keycode/process_combo.h | 38 | 
1 files changed, 28 insertions, 10 deletions
| diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h index e51a2f1f4e..43c36d79e6 100644 --- a/quantum/process_keycode/process_combo.h +++ b/quantum/process_keycode/process_combo.h @@ -20,23 +20,38 @@  #include "quantum.h"  #include <stdint.h> -#ifdef EXTRA_EXTRA_LONG_COMBOS +#ifdef EXTRA_SHORT_COMBOS +#    define MAX_COMBO_LENGTH 6 +#elif defined(EXTRA_EXTRA_LONG_COMBOS)  #    define MAX_COMBO_LENGTH 32 -#elif EXTRA_LONG_COMBOS +#elif defined(EXTRA_LONG_COMBOS)  #    define MAX_COMBO_LENGTH 16  #else  #    define MAX_COMBO_LENGTH 8  #endif +#ifndef COMBO_KEY_BUFFER_LENGTH +#    define COMBO_KEY_BUFFER_LENGTH MAX_COMBO_LENGTH +#endif +#ifndef COMBO_BUFFER_LENGTH +#    define COMBO_BUFFER_LENGTH 4 +#endif +  typedef struct {      const uint16_t *keys;      uint16_t        keycode; -#ifdef EXTRA_EXTRA_LONG_COMBOS +#ifdef EXTRA_SHORT_COMBOS +    uint8_t state; +#else +    bool disabled; +    bool active; +#    if defined(EXTRA_EXTRA_LONG_COMBOS)      uint32_t state; -#elif EXTRA_LONG_COMBOS +#    elif defined(EXTRA_LONG_COMBOS)      uint16_t state; -#else +#    else      uint8_t state; +#    endif  #endif  } combo_t; @@ -46,15 +61,18 @@ typedef struct {      { .keys = &(ck)[0] }  #define COMBO_END 0 -#ifndef COMBO_COUNT -#    define COMBO_COUNT 0 -#endif  #ifndef COMBO_TERM -#    define COMBO_TERM TAPPING_TERM +#    define COMBO_TERM 50  #endif +#ifndef COMBO_HOLD_TERM +#    define COMBO_HOLD_TERM TAPPING_TERM +#endif + +/* check if keycode is only modifiers */ +#define KEYCODE_IS_MOD(code) (IS_MOD(code) || (code >= QK_MODS && code <= QK_MODS_MAX && !(code & QK_BASIC_MAX)))  bool process_combo(uint16_t keycode, keyrecord_t *record); -void matrix_scan_combo(void); +void combo_task(void);  void process_combo_event(uint16_t combo_index, bool pressed);  void combo_enable(void); | 
