aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action_code.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/action_code.h')
-rw-r--r--tmk_core/common/action_code.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h
index d836b7a8a..5b5d0e566 100644
--- a/tmk_core/common/action_code.h
+++ b/tmk_core/common/action_code.h
@@ -66,7 +66,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
66 * EBBBB: bits and extra bit 66 * EBBBB: bits and extra bit
67 * ee: on event(01:press, 10:release, 11:both) 67 * ee: on event(01:press, 10:release, 11:both)
68 * 68 *
69 * 1001|xxxx|xxxx xxxx (reserved) 69 * ACT_LAYER_MODS(1001):
70 * 1001|LLLL| mods Layer with modifiers held
70 * 71 *
71 * ACT_LAYER_TAP(101x): 72 * ACT_LAYER_TAP(101x):
72 * 101E|LLLL| keycode On/Off with tap key (0x00-DF)[TAP] 73 * 101E|LLLL| keycode On/Off with tap key (0x00-DF)[TAP]
@@ -110,6 +111,7 @@ enum action_kind_id {
110 ACT_SWAP_HANDS = 0b0110, 111 ACT_SWAP_HANDS = 0b0110,
111 /* Layer Actions */ 112 /* Layer Actions */
112 ACT_LAYER = 0b1000, 113 ACT_LAYER = 0b1000,
114 ACT_LAYER_MODS = 0b1001,
113 ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ 115 ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
114 ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */ 116 ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
115 /* Extensions */ 117 /* Extensions */
@@ -153,6 +155,12 @@ typedef union {
153 uint8_t op :2; 155 uint8_t op :2;
154 uint8_t kind :4; 156 uint8_t kind :4;
155 } layer_bitop; 157 } layer_bitop;
158 struct action_layer_mods
159 {
160 uint8_t mods :8;
161 uint8_t layer :4;
162 uint8_t kind :4;
163 } layer_mods;
156 struct action_layer_tap { 164 struct action_layer_tap {
157 uint8_t code :8; 165 uint8_t code :8;
158 uint8_t val :5; 166 uint8_t val :5;
@@ -261,8 +269,8 @@ enum layer_param_tap_op {
261 OP_SET_CLEAR, 269 OP_SET_CLEAR,
262 OP_ONESHOT, 270 OP_ONESHOT,
263}; 271};
264#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) 272#define ACTION_LAYER_BITOP(op, part, bits, on) ACTION(ACT_LAYER, (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f))
265#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) 273#define ACTION_LAYER_TAP(layer, key) ACTION(ACT_LAYER_TAP, (layer)<<8 | (key))
266/* Default Layer */ 274/* Default Layer */
267#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4)) 275#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4))
268/* Layer Operation */ 276/* Layer Operation */
@@ -277,7 +285,7 @@ enum layer_param_tap_op {
277#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) 285#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
278#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) 286#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
279#define ACTION_LAYER_ONESHOT(layer) ACTION_LAYER_TAP((layer), OP_ONESHOT) 287#define ACTION_LAYER_ONESHOT(layer) ACTION_LAYER_TAP((layer), OP_ONESHOT)
280#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f)) 288#define ACTION_LAYER_MODS(layer, mods) ACTION(ACT_LAYER_MODS, (layer) << 8 | (mods))
281/* With Tapping */ 289/* With Tapping */
282#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) 290#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
283#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE) 291#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)