diff options
author | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
commit | 27fc28fd2ff52e079a5bc58d6aaea4c752420615 (patch) | |
tree | 7ac943fb1ba4f430a7220efd18f66f6a77205c30 /keyboards/jian | |
parent | e736133392fe6427cfb995da0787337189828272 (diff) | |
parent | 2709b6ed616f8012ff4cfd3ee69a822a8d188351 (diff) |
Merge upstream master
Diffstat (limited to 'keyboards/jian')
-rw-r--r-- | keyboards/jian/keymaps/advanced/keymap.c | 584 | ||||
-rw-r--r-- | keyboards/jian/keymaps/default/keymap.c | 120 | ||||
-rw-r--r-- | keyboards/jian/keymaps/left_hand/keymap.c | 71 | ||||
-rw-r--r-- | keyboards/jian/keymaps/via/keymap.c | 28 | ||||
-rw-r--r-- | keyboards/jian/nsrev2/config.h | 133 | ||||
-rw-r--r-- | keyboards/jian/rev1/config.h | 138 | ||||
-rw-r--r-- | keyboards/jian/rev2/config.h | 138 |
7 files changed, 1212 insertions, 0 deletions
diff --git a/keyboards/jian/keymaps/advanced/keymap.c b/keyboards/jian/keymaps/advanced/keymap.c new file mode 100644 index 0000000000..0c13b2d301 --- /dev/null +++ b/keyboards/jian/keymaps/advanced/keymap.c @@ -0,0 +1,584 @@ +#include QMK_KEYBOARD_H + +typedef union { + uint32_t raw; + struct { + bool thumb_alt :1; + bool iso :1; + }; +} user_config_t; + +user_config_t user_config; + +#ifdef STENO_ENABLE +#include "keymap_steno.h" +#endif // STENO_ENABLE + + +#define QWERTY_base KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, \ + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH +#define DVORAK_base KC_GRV, KC_QUOT, KC_COMM, KC_DOT,KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_LBRC, KC_RBRC, \ + KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z +#define COLEMAK_base KC_GRV, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, \ + KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH +#define WORKMAN_base KC_GRV, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_LBRC, KC_RBRC, \ + KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT, \ + KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH +#ifdef ALT_LAYOUTS_ENABLE +#include "keymap_dvorak.h" +#include "keymap_colemak.h" +#include "keymap_workman.h" +#define DVK2QWE_base DV_GRV, DV_Q, DV_W, DV_E, DV_R, DV_T, DV_Y, DV_U, DV_I, DV_O, DV_P, DV_LBRC, DV_RBRC, \ + DV_A, DV_S, DV_D, DV_F, DV_G, DV_H, DV_J, DV_K, DV_L, DV_SCLN, DV_QUOT, \ + DV_Z, DV_X, DV_C, DV_V, DV_B, DV_N, DV_M, DV_COMM, DV_DOT, DV_SLSH +#define CMK2QWE_base KC_GRV, CM_Q, CM_W, CM_E, CM_R, CM_T, CM_Y, CM_U, CM_I, CM_O, CM_P, KC_LBRC, KC_RBRC, \ + CM_A, CM_S, CM_D, CM_F, CM_G, CM_H, CM_J, CM_K, CM_L, CM_SCLN, KC_QUOT, \ + CM_Z, CM_X, CM_C, CM_V, CM_B, CM_N, CM_M, CM_COMM, CM_DOT, CM_SLSH +#define WMN2QWE_base KC_GRV, WK_Q, WK_W, WK_E, WK_R, WK_T, WK_Y, WK_U, WK_I, WK_O, WK_P, KC_LBRC, KC_RBRC, \ + WK_A, WK_S, WK_D, WK_F, WK_G, WK_H, WK_J, WK_K, WK_L, WK_SCLN, KC_QUOT, \ + WK_Z, WK_X, WK_C, WK_V, WK_B, WK_N, WK_M, KC_COMM, KC_DOT, KC_SLSH +#define CMK2DVK_base KC_GRV, KC_QUOT, KC_COMM, KC_DOT,CM_P, CM_Y, CM_F, CM_G, CM_C, CM_R, CM_L, KC_LBRC, KC_RBRC, \ + CM_A, CM_O, CM_E, CM_U, CM_I, CM_D, CM_H, CM_T, CM_N, CM_S, CM_SLSH, \ + CM_SCLN, CM_Q, CM_J, CM_K, CM_X, CM_B, CM_M, CM_W, CM_V, CM_Z +#define WMN2DVK_base KC_GRV, KC_QUOT, KC_COMM, KC_DOT,WK_P, WK_Y, WK_F, WK_G, WK_C, WK_R, WK_L, KC_LBRC, KC_RBRC, \ + WK_A, WK_O, WK_E, WK_U, WK_I, WK_D, WK_H, WK_T, WK_N, WK_S, KC_SLSH, \ + WK_SCLN, WK_Q, WK_J, WK_K, WK_X, WK_B, WK_M, WK_W, WK_V, WK_Z +#define DVK2CMK_base DV_GRV, DV_Q, DV_W, DV_F, DV_P, DV_G, DV_J, DV_L, DV_U, DV_Y, DV_SCLN, DV_LBRC, DV_RBRC, \ + DV_A, DV_R, DV_S, DV_T, DV_D, DV_H, DV_N, DV_E, DV_I, DV_O, DV_QUOT, \ + DV_Z, DV_X, DV_C, DV_V, DV_B, DV_K, DV_M, DV_COMM, DV_DOT, DV_SLSH +#define WMN2CMK_base KC_GRV, WK_Q, WK_W, WK_F, WK_P, WK_G, WK_J, WK_L, WK_U, WK_Y, WK_SCLN, KC_LBRC, KC_RBRC, \ + WK_A, WK_R, WK_S, WK_T, WK_D, WK_H, WK_N, WK_E, WK_I, WK_O, KC_QUOT, \ + WK_Z, WK_X, WK_C, WK_V, WK_B, WK_K, WK_M, KC_COMM, KC_DOT, KC_SLSH +#define DVK2WMN_base DV_GRV, DV_Q, DV_D, DV_R, DV_W, DV_B, DV_J, DV_F, DV_U, DV_P, DV_SCLN, DV_LBRC, DV_RBRC, \ + DV_A, DV_S, DV_H, DV_T, DV_G, DV_Y, DV_N, DV_E, DV_O, DV_I, DV_QUOT, \ + DV_Z, DV_X, DV_M, DV_C, DV_V, DV_K, DV_L, DV_COMM, DV_DOT, DV_SLSH +#define CMK2WMN_base KC_GRV, CM_Q, CM_D, CM_R, CM_W, CM_B, CM_J, CM_F, CM_U, CM_P, CM_SCLN, KC_LBRC, KC_RBRC, \ + CM_A, CM_S, CM_H, CM_T, CM_G, CM_Y, CM_N, CM_E, CM_O, CM_I, KC_QUOT, \ + CM_Z, CM_X, CM_M, CM_C, CM_V, CM_K, CM_L, CM_COMM, CM_DOT, CM_SLSH +#endif // ALT_LAYOUTS_ENABLE + +enum jian_layers { + _QWERTY, +#ifdef ALT_LAYOUTS_ENABLE + _DVORAK, + _COLEMAK, + _WORKMAN, + _DVK2QWE, + _DVK2CMK, + _DVK2WMN, + _CMK2QWE, + _CMK2DVK, + _CMK2WMN, + _WMN2QWE, + _WMN2DVK, + _WMN2CMK, +#endif // ALT_LAYOUTS_ENABLE + _ISO, + _LOWER, + _RAISE, + _ADJUST, + _BCKLT_ADJ, + _THUMB_ALT, +#ifdef TRAINING_HALFES_LOCK + _LEFT, + _RIGHT, +#endif //TRAINING_HALFES_LOCK +#ifdef DIPS_ENABLE + _DIPS, +#endif // DIPS_ENABLE +#ifdef STENO_ENABLE + _PLOVER +#endif // STENO_ENABLE +}; + +enum jian_keycodes { + QWERTY = SAFE_RANGE, + PLOVER, + EXT_PLV, + EXT_RGB, + ISO, + THUMB_ALT, +//ifdef ALT_LAYOUTS_ENABLE + CH_WMN, + CH_CMK, + CH_QWE, + CH_DVK, +//endif // ALT_LAYOUTS_ENABLE +#ifdef DIPS_ENABLE + LAYOUT0, + LAYOUT1, + LAYOUT2, + LAYOUT3, + DIP_ISO, + FLIP_TH, + DIP6, + DIP7, + DIP8, + DIP9, + DIP10, + DIP11, +#endif // DIPS_ENABLE +}; + +#ifdef TRAINING_HALFES_LOCK +static uint8_t lock_timeout = 1; +static uint8_t lock_cooldown = 0; +#endif //TRAINING_HALFES_LOCK +#ifdef DIPS_ENABLE +#ifdef ALT_LAYOUTS_ENABLE +static uint8_t layout_conversion_dip_state = 0; +#endif // ALT_LAYOUTS_ENABLE +#endif // DIPS_ENABLE + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +#define BL_ADJ TG(_BCKLT_ADJ) +#define TG_LWR TG(_LOWER) +#define TG_RSE TG(_RAISE) + +#define RBR_RGU MT(MOD_RGUI, KC_RBRC) +#define F12_RGU MT(MOD_RGUI, KC_F12) +#define EQL_LCT MT(MOD_LCTL, KC_EQL) +#define APP_LCT MT(MOD_LCTL, KC_APP) +#define EQL_RCT MT(MOD_RCTL, KC_EQL) +#define QUO_RCT MT(MOD_RCTL, KC_QUOT) +#define APP_RCT MT(MOD_RCTL, KC_APP) +#define MIN_RCT MT(MOD_RCTL, KC_MINS) +#define PLS_LAL MT(MOD_LALT, KC_PPLS) +#define BSL_RAL MT(MOD_RALT, KC_BSLS) + +#define NBS_LCT MT(MOD_LCTL, KC_NUBS) +#define BSH_LAL MT(MOD_LALT, KC_BSLS) +#define APP_RAL MT(MOD_RALT, KC_APP) + +#define BSP_LSH MT(MOD_LSFT, KC_BSPC) +#define BSP_RSH MT(MOD_RSFT, KC_BSPC) +#define SPC_LSH MT(MOD_LSFT, KC_SPC) +#define SPC_RSH MT(MOD_RSFT, KC_SPC) +#define DEL_RSE LT(_RAISE, KC_DEL) +#define TAB_RSE LT(_RAISE, KC_TAB) +#define ENT_LWR LT(_LOWER, KC_ENT) +#define ESC_LWR LT(_LOWER, KC_ESC) + +#define RGU_RBR RGUI_T(KC_RBRC) +#define RCT_QUO RCTL_T(KC_QUOT) + +#define LAYOUT_base( \ + GRV, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, \ + A, S, D, F, G, H, J, K, L, SCLN, QUOT, \ + Z, X, C, V, B, N, M, COMM, DOT, SLSH \ + ) \ + LAYOUT( \ + KC_LGUI, GRV, Q, W, E, R, T, Y, U, I, O, P, LBRC, RGU_RBR, \ + KC_LCTL, A, S, D, F, G, H, J, K, L, SCLN, RCT_QUO, \ + KC_LALT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, BSL_RAL, \ + TAB_RSE, SPC_LSH, ENT_LWR, ESC_LWR, BSP_RSH, DEL_RSE \ + ) +#define LAYOUT_base_wrapper(...) LAYOUT_base(__VA_ARGS__) + +#ifdef SWAP_HANDS_ENABLE +#define SW_TG SH_TG +#else +#define SW_TG _______ +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = LAYOUT_base_wrapper(QWERTY_base), + +#ifdef DIPS_ENABLE +[_DIPS] = LAYOUT_dips(\ + LAYOUT0, LAYOUT1, LAYOUT2, LAYOUT3, DIP_ISO, FLIP_TH, \ + LAYOUT0, LAYOUT1, LAYOUT2, LAYOUT3, DIP_ISO, FLIP_TH \ +), +#endif // DIPS_ENABLE + +[_LOWER] = LAYOUT( + _______, KC_UNDS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, F12_RGU, + EQL_LCT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, MIN_RCT, + PLS_LAL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + _______, _______, _______, _______, _______, _______ +), + +[_RAISE] = LAYOUT( + _______, KC_NUM, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_VOLU, KC_HOME, KC_PSCR, KC_PGUP, KC_SCRL, KC_CAPS, _______, + EQL_LCT, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_MUTE, KC_LEFT, KC_UP, KC_RGHT, KC_INS, APP_RCT, + _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_PCMM, KC_VOLD, KC_END, KC_DOWN, KC_PGDN, KC_PAUS, _______, + _______, _______, _______, _______, _______, _______ +), + +[_ADJUST] = LAYOUT_symmetric( + QK_BOOT, DB_TOGG, AS_UP, CH_WMN, CH_CMK, CH_QWE, CH_DVK, + AS_RPT, AS_TOGG, XXXXXXX, XXXXXXX, QWERTY, PLOVER, + BL_ADJ, AS_DOWN, XXXXXXX, XXXXXXX, ISO, THUMB_ALT, + _______, SW_TG, _______ +), +#if defined(RGBLIGHT) | defined(BACKLIGHT_ENABLE) +[_BCKLT_ADJ] = LAYOUT_symmetric( + XXXXXXX, XXXXXXX, XXXXXXX, BL_UP, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DOWN, RGB_VAD, RGB_SAD, RGB_SAI, + BL_ADJ, BL_BRTG, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD, + _______, _______, _______ +), +#endif // defined(RGBLIGHT) | defined(BACKLIGHT_ENABLE) +#ifdef TRAINING_HALFES_LOCK +[_LEFT] = LAYOUT_base( + _______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +), + +[_RIGHT] = LAYOUT_base( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, _______, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______ +), +#endif // TRAINING_HALFES_LOCK + +#ifdef STENO_ENABLE +[_PLOVER] = LAYOUT( + EXT_PLV, STN_N1, STN_N2, STN_N3, STN_N4, STN_N5, STN_N6, STN_N7, STN_N8, STN_N9, STN_NA, STN_NB, STN_NC, EXT_PLV, + STN_FN, STN_S1, STN_TL, STN_PL, STN_HL, STN_ST1, STN_ST3, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR, + XXXXXXX, STN_S2, STN_KL, STN_WL, STN_RL, STN_ST2, STN_ST4, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR, + XXXXXXX, STN_A, STN_O, STN_E, STN_U, XXXXXXX +), +#endif // STENO_ENABLE + +[_THUMB_ALT] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + DEL_RSE, BSP_LSH, ESC_LWR, ENT_LWR, SPC_RSH, TAB_RSE +), + +[_ISO] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + LCTL_T(KC_NUBS), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + LALT_T(KC_NUHS), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, + _______, _______, _______, _______, _______, _______ +), + +#ifdef ALT_LAYOUTS_ENABLE +[_DVORAK] = LAYOUT_base_wrapper(DVORAK_base), +[_COLEMAK] = LAYOUT_base_wrapper(COLEMAK_base), +[_WORKMAN] = LAYOUT_base_wrapper(WORKMAN_base), +[_DVK2QWE] = LAYOUT_base_wrapper(DVK2QWE_base), +[_CMK2QWE] = LAYOUT_base_wrapper(CMK2QWE_base), +[_WMN2QWE] = LAYOUT_base_wrapper(WMN2QWE_base), +[_CMK2DVK] = LAYOUT_base_wrapper(CMK2DVK_base), +[_WMN2DVK] = LAYOUT_base_wrapper(WMN2DVK_base), +[_DVK2CMK] = LAYOUT_base_wrapper(DVK2CMK_base), +[_WMN2CMK] = LAYOUT_base_wrapper(WMN2CMK_base), +[_DVK2WMN] = LAYOUT_base_wrapper(DVK2WMN_base), +[_CMK2WMN] = LAYOUT_base_wrapper(CMK2WMN_base) +#endif // ALT_LAYOUTS_ENABLE +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +#ifdef DIPS_ENABLE +#ifdef ALT_LAYOUTS_ENABLE +void layout_convert(uint8_t statuses) { + switch (0b1111 & statuses) { + case 0b0000: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b0001: + set_single_persistent_default_layer(_DVORAK); + break; + case 0b0010: + set_single_persistent_default_layer(_COLEMAK); + break; + case 0b0011: + set_single_persistent_default_layer(_WORKMAN); + break; + case 0b0100: + set_single_persistent_default_layer(_DVK2QWE); + break; + case 0b0101: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b0110: + set_single_persistent_default_layer(_DVK2CMK); + break; + case 0b0111: + set_single_persistent_default_layer(_DVK2WMN); + break; + case 0b1000: + set_single_persistent_default_layer(_CMK2QWE); + break; + case 0b1001: + set_single_persistent_default_layer(_CMK2DVK); + break; + case 0b1010: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b1011: + set_single_persistent_default_layer(_CMK2WMN); + break; + case 0b1100: + set_single_persistent_default_layer(_WMN2QWE); + break; + case 0b1101: + set_single_persistent_default_layer(_WMN2DVK); + break; + case 0b1110: + set_single_persistent_default_layer(_WMN2CMK); + break; + case 0b1111: + set_single_persistent_default_layer(_QWERTY); + break; + } +} +#endif // ALT_LAYOUTS_ENABLE +#endif // DIPS_ENABLE + +void matrix_init_user(void) { +#ifdef DIPS_ENABLE + layer_on(_DIPS); +#endif // DIPS_ENABLE +} + +void keyboard_post_init_user(void) { + user_config.raw = eeconfig_read_user(); + if (user_config.thumb_alt) { + layer_on(_THUMB_ALT); + } else { + layer_off(_THUMB_ALT); + } + if (user_config.iso) { + layer_on(_ISO); + } else { + layer_off(_ISO); + } +} + +#ifdef ALT_LAYOUTS_ENABLE +static char change_layout_input = 0; +static bool change_layout_keystroke = 0; +void change_layout_conversion(uint16_t keycode) { + switch (keycode) { + case CH_WMN: + change_layout_input |= 0b1000 << (change_layout_keystroke << 2); + break; + case CH_CMK: + change_layout_input |= 0b0100 << (change_layout_keystroke << 2); + break; + case CH_DVK: + change_layout_input |= 0b0010 << (change_layout_keystroke << 2); + break; + case CH_QWE: + change_layout_input |= 0b0001 << (change_layout_keystroke << 2); + break; + } + if (change_layout_keystroke == 1) { + switch (change_layout_input) { + case 0b00010001: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b00100001: + set_single_persistent_default_layer(_DVORAK); + break; + case 0b01000001: + set_single_persistent_default_layer(_COLEMAK); + break; + case 0b10000001: + set_single_persistent_default_layer(_WORKMAN); + break; + case 0b00010010: + set_single_persistent_default_layer(_DVK2QWE); + break; + case 0b00100010: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b01000010: + set_single_persistent_default_layer(_DVK2CMK); + break; + case 0b10000010: + set_single_persistent_default_layer(_DVK2WMN); + break; + case 0b00010100: + set_single_persistent_default_layer(_CMK2QWE); + break; + case 0b00100100: + set_single_persistent_default_layer(_CMK2DVK); + break; + case 0b01000100: + set_single_persistent_default_layer(_QWERTY); + break; + case 0b10000100: + set_single_persistent_default_layer(_CMK2WMN); + break; + case 0b00011000: + set_single_persistent_default_layer(_WMN2QWE); + break; + case 0b00101000: + set_single_persistent_default_layer(_WMN2DVK); + break; + case 0b01001000: + set_single_persistent_default_layer(_WMN2CMK); + break; + case 0b10001000: + set_single_persistent_default_layer(_QWERTY); + break; + } + change_layout_input = 0; + } + change_layout_keystroke ^= 1; +} +#endif // ALT_LAYOUTS_ENABLE + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { +#ifdef TRAINING_HALFES_LOCK + if (!record->event.pressed) { + lock_cooldown = --lock_cooldown < 0 ? 0 : lock_cooldown; + } + if (lock_cooldown == 0) { + layer_off(_LEFT); + layer_off(_RIGHT); + } +#endif // TRAINING_HALFES_LOCK + switch (keycode) { +#ifdef TRAINING_HALFES_LOCK + case SPC_RSH: + case BSP_RSH: + case DEL_RSE: + case ESC_LWR: + case BSL_RAL: + case RGU_RBR: + case RCT_QUO: + if (record->event.pressed) { + layer_on(_LEFT); + lock_cooldown = lock_timeout; + } + else { + lock_cooldown = 0; + layer_off(_LEFT); + } + break; + case BSP_LSH: + case SPC_LSH: + case TAB_RSE: + case ENT_LWR: + case KC_LCTL: + case KC_LGUI: + case KC_LALT: + if (record->event.pressed) { + layer_on(_RIGHT); + lock_cooldown = lock_timeout; + } + else { + lock_cooldown = 0; + layer_off(_RIGHT); + } + break; +#endif // TRAINING_HALFES_LOCK +#ifdef STENO_ENABLE + case PLOVER: + if (!record->event.pressed) { + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + case EXT_PLV: + if (record->event.pressed) { + layer_off(_PLOVER); + } + return false; +#endif // STENO_ENABLE + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; +#ifdef ALT_LAYOUTS_ENABLE + case CH_WMN: + case CH_CMK: + case CH_QWE: + case CH_DVK: + if (record->event.pressed) { + change_layout_conversion(keycode); + } + return false; +#endif // ALT_LAYOUTS_ENABLE +#ifdef DIPS_ENABLE +#ifdef ALT_LAYOUTS_ENABLE + case LAYOUT0: + if (record->event.pressed) { + layout_conversion_dip_state |= 1 << 0; + } else { + layout_conversion_dip_state &= ~(1 << 0); + } + layout_convert(layout_conversion_dip_state); + return false; + case LAYOUT1: + if (record->event.pressed) { + layout_conversion_dip_state |= 1 << 1; + } else { + layout_conversion_dip_state &= ~(1 << 1); + } + layout_convert(layout_conversion_dip_state); + return false; + case LAYOUT2: + if (record->event.pressed) { + layout_conversion_dip_state |= 1 << 2; + } else { + layout_conversion_dip_state &= ~(1 << 2); + } + layout_convert(layout_conversion_dip_state); + return false; + case LAYOUT3: + if (record->event.pressed) { + layout_conversion_dip_state |= 1 << 3; + } else { + layout_conversion_dip_state &= ~(1 << 3); + } + layout_convert(layout_conversion_dip_state); + return false; +#endif // ALT_LAYOUTS_ENABLE + case DIP_ISO: + if (record->event.pressed) { + layer_on(_ISO); + } else { + layer_off(_ISO); + } + return false; + case FLIP_TH: + if (record->event.pressed) { + layer_on(_THUMB_ALT); + } else { + layer_off(_THUMB_ALT); + } + return false; +#endif // DIPS_ENABLE + case THUMB_ALT: + if (record->event.pressed) { + layer_invert(_THUMB_ALT); + user_config.thumb_alt ^= 1; + eeconfig_update_user(user_config.raw); + } + return false; + case ISO: + if (record->event.pressed) { + layer_invert(_ISO); + user_config.iso ^= 1; + eeconfig_update_user(user_config.raw); + } + return false; + } + return true; +} diff --git a/keyboards/jian/keymaps/default/keymap.c b/keyboards/jian/keymaps/default/keymap.c new file mode 100644 index 0000000000..8a1234e1aa --- /dev/null +++ b/keyboards/jian/keymaps/default/keymap.c @@ -0,0 +1,120 @@ +#include QMK_KEYBOARD_H + +enum jian_layers { + _QWERTY, + _DVORAK, + _COLEMAK, + _WORKMAN, + _LOWER, + _RAISE, + _ADJUST, + _BCKLT_ADJ +}; + +enum jian_keycodes { + QWERTY = SAFE_RANGE, + DVORAK, + COLEMAK, + WORKMAN +}; + +#define RAISE_T(kc) LT(_RAISE, kc) +#define LOWER_T(kc) LT(_LOWER, kc) + +#ifdef SWAP_HANDS_ENABLE +#define SW_TG SH_TG +#else +#define SW_TG _______ +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_QWERTY] = LAYOUT( + KC_LGUI, KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, RGUI_T(KC_RBRC), + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RCTL_T(KC_QUOT), + KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RALT_T(KC_BSLS), + RAISE_T(KC_TAB), LSFT_T(KC_SPC), LOWER_T(KC_ENT), LOWER_T(KC_ESC), RSFT_T(KC_BSPC), RAISE_T(KC_DEL) +), + +[_DVORAK] = LAYOUT( + KC_LGUI, KC_GRV, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_LBRC, RGUI_T(KC_RBRC), + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, RCTL_T(KC_SLSH), + KC_LALT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, RALT_T(KC_BSLS), + RAISE_T(KC_TAB), LSFT_T(KC_SPC), LOWER_T(KC_ENT), LOWER_T(KC_ESC), RSFT_T(KC_BSPC), RAISE_T(KC_DEL) +), + +[_COLEMAK] = LAYOUT( + KC_LGUI, KC_GRV, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, RGUI_T(KC_RBRC), + KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, RCTL_T(KC_QUOT), + KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, RALT_T(KC_BSLS), + RAISE_T(KC_TAB), LSFT_T(KC_SPC), LOWER_T(KC_ENT), LOWER_T(KC_ESC), RSFT_T(KC_BSPC), RAISE_T(KC_DEL) +), + +[_WORKMAN] = LAYOUT( + KC_LGUI, KC_GRV, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_LBRC, RGUI_T(KC_RBRC), + KC_LCTL, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, RCTL_T(KC_QUOT), + KC_LALT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, RALT_T(KC_BSLS), + RAISE_T(KC_TAB), LSFT_T(KC_SPC), LOWER_T(KC_ENT), LOWER_T(KC_ESC), RSFT_T(KC_BSPC), RAISE_T(KC_DEL) +), + +[_LOWER] = LAYOUT( + _______, KC_UNDS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, RGUI_T(KC_F12), + LCTL_T(KC_EQL), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, RCTL_T(KC_MINS), + LALT_T(KC_PPLS), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + _______, _______, _______, _______, _______, _______ +), + +[_RAISE] = LAYOUT( + _______, KC_NUM, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_VOLU, KC_HOME, KC_PSCR, KC_PGUP, KC_SCRL, KC_CAPS, _______, + LCTL_T(KC_EQL), KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_MUTE, KC_LEFT, KC_UP, KC_RGHT, KC_INS, RCTL_T(KC_APP), + _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_PCMM, KC_VOLD, KC_END, KC_DOWN, KC_PGDN, KC_PAUS, _______, + _______, _______, _______, _______, _______, _______ +), + +[_ADJUST] = LAYOUT_symmetric( + QK_BOOT, DB_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, WORKMAN, COLEMAK, DVORAK, QWERTY, XXXXXXX, + TG(_BCKLT_ADJ), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, SW_TG, _______ +), + +#if defined(RGBLIGHT) || defined(BACKLIGHT_ENABLE) +[_BCKLT_ADJ] = LAYOUT_symmetric( + XXXXXXX, XXXXXXX, XXXXXXX, BL_UP, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DOWN, RGB_VAD, RGB_SAD, RGB_SAI, + TG(_BCKLT_ADJ), BL_BRTG, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD, + _______, _______, _______ +) +#endif // defined(RGBLIGHT) || defined(BACKLIGHT_ENABLE) + +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +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; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + case WORKMAN: + if (record->event.pressed) { + set_single_persistent_default_layer(_WORKMAN); + } + return false; + } + return true; +} diff --git a/keyboards/jian/keymaps/left_hand/keymap.c b/keyboards/jian/keymaps/left_hand/keymap.c new file mode 100644 index 0000000000..5f6b93bc6e --- /dev/null +++ b/keyboards/jian/keymaps/left_hand/keymap.c @@ -0,0 +1,71 @@ + /* Copyright 2020 KGOH + * + * 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/>. + */ +#include QMK_KEYBOARD_H + +enum jian_layers { + _DFLT_L, + _DFLT_R, + _RAIS_L, + _RAIS_R, + _LOWR_L, + _LOWR_R, + _ADJUST +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_DFLT_L] = LAYOUT_symmetric_left( + KC_LSFT, LGUI_T(KC_GRV), KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, + LT(_RAIS_L, KC_BSPC), LT(_DFLT_R, KC_SPC), LT(_LOWR_L, KC_ENT) +), +[_DFLT_R] = LAYOUT_symmetric_right( + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, + LT(_LOWR_R, KC_ESC), _______, LT(_RAIS_R, KC_DEL) +), +[_RAIS_L] = LAYOUT_symmetric_left( + _______, LGUI_T(KC_CAPS), KC_SCRL, KC_HOME, KC_PSCR, KC_PGUP, KC_VOLU, + LCTL_T(KC_APP), KC_INS, KC_LEFT, KC_UP, KC_RGHT, KC_MUTE, + _______, KC_PAUS, KC_END, KC_DOWN, KC_PGDN, KC_VOLD, + _______, LT(_RAIS_R, KC_TAB) , LT(_ADJUST, KC_ESC) +), +[_RAIS_R] = LAYOUT_symmetric_left( + KC_RSFT, KC_RGUI, XXXXXXX, KC_F7, KC_F8, KC_F9, KC_F10, + KC_RCTL, XXXXXXX, KC_F4, KC_F5, KC_F6, KC_F11, + KC_LALT, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F12, + LT(_ADJUST, KC_DEL), _______, _______ +), +[_LOWR_L] = LAYOUT_symmetric_left( + _______, _______, XXXXXXX, KC_7, KC_8, KC_9, KC_0, + _______, KC_GRV, KC_4, KC_5, KC_6, KC_MINS, + _______, KC_0, KC_1, KC_2, KC_3, KC_EQL, + LT(_ADJUST, KC_DEL), LT(_LOWR_R, KC_TAB), _______ +), +[_LOWR_R] = LAYOUT_symmetric_left( + _______, _______, XXXXXXX, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, + _______, KC_TILD, KC_DLR, KC_PERC, KC_CIRC, KC_UNDS, + _______, KC_LPRN, KC_EXLM, KC_AT, KC_HASH, KC_PLUS, + _______, _______, LT(_ADJUST, KC_ESC) +), +[_ADJUST] = LAYOUT_symmetric_left( + QK_BOOT, DB_TOGG, XXXXXXX, BL_UP, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DOWN, RGB_VAD, RGB_SAD, RGB_SAI, + XXXXXXX, BL_BRTG, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD, + _______, _______, _______ +) +}; diff --git a/keyboards/jian/keymaps/via/keymap.c b/keyboards/jian/keymaps/via/keymap.c new file mode 100644 index 0000000000..5844ef16e8 --- /dev/null +++ b/keyboards/jian/keymaps/via/keymap.c @@ -0,0 +1,28 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = LAYOUT( + KC_LGUI, KC_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, RGUI_T(KC_RBRC), + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RCTL_T(KC_QUOT), + KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RALT_T(KC_BSLS), + LT(2, KC_TAB), LSFT_T(KC_SPC), LT(1, KC_ENT), LT(1, KC_ESC), RSFT_T(KC_BSPC), LT(2, KC_DEL) +), +[1] = LAYOUT( + _______, KC_UNDS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, RGUI_T(KC_F12), + LCTL_T(KC_EQL), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, RCTL_T(KC_MINS), + LALT_T(KC_PPLS), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + LT(3, KC_TAB), _______, _______, _______, _______, LT(3, KC_DEL) +), +[2] = LAYOUT( + _______, KC_NUM, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_VOLU, KC_HOME, KC_PSCR, KC_PGUP, KC_SCRL, KC_CAPS, _______, + LCTL_T(KC_EQL), KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_MUTE, KC_LEFT, KC_UP, KC_RGHT, KC_INS, RCTL_T(KC_APP), + _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_PCMM, KC_VOLD, KC_END, KC_DOWN, KC_PGDN, KC_PAUS, _______, + _______, _______, LT(3, KC_ENT), LT(3, KC_ESC), _______, _______ +), +[3] = LAYOUT_symmetric( + QK_BOOT, DB_TOGG, XXXXXXX, BL_UP, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DOWN, RGB_VAD, RGB_SAD, RGB_SAI, + XXXXXXX, BL_BRTG, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD, + _______, SH_TG, _______ +) +}; diff --git a/keyboards/jian/nsrev2/config.h b/keyboards/jian/nsrev2/config.h new file mode 100644 index 0000000000..9e2e5e765e --- /dev/null +++ b/keyboards/jian/nsrev2/config.h @@ -0,0 +1,133 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +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/>. +*/ +#pragma once + +#include "config_common.h" + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 +#define DIODE_DIRECTION COL2ROW + + +// wiring of each half +#define MATRIX_ROW_PINS { F4, F5, B1, B3, D1, D0, D7, E6 } +#define MATRIX_COL_PINS { D3, D2, B4, F6, F7, B2 } + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#define QMK_ESC_OUTPUT D3 +#define QMK_ESC_INPUT B1 + +#define PHYSICAL_LEDS_ENABLE + +#ifdef BACKLIGHT_ENABLE +#define BACKLIGHT_PIN C6 +#define BACKLIGHT_LEVELS 5 +#define BACKLIGHT_BREATHING //not working with splits right now +#define BREATHING_PERIOD 6 +#endif + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D4 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 7 // Number of LEDs +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE + +#define RGBLIGHT_SLEEP +#define RGBLIGHT_SPLIT + +#ifndef IOS_DEVICE_ENABLE +#if RGBLED_NUM <= 6 +#define RGBLIGHT_LIMIT_VAL 255 +#else +#define RGBLIGHT_LIMIT_VAL 130 +#endif +#define RGBLIGHT_VAL_STEP 8 +#else +#if RGBLED_NUM <= 6 +#define RGBLIGHT_LIMIT_VAL 90 +#else +#define RGBLIGHT_LIMIT_VAL 45 +#endif +#define RGBLIGHT_VAL_STEP 4 +#endif +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SA |