summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-12-24 06:52:41 +0000
committerGitHub <noreply@github.com>2023-12-24 06:52:41 +0000
commitb824faca71e1db86c158a0e09f225410c1e7e0a8 (patch)
tree21a77608c53feb71dea650714cf794cc42e4a4ae /quantum/process_keycode
parent03848bb3aae551b11dd3da5ee33a41f2f1543a33 (diff)
Align location of tap dance keycode (#22742)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_tap_dance.c6
-rw-r--r--quantum/process_keycode/process_tap_dance.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index b8a8d32f35..ce3b8fc81f 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -133,7 +133,7 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
if (!active_td || keycode == active_td) return false;
- action = &tap_dance_actions[TD_INDEX(active_td)];
+ action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
action->state.interrupted = true;
action->state.interrupting_keycode = keycode;
process_tap_dance_action_on_dance_finished(action);
@@ -154,7 +154,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
- action = &tap_dance_actions[TD_INDEX(keycode)];
+ action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)];
action->state.pressed = record->event.pressed;
if (record->event.pressed) {
@@ -182,7 +182,7 @@ void tap_dance_task(void) {
if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return;
- action = &tap_dance_actions[TD_INDEX(active_td)];
+ action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
if (!action->state.interrupted) {
process_tap_dance_action_on_dance_finished(action);
}
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index 2b114dabd3..c0137c14a3 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "action.h"
+#include "quantum_keycodes.h"
typedef struct {
uint16_t interrupting_keycode;
@@ -74,8 +75,7 @@ typedef struct {
#define ACTION_TAP_DANCE_FN_ADVANCED_WITH_RELEASE(user_fn_on_each_tap, user_fn_on_each_release, 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_fn_on_each_release}, .user_data = NULL, }
-#define TD(n) (QK_TAP_DANCE | TD_INDEX(n))
-#define TD_INDEX(code) ((code)&0xFF)
+#define TD_INDEX(code) QK_TAP_DANCE_GET_INDEX(code)
#define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions)
extern tap_dance_action_t tap_dance_actions[];