tap-dance: Restructure code and document in more detail (#16394)
This commit is contained in:
parent
b17324498e
commit
1706da9054
52 changed files with 970 additions and 244 deletions
|
@ -40,6 +40,7 @@
|
|||
//#define MIDI_ADVANCED
|
||||
|
||||
#define TAPPING_TERM 150
|
||||
#define TAPPING_TERM_PER_KEY
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
// #define IGNORE_MOD_TAP_INTERRUPT
|
||||
// #define HOLD_ON_OTHER_KEY_PRESS
|
||||
|
|
|
@ -379,9 +379,18 @@ void usl_reset(qk_tap_dance_state_t *state, void *user_data) {
|
|||
|
||||
// Associate our tap dance key with its functionality
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, usl_finished, usl_reset, 175)
|
||||
[UNDS_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, usl_finished, usl_reset)
|
||||
};
|
||||
|
||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case TD(UNDS_LOWER):
|
||||
return 175;
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (!process_select_word(keycode, record, SELWORD)) { return false; }
|
||||
if (!process_caps_word(keycode, record)) { return false; }
|
||||
|
@ -661,4 +670,4 @@ void process_combo_event(uint16_t combo_index, bool pressed) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
/*
|
||||
* TAP-DANCE options
|
||||
*/
|
||||
#define TAPPING_TERM_PER_KEY // Control Tap-Dance time individually by key
|
||||
#define TAPPING_TERM 250 // Default time allowed before resetting a Tap-Dance combo
|
||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */
|
||||
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
|
||||
|
|
|
@ -1656,13 +1656,26 @@ void sml_reset(qk_tap_dance_state_t* state, void* user_data) { sml_state.state =
|
|||
// Tap Dance definitions
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
// Tap once for °, twice for ℉, thrice for ℃
|
||||
[TD_DEG_DEGF] = ACTION_TAP_DANCE_FN(send_degree_symbol), //
|
||||
[TD_LSHFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, scap_finished, scap_reset, 200), //
|
||||
[TD_LCTL_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, slctl_finished, slctl_reset, 200), //
|
||||
[TD_LALT_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, slalt_finished, slalt_reset, 200), //
|
||||
[TD_SMILEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, sml_finished, sml_reset, 500),
|
||||
[TD_DEG_DEGF] = ACTION_TAP_DANCE_FN(send_degree_symbol), //
|
||||
[TD_LSHFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, scap_finished, scap_reset), //
|
||||
[TD_LCTL_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, slctl_finished, slctl_reset), //
|
||||
[TD_LALT_STICKY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, slalt_finished, slalt_reset), //
|
||||
[TD_SMILEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, sml_finished, sml_reset),
|
||||
};
|
||||
|
||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case TD(TD_LSHFT_CAPS):
|
||||
case TD(TD_LCTL_STICKY):
|
||||
case TD(TD_LALT_STICKY):
|
||||
return 200;
|
||||
case TD(TD_SMILEY):
|
||||
return 500;
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
}
|
||||
|
||||
// Dip-Switch controls
|
||||
void dip_switch_update_user(uint8_t index, bool active) {
|
||||
switch (index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue