diff options
author | Takuya Urakawa <urkwtky@gmail.com> | 2018-08-17 00:36:35 +0900 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-08-16 08:36:35 -0700 |
commit | 303ca46e77965700de40b0b1d1b41284b2ff7811 (patch) | |
tree | eecff746fb95087dfff0a40af786fe9149e24d5a /keyboards | |
parent | a828d49f8c6e0cce16727b596ed141f173c03495 (diff) |
Keyboard: add ergoinu keyboard (#3655)
* add ergoinu
* remove unnecessary code
* replace include guard
delete unused code
* remove unused RGBLED defines
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/ergoinu/config.h | 116 | ||||
-rw-r--r-- | keyboards/ergoinu/ergoinu.c | 5 | ||||
-rw-r--r-- | keyboards/ergoinu/ergoinu.h | 44 | ||||
-rw-r--r-- | keyboards/ergoinu/info.json | 20 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default/config.h | 24 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default/keymap.c | 101 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default/rules.mk | 29 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default_jis/config.h | 24 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default_jis/keymap.c | 101 | ||||
-rw-r--r-- | keyboards/ergoinu/keymaps/default_jis/rules.mk | 29 | ||||
-rw-r--r-- | keyboards/ergoinu/matrix.c | 303 | ||||
-rw-r--r-- | keyboards/ergoinu/readme.md | 21 | ||||
-rw-r--r-- | keyboards/ergoinu/rules.mk | 84 | ||||
-rw-r--r-- | keyboards/ergoinu/serial.c | 295 | ||||
-rw-r--r-- | keyboards/ergoinu/serial.h | 24 | ||||
-rw-r--r-- | keyboards/ergoinu/serial_config.h | 11 | ||||
-rw-r--r-- | keyboards/ergoinu/split_util.c | 56 | ||||
-rw-r--r-- | keyboards/ergoinu/split_util.h | 12 |
18 files changed, 1299 insertions, 0 deletions
diff --git a/keyboards/ergoinu/config.h b/keyboards/ergoinu/config.h new file mode 100644 index 0000000000..4b7c584005 --- /dev/null +++ b/keyboards/ergoinu/config.h @@ -0,0 +1,116 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert +Copyright 2018 Takuya Urakawa<twitter:@hsgw> + +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" +#include <serial_config.h> + +/* USB Device descriptor parameter + VID & PID are lisenced from microchip sublisence program, Don't use other project! */ +#define VENDOR_ID 0x04D8 +#define PRODUCT_ID 0xEE60 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Dm9Records +#define PRODUCT ergoinu +#define DESCRIPTION An (Not Portable But Small) Ergonomic split keyboard + + +#define PREVENT_STUCK_MODIFIERS +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 100 + +#define USE_SERIAL + +/* Select hand configuration */ +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_ROW_PINS { F6, F7, B1, B3, B2 } + +// wiring of each half +#define MATRIX_COLS 7 +#define MATRIX_COL_PINS { B4, E6, D7, C6, D4, F5, F4 } + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define RGB_DI_PIN B6 + +#define RGBLED_NUM 7 + +#ifndef IOS_DEVICE_ENABLE + #if RGBLED_NUM <= 7 + #define RGBLIGHT_LIMIT_VAL 255 + #define RGBLIGHT_VAL_STEP 17 + #endif +#else + #define RGBLIGHT_LIMIT_VAL 90 + #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 500 +#else + // fix iPhone and iPad power adapter issue + // iOS device need lessthan 100 + #define USB_MAX_POWER_CONSUMPTION 100 +#endif + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/ergoinu/ergoinu.c b/keyboards/ergoinu/ergoinu.c new file mode 100644 index 0000000000..b43ab17c8b --- /dev/null +++ b/keyboards/ergoinu/ergoinu.c @@ -0,0 +1,5 @@ +#include "ergoinu.h" + +void matrix_init_kb(void) { + matrix_init_user(); +}; diff --git a/keyboards/ergoinu/ergoinu.h b/keyboards/ergoinu/ergoinu.h new file mode 100644 index 0000000000..43249a8440 --- /dev/null +++ b/keyboards/ergoinu/ergoinu.h @@ -0,0 +1,44 @@ +/* +Copyright 2018 Takuya Urakawa<twitter:@hsgw> + +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 "quantum.h" + +#ifdef RGBLIGHT_ENABLE +#include "ws2812.h" +#endif + +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L07, L08, L09, L10, L11, L12, L13, R07, R08, R09, R10, R11, R12, R13, \ + L14, L15, L16, L17, L18, L19, R14, R15, R16, R17, R18, R19, R20, \ + L20, L21, L22, L23, L24, L25, R21, R22, R23, R24, R25, R26, R27,\ + L26, L27, L28, L29, L30, R28, R29, R30, R31, R32 \ + ) { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L07, L08, L09, L10, L11, L12, L13 }, \ + { L14, KC_NO, L15, L16, L17, L18, L19 }, \ + { L20, KC_NO, L21, L22, L23, L24, L25 }, \ + { KC_NO, KC_NO, L26, L27, L28, L29, L30}, \ + { R06, R05, R04, R03, R02, R01, R00 }, \ + { R13, R12, R11, R10, R09, R08, R07 }, \ + { R20, R19, R18, R17, R16, R15, R14 }, \ + { R27, R26, R25, R24, R23, R22, R21 }, \ + { KC_NO, KC_NO, R32, R31, R30, R29, R28 } \ + } + diff --git a/keyboards/ergoinu/info.json b/keyboards/ergoinu/info.json new file mode 100644 index 0000000000..f85447913c --- /dev/null +++ b/keyboards/ergoinu/info.json @@ -0,0 +1,20 @@ +{ + "keyboard_name": "Ergoinu", + "url": "", + "maintainer": "hsgw", + "width": 17, + "height": 6.75, + "layouts": { + "LAYOUT": { + "key_count": 64, + "layout": [ + {"x": 0, "y": 0.6}, {"x": 1, "y": 0.4}, {"x": 2, "y": 0.4}, {"x": 3, "y": 0.25}, {"x": 4, "y": 0}, {"x": 5, "y": 0.25}, {"x": 6, "y": 0.4}, {"x": 10, "y": 0.4}, {"x": 11, "y": 0.25}, {"x": 12, "y": 0}, {"x": 13, "y": 0.25}, {"x": 14, "y": 0.4}, {"x": 15, "y": 0.4}, {"x": 16, "y": 0.6}, + {"x": 0, "y": 1.6}, {"x": 1, "y": 1.4}, {"x": 2, "y": 1.4}, {"x": 3, "y": 1.25}, {"x": 4, "y": 1}, {"x": 5, "y": 1.25}, {"x": 6, "y": 1.4}, {"x": 10, "y": 1.4}, {"x": 11, "y": 1.25}, {"x": 12, "y": 1}, {"x": 13, "y": 1.25}, {"x": 14, "y": 1.4}, {"x": 15, "y": 1.4}, {"x": 16, "y": 1.6}, + {"x": 0.25, "y": 2.6, "W":1.75}, {"x": 2, "y": 2.4}, {"x": 3, "y": 2.25}, {"x": 4, "y": 2}, {"x": 5, "y": 2.25}, {"x": 6, "y": 2.4}, {"x": 10, "y": 2.4}, {"x": 11, "y": 2.25}, {"x": 12, "y": 2}, {"x": 13, "y": 2.25}, {"x": 14, "y": 2.4}, {"x": 15, "y": 2.4}, {"x": 16, "y": 2.6}, + {"x": 0.25, "y": 3.6, "W":1.75}, {"x": 2, "y": 3.4}, {"x": 3, "y": 3.25}, {"x": 4, "y": 3}, {"x": 5, "y": 3.25}, {"x": 6, "y": 3.4}, {"x": 10, "y": 3.4}, {"x": 11, "y": 3.25}, {"x": 12, "y": 3}, {"x": 13, "y": 3.25}, {"x": 14, "y": 3.4}, {"x": 15, "y": 3.4}, {"x": 16, "y": 3.6}, + {"x": 3, "y": 4.25}, {"x": 4, "y": 4}, {"x": 5, "y": 4.25}, {"x": 6, "y": 4.4}, {"X":7.5, "Y":4.4, "H":1.25,"R":30, "RX":6, "RY":4.4}, + {"X":8.25, "Y":4.4, "H":1.25,"R":-30, "RX":11, "RY":4.4}, {"x": 10, "y": 4.4}, {"x": 11, "y": 4.25}, {"x": 12, "y": 4}, {"x": 13, "y": 4.4} + ] + } + } +} diff --git a/keyboards/ergoinu/keymaps/default/config.h b/keyboards/ergoinu/keymaps/default/config.h new file mode 100644 index 0000000000..bb266f25e7 --- /dev/null +++ b/keyboards/ergoinu/keymaps/default/config.h @@ -0,0 +1,24 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert +Copyright 2018 Takuya Urakawa <Twitter:@hsgw> + +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 + +#define RGBLIGHT_ANIMATIONS diff --git a/keyboards/ergoinu/keymaps/default/keymap.c b/keyboards/ergoinu/keymaps/default/keymap.c new file mode 100644 index 0000000000..7f1be4796c --- /dev/null +++ b/keyboards/ergoinu/keymaps/default/keymap.c @@ -0,0 +1,101 @@ +#include QMK_KEYBOARD_H + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +#define JA_CLON KC_QUOT // : and + +#define JA_AT KC_LBRC // @ and ` +#define JA_HAT KC_EQL // ^ and ~ +#define JA_ENUN KC_RO // \ and _ (EN mark and UNder score) +#define JA_ENVL KC_JYEN // \ and | (EN mark and Vertical Line) +#define JA_LBRC KC_RBRC // [ and { +#define JA_RBRC KC_BSLS // ] and } + +enum LAYER_NO { + BASE = 0, + META, + CONF +}; + +enum CUSTOM_KEYCODES { + RGB_RST = SAFE_RANGE, + RGB_TYPE, +}; + +// Fillers to make layering more clear +#define ______ KC_TRNS +#define XXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT( \ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, \ + KC_DEL, KC_TAB, 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_GRV, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, \ + MO(META),KC_LALT, KC_LGUI, KC_ENT, KC_SPC, KC_ENT, KC_BSPC, KC_RGUI, KC_RALT, MO(META) \ + ), + + [META] = LAYOUT( \ + MO(CONF),KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, \ + ______, KC_CAPS, ______, ______, ______, ______, ______, ______, ______, ______, KC_SLCK, KC_PSCR, KC_HOME, KC_END, \ + ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_PAUS, KC_PGUP, KC_UP, KC_PGDN, \ + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_LEFT, KC_DOWN, KC_RGHT, \ + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ \ + ), + [CONF] = LAYOUT( \ + ______, RGB_TYPE,RGB_MOD, RGB_VAI, RGB_HUI, RGB_HUI, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + RGB_RST, RGB_TOG, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_HUD, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX \ + ) +}; + +bool enableLEDTypeAnime = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case RGB_RST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + #endif + break; + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + enableLEDTypeAnime = false; + rgblight_step(); + } + #endif + return false; + case RGB_TYPE: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); + enableLEDTypeAnime = !enableLEDTypeAnime; + } + #endif + return false; + default: + break; + } + #ifdef RGBLIGHT_ENABLE + if(enableLEDTypeAnime) { + rgblight_mode_noeeprom(1); + uint16_t hue = (rgblight_config.hue + 5) % 360; + rgblight_sethsv_noeeprom(hue, rgblight_config.sat, rgblight_config.val); + } + #endif + + return true; +} + +void matrix_init_user(void) { +} diff --git a/keyboards/ergoinu/keymaps/default/rules.mk b/keyboards/ergoinu/keymaps/default/rules.mk new file mode 100644 index 0000000000..7d7a475d17 --- /dev/null +++ b/keyboards/ergoinu/keymaps/default/rules.mk @@ -0,0 +1,29 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SWAP_HANDS_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +# ergoinu configs +DISABLE_PROMICRO_LEDs = yes + +# Uncomment these for debugging +# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) +# $(info -- OPT_DEFS=$(OPT_DEFS)) +# $(info ) diff --git a/keyboards/ergoinu/keymaps/default_jis/config.h b/keyboards/ergoinu/keymaps/default_jis/config.h new file mode 100644 index 0000000000..bb266f25e7 --- /dev/null +++ b/keyboards/ergoinu/keymaps/default_jis/config.h @@ -0,0 +1,24 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert +Copyright 2018 Takuya Urakawa <Twitter:@hsgw> + +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 + +#define RGBLIGHT_ANIMATIONS diff --git a/keyboards/ergoinu/keymaps/default_jis/keymap.c b/keyboards/ergoinu/keymaps/default_jis/keymap.c new file mode 100644 index 0000000000..3a1a88f47c --- /dev/null +++ b/keyboards/ergoinu/keymaps/default_jis/keymap.c @@ -0,0 +1,101 @@ +#include QMK_KEYBOARD_H + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +#define JA_CLON KC_QUOT // : and + +#define JA_AT KC_LBRC // @ and ` +#define JA_HAT KC_EQL // ^ and ~ +#define JA_ENUN KC_RO // \ and _ (EN mark and UNder score) +#define JA_ENVL KC_JYEN // \ and | (EN mark and Vertical Line) +#define JA_LBRC KC_RBRC // [ and { +#define JA_RBRC KC_BSLS // ] and } + +enum LAYER_NO { + BASE = 0, + META, + CONF +}; + +enum CUSTOM_KEYCODES { + RGB_RST = SAFE_RANGE, + RGB_TYPE, +}; + +// Fillers to make layering more clear +#define ______ KC_TRNS +#define XXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT( \ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, JA_HAT, KC_JYEN, \ + KC_DEL, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JA_AT, JA_LBRC, \ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, JA_CLON, JA_RBRC, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, \ + MO(META),KC_LALT, KC_ZKHK, KC_BSPC, KC_SPC, KC_ENT, KC_BSPC, KC_MHEN, KC_KANA, MO(META) \ + ), + + + [META] = LAYOUT( \ + MO(CONF),KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, \ + ______, KC_CAPS, ______, KC_UP, ______, ______, ______, ______, ______, ______, KC_SLCK, KC_PSCR, KC_HOME, KC_END, \ + ______, KC_LEFT, KC_DOWN, KC_RGHT, ______, ______, ______, ______, ______, KC_PAUS, KC_PGUP, KC_UP, KC_PGDN, \ + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_LEFT, KC_DOWN, KC_RGHT, \ + ______, ______, KC_RGUI, KC_DEL, KC_ENT, ______, KC_DEL, KC_HENK, KC_LGUI, ______ \ + ), + [CONF] = LAYOUT( \ + ______, RGB_TYPE,RGB_MOD, RGB_VAI, RGB_HUI, RGB_HUI, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + RGB_RST, RGB_TOG, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_HUD, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, \ + XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX \ + ) +}; + +bool enableLEDTypeAnime = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case RGB_RST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + #endif + break; + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + enableLEDTypeAnime = false; + rgblight_step(); + } + #endif + return false; + case RGB_TYPE: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); + enableLEDTypeAnime = !enableLEDTypeAnime; + } + #endif + return false; + default: + break; + } + #ifdef RGBLIGHT_ENABLE + if(enableLEDTypeAnime) { + rgblight_mode_noeeprom(1); + uint16_t hue = (rgblight_config.hue + 5) % 360; + rgblight_sethsv_noeeprom(hue, rgblight_config.sat, rgblight_config.val); + } + #endif + return true; +} + +void matrix_init_user(void) { +} diff --git a/keyboards/ergoinu/keymaps/default_jis/rules.mk b/keyboards/ergoinu/keymaps/default_jis/rules.mk new file mode 100644 index 0000000000..7d7a475d17 --- /dev/null +++ b/keyboards/ergoinu/keymaps/default_jis/rules.mk @@ -0,0 +1,29 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SWAP_HANDS_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +# ergoinu configs +DISABLE_PROMICRO_LEDs = yes + +# Uncomment these for debugging +# $(info -- RGBLIGHT_ENABLE=$(RGBLIGHT_ENABLE)) +# $(info -- OPT_DEFS=$(OPT_DEFS)) +# $(info ) diff --git a/keyboards/ergoinu/matrix.c b/keyboards/ergoinu/matrix.c new file mode 100644 index 0000000000..92c95e335e --- /dev/null +++ b/keyboards/ergoinu/matrix.c @@ -0,0 +1,303 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> + +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/>. +*/ + +/* + * scan matrix + */ +#include <stdint.h> +#include <stdbool.h> +#include <avr/io.h> +#include <avr/wdt.h> +#include <avr/interrupt.h> +#include <util/delay.h> +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" + +#include "serial.h" + +// from pro_micro.h +#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) + +#ifndef DISABLE_PROMICRO_LEDs + #define TXLED0 PORTD |= (1<<5) + #define TXLED1 PORTD &= ~(1<<5) + #define RXLED0 PORTB |= (1<<0) + #define RXLED1 PORTB &= ~(1<<0) +#else + #define TXLED0 + #define TXLED1 + #define RXLED0 + #define RXLED1 +#endif + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +#define ERROR_DISCONNECT_COUNT 5 + +static uint8_t debouncing = DEBOUNCE; +static const int ROWS_PER_HAND = MATRIX_ROWS/2; +static uint8_t error_count = 0; +uint8_t is_master = 0 ; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); +static uint8_t matrix_master_scan(void); + + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) { + return MATRIX_COLS; +} + +void matrix_init(void) { + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + #ifdef DISABLE_PROMICRO_LEDs + PORTD |= (1<<5); + PORTB |= (1<<0); + #endif + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + is_master = has_usb(); + + matrix_init_quantum(); +} + +uint8_t _matrix_scan(void) { + // Right hand is stored after the left in the matirx so, we need to offset it + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); + + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + select_row(i); + _delay_us(30); // without this wait read unstable value. + matrix_row_t cols = read_cols(); + if (matrix_debouncing[i+offset] != cols) { + matrix_debouncing[i+offset] = cols; + debouncing = DEBOUNCE; + } + unselect_rows(); + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + } + } + + return 1; +} + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + int ret=serial_update_buffers(); + if (ret ) { + if(ret==2)RXLED1; + return 1; + } +RXLED0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + return 0; +} + +uint8_t matrix_scan(void) { + if (is_master) { + matrix_master_scan(); + }else{ + matrix_slave_scan(); + +// if(serial_slave_DATA_CORRUPT()){ +// TXLED0; + int offset = (isLeftHand) ? ROWS_PER_HAND : 0; + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[offset+i] = serial_master_buffer[i]; + } + +// }else{ +// TXLED1; +// } + + matrix_scan_quantum(); + } + return 1; +} + + +uint8_t matrix_master_scan(void) { + + int ret = _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_master_buffer[i] = matrix[offset+i]; + } + + if( serial_transaction() ) { + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + matrix_scan_quantum(); + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<<col)); +} + +inline +matrix_row_t matrix_get_row(uint8_t row) +{ + return matrix[row]; +} + +void matrix_print(void) +{ + print("\nr/c 0123456789ABCDEF\n"); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + phex(row); print(": "); + pbin_reverse16(matrix_get_row(row)); + print("\n"); + } +} + +uint8_t matrix_key_count(void) +{ + uint8_t count = 0; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + count += bitpop16(matrix[i]); + } + return count; +} + +static void init_cols(void) +{ + for(int x = 0; x < MATRIX_COLS; x++) { + _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); + _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); + } +} + +static matrix_row_t read_cols(void) +{ + matrix_row_t result = 0; + for(int x = 0; x < MATRIX_COLS; x++) { + result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); + } + return result; +} + +static void unselect_rows(void) +{ + for(int x = 0; x < ROWS_PER_HAND; x++) { + _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); + _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); + } +} + +static void select_row(uint8_t row) +{ + _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); + _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); +} diff --git a/keyboards/ergoinu/readme.md b/keyboards/ergoinu/readme.md new file mode 100644 index 0000000000..a0d1c18a24 --- /dev/null +++ b/keyboards/ergoinu/readme.md @@ -0,0 +1,21 @@ +ErgoInu +=== + +![ergoinu](https://i.imgur.com/4CCM8Vl.jpg) + +An (Not Portable But Small) Ergonomic Split Keyboard. + +Keyboard Maintainer: [hsgw](https://github.com/hsgw/) [twitter](https://twitter.com/hsgw) +Hardware Supported: Pro Micro +Hardware Availability & Repository: [https://github.com/hsgw/ergoinu](https://github.com/hsgw/ergoinu) + +Make example for this keyboard (after setting up your build environment): + + make ergoinu:default + + (or) + + make ergoinu:default_jis + + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/ergoinu/rules.mk b/keyboards/ergoinu/rules.mk new file mode 100644 index 0000000000..a00cc16de2 --- /dev/null +++ b/keyboards/ergoinu/rules.mk @@ -0,0 +1,84 @@ +SRC += matrix.c serial.c split_util.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adj |