Merge branch 'tap-dance-release' into vial
This commit is contained in:
commit
52e90179d0
@ -2,3 +2,4 @@ VIA_ENABLE = yes
|
|||||||
LTO_ENABLE = yes
|
LTO_ENABLE = yes
|
||||||
VIAL_ENABLE = yes
|
VIAL_ENABLE = yes
|
||||||
QMK_SETTINGS = no
|
QMK_SETTINGS = no
|
||||||
|
TAP_DANCE_ENABLE = no
|
||||||
|
@ -86,7 +86,7 @@ static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, voi
|
|||||||
|
|
||||||
static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); }
|
static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); }
|
||||||
|
|
||||||
static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) {
|
void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) {
|
||||||
if (action->state.finished) return;
|
if (action->state.finished) return;
|
||||||
action->state.finished = true;
|
action->state.finished = true;
|
||||||
add_mods(action->state.oneshot_mods);
|
add_mods(action->state.oneshot_mods);
|
||||||
|
@ -245,6 +245,9 @@ bool process_record_quantum_helper(uint16_t keycode, keyrecord_t *record) {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(VIA_ENABLE)
|
#if defined(VIA_ENABLE)
|
||||||
process_record_via(keycode, record) &&
|
process_record_via(keycode, record) &&
|
||||||
|
#endif
|
||||||
|
#if defined(VIAL_ENABLE)
|
||||||
|
process_record_vial(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
process_record_kb(keycode, record) &&
|
process_record_kb(keycode, record) &&
|
||||||
#if defined(SEQUENCER_ENABLE)
|
#if defined(SEQUENCER_ENABLE)
|
||||||
|
@ -514,3 +514,33 @@ static void reload_combo(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VIAL_TAP_DANCE_ENABLE
|
||||||
|
void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool process_record_vial(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
#ifdef VIAL_TAP_DANCE_ENABLE
|
||||||
|
/* process releases before tap-dance timeout arrives */
|
||||||
|
if (!record->event.pressed && keycode >= QK_TAP_DANCE && keycode <= QK_TAP_DANCE_MAX) {
|
||||||
|
uint16_t idx = keycode - QK_TAP_DANCE;
|
||||||
|
if (dynamic_keymap_get_tap_dance(idx, &td_entry) != 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
qk_tap_dance_action_t *action = &tap_dance_actions[idx];
|
||||||
|
|
||||||
|
/* only care about 2 possibilities here
|
||||||
|
- tap and hold set, everything else unset: process first release early (count == 1)
|
||||||
|
- double tap set: process second release early (count == 2)
|
||||||
|
*/
|
||||||
|
if ((action->state.count == 1 && td_entry.on_tap && td_entry.on_hold && !td_entry.on_double_tap && !td_entry.on_tap_hold)
|
||||||
|
|| (action->state.count == 2 && td_entry.on_double_tap)) {
|
||||||
|
action->state.pressed = false;
|
||||||
|
process_tap_dance_action_on_dance_finished(action);
|
||||||
|
/* reset_tap_dance() will get called in process_tap_dance() */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -20,12 +20,14 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "dynamic_keymap_eeprom.h"
|
#include "dynamic_keymap_eeprom.h"
|
||||||
|
#include "action.h"
|
||||||
|
|
||||||
#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000004)
|
#define VIAL_PROTOCOL_VERSION ((uint32_t)0x00000004)
|
||||||
#define VIAL_RAW_EPSIZE 32
|
#define VIAL_RAW_EPSIZE 32
|
||||||
|
|
||||||
void vial_init(void);
|
void vial_init(void);
|
||||||
void vial_handle_cmd(uint8_t *data, uint8_t length);
|
void vial_handle_cmd(uint8_t *data, uint8_t length);
|
||||||
|
bool process_record_vial(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#ifdef VIAL_ENCODERS_ENABLE
|
#ifdef VIAL_ENCODERS_ENABLE
|
||||||
bool vial_encoder_update(uint8_t index, bool clockwise);
|
bool vial_encoder_update(uint8_t index, bool clockwise);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user