174 lines
16 KiB
C
174 lines
16 KiB
C
|
#include QMK_KEYBOARD_H
|
||
|
#include <print.h>
|
||
|
|
||
|
extern keymap_config_t keymap_config;
|
||
|
|
||
|
#define _QWERTY 0
|
||
|
#define _LOWER 1
|
||
|
#define _RAISE 2
|
||
|
#define _MOUSE 3
|
||
|
#define _ADJUST 4
|
||
|
|
||
|
enum custom_keycodes {
|
||
|
QWERTY = SAFE_RANGE,
|
||
|
LOWER,
|
||
|
RAISE,
|
||
|
MOUSE,
|
||
|
ADJUST,
|
||
|
};
|
||
|
|
||
|
#define KC_MOUS TT(_MOUSE) // double tab toggle mouse layer
|
||
|
#define MS_L KC_MS_LEFT
|
||
|
#define MS_R KC_MS_RIGHT
|
||
|
#define MS_U KC_MS_UP
|
||
|
#define MS_D KC_MS_DOWN
|
||
|
#define MS_B1 KC_MS_BTN1
|
||
|
#define MS_B2 KC_MS_BTN2
|
||
|
#define MW_U KC_MS_WH_UP
|
||
|
#define MW_D KC_MS_WH_DOWN
|
||
|
#define MW_L KC_MS_WH_LEFT
|
||
|
#define MW_R KC_MS_WH_RIGHT
|
||
|
|
||
|
//Tap Dance Declarations
|
||
|
enum {
|
||
|
TD_SCL = 0
|
||
|
};
|
||
|
//Tap Dance Definitions
|
||
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||
|
//Tap once for Shift, twice for Caps Lock
|
||
|
[TD_SCL] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS)
|
||
|
};
|
||
|
enum {
|
||
|
TD_EBT = 0
|
||
|
};
|
||
|
|
||
|
|
||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||
|
|
||
|
[_QWERTY] = LAYOUT(
|
||
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||
|
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
TD(TD_SCL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MOUS, KC_MOUS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
|
||
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||
|
KC_LALT, LOWER, KC_ENT, KC_SPC, RAISE, KC_LGUI
|
||
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||
|
),
|
||
|
|
||
|
[_LOWER] = LAYOUT(
|
||
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||
|
KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_MINS, KC_EQL, KC_BSPC,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, _______, KC_UP, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_PIPE,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,_______, KC_ENT,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
KC_LCTL, _______, _______, _______, KC_LCBR, KC_LBRC, KC_LPRN, KC_RPRN, KC_RBRC, KC_RCBR, _______, _______, _______, _______,
|
||
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||
|
_______, _______, KC_DEL, KC_DEL, _______, _______
|
||
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||
|
),
|
||
|
|
||
|
[_RAISE] = LAYOUT(
|
||
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||
|
KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
RGB_MOD, KC_MPRV, KC_MNXT, _______, KC_PGUP, KC_UNDS, KC_EQL, KC_HOME, RGB_HUI, RGB_SAI, RGB_VAI, KC_ENT,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, KC_MSTP, KC_MPLY, _______, KC_PGDN, KC_MINS, KC_LPRN, KC_RPRN, KC_PLUS, KC_END, RGB_HUD, RGB_SAD, RGB_VAD, _______,
|
||
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||
|
_______, _______, _______, _______, _______, _______
|
||
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||
|
),
|
||
|
|
||
|
[_MOUSE] = LAYOUT(
|
||
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||
|
BL_BRTG, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, RESET,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
BL_TOGG, MS_B1, MS_U, MS_B2, MW_U, _______, _______, MS_B1, MS_B2, _______, _______, _______,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, MS_L, MS_D, MS_R, MW_D, _______, MS_L, MS_D , MS_U, MS_R ,_______, _______,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
BL_STEP, _______, _______, MW_L, MW_R, _______, _______, _______, KC_BRID, KC_BRIU, KC_VOLD, KC_VOLU, KC_MUTE, _______,
|
||
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||
|
_______, _______, _______, _______, _______, _______
|
||
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||
|
),
|
||
|
|
||
|
[_ADJUST] = LAYOUT(
|
||
|
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
|
||
|
_______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, RESET,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||
|
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
|
||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, KC_BRIU, KC_VOLD, KC_VOLU, KC_MUTE, _______,
|
||
|
//└────────┴────────┴────────┴───┬────┴───┬────┴───┬────┴───┬────┘ └───┬────┴───┬────┴───┬────┴───┬────┴────────┴────────┴────────┘
|
||
|
_______, _______, _______, _______, _______, _______
|
||
|
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
|
||
|
)
|
||
|
};
|
||
|
|
||
|
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);
|
||
|
dprintf("Got on layer %s ", LOWER);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
} else {
|
||
|
layer_off(_LOWER);
|
||
|
dprintf("Got off layer %s ", LOWER);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
case RAISE:
|
||
|
if (record->event.pressed) {
|
||
|
layer_on(_RAISE);
|
||
|
dprintf("Got on layer %s ", RAISE);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
} else {
|
||
|
layer_off(_RAISE);
|
||
|
dprintf("Got off layer %s ", RAISE);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
case MOUSE:
|
||
|
if (record->event.pressed) {
|
||
|
layer_on(_MOUSE);
|
||
|
dprintf("Got on layer %s ", MOUSE);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
} else {
|
||
|
layer_off(_MOUSE);
|
||
|
dprintf("Got off layer %s ", MOUSE);
|
||
|
update_tri_layer(_LOWER, _RAISE, _MOUSE);
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
case ADJUST:
|
||
|
if (record->event.pressed) {
|
||
|
layer_on(_ADJUST);
|
||
|
} else {
|
||
|
layer_off(_ADJUST);
|
||
|
}
|
||
|
return false;
|
||
|
break;
|
||
|
}
|
||
|
return true;
|
||
|
}
|