2020-02-05 23:14:00 +06:00
|
|
|
/* Copyright 2020 kamonanban
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-01-01 19:52:49 +06:00
|
|
|
|
2020-02-05 23:14:00 +06:00
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
2021-01-01 19:52:49 +06:00
|
|
|
enum layer_names {
|
|
|
|
_BASE = 0,
|
|
|
|
_LOWER,
|
|
|
|
_RAISE,
|
|
|
|
_ADJUST
|
2020-02-05 23:14:00 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
enum custom_keycodes {
|
2021-01-01 19:52:49 +06:00
|
|
|
LOWER = SAFE_RANGE,
|
|
|
|
RAISE,
|
|
|
|
ADJUST
|
2020-02-05 23:14:00 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2021-01-01 19:52:49 +06:00
|
|
|
[_BASE] = LAYOUT(
|
|
|
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL, KC_MINS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
|
|
|
|
KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_AT,
|
|
|
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_COMM, KC_DOT, KC_H, KC_J, KC_K, KC_L, KC_UP, KC_SCLN,
|
|
|
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_SLSH, KC_B, KC_N, KC_M, KC_LEFT, KC_DOWN, KC_RGHT,
|
|
|
|
LOWER, XXXXXXX, KC_LALT, KC_LCTL, KC_SPC, KC_LGUI, KC_ENT, KC_BSPC, KC_DEL, KC_SPC, KC_RCTL, KC_RALT, XXXXXXX, RAISE
|
|
|
|
),
|
2020-02-05 23:14:00 +06:00
|
|
|
|
2021-01-01 19:52:49 +06:00
|
|
|
[_LOWER] = LAYOUT(
|
2022-10-09 09:51:09 +06:00
|
|
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_INT3, KC_LBRC, KC_RBRC,
|
2021-01-01 19:52:49 +06:00
|
|
|
_______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SCLN, KC_QUOT, KC_BSLS,
|
|
|
|
_______, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX,
|
|
|
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
LOWER, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, RAISE
|
|
|
|
),
|
2020-02-05 23:14:00 +06:00
|
|
|
|
2021-01-01 19:52:49 +06:00
|
|
|
[_RAISE] = LAYOUT(
|
|
|
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
LOWER, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, RAISE
|
|
|
|
),
|
2020-02-05 23:14:00 +06:00
|
|
|
|
2021-01-01 19:52:49 +06:00
|
|
|
[_ADJUST] = LAYOUT(
|
2024-08-25 18:15:07 +06:00
|
|
|
_______, UG_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, RGB_M_R, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT,
|
|
|
|
_______, UG_NEXT, UG_HUEU, UG_SATU, UG_VALU, RGB_M_SN,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
_______, RGB_M_T, UG_HUED, UG_SATD, UG_VALD, RGB_M_K, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
2021-01-01 19:52:49 +06:00
|
|
|
_______, RGB_M_P, XXXXXXX, XXXXXXX, XXXXXXX, RGB_M_SW, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
|
|
|
LOWER, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, RAISE
|
|
|
|
)
|
2020-02-05 23:14:00 +06:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
2021-01-01 19:52:49 +06:00
|
|
|
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
|
|
|
layer_on(layer3);
|
|
|
|
} else {
|
|
|
|
layer_off(layer3);
|
|
|
|
}
|
2020-02-05 23:14:00 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
2021-01-01 19:52:49 +06:00
|
|
|
switch (keycode) {
|
|
|
|
case LOWER:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
layer_on(_LOWER);
|
|
|
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
|
|
|
} else {
|
|
|
|
layer_off(_LOWER);
|
|
|
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case RAISE:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
layer_on(_RAISE);
|
|
|
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
|
|
|
} else {
|
|
|
|
layer_off(_RAISE);
|
|
|
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case ADJUST:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
layer_on(_ADJUST);
|
|
|
|
} else {
|
|
|
|
layer_off(_ADJUST);
|
|
|
|
}
|
|
|
|
return false;
|
2020-02-05 23:14:00 +06:00
|
|
|
}
|
2021-01-01 19:52:49 +06:00
|
|
|
return true;
|
2020-02-05 23:14:00 +06:00
|
|
|
}
|