33a5dc4fcf
* sync with upstream; initial iris design * sync with upstream * update to iris keymap * merge upstream * iris keymap refined * Iris readme update * messed up upstream merge somehow, hopefully fixed * removed extra closing bracket * Apply suggestions from code review Co-Authored-By: Joel Challis <git@zvecr.com> * change layers from define to enum per suggestions Co-authored-by: Mysti Woodard <mystiwoodard@gmail.com> Co-authored-by: Joel Challis <git@zvecr.com>
154 lines
15 KiB
C
154 lines
15 KiB
C
#include QMK_KEYBOARD_H
|
|
|
|
enum layers {
|
|
_QWERTY,
|
|
_GAME,
|
|
_LOWER,
|
|
_RAISE,
|
|
_ADJUST
|
|
};
|
|
|
|
// define keycode macros for readability
|
|
#define KM_DLEFT LGUI(LCTL(KC_LEFT))
|
|
#define KM_DRIGHT LGUI(LCTL(KC_RIGHT))
|
|
#define TSKMGR LCTL(LSFT(KC_ESC))
|
|
#define KC_LCBR LSFT(KC_LBRC)
|
|
#define KC_RCBR LSFT(KC_RBRC)
|
|
|
|
enum custom_keycodes {
|
|
QWERTY = SAFE_RANGE,
|
|
GAME,
|
|
LOWER,
|
|
RAISE,
|
|
ADJUST
|
|
};
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
[_QWERTY] = LAYOUT(
|
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
KC_LCTL, 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_ENT, KC_DEL, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS,
|
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
|
KC_LALT, LT(_LOWER, KC_TAB), CTL_T(KC_SPC), SFT_T(KC_BSPC), MO(_RAISE), KC_LGUI
|
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
|
),
|
|
|
|
[_GAME] = LAYOUT(
|
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
|
_______, MO(_LOWER), KC_SPC, _______, TO(_QWERTY), _______
|
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
|
),
|
|
|
|
[_LOWER] = LAYOUT(
|
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
|
LALT(KC_F4), KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, KC_LPRN, KC_RPRN, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
KC_MUTE, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, KC_NLCK, KC_LBRC, KC_RBRC, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
KC_VOLU, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, _______, KC_LCBR, KC_RCBR, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
|
KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, KM_DLEFT, KM_DRIGHT,_______, _______, _______, _______, _______, _______, _______, _______,
|
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
|
_______, _______, _______, _______, _______, _______
|
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
|
),
|
|
|
|
[_RAISE] = LAYOUT(
|
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
|
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PLUS, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PMNS, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_EQL, _______,
|
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
|
_______, _______, _______, _______, _______, TO(_GAME)
|
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
|
),
|
|
[_ADJUST] = LAYOUT(
|
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
|
_______, _______, _______,_______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
|
_______, _______, _______, _______, _______, _______
|
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
|
)
|
|
};
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case QWERTY:
|
|
if (record->event.pressed) {
|
|
set_single_persistent_default_layer(_QWERTY);
|
|
}
|
|
return false;
|
|
break;
|
|
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;
|
|
break;
|
|
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;
|
|
break;
|
|
case ADJUST:
|
|
if (record->event.pressed) {
|
|
layer_on(_ADJUST);
|
|
} else {
|
|
layer_off(_ADJUST);
|
|
}
|
|
return false;
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
|
if (index == 0) {
|
|
if (clockwise) {
|
|
tap_code(KC_VOLU);
|
|
} else {
|
|
tap_code(KC_VOLD);
|
|
}
|
|
}
|
|
else if (index == 1) {
|
|
if (clockwise) {
|
|
tap_code(KC_PGDN);
|
|
} else {
|
|
tap_code(KC_PGUP);
|
|
}
|
|
}
|
|
}
|