diff options
| author | QMK Bot <hello@qmk.fm> | 2021-07-20 17:25:14 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-07-20 17:25:14 +0000 |
| commit | 11334ef6af68c89a1746c8831aee559186f667b8 (patch) | |
| tree | 42acdc67aa4d7ff4d488427fda28bdf6dc3f7913 | |
| parent | 14a839e39c84ad3956d6e8041bcb96de6619de8f (diff) | |
| parent | c6698cfce314cdc75cdaa06b2440d2ae0c7b6ea2 (diff) | |
| download | qmk_firmware-11334ef6af68c89a1746c8831aee559186f667b8.tar.gz qmk_firmware-11334ef6af68c89a1746c8831aee559186f667b8.zip | |
Merge remote-tracking branch 'origin/master' into develop
| -rw-r--r-- | keyboards/sekigon/grs_70ec/config.h | 154 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/ec_switch_matrix.c | 161 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/ec_switch_matrix.h | 38 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/grs_70ec.c | 38 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/grs_70ec.h | 49 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/info.json | 83 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/keymaps/default/keymap.c | 41 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/matrix.c | 107 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/readme.md | 19 | ||||
| -rw-r--r-- | keyboards/sekigon/grs_70ec/rules.mk | 26 |
10 files changed, 716 insertions, 0 deletions
diff --git a/keyboards/sekigon/grs_70ec/config.h b/keyboards/sekigon/grs_70ec/config.h new file mode 100644 index 000000000..aa740e777 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/config.h | |||
| @@ -0,0 +1,154 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 sekigon-gonnoc | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #include "config_common.h" | ||
| 21 | |||
| 22 | /* USB Device descriptor parameter */ | ||
| 23 | #define VENDOR_ID 0xFEED | ||
| 24 | #define PRODUCT_ID 0x70EC | ||
| 25 | #define DEVICE_VER 0x0001 | ||
| 26 | #define MANUFACTURER sekigon-gonnoc | ||
| 27 | #define PRODUCT GRS-70EC | ||
| 28 | |||
| 29 | /* key matrix size */ | ||
| 30 | #define MATRIX_ROWS 10 | ||
| 31 | #define MATRIX_COLS 8 | ||
| 32 | |||
| 33 | /* EC switch threshold with hysteresis */ | ||
| 34 | #define HIGH_THRESHOLD 300 | ||
| 35 | #define LOW_THRESHOLD 200 | ||
| 36 | |||
| 37 | /* | ||
| 38 | * Keyboard Matrix Assignments | ||
| 39 | * | ||
| 40 | * Change this to how you wired your keyboard | ||
| 41 | * COLS: AVR pins used for columns, left to right | ||
| 42 | * ROWS: AVR pins used for rows, top to bottom | ||
| 43 | * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | ||
| 44 | * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | ||
| 45 | * | ||
| 46 | */ | ||
| 47 | #define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } | ||
| 48 | #define MATRIX_COL_PINS { S2, S1, S0, S3, S5, S7, S6, S4 } | ||
| 49 | #define UNUSED_PINS | ||
| 50 | #define DISCHARGE_PIN B1 | ||
| 51 | #define ANALOG_PORT F6 | ||
| 52 | #define MUX_SEL_PINS { D1, D0, D4 } | ||
| 53 | |||
| 54 | /* COL2ROW, ROW2COL */ | ||
| 55 | #define DIODE_DIRECTION COL2ROW | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. | ||
| 59 | */ | ||
| 60 | #define SOFT_SERIAL_PIN D3 // or D1, D2, D3, E6 | ||
| 61 | #define EE_HANDS | ||
| 62 | |||
| 63 | //#define BACKLIGHT_PIN B7 | ||
| 64 | //#define BACKLIGHT_LEVELS 3 | ||
| 65 | //#define BACKLIGHT_BREATHING | ||
| 66 | |||
| 67 | //#define RGB_DI_PIN E2 | ||
| 68 | //#ifdef RGB_DI_PIN | ||
| 69 | //# define RGBLED_NUM 16 | ||
| 70 | //# define RGBLIGHT_HUE_STEP 8 | ||
| 71 | //# define RGBLIGHT_SAT_STEP 8 | ||
| 72 | //# define RGBLIGHT_VAL_STEP 8 | ||
| 73 | //# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ | ||
| 74 | //# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ | ||
| 75 | /*== all animations enable ==*/ | ||
| 76 | //# define RGBLIGHT_ANIMATIONS | ||
| 77 | /*== or choose animations ==*/ | ||
| 78 | //# define RGBLIGHT_EFFECT_BREATHING | ||
| 79 | //# define RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
| 80 | //# define RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
| 81 | //# define RGBLIGHT_EFFECT_SNAKE | ||
| 82 | //# define RGBLIGHT_EFFECT_KNIGHT | ||
| 83 | //# define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 84 | //# define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 85 | //# define RGBLIGHT_EFFECT_RGB_TEST | ||
| 86 | //# define RGBLIGHT_EFFECT_ALTERNATING | ||
| 87 | /*== customize breathing effect ==*/ | ||
| 88 | /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ | ||
| 89 | //# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 | ||
| 90 | /*==== use exp() and sin() ====*/ | ||
| 91 | //# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 | ||
| 92 | //# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 | ||
| 93 | //#endif | ||
| 94 | |||
| 95 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 96 | #define DEBOUNCE 5 | ||
| 97 | |||
| 98 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
| 99 | //#define MATRIX_HAS_GHOST | ||
| 100 | |||
| 101 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 102 | #define LOCKING_SUPPORT_ENABLE | ||
| 103 | /* Locking resynchronize hack */ | ||
| 104 | #define LOCKING_RESYNC_ENABLE | ||
| 105 | |||
| 106 | /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. | ||
| 107 | * This is useful for the Windows task manager shortcut (ctrl+shift+esc). | ||
| 108 | */ | ||
| 109 | //#define GRAVE_ESC_CTRL_OVERRIDE | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Force NKRO | ||
| 113 | * | ||
| 114 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
| 115 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
| 116 | * makefile for this to work.) | ||
| 117 | * | ||
| 118 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
| 119 | * until the next keyboard reset. | ||
| 120 | * | ||
| 121 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
| 122 | * fully operational during normal computer usage. | ||
| 123 | * | ||
| 124 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
| 125 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
| 126 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
| 127 | * power-up. | ||
| 128 | * | ||
| 129 | */ | ||
| 130 | //#define FORCE_NKRO | ||
| 131 | |||
| 132 | /* | ||
| 133 | * Feature disable options | ||
| 134 | * These options are also useful to firmware size reduction. | ||
| 135 | */ | ||
| 136 | |||
| 137 | /* disable debug print */ | ||
| 138 | //#define NO_DEBUG | ||
| 139 | |||
| 140 | /* disable print */ | ||
| 141 | //#define NO_PRINT | ||
| 142 | |||
| 143 | /* disable action features */ | ||
| 144 | //#define NO_ACTION_LAYER | ||
| 145 | //#define NO_ACTION_TAPPING | ||
| 146 | //#define NO_ACTION_ONESHOT | ||
| 147 | |||
| 148 | /* disable these deprecated features by default */ | ||
| 149 | #define NO_ACTION_MACRO | ||
| 150 | #define NO_ACTION_FUNCTION | ||
| 151 | |||
| 152 | /* Bootmagic Lite key configuration */ | ||
| 153 | //#define BOOTMAGIC_LITE_ROW 0 | ||
| 154 | //#define BOOTMAGIC_LITE_COLUMN 0 | ||
diff --git a/keyboards/sekigon/grs_70ec/ec_switch_matrix.c b/keyboards/sekigon/grs_70ec/ec_switch_matrix.c new file mode 100644 index 000000000..88e9bdabd --- /dev/null +++ b/keyboards/sekigon/grs_70ec/ec_switch_matrix.c | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | #include "analog.h" | ||
| 21 | #include "print.h" | ||
| 22 | |||
| 23 | // sensing channel definitions | ||
| 24 | #define S0 0 | ||
| 25 | #define S1 1 | ||
| 26 | #define S2 2 | ||
| 27 | #define S3 3 | ||
| 28 | #define S4 4 | ||
| 29 | #define S5 5 | ||
| 30 | #define S6 6 | ||
| 31 | #define S7 7 | ||
| 32 | |||
| 33 | // pin connections | ||
| 34 | const uint8_t row_pins[] = MATRIX_ROW_PINS; | ||
| 35 | const uint8_t col_channels[] = MATRIX_COL_PINS; | ||
| 36 | const uint8_t mux_sel_pins[] = MUX_SEL_PINS; | ||
| 37 | |||
| 38 | _Static_assert(sizeof(mux_sel_pins) == 3, "invalid MUX_SEL_PINS"); | ||
| 39 | |||
| 40 | static ecsm_config_t config; | ||
| 41 | static uint16_t ecsm_sw_value[MATRIX_ROWS][MATRIX_COLS]; | ||
| 42 | |||
| 43 | static inline void discharge_capacitor(void) { setPinOutput(DISCHARGE_PIN); } | ||
| 44 | static inline void charge_capacitor(uint8_t row) { | ||
| 45 | setPinInput(DISCHARGE_PIN); | ||
| 46 | writePinHigh(row_pins[row]); | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline void clear_all_row_pins(void) { | ||
| 50 | for (int row = 0; row < sizeof(row_pins); row++) { | ||
| 51 | writePinLow(row_pins[row]); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline void init_mux_sel(void) { | ||
| 56 | for (int idx = 0; idx < sizeof(mux_sel_pins); idx++) { | ||
| 57 | setPinOutput(mux_sel_pins[idx]); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline void select_mux(uint8_t col) { | ||
| 62 | uint8_t ch = col_channels[col]; | ||
| 63 | writePin(mux_sel_pins[0], ch & 1); | ||
| 64 | writePin(mux_sel_pins[1], ch & 2); | ||
| 65 | writePin(mux_sel_pins[2], ch & 4); | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline void init_row(void) { | ||
| 69 | for (int idx = 0; idx < sizeof(row_pins); idx++) { | ||
| 70 | setPinOutput(row_pins[idx]); | ||
| 71 | writePinLow(row_pins[idx]); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | // Initialize pins | ||
| 76 | int ecsm_init(ecsm_config_t const* const ecsm_config) { | ||
| 77 | // save config | ||
| 78 | config = *ecsm_config; | ||
| 79 | |||
| 80 | // initialize discharge pin as discharge mode | ||
| 81 | writePinLow(DISCHARGE_PIN); | ||
| 82 | setPinOutput(DISCHARGE_PIN); | ||
| 83 | |||
| 84 | // set analog reference | ||
| 85 | analogReference(ADC_REF_POWER); | ||
| 86 | |||
| 87 | // initialize drive lines | ||
| 88 | init_row(); | ||
| 89 | |||
| 90 | // initialize multiplexer select pin | ||
| 91 | init_mux_sel(); | ||
| 92 | |||
| 93 | // set discharge pin to charge mode | ||
| 94 | setPinInput(DISCHARGE_PIN); | ||
| 95 | |||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | |||
| 99 | // Read key value of key (row, col) | ||
| 100 | uint16_t ecsm_readkey_raw(uint8_t row, uint8_t col) { | ||
| 101 | uint16_t sw_value = 0; | ||
| 102 | |||
| 103 | discharge_capacitor(); | ||
| 104 | |||
| 105 | select_mux(col); | ||
| 106 | |||
| 107 | clear_all_row_pins(); | ||
| 108 | |||
| 109 | cli(); | ||
| 110 | |||
| 111 | charge_capacitor(row); | ||
| 112 | |||
| 113 | sw_value = analogReadPin(ANALOG_PORT); | ||
| 114 | |||
| 115 | sei(); | ||
| 116 | |||
| 117 | return sw_value; | ||
| 118 | } | ||
| 119 | |||
| 120 | // Update press/release state of key at (row, col) | ||
| 121 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t col, uint16_t sw_value) { | ||
| 122 | bool current_state = (*current_row >> col) & 1; | ||
| 123 | |||
| 124 | // press to release | ||
| 125 | if (current_state && sw_value < config.low_threshold) { | ||
| 126 | *current_row &= ~(1 << col); | ||
| 127 | return true; | ||
| 128 | } | ||
| 129 | |||
| 130 | // release to press | ||
| 131 | if ((!current_state) && sw_value > config.high_threshold) { | ||
| 132 | *current_row |= (1 << col); | ||
| 133 | return true; | ||
| 134 | } | ||
| 135 | |||
| 136 | return false; | ||
| 137 | } | ||
| 138 | |||
| 139 | // Scan key values and update matrix state | ||
| 140 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]) { | ||
| 141 | bool updated = false; | ||
| 142 | |||
| 143 | for (int col = 0; col < sizeof(col_channels); col++) { | ||
| 144 | for (int row = 0; row < sizeof(row_pins); row++) { | ||
| 145 | ecsm_sw_value[row][col] = ecsm_readkey_raw(row, col); | ||
| 146 | updated |= ecsm_update_key(¤t_matrix[row], col, ecsm_sw_value[row][col]); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | return updated; | ||
| 151 | } | ||
| 152 | |||
| 153 | // Print key values | ||
| 154 | void ecsm_print_matrix(void) { | ||
| 155 | for (int row = 0; row < sizeof(row_pins); row++) { | ||
| 156 | for (int col = 0; col < sizeof(col_channels); col++) { | ||
| 157 | xprintf("%4d", ecsm_sw_value[row][col]); | ||
| 158 | } | ||
| 159 | xprintf("\n"); | ||
| 160 | } | ||
| 161 | } | ||
diff --git a/keyboards/sekigon/grs_70ec/ec_switch_matrix.h b/keyboards/sekigon/grs_70ec/ec_switch_matrix.h new file mode 100644 index 000000000..c690fe8e2 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/ec_switch_matrix.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | // | ||
| 18 | // Scan EC switch matrix using 74HC7051 | ||
| 19 | // Define MUX_SEL_PINS, DISCHARGE_PIN, and ANALOG_PORT to compile | ||
| 20 | // | ||
| 21 | |||
| 22 | #pragma once | ||
| 23 | |||
| 24 | #include <stdint.h> | ||
| 25 | #include <stdbool.h> | ||
| 26 | |||
| 27 | #include "matrix.h" | ||
| 28 | |||
| 29 | typedef struct { | ||
| 30 | uint16_t low_threshold; // threshold for key release | ||
| 31 | uint16_t high_threshold; // threshold for key press | ||
| 32 | } ecsm_config_t; | ||
| 33 | |||
| 34 | int ecsm_init(ecsm_config_t const* const ecsm_config); | ||
| 35 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]); | ||
| 36 | void ecsm_print_matrix(void); | ||
| 37 | uint16_t ecsm_readkey_raw(uint8_t row, uint8_t col); | ||
| 38 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t col, uint16_t sw_value); | ||
diff --git a/keyboards/sekigon/grs_70ec/grs_70ec.c b/keyboards/sekigon/grs_70ec/grs_70ec.c new file mode 100644 index 000000000..e8791c00c --- /dev/null +++ b/keyboards/sekigon/grs_70ec/grs_70ec.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "grs_70ec.h" | ||
| 18 | |||
| 19 | void led_on(void) { | ||
| 20 | setPinOutput(D2); | ||
| 21 | writePinHigh(D2); | ||
| 22 | } | ||
| 23 | |||
| 24 | void led_off(void) { writePinLow(D2); } | ||
| 25 | |||
| 26 | void keyboard_post_init_kb() { | ||
| 27 | led_on(); | ||
| 28 | |||
| 29 | keyboard_post_init_user(); | ||
| 30 | } | ||
| 31 | |||
| 32 | void keyboard_pre_init_kb(void) { | ||
| 33 | // Turn on extern circuit | ||
| 34 | setPinOutput(F7); | ||
| 35 | writePinHigh(F7); | ||
| 36 | |||
| 37 | keyboard_pre_init_user(); | ||
| 38 | } | ||
diff --git a/keyboards/sekigon/grs_70ec/grs_70ec.h b/keyboards/sekigon/grs_70ec/grs_70ec.h new file mode 100644 index 000000000..7b2b0c596 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/grs_70ec.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | |||
| 21 | void led_on(void); | ||
| 22 | void led_off(void); | ||
| 23 | |||
| 24 | /* This is a shortcut to help you visually see your layout. | ||
| 25 | * | ||
| 26 | * The first section contains all of the arguments representing the physical | ||
| 27 | * layout of the board and position of the keys. | ||
| 28 | * | ||
| 29 | * The second converts the arguments into a two-dimensional array which | ||
| 30 | * represents the switch matrix. | ||
| 31 | */ | ||
| 32 | #define LAYOUT( \ | ||
| 33 | L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, R07, \ | ||
| 34 | L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, R17, \ | ||
| 35 | L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, R27, \ | ||
| 36 | L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, R37, \ | ||
| 37 | L40, L42, L43, L45, L46, R40, R41, R42, R43, R45, R46, R47 \ | ||
| 38 | ) { \ | ||
| 39 | { L00, L01, L02, L03, L04, L05, L06, KC_NO }, \ | ||
| 40 | { KC_NO, L11, L12, L13, L14, L15, L16, KC_NO }, \ | ||
| 41 | { KC_NO, L21, L22, L23, L24, L25, L26, KC_NO }, \ | ||
| 42 | { L30, L31, L32, L33, L34, L35, L36, KC_NO }, \ | ||
| 43 | { L40, KC_NO, L42, L43, KC_NO, L45, L46, KC_NO }, \ | ||
| 44 | { R00, R01, R02, R03, R04, R05, R06, R07 }, \ | ||
| 45 | { R10, R11, R12, R13, R14, R15, R16, R17 }, \ | ||
| 46 | { R20, R21, R22, R23, R24, R25, R26, R27 }, \ | ||
| 47 | { R30, R31, R32, R33, R34, R35, R36, R37 }, \ | ||
| 48 | { R40, R41, R42, R43, KC_NO, R45, R46, R47 } \ | ||
| 49 | } | ||
diff --git a/keyboards/sekigon/grs_70ec/info.json b/keyboards/sekigon/grs_70ec/info.json new file mode 100644 index 000000000..0affe821a --- /dev/null +++ b/keyboards/sekigon/grs_70ec/info.json | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "grs_70ec", | ||
| 3 | "url": "https://github.com/sekigon-gonnoc/GRS-70EC-doc/", | ||
| 4 | "maintainer": "sekigon-gonnoc", | ||
| 5 | "width": 15.75, | ||
| 6 | "height": 5, | ||
| 7 | "layouts": { | ||
| 8 | "LAYOUT": { | ||
| 9 | "layout": [ | ||
| 10 | { "label": "k00", "x": 0, "y": 0 }, | ||
| 11 | { "label": "k01", "x": 1, "y": 0 }, | ||
| 12 | { "label": "k02", "x": 2, "y": 0 }, | ||
| 13 | { "label": "k03", "x": 3, "y": 0 }, | ||
| 14 | { "label": "k04", "x": 4, "y": 0 }, | ||
| 15 | { "label": "k05", "x": 5, "y": 0 }, | ||
| 16 | { "label": "k06", "x": 6, "y": 0 }, | ||
| 17 | { "label": "k50", "x": 7.75, "y": 0 }, | ||
| 18 | { "label": "k51", "x": 8.75, "y": 0 }, | ||
| 19 | { "label": "k52", "x": 9.75, "y": 0 }, | ||
| 20 | { "label": "k53", "x": 10.75, "y": 0 }, | ||
| 21 | { "label": "k54", "x": 11.75, "y": 0 }, | ||
| 22 | { "label": "k55", "x": 12.75, "y": 0 }, | ||
| 23 | { "label": "k56", "x": 13.75, "y": 0 }, | ||
| 24 | { "label": "k57", "x": 14.75, "y": 0 }, | ||
| 25 | { "label": "k11", "x": 0, "y": 1, "w": 1.5 }, | ||
| 26 | { "label": "k12", "x": 1.5, "y": 1 }, | ||
| 27 | { "label": "k13", "x": 2.5, "y": 1 }, | ||
| 28 | { "label": "k14", "x": 3.5, "y": 1 }, | ||
| 29 | { "label": "k15", "x": 4.5, "y": 1 }, | ||
| 30 | { "label": "k16", "x": 5.5, "y": 1 }, | ||
| 31 | { "label": "k60", "x": 7.25, "y": 1 }, | ||
| 32 | { "label": "k61", "x": 8.25, "y": 1 }, | ||
| 33 | { "label": "k62", "x": 9.25, "y": 1 }, | ||
| 34 | { "label": "k63", "x": 10.25, "y": 1 }, | ||
| 35 | { "label": "k64", "x": 11.25, "y": 1 }, | ||
| 36 | { "label": "k65", "x": 12.25, "y": 1 }, | ||
| 37 | { "label": "k66", "x": 13.25, "y": 1 }, | ||
| 38 | { "label": "k67", "x": 14.25, "y": 1, "w": 1.5 }, | ||
| 39 | { "label": "k21", "x": 0, "y": 2, "w": 1.75 }, | ||
| 40 | { "label": "k22", "x": 1.75, "y": 2 }, | ||
| 41 | { "label": "k23", "x": 2.75, "y": 2 }, | ||
| 42 | { "label": "k24", "x": 3.75, "y": 2 }, | ||
| 43 | { "label": "k25", "x": 4.75, "y": 2 }, | ||
| 44 | { "label": "k26", "x": 5.75, "y": 2 }, | ||
| 45 | { "label": "k70", "x": 7.5, "y": 2 }, | ||
| 46 | { "label": "k71", "x": 8.5, "y": 2 }, | ||
| 47 | { "label": "k72", "x": 9.5, "y": 2 }, | ||
| 48 | { "label": "k73", "x": 10.5, "y": 2 }, | ||
| 49 | { "label": "k74", "x": 11.5, "y": 2 }, | ||
| 50 | { "label": "k75", "x": 12.5, "y": 2 }, | ||
| 51 | { "label": "k76", "x": 13.5, "y": 2 }, | ||
| 52 | { "label": "k77", "x": 14.5, "y": 2 }, | ||
| 53 | { "label": "k30", "x": 0, "y": 3 }, | ||
| 54 | { "label": "k31", "x": 1, "y": 3 }, | ||
| 55 | { "label": "k32", "x": 2, "y": 3 }, | ||
| 56 | { "label": "k33", "x": 3, "y": 3 }, | ||
| 57 | { "label": "k34", "x": 4, "y": 3 }, | ||
| 58 | { "label": "k35", "x": 5, "y": 3 }, | ||
| 59 | { "label": "k36", "x": 6, "y": 3 }, | ||
| 60 | { "label": "k80", "x": 7.75, "y": 3 }, | ||
| 61 | { "label": "k81", "x": 8.75, "y": 3 }, | ||
| 62 | { "label": "k82", "x": 9.75, "y": 3 }, | ||
| 63 | { "label": "k83", "x": 10.75, "y": 3 }, | ||
| 64 | { "label": "k84", "x": 11.75, "y": 3 }, | ||
| 65 | { "label": "k85", "x": 12.75, "y": 3 }, | ||
| 66 | { "label": "k86", "x": 13.75, "y": 3 }, | ||
| 67 | { "label": "k87", "x": 14.75, "y": 3 }, | ||
| 68 | { "label": "k40", "x": 0, "y": 4, "w": 1.25 }, | ||
| 69 | { "label": "k42", "x": 2, "y": 4 }, | ||
| 70 | { "label": "k43", "x": 3, "y": 4, "w": 1.25 }, | ||
| 71 | { "label": "k45", "x": 4.25, "y": 4, "w": 1.25 }, | ||
| 72 | { "label": "k46", "x": 5.5, "y": 4, "w": 1.25 }, | ||
| 73 | { "label": "k90", "x": 7.5, "y": 4, "w": 1.25 }, | ||
| 74 | { "label": "k91", "x": 8.75, "y": 4, "w": 1.25 }, | ||
| 75 | { "label": "k92", "x": 10, "y": 4, "w": 1.25 }, | ||
| 76 | { "label": "k93", "x": 11.25, "y": 4 }, | ||
| 77 | { "label": "k95", "x": 12.75, "y": 4 }, | ||
| 78 | { "label": "k96", "x": 13.75, "y": 4 }, | ||
| 79 | { "label": "k97", "x": 14.75, "y": 4 } | ||
| 80 | ] | ||
| 81 | } | ||
| 82 | } | ||
| 83 | } | ||
diff --git a/keyboards/sekigon/grs_70ec/keymaps/default/keymap.c b/keyboards/sekigon/grs_70ec/keymaps/default/keymap.c new file mode 100644 index 000000000..bbb0fe4a2 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/keymaps/default/keymap.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include QMK_KEYBOARD_H | ||
| 17 | |||
| 18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 19 | [0] = LAYOUT( | ||
| 20 | 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_BSPC, KC_BSPC, | ||
| 21 | 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_BSLS, | ||
| 22 | 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_ENT, LALT(KC_GRV), | ||
| 23 | KC_LSFT, 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_UP, KC_RSFT, | ||
| 24 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, LT(1,KC_SPC), LT(2,KC_ENT), KC_ENT, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT | ||
| 25 | ), | ||
| 26 | [1] = LAYOUT( | ||
| 27 | KC_GRV, 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_DEL, KC_DEL, | ||
| 28 | KC_TAB, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9),S(KC_0), KC_LBRC, KC_RBRC, KC_PIPE, | ||
| 29 | KC_LCTL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LCBR, KC_MINS, KC_EQL, KC_RCBR,KC_COLN, KC_DQT, KC_ENT, KC_ENT, | ||
| 30 | KC_LSFT, KC_LSFT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC,KC_BSLS, KC_RSFT, KC_UP, KC_NO, | ||
| 31 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_TRNS, KC_ENT, KC_ENT, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT | ||
| 32 | ), | ||
| 33 | [2] = LAYOUT( | ||
| 34 | KC_TILD, 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_INS, KC_INS, | ||
| 35 | KC_TAB, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
| 36 | KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,KC_SCLN, KC_QUOT, KC_ENT, LALT(KC_GRV), | ||
| 37 | KC_LSFT, KC_LSFT, KC_F11, KC_F12, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_RSFT, | ||
| 38 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_TRNS, KC_ENT, KC_RGUI, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT | ||
| 39 | ) | ||
| 40 | }; | ||
| 41 | |||
diff --git a/keyboards/sekigon/grs_70ec/matrix.c b/keyboards/sekigon/grs_70ec/matrix.c new file mode 100644 index 000000000..7e90d99af --- /dev/null +++ b/keyboards/sekigon/grs_70ec/matrix.c | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | /* Copyright 2020 sekigon-gonnoc | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "grs_70ec.h" | ||
| 18 | |||
| 19 | #include "ec_switch_matrix.h" | ||
| 20 | #include "matrix.h" | ||
| 21 | #include "debug.h" | ||
| 22 | #include "split_util.h" | ||
| 23 | #include "transport.h" | ||
| 24 | #include "debounce.h" | ||
| 25 | |||
| 26 | #ifndef LOW_THRESHOLD | ||
| 27 | # define LOW_THRESHOLD 200 | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifndef HIGH_THRESHOLD | ||
| 31 | # define HIGH_THRESHOLD 300 | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #define ERROR_DISCONNECT_COUNT 20 | ||
| 35 | |||
| 36 | #define ROWS_PER_HAND (MATRIX_ROWS / 2) | ||
| 37 | |||
| 38 | /* matrix state(1:on, 0:off) */ | ||
| 39 | extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | ||
| 40 | extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values | ||
| 41 | |||
| 42 | // row offsets for each hand | ||
| 43 | uint8_t thisHand, thatHand; | ||
| 44 | |||
| 45 | // user-defined overridable functions | ||
| 46 | __attribute__((weak)) void matrix_slave_scan_user(void) {} | ||
| 47 | |||
| 48 | void matrix_init_custom(void) { | ||
| 49 | split_pre_init(); | ||
| 50 | |||
| 51 | ecsm_config_t ecsm_config = {.low_threshold = LOW_THRESHOLD, .high_threshold = HIGH_THRESHOLD}; | ||
| 52 | |||
| 53 | ecsm_init(&ecsm_config); | ||
| 54 | |||
| 55 | thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 56 | thatHand = ROWS_PER_HAND - thisHand; | ||
| 57 | |||
| 58 | split_post_init(); | ||
| 59 | } | ||
| 60 | |||
| 61 | bool matrix_scan_custom(matrix_row_t current_matrix[]) { | ||
| 62 | bool updated = ecsm_matrix_scan(current_matrix); | ||
| 63 | |||
| 64 | static int cnt = 0; | ||
| 65 | if (cnt++ == 300) { | ||
| 66 | cnt = 0; | ||
| 67 | ecsm_print_matrix(); | ||
| 68 | print("\n"); | ||
| 69 | } | ||
| 70 | |||
| 71 | return updated; | ||
| 72 | } | ||
| 73 | |||
| 74 | void matrix_post_scan(void) { | ||
| 75 | if (is_keyboard_master()) { | ||
| 76 | static uint8_t error_count; | ||
| 77 | |||
| 78 | if (!transport_master(matrix + thatHand)) { | ||
| 79 | error_count++; | ||
| 80 | |||
| 81 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 82 | // reset other half if disconnected | ||
| 83 | dprintf("Error: disconnect split half\n"); | ||
| 84 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 85 | matrix[thatHand + i] = 0; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } else { | ||
| 89 | error_count = 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | matrix_scan_quantum(); | ||
| 93 | } else { | ||
| 94 | transport_slave(matrix + thisHand); | ||
| 95 | |||
| 96 | matrix_slave_scan_user(); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | uint8_t matrix_scan(void) { | ||
| 101 | bool changed = matrix_scan_custom(raw_matrix); | ||
| 102 | |||
| 103 | debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed); | ||
| 104 | |||
| 105 | matrix_post_scan(); | ||
| 106 | return changed; | ||
| 107 | } | ||
diff --git a/keyboards/sekigon/grs_70ec/readme.md b/keyboards/sekigon/grs_70ec/readme.md new file mode 100644 index 000000000..c60e7fdb9 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/readme.md | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # GRS-70EC | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | A split keyboard using electrostatic capacitive switch | ||
| 6 | |||
| 7 | * Keyboard Maintainer: [sekigon](https://github.com/sekigon-gonnoc) | ||
| 8 | * Hardware Supported: GRS-70EC PCB, Pro Micro | ||
| 9 | * Hardware Availability: [BOOTH Shop](https://nogikes.booth.pm/items/2626903) | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make sekigon/grs_70ec:default | ||
| 14 | |||
| 15 | Flashing example for this keyboard: | ||
| 16 | |||
| 17 | make sekigon/grs_70ec:default:flash | ||
| 18 | |||
| 19 | 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/sekigon/grs_70ec/rules.mk b/keyboards/sekigon/grs_70ec/rules.mk new file mode 100644 index 000000000..410cd9247 --- /dev/null +++ b/keyboards/sekigon/grs_70ec/rules.mk | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = atmega32u4 | ||
| 3 | |||
| 4 | # Bootloader selection | ||
| 5 | BOOTLOADER = caterina | ||
| 6 | |||
| 7 | # Build Options | ||
| 8 | # change yes to no to disable | ||
| 9 | # | ||
| 10 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration | ||
| 11 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 13 | CONSOLE_ENABLE = yes # Console for debug | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 16 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 17 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 18 | NKRO_ENABLE = no # USB Nkey Rollover | ||
| 19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 20 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
| 21 | BLUETOOTH_ENABLE = no # Enable Bluetooth | ||
| 22 | AUDIO_ENABLE = no # Audio output | ||
| 23 | CUSTOM_MATRIX = lite | ||
| 24 | SPLIT_KEYBOARD = yes | ||
| 25 | |||
| 26 | SRC += analog.c ec_switch_matrix.c matrix.c | ||
