forked from mirrors/qmk_firmware
RETRO_TAPPING (#1922)
* add RETRO_TAP: tap anyway, even after TAP_TERM, if no interruption * consistent variable name * add option doc * change name for consistency * make RETRO_TAPPING default to off
This commit is contained in:
parent
b2bbbc2dfc
commit
04b9b62bdc
3 changed files with 40 additions and 3 deletions
|
@ -109,6 +109,8 @@ If you define these options you will enable the associated feature, which may in
|
||||||
|
|
||||||
* `#define TAPPING_TERM 200`
|
* `#define TAPPING_TERM 200`
|
||||||
* how long before a tap becomes a hold
|
* how long before a tap becomes a hold
|
||||||
|
* `#define RETRO_TAPPING`
|
||||||
|
* tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
|
||||||
* `#define TAPPING_TOGGLE 2`
|
* `#define TAPPING_TOGGLE 2`
|
||||||
* how many taps before triggering the toggle
|
* how many taps before triggering the toggle
|
||||||
* `#define PERMISSIVE_HOLD`
|
* `#define PERMISSIVE_HOLD`
|
||||||
|
|
|
@ -36,6 +36,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
int tp_buttons;
|
int tp_buttons;
|
||||||
|
|
||||||
|
#ifdef RETRO_TAPPING
|
||||||
|
int retro_tapping_counter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FAUXCLICKY_ENABLE
|
#ifdef FAUXCLICKY_ENABLE
|
||||||
#include <fauxclicky.h>
|
#include <fauxclicky.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +49,9 @@ void action_exec(keyevent_t event)
|
||||||
if (!IS_NOEVENT(event)) {
|
if (!IS_NOEVENT(event)) {
|
||||||
dprint("\n---- action_exec: start -----\n");
|
dprint("\n---- action_exec: start -----\n");
|
||||||
dprint("EVENT: "); debug_event(event); dprintln();
|
dprint("EVENT: "); debug_event(event); dprintln();
|
||||||
|
#ifdef RETRO_TAPPING
|
||||||
|
retro_tapping_counter++;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FAUXCLICKY_ENABLE
|
#ifdef FAUXCLICKY_ENABLE
|
||||||
|
@ -586,6 +593,32 @@ void process_action(keyrecord_t *record, action_t action)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_ACTION_TAPPING
|
||||||
|
#ifdef RETRO_TAPPING
|
||||||
|
if (!is_tap_key(record->event.key)) {
|
||||||
|
retro_tapping_counter = 0;
|
||||||
|
} else {
|
||||||
|
if (event.pressed) {
|
||||||
|
if (tap_count > 0) {
|
||||||
|
retro_tapping_counter = 0;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tap_count > 0) {
|
||||||
|
retro_tapping_counter = 0;
|
||||||
|
} else {
|
||||||
|
if (retro_tapping_counter == 2) {
|
||||||
|
register_code(action.layer_tap.code);
|
||||||
|
unregister_code(action.layer_tap.code);
|
||||||
|
}
|
||||||
|
retro_tapping_counter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NO_ACTION_ONESHOT
|
#ifndef NO_ACTION_ONESHOT
|
||||||
/* Because we switch layers after a oneshot event, we need to release the
|
/* Because we switch layers after a oneshot event, we need to release the
|
||||||
* key before we leave the layer or no key up event will be generated.
|
* key before we leave the layer or no key up event will be generated.
|
||||||
|
|
|
@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define TAPPING_TERM 200
|
#define TAPPING_TERM 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, as long as there was no interruption
|
||||||
|
|
||||||
/* tap count needed for toggling a feature */
|
/* tap count needed for toggling a feature */
|
||||||
#ifndef TAPPING_TOGGLE
|
#ifndef TAPPING_TOGGLE
|
||||||
#define TAPPING_TOGGLE 5
|
#define TAPPING_TOGGLE 5
|
||||||
|
|
Loading…
Reference in a new issue