summaryrefslogtreecommitdiff
path: root/quantum/action.c
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-08-24 14:28:37 +0100
committerGitHub <noreply@github.com>2021-08-24 14:28:37 +0100
commitc4dbf4bf0118dd785802861beb247433b5b7411d (patch)
tree91e5142e9c280db4fbee6c0d7e64f1abdad79109 /quantum/action.c
parentc4a2dc9a2d1b0c053272aec7672ab8df92550e88 (diff)
Tidy up quantum.c now some of tmk_core has been merged (#14083)
Diffstat (limited to 'quantum/action.c')
-rw-r--r--quantum/action.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/quantum/action.c b/quantum/action.c
index d19fd2a045..ec9fcd9c9c 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -960,6 +960,34 @@ void unregister_weak_mods(uint8_t mods) {
}
}
+static void do_code16(uint16_t code, void (*f)(uint8_t)) { f(extract_mod_bits(code)); }
+
+void register_code16(uint16_t code) {
+ if (IS_MOD(code) || code == KC_NO) {
+ do_code16(code, register_mods);
+ } else {
+ do_code16(code, register_weak_mods);
+ }
+ register_code(code);
+}
+
+void unregister_code16(uint16_t code) {
+ unregister_code(code);
+ if (IS_MOD(code) || code == KC_NO) {
+ do_code16(code, unregister_mods);
+ } else {
+ do_code16(code, unregister_weak_mods);
+ }
+}
+
+void tap_code16(uint16_t code) {
+ register_code16(code);
+#if TAP_CODE_DELAY > 0
+ wait_ms(TAP_CODE_DELAY);
+#endif
+ unregister_code16(code);
+}
+
/** \brief Utilities for actions. (FIXME: Needs better description)
*
* FIXME: Needs documentation.