vial/combo: prototype

This commit is contained in:
Ilya Zhuravlev 2021-07-03 23:12:12 -04:00
parent e0c7388e5d
commit 8ccef55b3e
5 changed files with 40 additions and 0 deletions

View file

@ -454,6 +454,7 @@ endif
ifeq ($(strip $(VIAL_ENABLE)), yes)
TAP_DANCE_ENABLE ?= yes
COMBO_ENABLE ?= yes
SRC += $(QUANTUM_DIR)/vial.c
EXTRAINCDIRS += $(KEYMAP_OUTPUT)
OPT_DEFS += -DVIAL_ENABLE -DNO_DEBUG

View file

@ -126,6 +126,10 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
drop_buffer = false;
bool no_combo_keys_pressed = true;
if (keycode == KC_NO) {
return true;
}
if (keycode == CMB_ON && record->event.pressed) {
combo_enable();
return true;

View file

@ -16,6 +16,10 @@
#pragma once
#ifdef VIAL_ENABLE
#include "vial.h"
#endif
#include "progmem.h"
#include "quantum.h"
#include <stdint.h>

View file

@ -200,6 +200,7 @@ void vial_handle_cmd(uint8_t *msg, uint8_t length) {
case dynamic_vial_get_number_of_entries: {
memset(msg, 0, length);
msg[0] = VIAL_TAP_DANCE_ENTRIES;
msg[1] = VIAL_COMBO_ENTRIES;
break;
}
case dynamic_vial_tap_dance_get: {
@ -459,3 +460,17 @@ static void reload_tap_dance(void) {
}
}
#endif
#ifdef VIAL_COMBO_ENABLE
const uint16_t PROGMEM test_combo[] = {KC_X, KC_Z, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {COMBO_ACTION(test_combo)};
void process_combo_event(uint16_t combo_index, bool pressed) {
uprintf("combo event %d\n", combo_index);
if (pressed)
vial_keycode_down(0x5F12);
else
vial_keycode_up(0x5F12);
}
#endif

View file

@ -79,3 +79,19 @@ _Static_assert(sizeof(vial_tap_dance_entry_t) == 10, "Unexpected size of the via
#undef VIAL_TAP_DANCE_ENTRIES
#define VIAL_TAP_DANCE_ENTRIES 0
#endif
#ifdef COMBO_ENABLE
#define VIAL_COMBO_ENABLE
#ifndef VIAL_COMBO_ENTRIES
#define VIAL_COMBO_ENTRIES 16
#endif
/* also to catch wrong include order in e.g. process_combo.h */
#ifdef COMBO_COUNT
#error COMBO_COUNT redefined - define VIAL_COMBO_ENTRIES instead
#endif
#define COMBO_COUNT VIAL_COMBO_ENTRIES
#endif