summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-03-28 11:55:19 -0400
committerJack Humbert <jack.humb@gmail.com>2016-03-28 11:55:19 -0400
commitfd9e5d151028e428249e4c42921e4bf2597d5f0d (patch)
treea1a95c9278260e31eaba0da21219b0c24e9087a4 /tmk_core/common
parent5e2c497d9a3aeb26e1ac9f3d9840fa213e67a339 (diff)
parentbcebb3447c155056819d42668943110ab0868517 (diff)
downloadqmk_firmware-fd9e5d151028e428249e4c42921e4bf2597d5f0d.tar.gz
qmk_firmware-fd9e5d151028e428249e4c42921e4bf2597d5f0d.zip
Merge pull request #214 from cdlm/action-hook
Add per-event user hook function
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/action.c5
-rw-r--r--tmk_core/common/action.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 4197c53ed2..2ccc0e0b94 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -53,6 +53,9 @@ void action_exec(keyevent_t event)
#endif
}
+__attribute__ ((weak))
+void process_action_kb(keyrecord_t *record) {}
+
void process_action(keyrecord_t *record)
{
keyevent_t event = record->event;
@@ -62,6 +65,8 @@ void process_action(keyrecord_t *record)
if (IS_NOEVENT(event)) { return; }
+ process_action_kb(record);
+
action_t action = layer_switch_get_action(event.key);
dprint("ACTION: "); debug_action(action);
#ifndef NO_ACTION_LAYER
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h
index 8a4736d7bc..9f528af4b9 100644
--- a/tmk_core/common/action.h
+++ b/tmk_core/common/action.h
@@ -58,6 +58,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
/* user defined special function */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
+/* keyboard-specific key event (pre)processing */
+void process_action_kb(keyrecord_t *record);
+
/* Utilities for actions. */
void process_action(keyrecord_t *record);
void register_code(uint8_t code);