summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorErez Zukerman <ezuk@madmimi.com>2016-04-07 15:21:06 +0300
committerErez Zukerman <ezuk@madmimi.com>2016-04-07 15:21:06 +0300
commit9cfc74c35b940884618b0fe1e6fd25c570e1c974 (patch)
treef4372d9b26521207d5106dd5a255f0ce285417ea /quantum
parentee2ee7f4f049dda385a9db7dddd8e7e91681315b (diff)
[Erez & Jack] Makes tri-layer available across Quantum
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.c8
-rw-r--r--quantum/keymap_common.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index e3030a8869..3a00d36f08 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -291,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode)
// For FUNC without 8bit limit
return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
}
+
+void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
index 4a877d2a70..7452a1ff3f 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -208,5 +208,9 @@ extern const uint16_t fn_actions[];
#define UNICODE(n) (n | 0x8000)
#define UC(n) UNICODE(n)
+// For tri-layer
+void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
+#define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer)))
+#define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer)))
#endif