vial: restore dynamic combo functionality

This commit is contained in:
Ilya Zhuravlev
2021-09-12 14:38:17 -04:00
parent cf548ab9e6
commit d5d40132a3
4 changed files with 30 additions and 18 deletions

View File

@ -18,6 +18,12 @@
#include "process_combo.h"
#include "action_tapping.h"
#ifdef VIAL_COMBO_ENABLE
#include "dynamic_keymap.h"
/* dynamic combos are stored entirely in ram */
#undef pgm_read_word
#define pgm_read_word(address_short) *((uint16_t*)(address_short))
#endif
#ifdef COMBO_COUNT
__attribute__((weak)) combo_t key_combos[COMBO_COUNT];
@ -212,8 +218,8 @@ static inline void dump_key_buffer(void) {
static inline void _find_key_index_and_count(const uint16_t *keys, uint16_t keycode, uint16_t *key_index, uint8_t *key_count) {
while (true) {
uint16_t key = pgm_read_word(&keys[*key_count]);
if (keycode == key) *key_index = *key_count;
if (COMBO_END == key) break;
if (keycode == key) *key_index = *key_count;
(*key_count)++;
}
}