aboutsummaryrefslogtreecommitdiff
path: root/quantum/action.c
diff options
context:
space:
mode:
authorIsaac Elenbaas <isaacelenbaas@gmail.com>2021-11-25 07:12:14 -0500
committerGitHub <noreply@github.com>2021-11-25 23:12:14 +1100
commitd9393b86842b7ef143259b5f771ae7969f98cbb4 (patch)
treee0760c20f65c4cac7b6ffb3fedf3f36c6f7c13a2 /quantum/action.c
parent282e916d86a5d353b7cbdfef3afad3c7b011eb14 (diff)
downloadqmk_firmware-d9393b86842b7ef143259b5f771ae7969f98cbb4.tar.gz
qmk_firmware-d9393b86842b7ef143259b5f771ae7969f98cbb4.zip
Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (#11059)
* Add Retro Shift and Custom Auto Shifts * Fix compilation errors with no RETRO_SHIFT value
Diffstat (limited to 'quantum/action.c')
-rw-r--r--quantum/action.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/quantum/action.c b/quantum/action.c
index ceaaa551f..5e81efb67 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -45,10 +45,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
45 45
46int tp_buttons; 46int tp_buttons;
47 47
48#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) 48#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
49int retro_tapping_counter = 0; 49int retro_tapping_counter = 0;
50#endif 50#endif
51 51
52#if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
53# include "process_auto_shift.h"
54#endif
55
52#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY 56#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
53__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; } 57__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; }
54#endif 58#endif
@@ -69,7 +73,7 @@ void action_exec(keyevent_t event) {
69 dprint("EVENT: "); 73 dprint("EVENT: ");
70 debug_event(event); 74 debug_event(event);
71 dprintln(); 75 dprintln();
72#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) 76#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
73 retro_tapping_counter++; 77 retro_tapping_counter++;
74#endif 78#endif
75 } 79 }
@@ -106,6 +110,11 @@ void action_exec(keyevent_t event) {
106#endif 110#endif
107 111
108#ifndef NO_ACTION_TAPPING 112#ifndef NO_ACTION_TAPPING
113# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
114 if (event.pressed) {
115 retroshift_poll_time(&event);
116 }
117# endif
109 if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) { 118 if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) {
110 action_tapping_process(record); 119 action_tapping_process(record);
111 } 120 }
@@ -730,7 +739,7 @@ void process_action(keyrecord_t *record, action_t action) {
730#endif 739#endif
731 740
732#ifndef NO_ACTION_TAPPING 741#ifndef NO_ACTION_TAPPING
733# if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) 742# if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
734 if (!is_tap_action(action)) { 743 if (!is_tap_action(action)) {
735 retro_tapping_counter = 0; 744 retro_tapping_counter = 0;
736 } else { 745 } else {
@@ -747,7 +756,11 @@ void process_action(keyrecord_t *record, action_t action) {
747 get_retro_tapping(get_event_keycode(record->event, false), record) && 756 get_retro_tapping(get_event_keycode(record->event, false), record) &&
748# endif 757# endif
749 retro_tapping_counter == 2) { 758 retro_tapping_counter == 2) {
759# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
760 process_auto_shift(action.layer_tap.code, record);
761# else
750 tap_code(action.layer_tap.code); 762 tap_code(action.layer_tap.code);
763# endif
751 } 764 }
752 retro_tapping_counter = 0; 765 retro_tapping_counter = 0;
753 } 766 }