aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-09-29 10:12:58 +0900
committertmk <nobody@nowhere>2014-09-29 10:29:33 +0900
commit821c719e98f310938e2bb3f2ad3e6a726bd8b03e (patch)
tree0af03831bbed9d6a4155e46923406b4a3bd6b67e /common
parent8cec0bc9d66cb7da4770e6502e97a426908eb532 (diff)
downloadqmk_firmware-821c719e98f310938e2bb3f2ad3e6a726bd8b03e.tar.gz
qmk_firmware-821c719e98f310938e2bb3f2ad3e6a726bd8b03e.zip
Add action 'Momentary switching with Modifiers'
Diffstat (limited to 'common')
-rw-r--r--common/action.c10
-rw-r--r--common/action_code.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/common/action.c b/common/action.c
index fddb97c50..83bc8a618 100644
--- a/common/action.c
+++ b/common/action.c
@@ -237,6 +237,16 @@ void process_action(keyrecord_t *record)
237 case ACT_LAYER_TAP: 237 case ACT_LAYER_TAP:
238 case ACT_LAYER_TAP_EXT: 238 case ACT_LAYER_TAP_EXT:
239 switch (action.layer_tap.code) { 239 switch (action.layer_tap.code) {
240 case 0xe0 ... 0xef:
241 /* layer On/Off with modifiers(left only) */
242 if (event.pressed) {
243 layer_on(action.layer_tap.val);
244 register_mods(action.layer_tap.code & 0x0f);
245 } else {
246 layer_off(action.layer_tap.val);
247 unregister_mods(action.layer_tap.code & 0x0f);
248 }
249 break;
240 case OP_TAP_TOGGLE: 250 case OP_TAP_TOGGLE:
241 /* tap toggle */ 251 /* tap toggle */
242 if (event.pressed) { 252 if (event.pressed) {
diff --git a/common/action_code.h b/common/action_code.h
index 50112d4d2..bc40e2c6f 100644
--- a/common/action_code.h
+++ b/common/action_code.h
@@ -71,7 +71,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
71 * 71 *
72 * ACT_LAYER_TAP(101x): 72 * ACT_LAYER_TAP(101x):
73 * 101E|LLLL| keycode On/Off with tap key 73 * 101E|LLLL| keycode On/Off with tap key
74 * 101E|LLLL|1110 xxxx Reserved(0xE0-EF) 74 * 101E|LLLL|1110 mods On/Off with modifiers(0xE0-EF)
75 * 101E|LLLL|1111 0000 Invert with tap toggle(0xF0) 75 * 101E|LLLL|1111 0000 Invert with tap toggle(0xF0)
76 * 101E|LLLL|1111 0001 On/Off 76 * 101E|LLLL|1111 0001 On/Off
77 * 101E|LLLL|1111 0010 Off/On 77 * 101E|LLLL|1111 0010 Off/On
@@ -266,6 +266,7 @@ enum layer_pram_tap_op {
266#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF) 266#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
267#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON) 267#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
268#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR) 268#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
269#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | (mods)&0x0f)
269/* With Tapping */ 270/* With Tapping */
270#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key)) 271#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
271#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE) 272#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)