From e695b5a33b97cfb4f9dd8bc8ecaff8aa7e0f14cc Mon Sep 17 00:00:00 2001 From: Nick Choi Date: Thu, 25 May 2017 00:41:00 -0400 Subject: Added per case tapping term, updated FF-nikchi keymap. --- quantum/process_keycode/process_tap_dance.c | 10 ++++++++-- quantum/process_keycode/process_tap_dance.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'quantum/process_keycode') diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index b807ec3c30..e58b6f2dfe 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -130,11 +130,17 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { void matrix_scan_tap_dance () { if (highest_td == -1) return; + int tap_user_defined; for (int i = 0; i <= highest_td; i++) { qk_tap_dance_action_t *action = &tap_dance_actions[i]; - - if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { + if(action->user_data != NULL ) { + tap_user_defined = (int)action->user_data; + } + else{ + tap_user_defined = TAPPING_TERM; + } + if (action->state.count && timer_elapsed (action->state.timer) > tap_user_defined) { process_tap_dance_action_on_dance_finished (action); reset_tap_dance (&action->state); } diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 330809f83a..95d51f4806 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -63,9 +63,9 @@ typedef struct .user_data = NULL, \ } -#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \ +#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ - .user_data = NULL, \ + .user_data = (void *)(tap_specific_tapping_term), \ } extern qk_tap_dance_action_t tap_dance_actions[]; -- cgit v1.2.3 From aeb3a34636c614cd392cfc6268491a51a461df31 Mon Sep 17 00:00:00 2001 From: Nick Choi Date: Thu, 25 May 2017 16:26:30 -0400 Subject: moved specific tap term to its own function included custom_tapping_term in action struct --- quantum/process_keycode/process_tap_dance.c | 6 ++++-- quantum/process_keycode/process_tap_dance.h | 12 ++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'quantum/process_keycode') diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index e58b6f2dfe..2c7f6e937e 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -127,6 +127,8 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { return true; } + + void matrix_scan_tap_dance () { if (highest_td == -1) return; @@ -134,8 +136,8 @@ void matrix_scan_tap_dance () { for (int i = 0; i <= highest_td; i++) { qk_tap_dance_action_t *action = &tap_dance_actions[i]; - if(action->user_data != NULL ) { - tap_user_defined = (int)action->user_data; + if(action->custom_tapping_term > 0 ) { + tap_user_defined = action->custom_tapping_term; } else{ tap_user_defined = TAPPING_TERM; diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 95d51f4806..a020f7991e 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -44,6 +44,7 @@ typedef struct qk_tap_dance_user_fn_t on_reset; } fn; qk_tap_dance_state_t state; + uint16_t custom_tapping_term; void *user_data; } qk_tap_dance_action_t; @@ -63,9 +64,16 @@ typedef struct .user_data = NULL, \ } -#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ +#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ - .user_data = (void *)(tap_specific_tapping_term), \ + .user_data = NULL, \ + .custom_tapping_term = -1, \ + } + +#define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ + .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ + .user_data = NULL, \ + .custom_tapping_term = tap_specific_tapping_term, \ } extern qk_tap_dance_action_t tap_dance_actions[]; -- cgit v1.2.3 From 7c8b166cce8bf5df058913acc07cd6505f83684a Mon Sep 17 00:00:00 2001 From: Nick Choi Date: Thu, 25 May 2017 16:29:57 -0400 Subject: =?UTF-8?q?changed=20-1=20to=200=20can't=20have=20negative=20unsig?= =?UTF-8?q?ned=20ints=20=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quantum/process_keycode/process_tap_dance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quantum/process_keycode') diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index a020f7991e..ef05ebda24 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -67,7 +67,7 @@ typedef struct #define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ .user_data = NULL, \ - .custom_tapping_term = -1, \ + .custom_tapping_term = 0, \ } #define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ -- cgit v1.2.3 From b3144112d3b0abb9bf1060185a001e2fb8d8196c Mon Sep 17 00:00:00 2001 From: Nick Choi Date: Thu, 25 May 2017 16:38:06 -0400 Subject: removed need to set customtapping term 0. defaults to 0 already --- quantum/process_keycode/process_tap_dance.h | 1 - 1 file changed, 1 deletion(-) (limited to 'quantum/process_keycode') diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index ef05ebda24..f42c154a05 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -67,7 +67,6 @@ typedef struct #define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ .user_data = NULL, \ - .custom_tapping_term = 0, \ } #define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ -- cgit v1.2.3 From 5393bc6f4eee3d3cb83997e5b03d8e5a5cea85d8 Mon Sep 17 00:00:00 2001 From: Nick Choi Date: Mon, 29 May 2017 21:25:50 -0400 Subject: switched to uint8 and 16 --- quantum/process_keycode/process_tap_dance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quantum/process_keycode') diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 2c7f6e937e..4fd45810bb 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -132,9 +132,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { void matrix_scan_tap_dance () { if (highest_td == -1) return; - int tap_user_defined; + uint16_t tap_user_defined; -for (int i = 0; i <= highest_td; i++) { +for (uint8_t i = 0; i <= highest_td; i++) { qk_tap_dance_action_t *action = &tap_dance_actions[i]; if(action->custom_tapping_term > 0 ) { tap_user_defined = action->custom_tapping_term; -- cgit v1.2.3