aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsankuanglee <github@tklee.com>2017-10-31 11:15:22 -0400
committerJack Humbert <jack.humb@gmail.com>2017-10-31 11:15:22 -0400
commit04b9b62bdc5ed394a06c5c73acdce0b261220e85 (patch)
tree53b6a67bdc577f5a1ce50a4b2aad7633a7c29777
parentb2bbbc2dfcf21783bd84cb4db9fd96016c2951af (diff)
downloadqmk_firmware-04b9b62bdc5ed394a06c5c73acdce0b261220e85.tar.gz
qmk_firmware-04b9b62bdc5ed394a06c5c73acdce0b261220e85.zip
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
-rw-r--r--docs/config_options.md2
-rw-r--r--tmk_core/common/action.c39
-rw-r--r--tmk_core/common/action_tapping.h2
3 files changed, 40 insertions, 3 deletions
diff --git a/docs/config_options.md b/docs/config_options.md
index de67630ad..faa9c6481 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -109,6 +109,8 @@ If you define these options you will enable the associated feature, which may in
109 109
110* `#define TAPPING_TERM 200` 110* `#define TAPPING_TERM 200`
111 * how long before a tap becomes a hold 111 * how long before a tap becomes a hold
112* `#define RETRO_TAPPING`
113 * tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
112* `#define TAPPING_TOGGLE 2` 114* `#define TAPPING_TOGGLE 2`
113 * how many taps before triggering the toggle 115 * how many taps before triggering the toggle
114* `#define PERMISSIVE_HOLD` 116* `#define PERMISSIVE_HOLD`
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 41de01485..b39aa4cbc 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -36,6 +36,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36 36
37int tp_buttons; 37int tp_buttons;
38 38
39#ifdef RETRO_TAPPING
40int retro_tapping_counter = 0;
41#endif
42
39#ifdef FAUXCLICKY_ENABLE 43#ifdef FAUXCLICKY_ENABLE
40#include <fauxclicky.h> 44#include <fauxclicky.h>
41#endif 45#endif
@@ -45,6 +49,9 @@ void action_exec(keyevent_t event)
45 if (!IS_NOEVENT(event)) { 49 if (!IS_NOEVENT(event)) {
46 dprint("\n---- action_exec: start -----\n"); 50 dprint("\n---- action_exec: start -----\n");
47 dprint("EVENT: "); debug_event(event); dprintln(); 51 dprint("EVENT: "); debug_event(event); dprintln();
52#ifdef RETRO_TAPPING
53 retro_tapping_counter++;
54#endif
48 } 55 }
49 56
50#ifdef FAUXCLICKY_ENABLE 57#ifdef FAUXCLICKY_ENABLE
@@ -586,6 +593,32 @@ void process_action(keyrecord_t *record, action_t action)
586 } 593 }
587#endif 594#endif
588 595
596#ifndef NO_ACTION_TAPPING
597 #ifdef RETRO_TAPPING
598 if (!is_tap_key(record->event.key)) {
599 retro_tapping_counter = 0;
600 } else {
601 if (event.pressed) {
602 if (tap_count > 0) {
603 retro_tapping_counter = 0;
604 } else {
605
606 }
607 } else {
608 if (tap_count > 0) {
609 retro_tapping_counter = 0;
610 } else {
611 if (retro_tapping_counter == 2) {
612 register_code(action.layer_tap.code);
613 unregister_code(action.layer_tap.code);
614 }
615 retro_tapping_counter = 0;
616 }
617 }
618 }
619 #endif
620#endif
621
589#ifndef NO_ACTION_ONESHOT 622#ifndef NO_ACTION_ONESHOT
590 /* Because we switch layers after a oneshot event, we need to release the 623 /* Because we switch layers after a oneshot event, we need to release the
591 * key before we leave the layer or no key up event will be generated. 624 * key before we leave the layer or no key up event will be generated.
@@ -619,7 +652,7 @@ void register_code(uint8_t code)
619#endif 652#endif
620 add_key(KC_CAPSLOCK); 653 add_key(KC_CAPSLOCK);
621 send_keyboard_report(); 654 send_keyboard_report();
622 wait_ms(100); 655 wait_ms(100);
623 del_key(KC_CAPSLOCK); 656 del_key(KC_CAPSLOCK);
624 send_keyboard_report(); 657 send_keyboard_report();
625 } 658 }
@@ -630,7 +663,7 @@ void register_code(uint8_t code)
630#endif 663#endif
631 add_key(KC_NUMLOCK); 664 add_key(KC_NUMLOCK);
632 send_keyboard_report(); 665 send_keyboard_report();
633 wait_ms(100); 666 wait_ms(100);
634 del_key(KC_NUMLOCK); 667 del_key(KC_NUMLOCK);
635 send_keyboard_report(); 668 send_keyboard_report();
636 } 669 }
@@ -641,7 +674,7 @@ void register_code(uint8_t code)
641#endif 674#endif
642 add_key(KC_SCROLLLOCK); 675 add_key(KC_SCROLLLOCK);
643 send_keyboard_report(); 676 send_keyboard_report();
644 wait_ms(100); 677 wait_ms(100);
645 del_key(KC_SCROLLLOCK); 678 del_key(KC_SCROLLLOCK);
646 send_keyboard_report(); 679 send_keyboard_report();
647 } 680 }
diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h
index 9b42d50dc..2f143ae8b 100644
--- a/tmk_core/common/action_tapping.h
+++ b/tmk_core/common/action_tapping.h
@@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
24#define TAPPING_TERM 200 24#define TAPPING_TERM 200
25#endif 25#endif
26 26
27//#define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, as long as there was no interruption
28
27/* tap count needed for toggling a feature */ 29/* tap count needed for toggling a feature */
28#ifndef TAPPING_TOGGLE 30#ifndef TAPPING_TOGGLE
29#define TAPPING_TOGGLE 5 31#define TAPPING_TOGGLE 5