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:
vnz 2025-12-20 11:14:59 +01:00
commit 7479351c0e
No known key found for this signature in database
3 changed files with 8 additions and 27 deletions

View 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

View file

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

View file

@ -2,3 +2,4 @@ COMMAND_ENABLE = no
CONSOLE_ENABLE = no
MOUSEKEY_ENABLE = yes
UNICODEMAP_ENABLE = yes
TRI_LAYER_ENABLE = yes