diff options
author | Takeshi ISHII <2170248+mtei@users.noreply.github.com> | 2020-11-16 04:31:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-15 11:31:23 -0800 |
commit | 81a17f4270d48e5377ca07d5ed5de60a4a7d0a70 (patch) | |
tree | 24de286a884d56d37146fb81784a8c42fbe7c7e8 /keyboards/handwired/symmetric70_proto | |
parent | bb9fbd66e9cbf2099c11c474188efb23c8a1b7fa (diff) | |
download | qmk_firmware-81a17f4270d48e5377ca07d5ed5de60a4a7d0a70.tar.gz qmk_firmware-81a17f4270d48e5377ca07d5ed5de60a4a7d0a70.zip |
[Keyboard] add Symmetric70 keyboard prototype (#10780)
* proto_symmetric70 作成中
74hc157 無しで 片手動作は、右と左でそれぞれうごいた。
* add 74HC157 support
* add keymaps/default_mac
* update proto_symmetric70/keymaps/default_mac/readme.md
* update 74HC157 support
* add keyboards/handwired/proto_symmetric70/matrix.c.patch
* update keyboards/handwired/proto_symmetric70/readme.md
* rename proto_symmetric70 to symmetric70_proto
* Update keyboards/handwired/symmetric70_proto/config.h
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/handwired/symmetric70_proto/symmetric70_proto.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/handwired/symmetric70_proto/readme.md
Co-authored-by: Ryan <fauxpark@gmail.com>
* update readme.md
* update keyboards/handwired/symmetric70_proto/config.h
* remove keyboards/handwired/symmetric70_proto/matrix.c.patch
* Update keyboards/handwired/symmetric70_proto/matrix.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/handwired/symmetric70_proto/matrix.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* use KC_NO, _______
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/handwired/symmetric70_proto')
11 files changed, 702 insertions, 0 deletions
diff --git a/keyboards/handwired/symmetric70_proto/config.h b/keyboards/handwired/symmetric70_proto/config.h new file mode 100644 index 0000000000..2cdce5802c --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/config.h @@ -0,0 +1,150 @@ +/* +Copyright 2020 mtei + +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" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x2BE5 +#define DEVICE_VER 0x0001 +#define MANUFACTURER mtei +#define PRODUCT Symmetric70 prototype + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 16 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } +#define MATRIX_COL_PINS { F4,F4,F5,F5, F6,F6,F7,F7, B6,B6,B2,B2, B3,B3,B1,B1 } +#define UNUSED_PINS + +#define MATRIX_MUL_SEL { 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 } +/* use 74HC157: quadruple 2-line to 1-line data selectors / multiplexers */ +#define MATRIX_MUL_SELECT B5 /* 74HC157 pin1:~A/B */ + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 + +//#define BACKLIGHT_PIN B7 +//#define BACKLIGHT_LEVELS 3 +//#define BACKLIGHT_BREATHING + +//#define RGB_DI_PIN E2 +//#ifdef RGB_DI_PIN +//# define RGBLED_NUM 16 +//# define RGBLIGHT_HUE_STEP 8 +//# define RGBLIGHT_SAT_STEP 8 +//# define RGBLIGHT_VAL_STEP 8 +//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ +//# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +//# define RGBLIGHT_EFFECT_BREATHING +//# define RGBLIGHT_EFFECT_RAINBOW_MOOD +//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +//# define RGBLIGHT_EFFECT_SNAKE +//# define RGBLIGHT_EFFECT_KNIGHT +//# define RGBLIGHT_EFFECT_CHRISTMAS +//# define RGBLIGHT_EFFECT_STATIC_GRADIENT +//# define RGBLIGHT_EFFECT_RGB_TEST +//# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +//#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is useful for the Windows task manager shortcut (ctrl+shift+esc). + */ +//#define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * 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 + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/handwired/symmetric70_proto/info.json b/keyboards/handwired/symmetric70_proto/info.json new file mode 100644 index 0000000000..abb0976a3f --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/info.json @@ -0,0 +1,87 @@ +{ + "keyboard_name": "symmetric70_proto", + "url": "", + "maintainer": "mtei", + "width": 16, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"L00", "x":0, "y":0, "w":1.25}, + {"label":"L01", "x":1.25, "y":0}, + {"label":"L02", "x":2.25, "y":0}, + {"label":"L03", "x":3.25, "y":0}, + {"label":"L04", "x":4.25, "y":0}, + {"label":"L05", "x":5.25, "y":0}, + {"label":"L06", "x":6.25, "y":0}, + {"label":"R06", "x":8.75, "y":0}, + {"label":"R05", "x":9.75, "y":0}, + {"label":"R04", "x":10.75, "y":0}, + {"label":"R03", "x":11.75, "y":0}, + {"label":"R02", "x":12.75, "y":0}, + {"label":"R01", "x":13.75, "y":0}, + {"label":"R00", "x":14.75, "y":0, "w":1.25}, + + {"label":"L10", "x":0, "y":1, "w":1.5}, + {"label":"L11", "x":1.5, "y":1}, + {"label":"L12", "x":2.5, "y":1}, + {"label":"L13", "x":3.5, "y":1}, + {"label":"L14", "x":4.5, "y":1}, + {"label":"L15", "x":5.5, "y":1}, + {"label":"L16", "x":6.5, "y":1}, + {"label":"R16", "x":8.5, "y":1}, + {"label":"R15", "x":9.5, "y":1}, + {"label":"R14", "x":10.5, "y":1}, + {"label":"R13", "x":11.5, "y":1}, + {"label":"R12", "x":12.5, "y":1}, + {"label":"R11", "x":13.5, "y":1}, + {"label":"R10", "x":14.5, "y":1, "w":1.5}, + + {"label":"L20", "x":0, "y":2, "w":1.25}, + {"label":"L21", "x":1.25, "y":2}, + {"label":"L22", "x":2.25, "y":2}, + {"label":"L23", "x":3.25, "y":2}, + {"label":"L24", "x":4.25, "y":2}, + {"label":"L25", "x":5.25, "y":2}, + {"label":"L26", "x":6.25, "y":2}, + {"label":"R26", "x":8.75, "y":2}, + {"label":"R25", "x":9.75, "y":2}, + {"label":"R24", "x":10.75, "y":2}, + {"label":"R23", "x":11.75, "y":2}, + {"label":"R22", "x":12.75, "y":2}, + {"label":"R21", "x":13.75, "y":2}, + {"label":"R20", "x":14.75, "y":2, "w":1.25}, + + {"label":"L30", "x":0, "y":3}, + {"label":"L31", "x":1, "y":3}, + {"label":"L32", "x":2, "y":3}, + {"label":"L33", "x":3, "y":3}, + {"label":"L34", "x":4, "y":3}, + {"label":"L35", "x":5, "y":3}, + {"label":"L36", "x":6, "y":3}, + {"label":"L37", "x":7, "y":3}, + {"label":"R37", "x":8, "y":3}, + {"label":"R36", "x":9, "y":3}, + {"label":"R35", "x":10, "y":3}, + {"label":"R34", "x":11, "y":3}, + {"label":"R33", "x":12, "y":3}, + {"label":"R32", "x":13, "y":3}, + {"label":"R31", "x":14, "y":3}, + {"label":"R30", "x":15, "y":3}, + + {"label":"L40", "x":0, "y":4, "w":1.75}, + {"label":"L42", "x":1.75, "y":4, "w":1.25}, + {"label":"L43", "x":3, "y":4, "w":1.25}, + {"label":"L44", "x":4.25, "y":4}, + {"label":"L45", "x":5.25, "y":4, "w":1.25}, + {"label":"L47", "x":6.5, "y":4, "w":1.5}, + {"label":"R47", "x":8, "y":4, "w":1.5}, + {"label":"R45", "x":9.5, "y":4, "w":1.25}, + {"label":"R44", "x":10.75, "y":4}, + {"label":"R43", "x":11.75, "y":4, "w":1.25}, + {"label":"R42", "x":13, "y":4, "w":1.25}, + {"label":"R40", "x":14.25, "y":4, "w":1.75} + ] + } + } +} diff --git a/keyboards/handwired/symmetric70_proto/keymaps/default/keymap.c b/keyboards/handwired/symmetric70_proto/keymaps/default/keymap.c new file mode 100644 index 0000000000..d396907146 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/keymaps/default/keymap.c @@ -0,0 +1,54 @@ +/* Copyright 2020 mtei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN +}; + +#define KC_FUNC MO(_FN) + +// clang-format off + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + //_ESC_1_2_3_4_5_NO _NO_6_7_8_9_0_BSPC + //_TAB_Q_W_E_R_T_MINS _EQL_Y_U_I_O_P_BSLS + //_LCTL_A_S_D_F_G_LBRC _RBRC_H_J_K_L_SCLN_RCTL + //_LSFT_Z_X_C_V_B_GRV_NO _NO_QUOT_N_M_COMM_DOT_SLSH_RSFT + //_FUNC_CAPS_LALT_LGUI_SPC_BSPC _ENT_SPC_RGUI_RALT_APP_FUNC + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LBRC, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RCTL, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_NO, KC_NO, KC_QUOT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_FUNC, KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ENT, KC_SPC, KC_RGUI, KC_RALT, KC_APP, KC_FUNC + ), + [_FN] = LAYOUT( + //_NO_F1_F2_F3_F4_F5_NO _NO_F6_F7_F8_F9_F10_F11 + //_NO_NO_PAUS_SLCK_NO_NO_NO _NO_NO_NO_SLCK_PAUS_NO_F12 + //_TRNS_HOME_NO_UP_NO_PGUP_INS _INS_PGUP_NO_UP_NO_HOME_TRNS + //_TRNS_END_LEFT_DOWN_RGHT_PGDN_DEL_TRNS _TRNS_DEL_PGDN_LEFT_DOWN_RGHT_END_TRNS + //_TRNS_PSCR_TRNS_TRNS_NO_NO _NO_NO_TRNS_TRNS_PSCR_TRNS + KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_NO, KC_NO, KC_PAUS, KC_SLCK, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_SLCK, KC_PAUS, KC_NO, KC_F12, + _______, KC_HOME, KC_NO, KC_UP, KC_NO, KC_PGUP, KC_INS, KC_INS, KC_PGUP, KC_NO, KC_UP, KC_NO, KC_HOME, _______, + _______, KC_END, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_DEL, KC_NO,KC_NO, KC_DEL, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, + _______, KC_PSCR, _______, _______, KC_NO, KC_NO,KC_NO, KC_NO, _______, _______, KC_PSCR, _______ + ) +}; diff --git a/keyboards/handwired/symmetric70_proto/keymaps/default/readme.md b/keyboards/handwired/symmetric70_proto/keymaps/default/readme.md new file mode 100644 index 0000000000..f9bb5bf675 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/keymaps/default/readme.md @@ -0,0 +1,9 @@ +# The default keymap for symmetric70_proto + +``` + ESC 1 2 3 4 5 6 7 8 9 0 BS + TAB Q W E R T - = Y U I O P \ + CTL A S D F G [ ] H J K L ; CTL + SFT Z X C V B ` ' N M , . / SFT + FUNC CAPS ALT GUI SPC BS ENT SPC GUI RALT APP FUNC +``` diff --git a/keyboards/handwired/symmetric70_proto/keymaps/default_mac/keymap.c b/keyboards/handwired/symmetric70_proto/keymaps/default_mac/keymap.c new file mode 100644 index 0000000000..30f42e70ab --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/keymaps/default_mac/keymap.c @@ -0,0 +1,54 @@ +/* Copyright 2020 mtei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN +}; + +#define KC_FUNC MO(_FN) + +// clang-format off + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + //_ESC_1_2_3_4_5_NO _NO_6_7_8_9_0_BSPC + //_TAB_Q_W_E_R_T_MINS _EQL_Y_U_I_O_P_BSLS + //_LCTL_A_S_D_F_G_LBRC _RBRC_H_J_K_L_SCLN_RCTL + //_LSFT_Z_X_C_V_B_GRV_NO _NO_QUOT_N_M_COMM_DOT_SLSH_RSFT + //_FUNC_CAPS_LALT_LGUI_SPC_BSPC _ENT_SPC_RGUI_RALT_APP_FUNC + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LBRC, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RCTL, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_LANG2, KC_LANG1, KC_QUOT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_FUNC, KC_CAPS, KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ENT, KC_SPC, KC_RGUI, KC_RALT, KC_APP, KC_FUNC + ), + [_FN] = LAYOUT( + //_NO_F1_F2_F3_F4_F5_NO _NO_F6_F7_F8_F9_F10_F11 + //_NO_NO_PAUS_SLCK_NO_NO_NO _NO_NO_NO_SLCK_PAUS_NO_F12 + //_TRNS_HOME_NO_UP_NO_PGUP_INS _INS_PGUP_NO_UP_NO_HOME_TRNS + //_TRNS_END_LEFT_DOWN_RGHT_PGDN_DEL_TRNS _TRNS_DEL_PGDN_LEFT_DOWN_RGHT_END_TRNS + //_TRNS_PSCR_TRNS_TRNS_NO_NO _NO_NO_TRNS_TRNS_PSCR_TRNS + KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_NO, KC_NO, KC_PAUS, KC_SLCK, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_SLCK, KC_PAUS, KC_NO, KC_F12, + _______, KC_HOME, KC_NO, KC_UP, KC_NO, KC_PGUP, KC_INS, KC_INS, KC_PGUP, KC_NO, KC_UP, KC_NO, KC_HOME, _______, + _______, KC_END, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_DEL, KC_NO,KC_NO, KC_DEL, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, + _______, KC_PSCR, _______, _______, KC_NO, KC_NO,KC_NO, KC_NO, _______, _______, KC_PSCR, _______ + ) +}; diff --git a/keyboards/handwired/symmetric70_proto/keymaps/default_mac/readme.md b/keyboards/handwired/symmetric70_proto/keymaps/default_mac/readme.md new file mode 100644 index 0000000000..c533e32832 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/keymaps/default_mac/readme.md @@ -0,0 +1,9 @@ +# The default_mac keymap for symmetric70_proto + +``` + ESC 1 2 3 4 5 6 7 8 9 0 BS + TAB Q W E R T - = Y U I O P \ + CTL A S D F G [ ] H J K L ; CTL + SFT Z X C V B ` LANG2 LANG1 ' N M , . / SFT + FUNC CAPS ALT GUI SPC BS ENT SPC GUI RALT APP FUNC +``` diff --git a/keyboards/handwired/symmetric70_proto/matrix.c b/keyboards/handwired/symmetric70_proto/matrix.c new file mode 100644 index 0000000000..c016120737 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/matrix.c @@ -0,0 +1,226 @@ +/* +Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include <stdint.h> +#include <stdbool.h> +#include "util.h" +#include "matrix.h" +#include "debounce.h" +#include "quantum.h" + +#ifdef DIRECT_PINS +static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; +#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +# ifdef MATRIX_MUL_SELECT +static const pin_t col_sel[MATRIX_COLS] = MATRIX_MUL_SEL; +# ifndef MATRIX_MUL_SELECT_DELAY +# define MATRIX_MUL_SELECT_DELAY 1 +# endif +# endif +#endif + +/* matrix state(1:on, 0:off) */ +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values + +// matrix code + +#ifdef DIRECT_PINS + +static void init_pins(void) { + for (int row = 0; row < MATRIX_ROWS; row++) { + for (int col = 0; col < MATRIX_COLS; col++) { + pin_t pin = direct_pins[row][col]; + if (pin != NO_PIN) { + setPinInputHigh(pin); + } + } + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Start with a clear matrix row + matrix_row_t current_row_value = 0; + + for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + pin_t pin = direct_pins[current_row][col_index]; + if (pin != NO_PIN) { + current_row_value |= readPin(pin) ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + } + + // If the row has changed, store the row and return the changed flag. + if (current_matrix[current_row] != current_row_value) { + current_matrix[current_row] = current_row_value; + return true; + } + return false; +} + +#elif defined(DIODE_DIRECTION) +# if (DIODE_DIRECTION == COL2ROW) + +static void select_row(uint8_t row) { + setPinOutput(row_pins[row]); + writePinLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } + +static void unselect_rows(void) { + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static void init_pins(void) { +#ifdef MATRIX_MUL_SELECT + setPinOutput(MATRIX_MUL_SELECT); + writePinLow(MATRIX_MUL_SELECT); +#endif + unselect_rows(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Start with a clear matrix row + matrix_row_t current_row_value = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + matrix_io_delay(); + + // For each col... + for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + // Select the col pin to read (active low) +#ifdef MATRIX_MUL_SELECT + writePin(MATRIX_MUL_SELECT,col_sel[col_index]); + __builtin_avr_delay_cycles(MATRIX_MUL_SELECT_DELAY); +#endif + uint8_t pin_state = readPin(col_pins[col_index]); + + // Populate the matrix row with the state of the col pin + current_row_value |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + // If the row has changed, store the row and return the changed flag. + if (current_matrix[current_row] != current_row_value) { + current_matrix[current_row] = current_row_value; + return true; + } + return false; +} + +# elif (DIODE_DIRECTION == ROW2COL) + +static void select_col(uint8_t col) { + setPinOutput(col_pins[col]); + writePinLow(col_pins[col]); +} + +static void unselect_col(uint8_t col) { setPinInputHigh(col_pins[col]); } + +static void unselect_cols(void) { + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static void init_pins(void) { + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + matrix_io_delay(); + + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + matrix_row_t current_row_value = last_row_value; + + // Check row pin state + if (readPin(row_pins[row_index]) == 0) { + // Pin LO, set col bit + current_row_value |= (MATRIX_ROW_SHIFTER << current_col); + } else { + // Pin HI, clear col bit + current_row_value &= ~(MATRIX_ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_row_value)) { + matrix_changed |= true; + current_matrix[row_index] = current_row_value; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +# else +# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL! +# endif +#else +# error DIODE_DIRECTION is not defined! +#endif + +void matrix_init_custom(void) { + // initialize key pins + init_pins(); + + // initialize matrix state: all keys off + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + raw_matrix[i] = 0; + matrix[i] = 0; + } + +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + +#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { + changed |= read_cols_on_row(current_matrix, current_row); + } +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + changed |= read_rows_on_col(current_matrix, current_col); + } +#endif + + return changed; +} diff --git a/keyboards/handwired/symmetric70_proto/readme.md b/keyboards/handwired/symmetric70_proto/readme.md new file mode 100644 index 0000000000..01c2889c27 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/readme.md @@ -0,0 +1,20 @@ +# symmetric70_proto + +![symmetric70_proto](https://i.imgur.com/Br4pH9ol.jpg) +![74HC157_schematic](https://i.imgur.com/8IU8Jgcl.jpg) + +A compact 70keys keyboard (prototype) designed by mtei + +* Keyboard Maintainer: [mtei](https://github.com/mtei) +* Hardware Supported: Pro Micro (ATmega32U4) & 74HC157 +* Hardware Availability: This is just prototype + +Make example for this keyboard (after setting up your build environment): + + make symmetric70_proto:default + +Flashing example for this keyboard: + + make symmetric70_proto:default:flash + +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/handwired/symmetric70_proto/rules.mk b/keyboards/handwired/symmetric70_proto/rules.mk new file mode 100644 index 0000000000..494dc6fbaf --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/rules.mk @@ -0,0 +1,27 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +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 = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +CUSTOM_MATRIX = lite +SRC += matrix.c + +## CONSOLE_ENABLE = yes # matrix dump diff --git a/keyboards/handwired/symmetric70_proto/symmetric70_proto.c b/keyboards/handwired/symmetric70_proto/symmetric70_proto.c new file mode 100644 index 0000000000..daab4f0993 --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/symmetric70_proto.c @@ -0,0 +1,25 @@ +/* Copyright 2020 mtei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "symmetric70_proto.h" + +__attribute__((weak)) void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + //debug_keyboard=true; + //debug_mouse=true; +} diff --git a/keyboards/handwired/symmetric70_proto/symmetric70_proto.h b/keyboards/handwired/symmetric70_proto/symmetric70_proto.h new file mode 100644 index 0000000000..4a8539b50c --- /dev/null +++ b/keyboards/handwired/symmetric70_proto/symmetric70_proto.h @@ -0,0 +1,41 @@ +/* Copyright 2020 mtei + * + * 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" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, L06, R06, R05, R04, R03, R02, R01, R00, \ + L10, L11, L12, L13, L14, L15, L16, R16, R15, R14, R13, R12, R11, R10, \ + L20, L21, L22, L23, L24, L25, L26, R26, R25, R24, R23, R22, R21, R20, \ + L30, L31, L32, L33, L34, L35, L36, L37, R37, R36, R35, R34, R33, R32, R31, R30, \ + L40, L42, L43, L44, L45, L47, R47, R45, R44, R43, R42, R40 \ +) { \ + { L00, L01, L02, L03, L04, L05, L06, KC_NO, KC_NO, R06, R05, R04, R03, R02, R01, R00 }, \ + { L10, L11, L12, L13, L14, L15, L16, KC_NO, KC_NO, R16, R15, R14, R13, R12, R11, R10 }, \ + { L20, L21, L22, L23, L24, L25, L26, KC_NO, KC_NO, R26, R25, R24, R23, R22, R21, R20 }, \ + { L30, L31, L32, L33, L34, L35, L36, L37, R37, R36, R35, R34, R33, R32, R31, R30 }, \ + { L40, KC_NO, L42, L43, L44, L45, KC_NO, L47, R47, KC_NO, R45, R44, R43, R42, KC_NO, R40 } \ +} |