From 9204f8535b36e4b9ea51c083bd04d6ea76ac97ee Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 30 Nov 2021 17:49:09 +0000 Subject: [PATCH] [Keyboard] Convert ergoinu to SPLIT_KEYBOARD (#15305) --- keyboards/dm9records/ergoinu/config.h | 10 +- keyboards/dm9records/ergoinu/ergoinu.c | 17 + keyboards/dm9records/ergoinu/ergoinu.h | 5 - .../ergoinu/keymaps/default/config.h | 24 -- .../ergoinu/keymaps/default/keymap.c | 49 ++- .../ergoinu/keymaps/default/rules.mk | 26 -- .../ergoinu/keymaps/default_jis/config.h | 24 -- .../ergoinu/keymaps/default_jis/keymap.c | 42 ++- .../ergoinu/keymaps/default_jis/rules.mk | 26 -- keyboards/dm9records/ergoinu/matrix.c | 286 ----------------- keyboards/dm9records/ergoinu/post_rules.mk | 9 - keyboards/dm9records/ergoinu/readme.md | 9 +- keyboards/dm9records/ergoinu/rules.mk | 30 +- keyboards/dm9records/ergoinu/serial.c | 295 ------------------ keyboards/dm9records/ergoinu/serial.h | 24 -- keyboards/dm9records/ergoinu/serial_config.h | 11 - keyboards/dm9records/ergoinu/split_util.c | 56 ---- keyboards/dm9records/ergoinu/split_util.h | 12 - 18 files changed, 77 insertions(+), 878 deletions(-) delete mode 100644 keyboards/dm9records/ergoinu/keymaps/default/config.h delete mode 100644 keyboards/dm9records/ergoinu/keymaps/default/rules.mk delete mode 100644 keyboards/dm9records/ergoinu/keymaps/default_jis/config.h delete mode 100644 keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk delete mode 100644 keyboards/dm9records/ergoinu/matrix.c delete mode 100644 keyboards/dm9records/ergoinu/post_rules.mk delete mode 100644 keyboards/dm9records/ergoinu/serial.c delete mode 100644 keyboards/dm9records/ergoinu/serial.h delete mode 100644 keyboards/dm9records/ergoinu/serial_config.h delete mode 100644 keyboards/dm9records/ergoinu/split_util.c delete mode 100644 keyboards/dm9records/ergoinu/split_util.h diff --git a/keyboards/dm9records/ergoinu/config.h b/keyboards/dm9records/ergoinu/config.h index 113eaf9f76..89ea9e7903 100644 --- a/keyboards/dm9records/ergoinu/config.h +++ b/keyboards/dm9records/ergoinu/config.h @@ -20,7 +20,6 @@ along with this program. If not, see . #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! */ @@ -30,11 +29,11 @@ along with this program. If not, see . #define MANUFACTURER Dm9Records #define PRODUCT ergoinu -#define TAPPING_FORCE_HOLD -#define TAPPING_TERM 100 - #define USE_SERIAL +/* serial.c configuration for split keyboard */ +#define SOFT_SERIAL_PIN D2 + /* Select hand configuration */ #define MASTER_LEFT // #define MASTER_RIGHT @@ -49,6 +48,9 @@ along with this program. If not, see . #define MATRIX_COLS 7 #define MATRIX_COL_PINS { B4, E6, D7, C6, D4, F5, F4 } +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST diff --git a/keyboards/dm9records/ergoinu/ergoinu.c b/keyboards/dm9records/ergoinu/ergoinu.c index c6d099a148..a01ac0a25c 100644 --- a/keyboards/dm9records/ergoinu/ergoinu.c +++ b/keyboards/dm9records/ergoinu/ergoinu.c @@ -1 +1,18 @@ +/* +Copyright 2018 Takuya Urakawa + +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 . +*/ + #include "ergoinu.h" diff --git a/keyboards/dm9records/ergoinu/ergoinu.h b/keyboards/dm9records/ergoinu/ergoinu.h index 43249a8440..c275d3fa27 100644 --- a/keyboards/dm9records/ergoinu/ergoinu.h +++ b/keyboards/dm9records/ergoinu/ergoinu.h @@ -19,10 +19,6 @@ along with this program. If not, see . #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, \ @@ -41,4 +37,3 @@ along with this program. If not, see . { R27, R26, R25, R24, R23, R22, R21 }, \ { KC_NO, KC_NO, R32, R31, R30, R29, R28 } \ } - diff --git a/keyboards/dm9records/ergoinu/keymaps/default/config.h b/keyboards/dm9records/ergoinu/keymaps/default/config.h deleted file mode 100644 index bb266f25e7..0000000000 --- a/keyboards/dm9records/ergoinu/keymaps/default/config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -This is the c configuration file for the keymap - -Copyright 2012 Jun Wako -Copyright 2015 Jack Humbert -Copyright 2018 Takuya Urakawa - -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 RGBLIGHT_ANIMATIONS diff --git a/keyboards/dm9records/ergoinu/keymaps/default/keymap.c b/keyboards/dm9records/ergoinu/keymaps/default/keymap.c index 3192b0f220..862b538829 100644 --- a/keyboards/dm9records/ergoinu/keymaps/default/keymap.c +++ b/keyboards/dm9records/ergoinu/keymaps/default/keymap.c @@ -5,14 +5,6 @@ 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, @@ -24,33 +16,30 @@ enum CUSTOM_KEYCODES { 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) \ + [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, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ \ + [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 \ + + [CONF] = LAYOUT( + _______, RGB_TYPE,RGB_MOD, RGB_VAI, RGB_HUI, RGB_HUI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_RST, RGB_TOG, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_HUD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX ) }; diff --git a/keyboards/dm9records/ergoinu/keymaps/default/rules.mk b/keyboards/dm9records/ergoinu/keymaps/default/rules.mk deleted file mode 100644 index 8741c24d87..0000000000 --- a/keyboards/dm9records/ergoinu/keymaps/default/rules.mk +++ /dev/null @@ -1,26 +0,0 @@ - -# 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 # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = no # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -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 -AUDIO_ENABLE = no # Audio output -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -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/dm9records/ergoinu/keymaps/default_jis/config.h b/keyboards/dm9records/ergoinu/keymaps/default_jis/config.h deleted file mode 100644 index bb266f25e7..0000000000 --- a/keyboards/dm9records/ergoinu/keymaps/default_jis/config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -This is the c configuration file for the keymap - -Copyright 2012 Jun Wako -Copyright 2015 Jack Humbert -Copyright 2018 Takuya Urakawa - -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 RGBLIGHT_ANIMATIONS diff --git a/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c b/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c index e161145f4f..32289c44db 100644 --- a/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c +++ b/keyboards/dm9records/ergoinu/keymaps/default_jis/keymap.c @@ -24,34 +24,30 @@ enum CUSTOM_KEYCODES { 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) \ + [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, ______ \ + [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 \ + + [CONF] = LAYOUT( + _______, RGB_TYPE,RGB_MOD, RGB_VAI, RGB_HUI, RGB_HUI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_RST, RGB_TOG, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_HUD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX ) }; diff --git a/keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk b/keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk deleted file mode 100644 index 48418de471..0000000000 --- a/keyboards/dm9records/ergoinu/keymaps/default_jis/rules.mk +++ /dev/null @@ -1,26 +0,0 @@ - -# 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 # Enable Bootmagic Lite -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 -AUDIO_ENABLE = no # Audio output -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -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/dm9records/ergoinu/matrix.c b/keyboards/dm9records/ergoinu/matrix.c deleted file mode 100644 index 87a5817313..0000000000 --- a/keyboards/dm9records/ergoinu/matrix.c +++ /dev/null @@ -1,286 +0,0 @@ -/* -Copyright 2012 Jun Wako - -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 . -*/ - -/* - * scan matrix - */ -#include -#include -#include -#include -#include -#include -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "split_util.h" -#include "quantum.h" - -#include "serial.h" - -#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(); - - setPinOutput(B0); - setPinOutput(D5); - - #ifdef DISABLE_PROMICRO_LEDs - writePinHigh(B0); - writePinHigh(D5); - #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 ) { -#ifndef DISABLE_PROMICRO_LEDs - if(ret==2) writePinLow(B0); -#endif - return 1; - } -#ifndef DISABLE_PROMICRO_LEDs - writePinHigh(B0); -#endif - 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(); - - int offset = (isLeftHand) ? ROWS_PER_HAND : 0; - - for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[offset+i] = serial_master_buffer[i]; - } - - 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() ) { -#ifndef DISABLE_PROMICRO_LEDs - // turn on the indicator led when halves are disconnected - writePinLow(D5); -#endif - - 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 { -#ifndef DISABLE_PROMICRO_LEDs - // turn off the indicator led on no error - writePinHigh(D5); -#endif - 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]; - } -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1<> 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/dm9records/ergoinu/post_rules.mk b/keyboards/dm9records/ergoinu/post_rules.mk deleted file mode 100644 index 02aa48104c..0000000000 --- a/keyboards/dm9records/ergoinu/post_rules.mk +++ /dev/null @@ -1,9 +0,0 @@ -ifneq ($(strip $(ERGOINU)),) - ifeq ($(findstring promicroled, $(ERGOINU)), promicroled) - DISABLE_PROMICRO_LEDs = no - endif -endif - -ifeq ($(strip $(DISABLE_PROMICRO_LEDs)), yes) - OPT_DEFS += -DDISABLE_PROMICRO_LEDs -endif diff --git a/keyboards/dm9records/ergoinu/readme.md b/keyboards/dm9records/ergoinu/readme.md index de0a1c6c97..45f91dbac2 100644 --- a/keyboards/dm9records/ergoinu/readme.md +++ b/keyboards/dm9records/ergoinu/readme.md @@ -1,13 +1,12 @@ -ErgoInu -=== +# 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) +* 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): diff --git a/keyboards/dm9records/ergoinu/rules.mk b/keyboards/dm9records/ergoinu/rules.mk index 895ce253d7..9bdc73b761 100644 --- a/keyboards/dm9records/ergoinu/rules.mk +++ b/keyboards/dm9records/ergoinu/rules.mk @@ -5,25 +5,19 @@ MCU = atmega32u4 BOOTLOADER = caterina # 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 +# change yes to no to disable # -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = no # Audio control and System control +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug -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 -AUDIO_ENABLE = no # Audio output -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. -SUBPROJECT_rev1 = no -USE_I2C = no # i2c is not supported +COMMAND_ENABLE = no # Commands for debug and configuration # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output -CUSTOM_MATRIX = yes -SRC += matrix.c serial.c split_util.c - -# ergoinu configs -DISABLE_PROMICRO_LEDs = yes +SPLIT_KEYBOARD = yes diff --git a/keyboards/dm9records/ergoinu/serial.c b/keyboards/dm9records/ergoinu/serial.c deleted file mode 100644 index 5919415877..0000000000 --- a/keyboards/dm9records/ergoinu/serial.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * WARNING: be careful changing this code, it is very timing dependent - */ - -#ifndef F_CPU -#define F_CPU 16000000 -#endif - -#include -#include -#include -#include -#include "serial.h" - -#ifdef USE_SERIAL - -#define _delay_sub_us(x) __builtin_avr_delay_cycles(x) - -// Serial pulse period in microseconds. -#define SELECT_SERIAL_SPEED 1 -#if SELECT_SERIAL_SPEED == 0 - // Very High speed - #define SERIAL_DELAY 4 // micro sec - #define READ_WRITE_START_ADJUST 30 // cycles - #define READ_WRITE_WIDTH_ADJUST 10 // cycles -#elif SELECT_SERIAL_SPEED == 1 - // High speed - #define SERIAL_DELAY 6 // micro sec - #define READ_WRITE_START_ADJUST 23 // cycles - #define READ_WRITE_WIDTH_ADJUST 10 // cycles -#elif SELECT_SERIAL_SPEED == 2 - // Middle speed - #define SERIAL_DELAY 12 // micro sec - #define READ_WRITE_START_ADJUST 25 // cycles - #define READ_WRITE_WIDTH_ADJUST 10 // cycles -#elif SELECT_SERIAL_SPEED == 3 - // Low speed - #define SERIAL_DELAY 24 // micro sec - #define READ_WRITE_START_ADJUST 25 // cycles - #define READ_WRITE_WIDTH_ADJUST 10 // cycles -#elif SELECT_SERIAL_SPEED == 4 - // Very Low speed - #define SERIAL_DELAY 50 // micro sec - #define READ_WRITE_START_ADJUST 25 // cycles - #define READ_WRITE_WIDTH_ADJUST 10 // cycles -#else -#error Illegal Serial Speed -#endif - - -#define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2) -#define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2) - -#define SLAVE_INT_WIDTH 1 -#define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY - -uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; -uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; - -#define SLAVE_DATA_CORRUPT (1<<0) -volatile uint8_t status = 0; - -inline static -void serial_delay(void) { - _delay_us(SERIAL_DELAY); -} - -inline static -void serial_delay_half1(void) { - _delay_us(SERIAL_DELAY_HALF1); -} - -inline static -void serial_delay_half2(void) { - _delay_us(SERIAL_DELAY_HALF2); -} - -inline static -void serial_output(void) { - SERIAL_PIN_DDR |= SERIAL_PIN_MASK; -} - -// make the serial pin an input with pull-up resistor -inline static -void serial_input_with_pullup(void) { - SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; -} - -inline static -uint8_t serial_read_pin(void) { - return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); -} - -inline static -void serial_low(void) { - SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; -} - -inline static -void serial_high(void) { - SERIAL_PIN_PORT |= SERIAL_PIN_MASK; -} - -void serial_master_init(void) { - serial_output(); - serial_high(); -} - -void serial_slave_init(void) { - serial_input_with_pullup(); - -#if SERIAL_PIN_MASK == _BV(PD0) - // Enable INT0 - EIMSK |= _BV(INT0); - // Trigger on falling edge of INT0 - EICRA &= ~(_BV(ISC00) | _BV(ISC01)); -#elif SERIAL_PIN_MASK == _BV(PD2) - // Enable INT2 - EIMSK |= _BV(INT2); - // Trigger on falling edge of INT2 - EICRA &= ~(_BV(ISC20) | _BV(ISC21)); -#else - #error unknown SERIAL_PIN_MASK value -#endif -} - -// Used by the sender to synchronize timing with the reciver. -static -void sync_recv(void) { - for (int i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) { - } - // This shouldn't hang if the slave disconnects because the - // serial line will float to high if the slave does disconnect. - while (!serial_read_pin()); -} - -// Used by the reciver to send a synchronization signal to the sender. -static -void sync_send(void) { - serial_low(); - serial_delay(); - serial_high(); -} - -// Reads a byte from the serial line -static -uint8_t serial_read_byte(void) { - uint8_t byte = 0; - _delay_sub_us(READ_WRITE_START_ADJUST); - for ( uint8_t i = 0; i < 8; ++i) { - serial_delay_half1(); // read the middle of pulses - byte = (byte << 1) | serial_read_pin(); - _delay_sub_us(READ_WRITE_WIDTH_ADJUST); - serial_delay_half2(); - } - return byte; -} - -// Sends a byte with MSB ordering -static -void serial_write_byte(uint8_t data) { - uint8_t b = 1<<7; - while( b ) { - if(data & b) { - serial_high(); - } else { - serial_low(); - } - b >>= 1; - serial_delay(); - } - serial_low(); // sync_send() / senc_recv() need raise edge -} - -// interrupt handle to be used by the slave device -ISR(SERIAL_PIN_INTERRUPT) { - serial_output(); - - // slave send phase - uint8_t checksum = 0; - for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { - sync_send(); - serial_write_byte(serial_slave_buffer[i]); - checksum += serial_slave_buffer[i]; - } - sync_send(); - serial_write_byte(checksum); - - // slave switch to input - sync_send(); //0 - serial_delay_half1(); //1 - serial_low(); //2 - serial_input_with_pullup(); //2 - serial_delay_half1(); //3 - - // slave recive phase - uint8_t checksum_computed = 0; - for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { - sync_recv(); - serial_master_buffer[i] = serial_read_byte(); - checksum_computed += serial_master_buffer[i]; - } - sync_recv(); - uint8_t checksum_received = serial_read_byte(); - - if ( checksum_computed != checksum_received ) { - status |= SLAVE_DATA_CORRUPT; - } else { - status &= ~SLAVE_DATA_CORRUPT; - } - - sync_recv(); //weit master output to high -} - -inline -bool serial_slave_DATA_CORRUPT(void) { - return status & SLAVE_DATA_CORRUPT; -} - -// Copies the serial_slave_buffer to the master and sends the -// serial_master_buffer to the slave. -// -// Returns: -// 0 => no error -// 1 => slave did not respond -// 2 => checksum error -int serial_update_buffers(void) { - // this code is very time dependent, so we need to disable interrupts - cli(); - - // signal to the slave that we want to start a transaction - serial_output(); - serial_low(); - _delay_us(SLAVE_INT_WIDTH); - - // wait for the slaves response - serial_input_with_pullup(); - _delay_us(SLAVE_INT_RESPONSE_TIME); - - // check if the slave is present - if (serial_read_pin()) { - // slave failed to pull the line low, assume not present - serial_output(); - serial_high(); - sei(); - return 1; - } - - // master recive phase - // if the slave is present syncronize with it - - uint8_t checksum_computed = 0; - // receive data from the slave - for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { - sync_recv(); - serial_slave_buffer[i] = serial_read_byte(); - checksum_computed += serial_slave_buffer[i]; - } - sync_recv(); - uint8_t checksum_received = serial_read_byte(); - - if (checksum_computed != checksum_received) { - serial_output(); - serial_high(); - sei(); - return 2; - } - - // master switch to output - sync_recv(); //0 - serial_delay(); //1 - serial_low(); //3 - serial_output(); // 3 - serial_delay_half1(); //4 - - // master send phase - uint8_t checksum = 0; - - for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { - sync_send(); - serial_write_byte(serial_master_buffer[i]); - checksum += serial_master_buffer[i]; - } - sync_send(); - serial_write_byte(checksum); - - // always, release the line when not in use - sync_send(); - - sei(); - return 0; -} - -#endif diff --git a/keyboards/dm9records/ergoinu/serial.h b/keyboards/dm9records/ergoinu/serial.h deleted file mode 100644 index 67cf06ac6b..0000000000 --- a/keyboards/dm9records/ergoinu/serial.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -// //////////////////////////////////////////// -// Need Soft Serial defines in serial_config.h -// //////////////////////////////////////////// -// ex. -// #define SERIAL_PIN_DDR DDRD -// #define SERIAL_PIN_PORT PORTD -// #define SERIAL_PIN_INPUT PIND -// #define SERIAL_PIN_MASK _BV(PD?) ?=0,2 -// #define SERIAL_PIN_INTERRUPT INT?_vect ?=0,2 -// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -// #define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 - -// Buffers for master - slave communication -extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; -extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; - -void serial_master_init(void); -void serial_slave_init(void); -int serial_update_buffers(void); -bool serial_slave_data_corrupt(void); diff --git a/keyboards/dm9records/ergoinu/serial_config.h b/keyboards/dm9records/ergoinu/serial_config.h deleted file mode 100644 index a16db684ca..0000000000 --- a/keyboards/dm9records/ergoinu/serial_config.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -/* Soft Serial defines */ -#define SERIAL_PIN_DDR DDRD -#define SERIAL_PIN_PORT PORTD -#define SERIAL_PIN_INPUT PIND -#define SERIAL_PIN_MASK _BV(PD2) -#define SERIAL_PIN_INTERRUPT INT2_vect - -#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 -#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 diff --git a/keyboards/dm9records/ergoinu/split_util.c b/keyboards/dm9records/ergoinu/split_util.c deleted file mode 100644 index 0cbc2c69c4..0000000000 --- a/keyboards/dm9records/ergoinu/split_util.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "split_util.h" -#include "matrix.h" -#include "keyboard.h" - -#include "serial.h" - -volatile bool isLeftHand = true; - -static void setup_handedness(void) { - #ifdef EE_HANDS - isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); - #else - // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c - #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) - isLeftHand = !has_usb(); - #else - isLeftHand = has_usb(); - #endif - #endif -} - -static void keyboard_master_setup(void) { - serial_master_init(); -} - -static void keyboard_slave_setup(void) { - serial_slave_init(); -} - -bool has_usb(void) { - USBCON |= (1 << OTGPADE); //enables VBUS pad - _delay_us(5); - return (USBSTA & (1< -#include "eeconfig.h" - -extern volatile bool isLeftHand; - -// slave version of matix scan, defined in matrix.c -void matrix_slave_scan(void); - -void split_keyboard_setup(void); -bool has_usb(void);