mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-27 11:06:37 +06:00
fe02abc479
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>
31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
// 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;
|
|
}
|