diff options
author | Jeremy Bernhardt <jeremythegeek@gmail.com> | 2020-05-04 10:49:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 12:49:47 -0400 |
commit | 15e84f79f177d92e0faeb5e424a48506489eb955 (patch) | |
tree | 8936f6087b900274928107b4fbf27a3bba149d92 /keyboards/gboards/g/keymap_combo.h | |
parent | 6f30b402a285ddecce9b6f5b002a649f775225d2 (diff) | |
download | qmk_firmware-15e84f79f177d92e0faeb5e424a48506489eb955.tar.gz |
gBoards Common (#8921)
Co-Authored-By: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/gboards/g/keymap_combo.h')
-rw-r--r-- | keyboards/gboards/g/keymap_combo.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/keyboards/gboards/g/keymap_combo.h b/keyboards/gboards/g/keymap_combo.h new file mode 100644 index 000000000..674d3356c --- /dev/null +++ b/keyboards/gboards/g/keymap_combo.h @@ -0,0 +1,56 @@ +// Keymap helpers + +#define K_ENUM(name, key, ...) name, +#define K_DATA(name, key, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END}; +#define K_COMB(name, key, ...) [name] = COMBO(cmb_##name, key), + +#define A_ENUM(name, string, ...) name, +#define A_DATA(name, string, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END}; +#define A_COMB(name, string, ...) [name] = COMBO_ACTION(cmb_##name), +#define A_ACTI(name, string, ...) \ + case name: \ + if (pressed) SEND_STRING(string); \ + break; +#define BLANK(...) + +// Generate data needed for combos/actions +// Create Enum +#undef COMB +#undef SUBS +#define COMB K_ENUM +#define SUBS A_ENUM +enum combos { +#include "combos.def" +}; + +// Bake combos into mem +#undef COMB +#undef SUBS +#define COMB K_DATA +#define SUBS A_DATA +#include "combos.def" +#undef COMB +#undef SUBS + +// Fill combo array +#define COMB K_COMB +#define SUBS A_COMB +combo_t key_combos[] = { +#include "combos.def" +}; +#undef COMB +#undef SUBS + +// Export length to combo module +int COMBO_LEN = sizeof(key_combos) / sizeof(key_combos[0]); + +// Fill QMK hook +#define COMB BLANK +#define SUBS A_ACTI +void process_combo_event(uint8_t combo_index, bool pressed) { + switch (combo_index) { +#include "combos.def" + } +} +#undef COMB +#undef SUBS |