X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Faction_code.h;h=10d040ee0136dc1438409a9703a2b55fa66380b2;hb=530818b2abf106bd565e798b3ad363edb7be9729;hp=da93f77b2276760850e157364882497de2962145;hpb=2d673dfabc7dbafb60dd340b5b9bc45d91715315;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index da93f77b..10d040ee 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -29,14 +29,15 @@ along with this program. If not, see . * 000r|0000|0000 0001 Transparent code * 000r|0000| keycode Key * 000r|mods|0000 0000 Modifiers - * 000r|mods| keycode Modifiers+Key(Modified key) + * 000r|mods| keycode Modifiers+key(Modified key) * r: Left/Right flag(Left:0, Right:1) * * ACT_MODS_TAP(001r): - * 001r|mods|0000 0000 Modifiers with OneShot - * 001r|mods|0000 0001 Modifiers with tap toggle - * 001r|mods|0000 00xx (reserved) - * 001r|mods| keycode Modifiers with Tap Key(Dual role) + * 001r|mods|0000 0000 Modifiers with OneShot[TAP] + * 001r|mods|0000 0001 Modifiers with tap toggle[TAP] + * 001r|mods|0000 00xx (reserved) (0x02-03) + * 001r|mods| keycode Modifiers with tap key(0x04-A4, E0-E7)[TAP] + * (reserved) (0xA5-DF, E8-FF) * * * Other Keys(01xx) @@ -70,13 +71,15 @@ along with this program. If not, see . * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation??? * * ACT_LAYER_TAP(101x): - * 101E|LLLL| keycode On/Off with tap key (0x00-DF)[TAP] - * 101E|LLLL|1110 mods On/Off with modifiers (0xE0-EF)[NOT TAP] + * 101E|LLLL| keycode On/Off with tap key (0x04-A4, E0-E7)[TAP] + * 101E|LLLL|110r mods On/Off with modifiers (0xC0-DF)[NOT TAP] + * r: Left/Right flag(Left:0, Right:1) + * (reserved) (0xA5-BF, E8-EF) * 101E|LLLL|1111 0000 Invert with tap toggle (0xF0) [TAP] * 101E|LLLL|1111 0001 On/Off (0xF1) [NOT TAP] * 101E|LLLL|1111 0010 Off/On (0xF2) [NOT TAP] * 101E|LLLL|1111 0011 Set/Clear (0xF3) [NOT TAP] - * 101E|LLLL|1111 xxxx Reserved (0xF4-FF) + * 101E|LLLL|1111 xxxx (reserved) (0xF4-FF) * ELLLL: layer 0-31(E: extra bit for layer 16-31) * * @@ -181,9 +184,9 @@ typedef union { /* action utility */ -#define ACTION_NO 0 -#define ACTION_TRANSPARENT 1 -#define ACTION(kind, param) ((kind)<<12 | (param)) +#define ACTION_NO { .code = 0 } +#define ACTION_TRANSPARENT { .code = 1 } +#define ACTION(kind, param) { .code = ((kind)<<12 | (param)) } /* @@ -251,8 +254,8 @@ enum layer_pram_tap_op { OP_OFF_ON, OP_SET_CLEAR, }; -#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) -#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) +#define ACTION_LAYER_BITOP(op, part, bits, on) ACTION(ACT_LAYER, (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) +#define ACTION_LAYER_TAP(layer, key) ACTION(ACT_LAYER_TAP, (layer)<<8 | (key)) /* Default Layer */ #define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4)) #define ACTION_DEFAULT_LAYER_TOGGLE(layer) ACTION_DEFAULT_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4)) @@ -267,7 +270,7 @@ enum layer_pram_tap_op { #define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) #define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) #define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) -#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f)) +#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xc0 | ((mods)&0x1f)) /* With Tapping */ #define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) #define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)