diff options
Diffstat (limited to 'quantum/process_keycode/process_tri_layer.c')
-rw-r--r-- | quantum/process_keycode/process_tri_layer.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_tri_layer.c b/quantum/process_keycode/process_tri_layer.c new file mode 100644 index 0000000000..1e681b9a1c --- /dev/null +++ b/quantum/process_keycode/process_tri_layer.c @@ -0,0 +1,30 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "process_tri_layer.h" +#include "tri_layer.h" +#include "action_layer.h" + +bool process_tri_layer(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TRI_LAYER_LOWER: + if (record->event.pressed) { + layer_on(get_tri_layer_lower_layer()); + update_tri_layer(get_tri_layer_lower_layer(), get_tri_layer_upper_layer(), get_tri_layer_adjust_layer()); + } else { + layer_off(get_tri_layer_lower_layer()); + update_tri_layer(get_tri_layer_lower_layer(), get_tri_layer_upper_layer(), get_tri_layer_adjust_layer()); + } + return false; + case QK_TRI_LAYER_UPPER: + if (record->event.pressed) { + layer_on(get_tri_layer_upper_layer()); + update_tri_layer(get_tri_layer_lower_layer(), get_tri_layer_upper_layer(), get_tri_layer_adjust_layer()); + } else { + layer_off(get_tri_layer_upper_layer()); + update_tri_layer(get_tri_layer_lower_layer(), get_tri_layer_upper_layer(), get_tri_layer_adjust_layer()); + } + return false; + } + return true; +} |