X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Faction.c;h=5a6f3df3116a1f0afa84028fa95c1cbed5bfd8ac;hb=ce5e565f58003eb5144e08e3e8cdcc63a6110b76;hp=ab6e9d895807898fde8b7112eadfb0eb8053b9e1;hpb=c0f09090512f026ff40554637a7b3ce42c98f204;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index ab6e9d89..5a6f3df3 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -28,6 +28,7 @@ along with this program. If not, see . #include "action.h" #include "hook.h" #include "wait.h" +#include "bootloader.h" #ifdef DEBUG_ACTION #include "debug.h" @@ -58,6 +59,8 @@ void action_exec(keyevent_t event) void process_action(keyrecord_t *record) { + if (hook_process_action(record)) return; + keyevent_t event = record->event; #ifndef NO_ACTION_TAPPING uint8_t tap_count = record->tap.count; @@ -65,7 +68,7 @@ void process_action(keyrecord_t *record) if (IS_NOEVENT(event)) { return; } - action_t action = layer_switch_get_action(event.key); + action_t action = layer_switch_get_action(event); dprint("ACTION: "); debug_action(action); #ifndef NO_ACTION_LAYER dprint(" layer_state: "); layer_debug(); @@ -339,6 +342,15 @@ void process_action(keyrecord_t *record) break; #endif case ACT_COMMAND: + switch (action.command.id) { + case COMMAND_BOOTLOADER: + if (event.pressed) { + clear_keyboard(); + wait_ms(50); + bootloader_jump(); + } + break; + } break; #ifndef NO_ACTION_FUNCTION case ACT_FUNCTION: @@ -492,6 +504,12 @@ void unregister_code(uint8_t code) } } +void type_code(uint8_t code) +{ + register_code(code); + unregister_code(code); +} + void register_mods(uint8_t mods) { if (mods) { @@ -529,9 +547,11 @@ void clear_keyboard_but_mods(void) #endif } -bool is_tap_key(keypos_t key) +bool is_tap_key(keyevent_t event) { - action_t action = layer_switch_get_action(key); + if (IS_NOEVENT(event)) { return false; } + + action_t action = layer_switch_get_action(event); switch (action.kind.id) { case ACT_LMODS_TAP: