[Erez & Jack] Makes tri-layer available across Quantum

This commit is contained in:
Erez Zukerman 2016-04-07 15:21:06 +03:00
parent ee2ee7f4f0
commit 9cfc74c35b
3 changed files with 12 additions and 9 deletions

View File

@ -174,16 +174,7 @@ float tone_dv[][2] = {
};
#endif
#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer)))
#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer)))
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);
}
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function

View File

@ -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);
}
}

View File

@ -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