mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-12-20 12:40:22 -05:00
Refactor to use QMK TRI_LAYER_ENABLE feature
Replace manual process_record_user tri-layer logic with QMK's built-in TRI_LAYER feature: - Add TRI_LAYER_ENABLE = yes to rules.mk - Create config.h with layer definitions - Replace custom LOWER/RAISE keycodes with TL_LOWR/TL_UPPR - Remove enum atlas_keycodes and process_record_user function This reduces ~25 lines of boilerplate code to 3 config lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5522b3ea4
commit
7479351c0e
3 changed files with 8 additions and 27 deletions
6
keyboards/cannonkeys/atlas/keymaps/vnz/config.h
Normal file
6
keyboards/cannonkeys/atlas/keymaps/vnz/config.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
// Tri Layer configuration
|
||||
#define TRI_LAYER_LOWER_LAYER 1
|
||||
#define TRI_LAYER_UPPER_LAYER 2
|
||||
#define TRI_LAYER_ADJUST_LAYER 3
|
||||
|
|
@ -19,8 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
enum layer_names { _BASE, _LOWER, _RAISE, _ADJUST };
|
||||
|
||||
enum atlas_keycodes { LOWER = SAFE_RANGE, RAISE };
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Base
|
||||
|
|
@ -41,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_LGUI, KC_SPC, LOWER, RAISE, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_LGUI, KC_SPC, TL_LOWR, TL_UPPR, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
||||
),
|
||||
|
||||
/* Lower (Better-Shift: shifted alphanumerics)
|
||||
|
|
@ -107,27 +105,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@ COMMAND_ENABLE = no
|
|||
CONSOLE_ENABLE = no
|
||||
MOUSEKEY_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = yes
|
||||
TRI_LAYER_ENABLE = yes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue