X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=common%2Faction_code.h;h=bc40e2c6fbfeebf4c82cd832ef0b90e42c88501e;hb=75a59e4d12a13efc03cacd85b394fcf1204aad76;hp=45e974a668330d73b4e6358bf1be239324c233a2;hpb=6aaa6e0ef9aa1e464b67723fd4cdd0d63b2c861d;p=max%2Ftmk_keyboard.git diff --git a/common/action_code.h b/common/action_code.h index 45e974a6..bc40e2c6 100644 --- a/common/action_code.h +++ b/common/action_code.h @@ -29,13 +29,14 @@ 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 Key and Modifiers + * 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 + * 001r|mods| keycode Modifiers with Tap Key(Dual role) * * * Other Keys(01xx) @@ -69,8 +70,8 @@ along with this program. If not, see . * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation??? * * ACT_LAYER_TAP(101x): - * 101E|LLLL| keycode Invert with tap key - * 101E|LLLL|1110 xxxx Reserved(0xE0-EF) + * 101E|LLLL| keycode On/Off with tap key + * 101E|LLLL|1110 mods On/Off with modifiers(0xE0-EF) * 101E|LLLL|1111 0000 Invert with tap toggle(0xF0) * 101E|LLLL|1111 0001 On/Off * 101E|LLLL|1111 0010 Off/On @@ -86,7 +87,7 @@ along with this program. If not, see . * 1100|1111| id(8) Macro record? * * ACT_BACKLIGHT(1101): - * 1101|xxxx| id(8) Backlight commands + * 1101|opt |level(8) Backlight commands * * ACT_COMMAND(1110): * 1110|opt | id(8) Built-in Command exec @@ -162,7 +163,9 @@ typedef union { uint8_t kind :4; } usage; struct action_backlight { - uint8_t id :8; + uint8_t level :8; + uint8_t opt :4; + uint8_t kind :4; } backlight; struct action_command { uint8_t id :8; @@ -205,12 +208,14 @@ enum mods_bit { }; enum mods_codes { MODS_ONESHOT = 0x00, + MODS_TAP_TOGGLE = 0x01, }; #define ACTION_KEY(key) ACTION(ACT_MODS, (key)) -#define ACTION_MODS(mods) ACTION(ACT_MODS, (mods)<<8 | 0) -#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, (mods)<<8 | (key)) -#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, (mods)<<8 | (key)) -#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, (mods)<<8 | MODS_ONESHOT) +#define ACTION_MODS(mods) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | 0) +#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | (key)) +#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | (key)) +#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_ONESHOT) +#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE) /* @@ -261,6 +266,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) /* 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) @@ -279,21 +285,23 @@ enum layer_pram_tap_op { /* * Extensions */ -enum backlight_id { +enum backlight_opt { BACKLIGHT_INCREASE = 0, BACKLIGHT_DECREASE = 1, BACKLIGHT_TOGGLE = 2, BACKLIGHT_STEP = 3, + BACKLIGHT_LEVEL = 4, }; /* Macro */ #define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) #define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id)) #define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt)<<8 | (id)) /* Backlight */ -#define ACTION_BACKLIGHT_INCREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_INCREASE) -#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE) -#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE) -#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP) +#define ACTION_BACKLIGHT_INCREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_INCREASE << 8) +#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8) +#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8) +#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) +#define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | level) /* Command */ #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr)) /* Function */