diff options
| author | Erez Zukerman <ezuk@madmimi.com> | 2016-04-07 15:21:06 +0300 |
|---|---|---|
| committer | Erez Zukerman <ezuk@madmimi.com> | 2016-04-07 15:21:06 +0300 |
| commit | 9cfc74c35b940884618b0fe1e6fd25c570e1c974 (patch) | |
| tree | f4372d9b26521207d5106dd5a255f0ce285417ea | |
| parent | ee2ee7f4f049dda385a9db7dddd8e7e91681315b (diff) | |
| download | qmk_firmware-9cfc74c35b940884618b0fe1e6fd25c570e1c974.tar.gz qmk_firmware-9cfc74c35b940884618b0fe1e6fd25c570e1c974.zip | |
[Erez & Jack] Makes tri-layer available across Quantum
| -rw-r--r-- | keyboard/planck/keymaps/default/keymap.c | 9 | ||||
| -rw-r--r-- | quantum/keymap_common.c | 8 | ||||
| -rw-r--r-- | quantum/keymap_common.h | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index dee2840f2..56092d04f 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c | |||
| @@ -174,16 +174,7 @@ float tone_dv[][2] = { | |||
| 174 | }; | 174 | }; |
| 175 | #endif | 175 | #endif |
| 176 | 176 | ||
| 177 | #define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) | ||
| 178 | #define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) | ||
| 179 | 177 | ||
| 180 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 181 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 182 | layer_on(layer3); | ||
| 183 | } else { | ||
| 184 | layer_off(layer3); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | 178 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) |
| 188 | { | 179 | { |
| 189 | // MACRODOWN only works in this function | 180 | // MACRODOWN only works in this function |
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index e3030a886..3a00d36f0 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
| @@ -291,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode) | |||
| 291 | // For FUNC without 8bit limit | 291 | // For FUNC without 8bit limit |
| 292 | return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; | 292 | return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; |
| 293 | } | 293 | } |
| 294 | |||
| 295 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 296 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 297 | layer_on(layer3); | ||
| 298 | } else { | ||
| 299 | layer_off(layer3); | ||
| 300 | } | ||
| 301 | } | ||
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 4a877d2a7..7452a1ff3 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h | |||
| @@ -208,5 +208,9 @@ extern const uint16_t fn_actions[]; | |||
| 208 | #define UNICODE(n) (n | 0x8000) | 208 | #define UNICODE(n) (n | 0x8000) |
| 209 | #define UC(n) UNICODE(n) | 209 | #define UC(n) UNICODE(n) |
| 210 | 210 | ||
| 211 | // For tri-layer | ||
| 212 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); | ||
| 213 | #define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer))) | ||
| 214 | #define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer))) | ||
| 211 | 215 | ||
| 212 | #endif | 216 | #endif |
