From 157319fbd03e6f7a6618111fd03ab3e53317893e Mon Sep 17 00:00:00 2001 From: KgOfHedgehogs Date: Thu, 18 Jun 2020 04:17:30 +0200 Subject: [Keyboard] Jian keyboard (#8914) Co-authored-by: Joel Challis Co-authored-by: Drashna Jaelre Co-authored-by: Ryan Co-authored-by: Nick Brassel --- keyboards/jian/config.h | 21 ++ keyboards/jian/handwired/config.h | 41 +++ keyboards/jian/handwired/handwired.c | 8 + keyboards/jian/handwired/handwired.h | 30 ++ keyboards/jian/handwired/rules.mk | 19 + keyboards/jian/info.json | 67 ++++ keyboards/jian/jian.c | 1 + keyboards/jian/jian.h | 19 + keyboards/jian/keymaps/advanced/config.h | 27 ++ keyboards/jian/keymaps/advanced/keymap.c | 584 +++++++++++++++++++++++++++++++ keyboards/jian/keymaps/advanced/rules.mk | 5 + keyboards/jian/keymaps/default/config.h | 22 ++ keyboards/jian/keymaps/default/keymap.c | 120 +++++++ keyboards/jian/keymaps/default/rules.mk | 2 + keyboards/jian/nsrev2/config.h | 129 +++++++ keyboards/jian/nsrev2/nsrev2.c | 74 ++++ keyboards/jian/nsrev2/nsrev2.h | 39 +++ keyboards/jian/nsrev2/rules.mk | 20 ++ keyboards/jian/readme.md | 16 + keyboards/jian/rev1/config.h | 138 ++++++++ keyboards/jian/rev1/rev1.c | 74 ++++ keyboards/jian/rev1/rev1.h | 56 +++ keyboards/jian/rev1/rules.mk | 20 ++ keyboards/jian/rev2/config.h | 136 +++++++ keyboards/jian/rev2/rev2.c | 74 ++++ keyboards/jian/rev2/rev2.h | 39 +++ keyboards/jian/rev2/rules.mk | 20 ++ keyboards/jian/rules.mk | 1 + 28 files changed, 1802 insertions(+) create mode 100644 keyboards/jian/config.h create mode 100644 keyboards/jian/handwired/config.h create mode 100644 keyboards/jian/handwired/handwired.c create mode 100644 keyboards/jian/handwired/handwired.h create mode 100644 keyboards/jian/handwired/rules.mk create mode 100644 keyboards/jian/info.json create mode 100644 keyboards/jian/jian.c create mode 100644 keyboards/jian/jian.h create mode 100644 keyboards/jian/keymaps/advanced/config.h create mode 100644 keyboards/jian/keymaps/advanced/keymap.c create mode 100644 keyboards/jian/keymaps/advanced/rules.mk create mode 100644 keyboards/jian/keymaps/default/config.h create mode 100644 keyboards/jian/keymaps/default/keymap.c create mode 100644 keyboards/jian/keymaps/default/rules.mk create mode 100644 keyboards/jian/nsrev2/config.h create mode 100644 keyboards/jian/nsrev2/nsrev2.c create mode 100644 keyboards/jian/nsrev2/nsrev2.h create mode 100644 keyboards/jian/nsrev2/rules.mk create mode 100644 keyboards/jian/readme.md create mode 100644 keyboards/jian/rev1/config.h create mode 100644 keyboards/jian/rev1/rev1.c create mode 100644 keyboards/jian/rev1/rev1.h create mode 100644 keyboards/jian/rev1/rules.mk create mode 100644 keyboards/jian/rev2/config.h create mode 100644 keyboards/jian/rev2/rev2.c create mode 100644 keyboards/jian/rev2/rev2.h create mode 100644 keyboards/jian/rev2/rules.mk create mode 100644 keyboards/jian/rules.mk (limited to 'keyboards/jian') diff --git a/keyboards/jian/config.h b/keyboards/jian/config.h new file mode 100644 index 0000000000..cfb6bf4ffc --- /dev/null +++ b/keyboards/jian/config.h @@ -0,0 +1,21 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ + +#pragma once + +#include "config_common.h" diff --git a/keyboards/jian/handwired/config.h b/keyboards/jian/handwired/config.h new file mode 100644 index 0000000000..5b69621bcd --- /dev/null +++ b/keyboards/jian/handwired/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC0DE +#define PRODUCT_ID 0x1337 +#define DEVICE_VER 0x0010 +#define MANUFACTURER KgOfHedgehogs +#define PRODUCT Huma +#define DESCRIPTION An ergo handwired keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 4 +#define MATRIX_COLS 14 +#define DIODE_DIRECTION COL2ROW + +// wiring of each half +#define MATRIX_ROW_PINS { D3, D2, B5, B6 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B4, E6, D7, C6, D4, D0, D1 } + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 diff --git a/keyboards/jian/handwired/handwired.c b/keyboards/jian/handwired/handwired.c new file mode 100644 index 0000000000..bcb7ec7102 --- /dev/null +++ b/keyboards/jian/handwired/handwired.c @@ -0,0 +1,8 @@ +#include "handwired.h" + +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + {{13, 0}, {12, 0}, {11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, + {{13, 1}, {12, 1}, {11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, + {{13, 2}, {12, 2}, {11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, + {{13, 3}, {12, 3}, {11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, +}; diff --git a/keyboards/jian/handwired/handwired.h b/keyboards/jian/handwired/handwired.h new file mode 100644 index 0000000000..9b388b94ae --- /dev/null +++ b/keyboards/jian/handwired/handwired.h @@ -0,0 +1,30 @@ +#pragma once + +#include "jian.h" + +#define XXX KC_NO +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L11, L12, L13, L14, L15, L16, R16, R15, R14, R13, R12, R11, \ + L21, L22, L23, L24, L25, L26, R26, R25, R24, R23, R22, R21, \ + L34, L35, L36, R36, R35, R34 \ +) \ +{ \ + {L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00}, \ + {XXX, L11, L12, L13, L14, L15, L16, R16, R15, R14, R13, R12, R11, XXX}, \ + {XXX, L21, L22, L23, L24, L25, L26, R26, R25, R24, R23, R22, R21, XXX}, \ + {XXX, XXX, XXX, XXX, L34, L35, L36, R36, R35, R34, XXX, XXX, XXX, XXX} \ +} + +#define LAYOUT_symmetric( \ + K00, K01, K02, K03, K04, K05, K06, \ + K11, K12, K13, K14, K15, K16, \ + K21, K22, K23, K24, K25, K26, \ + K34, K35, K36 \ +) \ +{ \ + {K00, K01, K02, K03, K04, K05, K06, K06, K05, K04, K03, K02, K01, K00}, \ + {XXX, K11, K12, K13, K14, K15, K16, K16, K15, K14, K13, K12, K11, XXX}, \ + {XXX, K21, K22, K23, K24, K25, K26, K26, K25, K24, K23, K22, K21, XXX}, \ + {XXX, XXX, XXX, XXX, K34, K35, K36, K36, K35, K34, XXX, XXX, XXX, XXX} \ +} diff --git a/keyboards/jian/handwired/rules.mk b/keyboards/jian/handwired/rules.mk new file mode 100644 index 0000000000..61f40dfcbe --- /dev/null +++ b/keyboards/jian/handwired/rules.mk @@ -0,0 +1,19 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +SPLIT_KEYBOARD = no +BACKLIGHT_ENABLE = no +RGBLIGHT_ENABLE = no diff --git a/keyboards/jian/info.json b/keyboards/jian/info.json new file mode 100644 index 0000000000..4503fb3b47 --- /dev/null +++ b/keyboards/jian/info.json @@ -0,0 +1,67 @@ +{ + "keyboard_name": "jian", + "url": "t.me/s/kgofhedgehogs", + "maintainer": "KGOH", + "width": 17, + "height": 4, + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Super", "x": 0, "y": 1.5 }, + { "label": "~", "x": 1, "y": 0.75 }, + { "label": "Q", "x": 2, "y": 0.625 }, + { "label": "W", "x": 3, "y": 0.25 }, + { "label": "E", "x": 4, "y": 0 }, + { "label": "R", "x": 5, "y": 0.25 }, + { "label": "T", "x": 6, "y": 0.375 }, + + { "label": "Y", "x": 10, "y": 0.375 }, + { "label": "U", "x": 11, "y": 0.25 }, + { "label": "I", "x": 12, "y": 0 }, + { "label": "O", "x": 13, "y": 0.25 }, + { "label": "P", "x": 14, "y": 0.625 }, + { "label": "{[", "x": 15, "y": 0.75 }, + { "label": "}]", "x": 16, "y": 1.5 }, + + + { "label": "Ctrl", "x": 1, "y": 1.75 }, + { "label": "A", "x": 2, "y": 1.625 }, + { "label": "S", "x": 3, "y": 1.25 }, + { "label": "D", "x": 4, "y": 1 }, + { "label": "F", "x": 5, "y": 1.25 }, + { "label": "G", "x": 6, "y": 1.375 }, + + { "label": "H", "x": 10, "y": 1.375 }, + { "label": "J", "x": 11, "y": 1.25 }, + { "label": "K", "x": 12, "y": 1 }, + { "label": "L", "x": 13, "y": 1.25 }, + { "label": ":;", "x": 14, "y": 1.625 }, + { "label": "\"'", "x": 15, "y": 1.75 }, + + + { "label": "Alt", "x": 1, "y": 2.75 }, + { "label": "Z", "x": 2, "y": 2.625 }, + { "label": "X", "x": 3, "y": 2.25 }, + { "label": "C", "x": 4, "y": 2 }, + { "label": "V", "x": 5, "y": 2.25 }, + { "label": "B", "x": 6, "y": 2.375 }, + + { "label": "N", "x": 10, "y": 2.375 }, + { "label": "M", "x": 11, "y": 2.25 }, + { "label": "<,", "x": 12, "y": 2 }, + { "label": ">.", "x": 13, "y": 2.25 }, + { "label": "?/", "x": 14, "y": 2.625 }, + { "label": "|\\", "x": 15, "y": 2.75 }, + + + { "label": "Tab", "x": 5, "y": 3.25 }, + { "label": "Spc", "x": 6, "y": 3.375 }, + { "label": "Enter", "x": 7, "y": 3.5 }, + + { "label": "Esc", "x": 9, "y": 3.5 }, + { "label": "Bscp", "x": 10, "y": 3.375 }, + { "label": "Del", "x": 11, "y": 3.25 } + ] + } + } +} diff --git a/keyboards/jian/jian.c b/keyboards/jian/jian.c new file mode 100644 index 0000000000..e85b8554f0 --- /dev/null +++ b/keyboards/jian/jian.c @@ -0,0 +1 @@ +#include "jian.h" diff --git a/keyboards/jian/jian.h b/keyboards/jian/jian.h new file mode 100644 index 0000000000..d09d056e9b --- /dev/null +++ b/keyboards/jian/jian.h @@ -0,0 +1,19 @@ +#pragma once + +#include "quantum.h" + +#ifdef KEYBOARD_jian_handwired + #include "handwired.h" +#endif + +#ifdef KEYBOARD_jian_rev1 + #include "rev1.h" +#endif + +#ifdef KEYBOARD_jian_rev2 +#include "rev2.h" +#endif + +#ifdef KEYBOARD_jian_nsrev2 + #include "nsrev2.h" +#endif diff --git a/keyboards/jian/keymaps/advanced/config.h b/keyboards/jian/keymaps/advanced/config.h new file mode 100644 index 0000000000..85b41c86d8 --- /dev/null +++ b/keyboards/jian/keymaps/advanced/config.h @@ -0,0 +1,27 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +//#define AUTO_SHIFT_TIMEOUT 150 +//#define NO_AUTO_SHIFT_NUMERIC +//#define AUTO_SHIFT_MODIFIERS +#define IGNORE_MOD_TAP_INTERRUPT +#define ALT_LAYOUTS_ENABLE +//#define TRAINING_HALFES_LOCK diff --git a/keyboards/jian/keymaps/advanced/keymap.c b/keyboards/jian/keymaps/advanced/keymap.c new file mode 100644 index 0000000000..417678f7e6 --- /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_NLCK, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_VOLU, KC_HOME, KC_PSCR, KC_PGUP, KC_SLCK, 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( + RESET, DEBUG, KC_ASUP, CH_WMN, CH_CMK, CH_QWE, CH_DVK, + KC_ASRP, KC_ASTG, XXXXXXX, XXXXXXX, QWERTY, PLOVER, + BL_ADJ, KC_ASDN, XXXXXXX, XXXXXXX, ISO, THUMB_ALT, + _______, SW_TG, _______ +), +#if defined(RGBLIGHT) | defined(BACKLIGHT_ENABLE) +[_BCKLT_ADJ] = LAYOUT_symmetric( + XXXXXXX, XXXXXXX, XXXXXXX, BL_INC, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DEC, 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 +}; + +uint32_t layer_state_set_user(uint32_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/advanced/rules.mk b/keyboards/jian/keymaps/advanced/rules.mk new file mode 100644 index 0000000000..2a61a26393 --- /dev/null +++ b/keyboards/jian/keymaps/advanced/rules.mk @@ -0,0 +1,5 @@ +SWAP_HANDS_ENABLE = yes +STENO_ENABLE = no +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes # Audio control and System control + diff --git a/keyboards/jian/keymaps/default/config.h b/keyboards/jian/keymaps/default/config.h new file mode 100644 index 0000000000..4d9cb17cac --- /dev/null +++ b/keyboards/jian/keymaps/default/config.h @@ -0,0 +1,22 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +#define IGNORE_MOD_TAP_INTERRUPT diff --git a/keyboards/jian/keymaps/default/keymap.c b/keyboards/jian/keymaps/default/keymap.c new file mode 100644 index 0000000000..7f4391f7d2 --- /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_NLCK, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_VOLU, KC_HOME, KC_PSCR, KC_PGUP, KC_SLCK, 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( + RESET, DEBUG, 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_INC, RGB_VAI, RGB_HUD, RGB_HUI, + XXXXXXX, XXXXXXX, BL_DEC, 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/default/rules.mk b/keyboards/jian/keymaps/default/rules.mk new file mode 100644 index 0000000000..092b119d39 --- /dev/null +++ b/keyboards/jian/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +SWAP_HANDS_ENABLE = yes +EXTRAKEY_ENABLE = yes # Audio control and System control diff --git a/keyboards/jian/nsrev2/config.h b/keyboards/jian/nsrev2/config.h new file mode 100644 index 0000000000..9277aa19af --- /dev/null +++ b/keyboards/jian/nsrev2/config.h @@ -0,0 +1,129 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC0DE +#define PRODUCT_ID 0x1337 +#define DEVICE_VER 0x0210 +#define MANUFACTURER KgOfHedgehogs +#define PRODUCT Huma +#define DESCRIPTION An ergo keyboard + +/* 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 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_ANIMATIONS //not working with splits right now + +#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_SAT_STEP 17 + +#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) +#define USB_MAX_POWER_CONSUMPTION 400 +#else +// iOS device need lessthan 100 +#define USB_MAX_POWER_CONSUMPTION 100 +#endif + +#define NUM_LOCK_LED_PIN B6 +#define CAPS_LOCK_LED_PIN B5 +// #define SCROLL_LOCK_LED_PIN B6 + +// #define NUM_NMOSFET //uncomment this if you using n-mosfet +// #define CAPS_NMOSFET //uncomment this if you using n-mosfet +// #define SCROLL_NMOSFET //uncomment this if you using n-mosfet + +// #define NUM_INVERT // uncomment this if you want to reverse logic of numlock +// This will make it light up only when lock is off +// (Doesn't work on mac. There is no num lock, so it will be always off and lit) + +#ifdef NUM_NMOSFET +#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#endif // NUM_INVERT +#else +#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#endif // NUM_INVERT +#endif // NUM_NMOSFET + +#ifdef CAPS_NMOSFET +#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#else +#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#endif // CAPS_NMOSFET + +#ifdef SCROLL_NMOSFET +#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#else +#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#endif // SCROLL_NMOSFET diff --git a/keyboards/jian/nsrev2/nsrev2.c b/keyboards/jian/nsrev2/nsrev2.c new file mode 100644 index 0000000000..a7508ad9b2 --- /dev/null +++ b/keyboards/jian/nsrev2/nsrev2.c @@ -0,0 +1,74 @@ +#include "nsrev2.h" + +// TODO: +#ifdef SWAP_HANDS_ENABLE +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, +}; +#endif + +static bool backlight_was_toggled = false; + +void suspend_power_down_kb(void) { + if (is_backlight_enabled()) { + backlight_disable(); + backlight_was_toggled = true; + } +} + +void suspend_wakeup_init_kb(void) { + if (backlight_was_toggled) { + backlight_enable(); + backlight_was_toggled = false; + } +} + +#ifdef PHYSICAL_LEDS_ENABLE +void led_init_kb(void) +{ +#ifdef NUM_LOCK_LED_PIN + setPinOutput(NUM_LOCK_LED_PIN); + RESET_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + setPinOutput(CAPS_LOCK_LED_PIN); + RESET_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + setPinOutput(SCROLL_LOCK_LED_PIN); + RESET_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN +} +#endif // PHYSICAL_LEDS_ENABLE + +void matrix_init_kb(void) { +#ifdef PHYSICAL_LEDS_ENABLE + led_init_kb(); +#endif // PHYSICAL_LEDS_ENABLE + matrix_init_user(); +}; + +#ifdef PHYSICAL_LEDS_ENABLE +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { +#ifdef NUM_LOCK_LED_PIN + UPDATE_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + UPDATE_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + UPDATE_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN + } + return res; +} +#endif // PHYSICAL_LEDS_ENABLE diff --git a/keyboards/jian/nsrev2/nsrev2.h b/keyboards/jian/nsrev2/nsrev2.h new file mode 100644 index 0000000000..9dfb7240b1 --- /dev/null +++ b/keyboards/jian/nsrev2/nsrev2.h @@ -0,0 +1,39 @@ +#pragma once + +#include "jian.h" + +#define XXX KC_NO + +#define LAYOUT( \ + L20, L00, L01, L12, L02, L03, L04, R04, R03, R02, R12, R01, R00, R20, \ + L10, L11, L22, L13, L14, L05, R05, R14, R13, R22, R11, R10, \ + L21, L32, L33, L23, L24, L15, R15, R24, R23, R33, R32, R21, \ + L34, L25, L35, R35, R25, R34 \ +) \ +{ \ + {L00, L01, L02, L03, L04, L05 }, \ + {L10, L11, L12, L13, L14, L15 }, \ + {L20, L21, L22, L23, L24, L25 }, \ + {XXX, XXX, L32, L33, L34, L35 }, \ + {R00, R01, R02, R03, R04, R05 }, \ + {R10, R11, R12, R13, R14, R15 }, \ + {R20, R21, R22, R23, R24, R25 }, \ + {XXX, XXX, R32, R33, R34, R35 } \ +} + +#define LAYOUT_symmetric( \ + K20, K00, K01, K12, K02, K03, K04, \ + K10, K11, K22, K13, K14, K05, \ + K21, K32, K33, K23, K24, K15, \ + K34, K25, K35 \ +) \ +{ \ + {K00, K01, K02, K03, K04, K05 }, \ + {K10, K11, K12, K13, K14, K15 }, \ + {K20, K21, K22, K23, K24, K25 }, \ + {XXX, XXX, K32, K33, K34, K35 }, \ + {K00, K01, K02, K03, K04, K05 }, \ + {K10, K11, K12, K13, K14, K15 }, \ + {K20, K21, K22, K23, K24, K25 }, \ + {XXX, XXX, K32, K33, K34, K35 } \ +} diff --git a/keyboards/jian/nsrev2/rules.mk b/keyboards/jian/nsrev2/rules.mk new file mode 100644 index 0000000000..3942e629a1 --- /dev/null +++ b/keyboards/jian/nsrev2/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = qmk-dfu + +# Build Options +# change yes to no to disable +# +CONSOLE_ENABLE = no +SPLIT_KEYBOARD = no +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = no diff --git a/keyboards/jian/readme.md b/keyboards/jian/readme.md new file mode 100644 index 0000000000..7afff2ab70 --- /dev/null +++ b/keyboards/jian/readme.md @@ -0,0 +1,16 @@ +# Jian + + + +A 40% ergonomic keyboard kit. Jian supports cherry mx, alps, kailh choc switches PCB and plate mounted. You can assembly keyboard without mounting plate. Jian also supports rgb led strip like ws2812b and 1 color in-switch backlight. Each half can work standalone. + +* Keyboard Maintainer: [KGOH](https://github.com/KGOH) +* Hardware Supported: Jian PCB rev1, rev2, Pro Micro +* Layout: [keyboard-layout-editor.com](http://www.keyboard-layout-editor.com/#/gists/4b6c2af67148f58ddd6c6b2976c4370f) +* Hardware Availability: [Telegram channel](https://t.me/KgOfHedgehogs) + +Make example for this keyboard (after setting up your build environment): + + make jian/rev2:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/jian/rev1/config.h b/keyboards/jian/rev1/config.h new file mode 100644 index 0000000000..799a71fc07 --- /dev/null +++ b/keyboards/jian/rev1/config.h @@ -0,0 +1,138 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC0DE +#define PRODUCT_ID 0x1337 +#define DEVICE_VER 0x0100 +#define MANUFACTURER KgOfHedgehogs +#define PRODUCT Jian +#define DESCRIPTION An ergo split keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 8 +#define MATRIX_COLS 7 +#define DIODE_DIRECTION COL2ROW + +// wiring of each half +#define MATRIX_ROW_PINS { D3, D2, E6, B4 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } + +/* Use I2C or Serial, not both */ +// #define USE_SERIAL +#define USE_I2C + +/* Select hand configuration */ +// #define MASTER_LEFT +// #define MASTER_RIGHT +#define EE_HANDS + +// different Jian configs +#define DIPS_ENABLE +#define PHYSICAL_LEDS_ENABLE +#define NUM_LOCK_LED_PIN C6 +#define CAPS_LOCK_LED_PIN D7 +#define SCROLL_LOCK_LED_PIN B5 + +// #define NUM_NMOSFET //uncomment this if you using n-mosfet +// #define CAPS_NMOSFET //uncomment this if you using n-mosfet +// #define SCROLL_NMOSFET //uncomment this if you using n-mosfet + +// #define NUM_INVERT // uncomment this if you want to reverse logic of numlock +// This will make it light up only when lock is off +// (Doesn't work on mac. There is no num lock, so it will be always off and lit) + +#ifdef NUM_NMOSFET +#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#endif // NUM_INVERT +#else +#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#endif // NUM_INVERT +#endif // NUM_NMOSFET + +#ifdef CAPS_NMOSFET +#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#else +#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#endif // CAPS_NMOSFET + +#ifdef SCROLL_NMOSFET +#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#else +#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#endif // SCROLL_NMOSFET + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#ifdef BACKLIGHT_ENABLE +#define BACKLIGHT_PIN B6 +#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_ANIMATIONS //not working with splits right now + +#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_SAT_STEP 17 + +#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) +#define USB_MAX_POWER_CONSUMPTION 400 +#else +// iOS device need lessthan 100 +#define USB_MAX_POWER_CONSUMPTION 100 +#endif diff --git a/keyboards/jian/rev1/rev1.c b/keyboards/jian/rev1/rev1.c new file mode 100644 index 0000000000..f1cfe99180 --- /dev/null +++ b/keyboards/jian/rev1/rev1.c @@ -0,0 +1,74 @@ +#include "rev1.h" + +#ifdef SWAP_HANDS_ENABLE +__attribute__ ((weak)) +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}, {6, 4}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}, {6, 5}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}, {6, 6}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}, {6, 7}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {6, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {6, 3}}, +}; +#endif + +static bool backlight_was_toggled = false; + +void suspend_power_down_kb(void) { + if (is_backlight_enabled()) { + backlight_disable(); + backlight_was_toggled = true; + } +} + +void suspend_wakeup_init_kb(void) { + if (backlight_was_toggled) { + backlight_enable(); + backlight_was_toggled = false; + } +} + +#ifdef PHYSICAL_LEDS_ENABLE +void led_init_kb(void) +{ +#ifdef NUM_LOCK_LED_PIN + setPinOutput(NUM_LOCK_LED_PIN); + RESET_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + setPinOutput(CAPS_LOCK_LED_PIN); + RESET_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + setPinOutput(SCROLL_LOCK_LED_PIN); + RESET_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN +} +#endif // PHYSICAL_LEDS_ENABLE + +void matrix_init_kb(void) { +#ifdef PHYSICAL_LEDS_ENABLE + led_init_kb(); +#endif // PHYSICAL_LEDS_ENABLE + matrix_init_user(); +}; + +#ifdef PHYSICAL_LEDS_ENABLE +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { +#ifdef NUM_LOCK_LED_PIN + UPDATE_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + UPDATE_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + UPDATE_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN + } + return res; +} +#endif // PHYSICAL_LEDS_ENABLE diff --git a/keyboards/jian/rev1/rev1.h b/keyboards/jian/rev1/rev1.h new file mode 100644 index 0000000000..ee55de6287 --- /dev/null +++ b/keyboards/jian/rev1/rev1.h @@ -0,0 +1,56 @@ +#pragma once + +#include "jian.h" + +#define XXX KC_NO + +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L11, L12, L13, L14, L15, L16, R16, R15, R14, R13, R12, R11, \ + L21, L22, L23, L24, L25, L26, R26, R25, R24, R23, R22, R21, \ + L34, L35, L36, R36, R35, R34 \ +) \ +{ \ + {L00, L01, L02, L03, L04, L05, L06}, \ + {XXX, L11, L12, L13, L14, L15, L16}, \ + {XXX, L21, L22, L23, L24, L25, L26}, \ + {XXX, XXX, XXX, XXX, L34, L35, L36}, \ + {R00, R01, R02, R03, R04, R05, R06}, \ + {XXX, R11, R12, R13, R14, R15, R16}, \ + {XXX, R21, R22, R23, R24, R25, R26}, \ + {XXX, XXX, XXX, XXX, R34, R35, R36} \ +} + +#define LAYOUT_symmetric( \ + K00, K01, K02, K03, K04, K05, K06, \ + K11, K12, K13, K14, K15, K16, \ + K21, K22, K23, K24, K25, K26, \ + K34, K35, K36 \ +) \ +{ \ + {K00, K01, K02, K03, K04, K05, K06}, \ + {XXX, K11, K12, K13, K14, K15, K16}, \ + {XXX, K21, K22, K23, K24, K25, K26}, \ + {XXX, XXX, XXX, XXX, K34, K35, K36}, \ + {K00, K01, K02, K03, K04, K05, K06}, \ + {XXX, K11, K12, K13, K14, K15, K16}, \ + {XXX, K21, K22, K23, K24, K25, K26}, \ + {XXX, XXX, XXX, XXX, K34, K35, K36} \ +} + +#ifdef DIPS_ENABLE +#define LAYOUT_dips( \ + DL0, DL1, DL2, DL3, DL4, DL5, \ + DR5, DR4, DR3, DR2, DR1, DR0 \ +) \ +{ \ + {XXX, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DL0, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DL1, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DL2, DL3, DL4, DL5, XXX, XXX, XXX}, \ + {XXX, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DR0, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DR1, XXX, XXX, XXX, XXX, XXX, XXX}, \ + {DR2, DR3, DR4, DR5, XXX, XXX, XXX}, \ +} +#endif // DIPS_ENABLE diff --git a/keyboards/jian/rev1/rules.mk b/keyboards/jian/rev1/rules.mk new file mode 100644 index 0000000000..915b647548 --- /dev/null +++ b/keyboards/jian/rev1/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +CONSOLE_ENABLE = no +SPLIT_KEYBOARD = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes diff --git a/keyboards/jian/rev2/config.h b/keyboards/jian/rev2/config.h new file mode 100644 index 0000000000..760389cc64 --- /dev/null +++ b/keyboards/jian/rev2/config.h @@ -0,0 +1,136 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC0DE +#define PRODUCT_ID 0x1337 +#define DEVICE_VER 0x0200 +#define MANUFACTURER KgOfHedgehogs +#define PRODUCT Jian +#define DESCRIPTION An ergo keyboard + +/* 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 } +#define MATRIX_COL_PINS { D3, D2, B4, F6, F7, B2 } + +//#define USE_I2C +#define USE_SERIAL +#define SOFT_SERIAL_PIN D1 + +//#define EE_HANDS +#define SPLIT_HAND_PIN E6 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +#define PHYSICAL_LEDS_ENABLE +#define IOS_DEVICE_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_ANIMATIONS //not working with splits right now + +#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_SAT_STEP 17 + +#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) +#define USB_MAX_POWER_CONSUMPTION 400 +#else +// iOS device need lessthan 100 +#define USB_MAX_POWER_CONSUMPTION 100 +#endif + +#define NUM_LOCK_LED_PIN D7 +#define CAPS_LOCK_LED_PIN B5 +#define SCROLL_LOCK_LED_PIN B6 + +// #define NUM_NMOSFET //uncomment this if you using n-mosfet +// #define CAPS_NMOSFET //uncomment this if you using n-mosfet +// #define SCROLL_NMOSFET //uncomment this if you using n-mosfet + +// #define NUM_INVERT // uncomment this if you want to reverse logic of numlock +// This will make it light up only when lock is off +// (Doesn't work on mac. There is no num lock, so it will be always off and lit) + +#ifdef NUM_NMOSFET +#define RESET_NUM_LOCK_LED() writePinLow(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#endif // NUM_INVERT +#else +#define RESET_NUM_LOCK_LED() writePinHigh(NUM_LOCK_LED_PIN) +#ifdef NUM_INVERT +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, led_state.num_lock) +#else +#define UPDATE_NUM_LOCK_LED() writePin(NUM_LOCK_LED_PIN, !led_state.num_lock) +#endif // NUM_INVERT +#endif // NUM_NMOSFET + +#ifdef CAPS_NMOSFET +#define RESET_CAPS_LOCK_LED() writePinLow(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, led_state.caps_lock) +#else +#define RESET_CAPS_LOCK_LED() writePinHigh(CAPS_LOCK_LED_PIN) +#define UPDATE_CAPS_LOCK_LED() writePin(CAPS_LOCK_LED_PIN, !led_state.caps_lock) +#endif // CAPS_NMOSFET + +#ifdef SCROLL_NMOSFET +#define RESET_SCROLL_LOCK_LED() writePinLow(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, led_state.scroll_lock) +#else +#define RESET_SCROLL_LOCK_LED() writePinHigh(SCROLL_LOCK_LED_PIN) +#define UPDATE_SCROLL_LOCK_LED() writePin(SCROLL_LOCK_LED_PIN, !led_state.scroll_lock) +#endif // SCROLL_NMOSFET diff --git a/keyboards/jian/rev2/rev2.c b/keyboards/jian/rev2/rev2.c new file mode 100644 index 0000000000..6f4808de73 --- /dev/null +++ b/keyboards/jian/rev2/rev2.c @@ -0,0 +1,74 @@ +#include "rev2.h" + +#ifdef SWAP_HANDS_ENABLE +__attribute__ ((weak)) +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, +}; +#endif + +static bool backlight_was_toggled = false; + +void suspend_power_down_kb(void) { + if (is_backlight_enabled()) { + backlight_disable(); + backlight_was_toggled = true; + } +} + +void suspend_wakeup_init_kb(void) { + if (backlight_was_toggled) { + backlight_enable(); + backlight_was_toggled = false; + } +} + +#ifdef PHYSICAL_LEDS_ENABLE +void led_init_kb(void) +{ +#ifdef NUM_LOCK_LED_PIN + setPinOutput(NUM_LOCK_LED_PIN); + RESET_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + setPinOutput(CAPS_LOCK_LED_PIN); + RESET_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + setPinOutput(SCROLL_LOCK_LED_PIN); + RESET_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN +} +#endif // PHYSICAL_LEDS_ENABLE + +void matrix_init_kb(void) { +#ifdef PHYSICAL_LEDS_ENABLE + led_init_kb(); +#endif // PHYSICAL_LEDS_ENABLE + matrix_init_user(); +}; + +#ifdef PHYSICAL_LEDS_ENABLE +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { +#ifdef NUM_LOCK_LED_PIN + UPDATE_NUM_LOCK_LED(); +#endif // NUM_LOCK_LED_PIN +#ifdef CAPS_LOCK_LED_PIN + UPDATE_CAPS_LOCK_LED(); +#endif // CAPS_LOCK_LED_PIN +#ifdef SCROLL_LOCK_LED_PIN + UPDATE_SCROLL_LOCK_LED(); +#endif // SCROLL_LOCK_LED_PIN + } + return res; +} +#endif // PHYSICAL_LEDS_ENABLE diff --git a/keyboards/jian/rev2/rev2.h b/keyboards/jian/rev2/rev2.h new file mode 100644 index 0000000000..9dfb7240b1 --- /dev/null +++ b/keyboards/jian/rev2/rev2.h @@ -0,0 +1,39 @@ +#pragma once + +#include "jian.h" + +#define XXX KC_NO + +#define LAYOUT( \ + L20, L00, L01, L12, L02, L03, L04, R04, R03, R02, R12, R01, R00, R20, \ + L10, L11, L22, L13, L14, L05, R05, R14, R13, R22, R11, R10, \ + L21, L32, L33, L23, L24, L15, R15, R24, R23, R33, R32, R21, \ + L34, L25, L35, R35, R25, R34 \ +) \ +{ \ + {L00, L01, L02, L03, L04, L05 }, \ + {L10, L11, L12, L13, L14, L15 }, \ + {L20, L21, L22, L23, L24, L25 }, \ + {XXX, XXX, L32, L33, L34, L35 }, \ + {R00, R01, R02, R03, R04, R05 }, \ + {R10, R11, R12, R13, R14, R15 }, \ + {R20, R21, R22, R23, R24, R25 }, \ + {XXX, XXX, R32, R33, R34, R35 } \ +} + +#define LAYOUT_symmetric( \ + K20, K00, K01, K12, K02, K03, K04, \ + K10, K11, K22, K13, K14, K05, \ + K21, K32, K33, K23, K24, K15, \ + K34, K25, K35 \ +) \ +{ \ + {K00, K01, K02, K03, K04, K05 }, \ + {K10, K11, K12, K13, K14, K15 }, \ + {K20, K21, K22, K23, K24, K25 }, \ + {XXX, XXX, K32, K33, K34, K35 }, \ + {K00, K01, K02, K03, K04, K05 }, \ + {K10, K11, K12, K13, K14, K15 }, \ + {K20, K21, K22, K23, K24, K25 }, \ + {XXX, XXX, K32, K33, K34, K35 } \ +} diff --git a/keyboards/jian/rev2/rules.mk b/keyboards/jian/rev2/rules.mk new file mode 100644 index 0000000000..bbfde67f94 --- /dev/null +++ b/keyboards/jian/rev2/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = qmk-dfu + +# Build Options +# change yes to no to disable +# +CONSOLE_ENABLE = no +SPLIT_KEYBOARD = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes diff --git a/keyboards/jian/rules.mk b/keyboards/jian/rules.mk new file mode 100644 index 0000000000..c19fa00b5c --- /dev/null +++ b/keyboards/jian/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = jian/rev2 -- cgit v1.2.3