aboutsummaryrefslogtreecommitdiff
path: root/common/action_code.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/action_code.h')
-rw-r--r--common/action_code.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/common/action_code.h b/common/action_code.h
index 8ebcc833d..0933dce13 100644
--- a/common/action_code.h
+++ b/common/action_code.h
@@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
40 * 40 *
41 * Other Keys(01xx) 41 * Other Keys(01xx)
42 * ---------------- 42 * ----------------
43 * ACT_USAGE(0100): 43 * ACT_USAGE(0100): TODO: Not needed?
44 * 0100|00| usage(10) System control(0x80) - General Desktop page(0x01) 44 * 0100|00| usage(10) System control(0x80) - General Desktop page(0x01)
45 * 0100|01| usage(10) Consumer control(0x01) - Consumer page(0x0C) 45 * 0100|01| usage(10) Consumer control(0x01) - Consumer page(0x0C)
46 * 0100|10| usage(10) (reserved) 46 * 0100|10| usage(10) (reserved)
@@ -66,6 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
66 * ee: on event(00:default layer, 01:press, 10:release, 11:both) 66 * ee: on event(00:default layer, 01:press, 10:release, 11:both)
67 * 67 *
68 * 1001|xxxx|xxxx xxxx (reserved) 68 * 1001|xxxx|xxxx xxxx (reserved)
69 * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
69 * 70 *
70 * ACT_LAYER_TAP(101x): 71 * ACT_LAYER_TAP(101x):
71 * 101E|LLLL| keycode Invert with tap key 72 * 101E|LLLL| keycode Invert with tap key
@@ -240,8 +241,10 @@ enum layer_pram_tap_op {
240}; 241};
241#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f)) 242#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f))
242#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key)) 243#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key))
244/* Default Layer */
245#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4))
243/* Layer Operation */ 246/* Layer Operation */
244#define ACTION_LAYER_CLEAR(on) ACTION_LAYER_AND(0x1f, (on)) 247#define ACTION_LAYER_CLEAR(on) ACTION_LAYER_BIT_AND(0, 0, (on))
245#define ACTION_LAYER_MOMENTARY(layer) ACTION_LAYER_ON_OFF(layer) 248#define ACTION_LAYER_MOMENTARY(layer) ACTION_LAYER_ON_OFF(layer)
246#define ACTION_LAYER_TOGGLE(layer) ACTION_LAYER_INVERT(layer, ON_RELEASE) 249#define ACTION_LAYER_TOGGLE(layer) ACTION_LAYER_INVERT(layer, ON_RELEASE)
247#define ACTION_LAYER_INVERT(layer, on) ACTION_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4), (on)) 250#define ACTION_LAYER_INVERT(layer, on) ACTION_LAYER_BIT_XOR((layer)/4, 1<<((layer)%4), (on))
@@ -251,21 +254,19 @@ enum layer_pram_tap_op {
251#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) 254#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
252#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) 255#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
253#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) 256#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
257/* With Tapping */
258#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
259#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)
254/* Bitwise Operation */ 260/* Bitwise Operation */
255#define ACTION_LAYER_BIT_AND(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_AND, (part), (bits), (on)) 261#define ACTION_LAYER_BIT_AND(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_AND, (part), (bits), (on))
256#define ACTION_LAYER_BIT_OR( part, bits, on) ACTION_LAYER_BITOP(OP_BIT_OR, (part), (bits), (on)) 262#define ACTION_LAYER_BIT_OR( part, bits, on) ACTION_LAYER_BITOP(OP_BIT_OR, (part), (bits), (on))
257#define ACTION_LAYER_BIT_XOR(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), (on)) 263#define ACTION_LAYER_BIT_XOR(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), (on))
258#define ACTION_LAYER_BIT_SET(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), (on)) 264#define ACTION_LAYER_BIT_SET(part, bits, on) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), (on))
259/* Default Layer */
260#define ACTION_DEFAULT_LAYER_SET(layer) ACTION_DEFAULT_LAYER_BIT_SET((layer)/4, 1<<((layer)%4))
261/* Default Layer Bitwise Operation */ 265/* Default Layer Bitwise Operation */
262#define ACTION_DEFAULT_LAYER_BIT_AND(part, bits) ACTION_LAYER_BITOP(OP_BIT_AND, (part), (bits), 0) 266#define ACTION_DEFAULT_LAYER_BIT_AND(part, bits) ACTION_LAYER_BITOP(OP_BIT_AND, (part), (bits), 0)
263#define ACTION_DEFAULT_LAYER_BIT_OR( part, bits) ACTION_LAYER_BITOP(OP_BIT_OR, (part), (bits), 0) 267#define ACTION_DEFAULT_LAYER_BIT_OR( part, bits) ACTION_LAYER_BITOP(OP_BIT_OR, (part), (bits), 0)
264#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0) 268#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0)
265#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0) 269#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0)
266/* With Tapping */
267#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
268#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)
269 270
270 271
271/* 272/*