aboutsummaryrefslogtreecommitdiff
path: root/quantum/action.c
diff options
context:
space:
mode:
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 d19fd2a04..ec9fcd9c9 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -960,6 +960,34 @@ void unregister_weak_mods(uint8_t mods) {
960 } 960 }
961} 961}
962 962
963static void do_code16(uint16_t code, void (*f)(uint8_t)) { f(extract_mod_bits(code)); }
964
965void register_code16(uint16_t code) {
966 if (IS_MOD(code) || code == KC_NO) {
967 do_code16(code, register_mods);
968 } else {
969 do_code16(code, register_weak_mods);
970 }
971 register_code(code);
972}
973
974void unregister_code16(uint16_t code) {
975 unregister_code(code);
976 if (IS_MOD(code) || code == KC_NO) {
977 do_code16(code, unregister_mods);
978 } else {
979 do_code16(code, unregister_weak_mods);
980 }
981}
982
983void tap_code16(uint16_t code) {
984 register_code16(code);
985#if TAP_CODE_DELAY > 0
986 wait_ms(TAP_CODE_DELAY);
987#endif
988 unregister_code16(code);
989}
990
963/** \brief Utilities for actions. (FIXME: Needs better description) 991/** \brief Utilities for actions. (FIXME: Needs better description)
964 * 992 *
965 * FIXME: Needs documentation. 993 * FIXME: Needs documentation.