X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=common%2Faction.c;h=6528cd46c8113f9bf8aa91792e7c707d06d42c75;hb=6215727b0bd827a18456b21a26d6175abe365ada;hp=710300eb3062bb86c5d62028f758fac126ce8474;hpb=48e6d0848cdeac26ffab101ea2ef48e5ac60acd3;p=max%2Ftmk_keyboard.git diff --git a/common/action.c b/common/action.c index 710300eb..6528cd46 100644 --- a/common/action.c +++ b/common/action.c @@ -26,6 +26,12 @@ along with this program. If not, see . #include "action.h" +/* default layer indicates base layer */ +uint8_t default_layer = 0; +/* current layer indicates active layer at this time */ +uint8_t current_layer = 0; + + static void process_action(keyrecord_t *record); static bool process_tapping(keyrecord_t *record); static void waiting_buffer_scan_tap(void); @@ -203,12 +209,12 @@ void action_exec(keyevent_t event) static action_t get_action(key_t key) { - action_t action = keymap_get_action(current_layer, key.pos.row, key.pos.col); + action_t action = action_for_key(current_layer, key); /* Transparently use default layer */ if (action.code == ACTION_TRANSPARENT) { // TODO: layer stacking - action = keymap_get_action(default_layer, key.pos.row, key.pos.col); + action = action_for_key(default_layer, key); debug("TRNASPARENT: "); debug_hex16(action.code); debug("\n"); } return action; @@ -509,12 +515,12 @@ static void process_action(keyrecord_t *record) /* Extentions */ case ACT_MACRO: + // TODO break; case ACT_COMMAND: break; case ACT_FUNCTION: - // TODO - keymap_call_function(record, action.func.id, action.func.opt); + action_function(record, action.func.id, action.func.opt); break; default: break; @@ -853,7 +859,7 @@ bool is_tap_key(key_t key) */ static void debug_event(keyevent_t event) { - debug_hex16(event.key.raw); + debug_hex16((event.key.row<<8) | event.key.col); if (event.pressed) debug("d("); else debug("u("); debug_dec(event.time); debug(")"); }