diff options
| author | Drashna Jaelre <drashna@live.com> | 2023-02-11 15:23:07 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-12 10:23:07 +1100 |
| commit | fe02abc47921428fe6eb59ca817bfd082f0de4bf (patch) | |
| tree | 5bc3f68ec782969cfed93660c21704df4b530823 /quantum/action_layer.h | |
| parent | 40028437971fbca33f49e1d0b683b3b6e2dc9a61 (diff) | |
[Core] Tri Layer Keys (#19795)
Co-authored-by: wilba <wilba@wilba.tech>
Co-authored-by: Pablo MartÃnez <58857054+elpekenin@users.noreply.github.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'quantum/action_layer.h')
| -rw-r--r-- | quantum/action_layer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/quantum/action_layer.h b/quantum/action_layer.h index 3fe2726529..ff783bb3e7 100644 --- a/quantum/action_layer.h +++ b/quantum/action_layer.h | |||
| @@ -113,6 +113,25 @@ void layer_and(layer_state_t state); | |||
| 113 | void layer_xor(layer_state_t state); | 113 | void layer_xor(layer_state_t state); |
| 114 | layer_state_t layer_state_set_user(layer_state_t state); | 114 | layer_state_t layer_state_set_user(layer_state_t state); |
| 115 | layer_state_t layer_state_set_kb(layer_state_t state); | 115 | layer_state_t layer_state_set_kb(layer_state_t state); |
| 116 | |||
| 117 | /** | ||
| 118 | * @brief Applies the tri layer to global layer state. Not be used in layer_state_set_(kb|user) functions. | ||
| 119 | * | ||
| 120 | * @param layer1 First layer to check for tri layer | ||
| 121 | * @param layer2 Second layer to check for tri layer | ||
| 122 | * @param layer3 Layer to activate if both other layers are enabled | ||
| 123 | */ | ||
| 124 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); | ||
| 125 | /** | ||
| 126 | * @brief Applies the tri layer behavior to supplied layer bitmask, without using layer functions. | ||
| 127 | * | ||
| 128 | * @param state Original layer bitmask to check and modify | ||
| 129 | * @param layer1 First layer to check for tri layer | ||
| 130 | * @param layer2 Second layer to check for tri layer | ||
| 131 | * @param layer3 Layer to activate if both other layers are enabled | ||
| 132 | * @return layer_state_t returns a modified layer bitmask with tri layer modifications applied | ||
| 133 | */ | ||
| 134 | layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); | ||
| 116 | #else | 135 | #else |
| 117 | # define layer_state 0 | 136 | # define layer_state 0 |
| 118 | 137 | ||
| @@ -131,6 +150,8 @@ layer_state_t layer_state_set_kb(layer_state_t state); | |||
| 131 | # define layer_xor(state) (void)state | 150 | # define layer_xor(state) (void)state |
| 132 | # define layer_state_set_kb(state) (void)state | 151 | # define layer_state_set_kb(state) (void)state |
| 133 | # define layer_state_set_user(state) (void)state | 152 | # define layer_state_set_user(state) (void)state |
| 153 | # define update_tri_layer(layer1, layer2, layer3) | ||
| 154 | # define update_tri_layer_state(state, layer1, layer2, layer3) (void)state | ||
| 134 | #endif | 155 | #endif |
| 135 | 156 | ||
| 136 | /* pressed actions cache */ | 157 | /* pressed actions cache */ |
