aboutsummaryrefslogtreecommitdiff
path: root/common/action.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/action.h')
-rw-r--r--common/action.h35
1 files changed, 15 insertions, 20 deletions
diff --git a/common/action.h b/common/action.h
index 1d00e02d5..46ae809cb 100644
--- a/common/action.h
+++ b/common/action.h
@@ -76,11 +76,6 @@ typedef union {
76 76
77 77
78 78
79/* layer used currently */
80extern uint8_t current_layer;
81/* layer to return or start with */
82extern uint8_t default_layer;
83
84/* Execute action per keyevent */ 79/* Execute action per keyevent */
85void action_exec(keyevent_t event); 80void action_exec(keyevent_t event);
86 81
@@ -155,14 +150,14 @@ bool waiting_buffer_has_anykey_pressed(void);
155 * 150 *
156 * Mouse Keys 151 * Mouse Keys
157 * ---------- 152 * ----------
158 * TODO: can be combined with 'Other HID Usage'? to save action kind id. 153 * NOTE: can be combined with 'Other HID Usage'? to save action kind id.
159 * ACT_MOUSEKEY(0110): 154 * ACT_MOUSEKEY(0110):
160 * 0101|XXXX| keycode Mouse key 155 * 0101|XXXX| keycode Mouse key
161 * 156 *
162 * 157 *
163 * Layer Actions 158 * Layer Actions
164 * ------------- 159 * -------------
165 * ACT_LAYER(1000): Set layer 160 * ACT_LAYER_SET(1000): Set layer
166 * 1000|LLLL|0000 0000 set current layer on press and return to default on release(momentary) 161 * 1000|LLLL|0000 0000 set current layer on press and return to default on release(momentary)
167 * 1000|LLLL|0000 0001 set current layer on press 162 * 1000|LLLL|0000 0001 set current layer on press
168 * 1000|LLLL|0000 0010 set current layer on release 163 * 1000|LLLL|0000 0010 set current layer on release
@@ -216,7 +211,7 @@ enum action_kind_id {
216 ACT_USAGE = 0b0100, 211 ACT_USAGE = 0b0100,
217 ACT_MOUSEKEY = 0b0101, 212 ACT_MOUSEKEY = 0b0101,
218 213
219 ACT_LAYER = 0b1000, 214 ACT_LAYER_SET = 0b1000,
220 ACT_LAYER_BIT = 0b1001, 215 ACT_LAYER_BIT = 0b1001,
221 ACT_LAYER_SWITCH = 0b1011, 216 ACT_LAYER_SWITCH = 0b1011,
222 217
@@ -277,14 +272,14 @@ enum layer_codes {
277 */ 272 */
278/* set default layer */ 273/* set default layer */
279#define ACTION_LAYER_SET_DEFAULT(layer) ACTION_LAYER_SET_DEFAULT_R(layer) 274#define ACTION_LAYER_SET_DEFAULT(layer) ACTION_LAYER_SET_DEFAULT_R(layer)
280#define ACTION_LAYER_SET_DEFAULT_P(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_PRESS) 275#define ACTION_LAYER_SET_DEFAULT_P(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_SET_DEFAULT_ON_PRESS)
281#define ACTION_LAYER_SET_DEFAULT_R(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_RELEASE) 276#define ACTION_LAYER_SET_DEFAULT_R(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_SET_DEFAULT_ON_RELEASE)
282#define ACTION_LAYER_SET_DEFAULT_B(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_SET_DEFAULT_ON_BOTH) 277#define ACTION_LAYER_SET_DEFAULT_B(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_SET_DEFAULT_ON_BOTH)
283/* bit-xor default layer */ 278/* bit-xor default layer */
284#define ACTION_LAYER_BIT_DEFAULT(bits) ACTION_LAYER_BIT_DEFAULT_R(bits) 279#define ACTION_LAYER_BIT_DEFAULT(bits) ACTION_LAYER_BIT_DEFAULT_R(bits)
285#define ACTION_LAYER_BIT_DEFAULT_P(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_PRESS) 280#define ACTION_LAYER_BIT_DEFAULT_P(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_SET_DEFAULT_ON_PRESS)
286#define ACTION_LAYER_BIT_DEFAULT_R(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_RELEASE) 281#define ACTION_LAYER_BIT_DEFAULT_R(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_SET_DEFAULT_ON_RELEASE)
287#define ACTION_LAYER_BIT_DEFAULT_B(bits) ACTION(ACT_LAYER, (bits)<<8 | LAYER_SET_DEFAULT_ON_BOTH) 282#define ACTION_LAYER_BIT_DEFAULT_B(bits) ACTION(ACT_LAYER_BIT, (bits)<<8 | LAYER_SET_DEFAULT_ON_BOTH)
288/* 283/*
289 * Current layer: Return to default layer 284 * Current layer: Return to default layer
290 */ 285 */
@@ -296,13 +291,13 @@ enum layer_codes {
296 * Current layer: Set 291 * Current layer: Set
297 */ 292 */
298#define ACTION_LAYER_SET(layer) ACTION_LAYER_SET_P(layer) 293#define ACTION_LAYER_SET(layer) ACTION_LAYER_SET_P(layer)
299#define ACTION_LAYER_SET_MOMENTARY(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_MOMENTARY) 294#define ACTION_LAYER_SET_MOMENTARY(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_MOMENTARY)
300#define ACTION_LAYER_SET_TOGGLE(layer) ACTION_LAYER_SET_R(layer) 295#define ACTION_LAYER_SET_TOGGLE(layer) ACTION_LAYER_SET_R(layer)
301#define ACTION_LAYER_SET_P(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_PRESS) 296#define ACTION_LAYER_SET_P(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_ON_PRESS)
302#define ACTION_LAYER_SET_R(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_RELEASE) 297#define ACTION_LAYER_SET_R(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_ON_RELEASE)
303#define ACTION_LAYER_SET_B(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_ON_BOTH) 298#define ACTION_LAYER_SET_B(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_ON_BOTH)
304#define ACTION_LAYER_SET_TAP_TOGGLE(layer) ACTION(ACT_LAYER, (layer)<<8 | LAYER_TAP_TOGGLE) 299#define ACTION_LAYER_SET_TAP_TOGGLE(layer) ACTION(ACT_LAYER_SET, (layer)<<8 | LAYER_TAP_TOGGLE)
305#define ACTION_LAYER_SET_TAP_KEY(layer, key) ACTION(ACT_LAYER, (layer)<<8 | (key)) 300#define ACTION_LAYER_SET_TAP_KEY(layer, key) ACTION(ACT_LAYER_SET, (layer)<<8 | (key))
306/* 301/*
307 * Current layer: Bit-op 302 * Current layer: Bit-op
308 */ 303 */