From d1e2a926cdbdf8a3a27a68771284e0bcd81cf306 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 29 Jul 2020 23:23:21 +1000 Subject: [PATCH 01/17] K-Type refactor --- keyboards/k_type/config.h | 58 +++++-- keyboards/k_type/info.json | 118 +++++++++++-- keyboards/k_type/k_type.c | 16 -- keyboards/k_type/k_type.h | 42 ++--- keyboards/k_type/keymaps/belak/keymap.c | 46 +++-- keyboards/k_type/keymaps/default/keymap.c | 16 +- keyboards/k_type/matrix.c | 201 ++++++++++------------ keyboards/k_type/readme.md | 12 +- keyboards/k_type/rules.mk | 30 ++-- 9 files changed, 320 insertions(+), 219 deletions(-) diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h index 86b08769d1d2..76a2496a9617 100644 --- a/keyboards/k_type/config.h +++ b/keyboards/k_type/config.h @@ -15,30 +15,56 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once /* USB Device descriptor parameter */ -#define VENDOR_ID 0x1c11 -#define PRODUCT_ID 0xb04d -#define DEVICE_VER 0x0001 +#define VENDOR_ID 0x1C11 +#define PRODUCT_ID 0xB04D +#define DEVICE_VER 0x0001 #define MANUFACTURER Input Club -#define PRODUCT K-Type/QMK +#define PRODUCT K-Type + /* key matrix size */ #define MATRIX_ROWS 10 #define MATRIX_COLS 10 -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 -/* Set 0 if debouncing isn't 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. @@ -54,7 +80,13 @@ along with this program. If not, see . //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION -#endif +/* 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 + +#define KIIBOHD_BOOTLOADER diff --git a/keyboards/k_type/info.json b/keyboards/k_type/info.json index 9d3e10568b0e..fd4c95274864 100644 --- a/keyboards/k_type/info.json +++ b/keyboards/k_type/info.json @@ -1,12 +1,110 @@ { - "keyboard_name": "K-Type", - "url": "", - "maintainer": "qmk", - "width": 18.25, - "height": 6.5, - "layouts": { - "KEYMAP": { - "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"label":"PrtSc", "x":15.25, "y":0}, {"label":"Scroll Lock", "x":16.25, "y":0}, {"label":"Pause", "x":17.25, "y":0}, {"label":"~", "x":0, "y":1.5}, {"label":"!", "x":1, "y":1.5}, {"label":"@", "x":2, "y":1.5}, {"label":"#", "x":3, "y":1.5}, {"label":"$", "x":4, "y":1.5}, {"label":"%", "x":5, "y":1.5}, {"label":"^", "x":6, "y":1.5}, {"label":"&", "x":7, "y":1.5}, {"label":"*", "x":8, "y":1.5}, {"label":"(", "x":9, "y":1.5}, {"label":")", "x":10, "y":1.5}, {"label":"_", "x":11, "y":1.5}, {"label":"+", "x":12, "y":1.5}, {"label":"Backspace", "x":13, "y":1.5, "w":2}, {"label":"Insert", "x":15.25, "y":1.5}, {"label":"Home", "x":16.25, "y":1.5}, {"label":"PgUp", "x":17.25, "y":1.5}, {"label":"Tab", "x":0, "y":2.5, "w":1.5}, {"label":"Q", "x":1.5, "y":2.5}, {"label":"W", "x":2.5, "y":2.5}, {"label":"E", "x":3.5, "y":2.5}, {"label":"R", "x":4.5, "y":2.5}, {"label":"T", "x":5.5, "y":2.5}, {"label":"Y", "x":6.5, "y":2.5}, {"label":"U", "x":7.5, "y":2.5}, {"label":"I", "x":8.5, "y":2.5}, {"label":"O", "x":9.5, "y":2.5}, {"label":"P", "x":10.5, "y":2.5}, {"label":"{", "x":11.5, "y":2.5}, {"label":"}", "x":12.5, "y":2.5}, {"label":"|", "x":13.5, "y":2.5, "w":1.5}, {"label":"Delete", "x":15.25, "y":2.5}, {"label":"End", "x":16.25, "y":2.5}, {"label":"PgDn", "x":17.25, "y":2.5}, {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, {"label":"A", "x":1.75, "y":3.5}, {"label":"S", "x":2.75, "y":3.5}, {"label":"D", "x":3.75, "y":3.5}, {"label":"F", "x":4.75, "y":3.5}, {"label":"G", "x":5.75, "y":3.5}, {"label":"H", "x":6.75, "y":3.5}, {"label":"J", "x":7.75, "y":3.5}, {"label":"K", "x":8.75, "y":3.5}, {"label":"L", "x":9.75, "y":3.5}, {"label":":", "x":10.75, "y":3.5}, {"label":"\"", "x":11.75, "y":3.5}, {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, {"label":"Shift", "x":0, "y":4.5, "w":2.25}, {"label":"Z", "x":2.25, "y":4.5}, {"label":"X", "x":3.25, "y":4.5}, {"label":"C", "x":4.25, "y":4.5}, {"label":"V", "x":5.25, "y":4.5}, {"label":"B", "x":6.25, "y":4.5}, {"label":"N", "x":7.25, "y":4.5}, {"label":"M", "x":8.25, "y":4.5}, {"label":"<", "x":9.25, "y":4.5}, {"label":">", "x":10.25, "y":4.5}, {"label":"?", "x":11.25, "y":4.5}, {"label":"Shift", "x":12.25, "y":4.5, "w":2.75}, {"label":"\u2191", "x":16.25, "y":4.5}, {"label":"Ctrl", "x":0, "y":5.5, "w":1.25}, {"label":"Win", "x":1.25, "y":5.5, "w":1.25}, {"label":"Alt", "x":2.5, "y":5.5, "w":1.25}, {"x":3.75, "y":5.5, "w":6.25}, {"label":"Alt", "x":10, "y":5.5, "w":1.25}, {"label":"Win", "x":11.25, "y":5.5, "w":1.25}, {"label":"Menu", "x":12.5, "y":5.5, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25}, {"label":"\u2190", "x":15.25, "y":5.5}, {"label":"\u2193", "x":16.25, "y":5.5}, {"label":"\u2192", "x":17.25, "y":5.5}] - } - } + "keyboard_name": "K-Type", + "url": "", + "maintainer": "qmk", + "width": 18.25, + "height": 6.5, + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6.5, "y": 0}, + {"x": 7.5, "y": 0}, + {"x": 8.5, "y": 0}, + {"x": 9.5, "y": 0}, + {"x": 11, "y": 0}, + {"x": 12, "y": 0}, + {"x": 13, "y": 0}, + {"x": 14, "y": 0}, + + {"x": 15.25, "y": 0}, + {"x": 16.25, "y": 0}, + {"x": 17.25, "y": 0}, + + {"x": 0, "y": 1.5}, + {"x": 1, "y": 1.5}, + {"x": 2, "y": 1.5}, + {"x": 3, "y": 1.5}, + {"x": 4, "y": 1.5}, + {"x": 5, "y": 1.5}, + {"x": 6, "y": 1.5}, + {"x": 7, "y": 1.5}, + {"x": 8, "y": 1.5}, + {"x": 9, "y": 1.5}, + {"x": 10, "y": 1.5}, + {"x": 11, "y": 1.5}, + {"x": 12, "y": 1.5}, + {"x": 13, "y": 1.5, "w": 2}, + + {"x": 15.25, "y": 1.5}, + {"x": 16.25, "y": 1.5}, + {"x": 17.25, "y": 1.5}, + + {"x": 0, "y": 2.5, "w": 1.5}, + {"x": 1.5, "y": 2.5}, + {"x": 2.5, "y": 2.5}, + {"x": 3.5, "y": 2.5}, + {"x": 4.5, "y": 2.5}, + {"x": 5.5, "y": 2.5}, + {"x": 6.5, "y": 2.5}, + {"x": 7.5, "y": 2.5}, + {"x": 8.5, "y": 2.5}, + {"x": 9.5, "y": 2.5}, + {"x": 10.5, "y": 2.5}, + {"x": 11.5, "y": 2.5}, + {"x": 12.5, "y": 2.5}, + {"x": 13.5, "y": 2.5, "w": 1.5}, + + {"x": 15.25, "y": 2.5}, + {"x": 16.25, "y": 2.5}, + {"x": 17.25, "y": 2.5}, + + {"x": 0, "y": 3.5, "w": 1.75}, + {"x": 1.75, "y": 3.5}, + {"x": 2.75, "y": 3.5}, + {"x": 3.75, "y": 3.5}, + {"x": 4.75, "y": 3.5}, + {"x": 5.75, "y": 3.5}, + {"x": 6.75, "y": 3.5}, + {"x": 7.75, "y": 3.5}, + {"x": 8.75, "y": 3.5}, + {"x": 9.75, "y": 3.5}, + {"x": 10.75, "y": 3.5}, + {"x": 11.75, "y": 3.5}, + {"x": 12.75, "y": 3.5, "w": 2.25}, + + {"x": 0, "y": 4.5, "w": 2.25}, + {"x": 2.25, "y": 4.5}, + {"x": 3.25, "y": 4.5}, + {"x": 4.25, "y": 4.5}, + {"x": 5.25, "y": 4.5}, + {"x": 6.25, "y": 4.5}, + {"x": 7.25, "y": 4.5}, + {"x": 8.25, "y": 4.5}, + {"x": 9.25, "y": 4.5}, + {"x": 10.25, "y": 4.5}, + {"x": 11.25, "y": 4.5}, + {"x": 12.25, "y": 4.5, "w": 2.75}, + + {"x": 16.25, "y": 4.5}, + + {"x": 0, "y": 5.5, "w": 1.25}, + {"x": 1.25, "y": 5.5, "w": 1.25}, + {"x": 2.5, "y": 5.5, "w": 1.25}, + {"x": 3.75, "y": 5.5, "w": 6.25}, + {"x": 10, "y": 5.5, "w": 1.25}, + {"x": 11.25, "y": 5.5, "w": 1.25}, + {"x": 12.5, "y": 5.5, "w": 1.25}, + {"x": 13.75, "y": 5.5, "w": 1.25}, + + {"x": 15.25, "y": 5.5}, + {"x": 16.25, "y": 5.5}, + {"x": 17.25, "y": 5.5} + ] + } + } } diff --git a/keyboards/k_type/k_type.c b/keyboards/k_type/k_type.c index 0cffbedfd69d..ef3f431dd96d 100644 --- a/keyboards/k_type/k_type.c +++ b/keyboards/k_type/k_type.c @@ -15,19 +15,3 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "k_type.h" - -__attribute__ ((weak)) -void matrix_init_user(void) { -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { -} - -void matrix_init_kb(void) { - matrix_init_user(); -}; - -void matrix_scan_kb(void) { - matrix_scan_user(); -}; diff --git a/keyboards/k_type/k_type.h b/keyboards/k_type/k_type.h index b0c1f2d652d3..ef710fffa4aa 100644 --- a/keyboards/k_type/k_type.h +++ b/keyboards/k_type/k_type.h @@ -14,29 +14,29 @@ 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 . */ -#ifndef K_TYPE_H -#define K_TYPE_H + +#pragma once #include "quantum.h" -#define KEYMAP( \ - K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, K14, K15, K16, \ - K17, K18, K19, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K30, K31, K32, K33, \ - K34, K35, K36, K37, K38, K39, K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K50, \ - K51, K52, K53, K54, K55, K56, K57, K58, K59, K60, K61, K62, K63, \ - K64, K65, K66, K67, K68, K69, K70, K71, K72, K73, K74, K75, K76, \ - K77, K78, K79, K80, K81, K82, K83, K84, K85, K86, K87 \ +#define XXX KC_NO + +#define LAYOUT_tkl_ansi( \ + k00, k10, k20, k30, k40, k50, k60, k70, k80, k90, k01, k11, k21, k31, k41, k51, \ + k61, k71, k81, k91, k02, k12, k22, k32, k42, k52, k62, k72, k82, k03, k23, k33, k43, \ + k53, k63, k73, k83, k93, k04, k14, k24, k34, k44, k54, k64, k74, k84, k05, k15, k25, \ + k35, k45, k55, k65, k75, k85, k95, k06, k16, k26, k36, k46, k66, \ + k86, k07, k17, k27, k37, k47, k57, k67, k77, k87, k97, k18, k38, \ + k48, k58, k68, k78, k88, k98, k09, k19, k29, k39, k49 \ ) { \ - { K01, K11, K21, K30, K39, K48, K58, K65, KC_NO, K83, }, \ - { K02, K12, K22, KC_NO, K40, K49, K59, K66, K75, K84, }, \ - { K03, K13, K23, K31, K41, K50, K60, K67, KC_NO, K85, }, \ - { K04, K14, K24, K32, K42, K51, K61, K68, K76, K86, }, \ - { K05, K15, K25, K33, K43, K52, K62, K69, K77, K87, }, \ - { K06, K16, K26, K34, K44, K53, KC_NO, K70, K78, KC_NO, }, \ - { K07, K17, K27, K35, K45, K54, K63, K71, K79, KC_NO, }, \ - { K08, K18, K28, K36, K46, K55, KC_NO, K72, K80, KC_NO, }, \ - { K09, K19, K29, K37, K47, K56, K64, K73, K81, KC_NO, }, \ - { K10, K20, KC_NO, K38, KC_NO, K57, KC_NO, K74, K82, KC_NO, }, \ + { k00, k01, k02, k03, k04, k05, k06, k07, XXX, k09 }, \ + { k10, k11, k12, XXX, k14, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, XXX, k29 }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39 }, \ + { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49 }, \ + { k50, k51, k52, k53, k54, k55, XXX, k57, k58, XXX }, \ + { k60, k61, k62, k63, k64, k65, k66, k67, k68, XXX }, \ + { k70, k71, k72, k73, k74, k75, XXX, k77, k78, XXX }, \ + { k80, k81, k82, k83, k84, k85, k86, k87, k88, XXX }, \ + { k90, k91, XXX, k93, XXX, k95, XXX, k97, k98, XXX } \ } - -#endif diff --git a/keyboards/k_type/keymaps/belak/keymap.c b/keyboards/k_type/keymaps/belak/keymap.c index ed9392a2a594..e920579317b5 100644 --- a/keyboards/k_type/keymaps/belak/keymap.c +++ b/keyboards/k_type/keymaps/belak/keymap.c @@ -1,31 +1,27 @@ -#include "k_type.h" +#include QMK_KEYBOARD_H -#define _QW 0 -#define _L1 1 - -const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QW] = KEYMAP( - KC_ESC, 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_PSCR, KC_SLCK, KC_PAUS, \ - 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_BSPC, KC_INS, KC_HOME, KC_PGUP, \ - 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, KC_DEL, KC_END, KC_PGDN, \ - MO(_L1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ - 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), - [_L1] = KEYMAP( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_VOLU, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPRV, KC_VOLD, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END), +enum layer_names { + _QW, + _L1 }; -// Runs just one time when the keyboard initializes. -void matrix_init_user(void) { - -}; +const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QW] = LAYOUT_tkl_ansi( + KC_ESC, 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_PSCR, KC_SLCK, KC_PAUS, -// Runs constantly in the background, in a loop. -void matrix_scan_user(void) { + 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_BSPC, KC_INS, KC_HOME, KC_PGUP, + 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, KC_DEL, KC_END, KC_PGDN, + MO(_L1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_L1] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_VOLU, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPRV, KC_VOLD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END + ) }; diff --git a/keyboards/k_type/keymaps/default/keymap.c b/keyboards/k_type/keymaps/default/keymap.c index 4f304b012027..39411b1c2c39 100644 --- a/keyboards/k_type/keymaps/default/keymap.c +++ b/keyboards/k_type/keymaps/default/keymap.c @@ -1,11 +1,13 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = KEYMAP( - KC_ESC, 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_PSCR, KC_SLCK, KC_PAUS, \ - 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_BSPC, KC_INS, KC_HOME, KC_PGUP, \ - 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, KC_DEL, KC_END, KC_PGDN, \ - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ - 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + [0] = LAYOUT_tkl_ansi( + KC_ESC, 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_PSCR, KC_SLCK, KC_PAUS, + + 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_BSPC, KC_INS, KC_HOME, KC_PGUP, + 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, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ) }; diff --git a/keyboards/k_type/matrix.c b/keyboards/k_type/matrix.c index d919bb880905..486994bc0439 100644 --- a/keyboards/k_type/matrix.c +++ b/keyboards/k_type/matrix.c @@ -1,77 +1,74 @@ -//#include -//#include -#include -#include "hal.h" -#include "timer.h" -#include "wait.h" -#include "print.h" #include "matrix.h" -#include "debug.h" -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static bool debouncing = false; -static uint16_t debouncing_time = 0; - -void matrix_init(void) -{ - debug_matrix = true; +#include "quantum.h" +void matrix_init_custom(void) { /* Column(sense) */ - palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 6, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 7, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 6, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 7, PAL_MODE_INPUT_PULLDOWN); /* Row(strobe) */ - palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 18, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 19, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 8, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); - - memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t)); - - matrix_init_quantum(); + palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 18, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 19, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOC, 8, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); } -uint8_t matrix_scan(void) -{ +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + for (int row = 0; row < MATRIX_ROWS; row++) { matrix_row_t data = 0; + // strobe row switch (row) { - case 0: palSetPad(GPIOB, 2); break; - case 1: palSetPad(GPIOB, 3); break; - case 2: palSetPad(GPIOB, 18); break; - case 3: palSetPad(GPIOB, 19); break; - case 4: palSetPad(GPIOC, 0); break; - case 5: palSetPad(GPIOC, 8); break; - case 6: palSetPad(GPIOC, 9); break; - case 7: palSetPad(GPIOD, 0); break; - case 8: palSetPad(GPIOD, 1); break; - case 9: palSetPad(GPIOD, 4); break; + case 0: + palSetPad(GPIOB, 2); + break; + case 1: + palSetPad(GPIOB, 3); + break; + case 2: + palSetPad(GPIOB, 18); + break; + case 3: + palSetPad(GPIOB, 19); + break; + case 4: + palSetPad(GPIOC, 0); + break; + case 5: + palSetPad(GPIOC, 8); + break; + case 6: + palSetPad(GPIOC, 9); + break; + case 7: + palSetPad(GPIOD, 0); + break; + case 8: + palSetPad(GPIOD, 1); + break; + case 9: + palSetPad(GPIOD, 4); + break; } - // need wait to settle pin state - // if you wait too short, or have a too high update rate - // the keyboard might freeze, or there might not be enough - // processing power to update the LCD screen properly. - // 20us, or two ticks at 100000Hz seems to be OK - wait_us(20); + matrix_io_delay(); // read col data: { PTD5, PTD6, PTD7, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7 } data = ((palReadPort(GPIOC) & 0xFEUL) << 2) | @@ -79,60 +76,42 @@ uint8_t matrix_scan(void) // un-strobe row switch (row) { - case 0: palClearPad(GPIOB, 2); break; - case 1: palClearPad(GPIOB, 3); break; - case 2: palClearPad(GPIOB, 18); break; - case 3: palClearPad(GPIOB, 19); break; - case 4: palClearPad(GPIOC, 0); break; - case 5: palClearPad(GPIOC, 8); break; - case 6: palClearPad(GPIOC, 9); break; - case 7: palClearPad(GPIOD, 0); break; - case 8: palClearPad(GPIOD, 1); break; - case 9: palClearPad(GPIOD, 4); break; + case 0: + palClearPad(GPIOB, 2); + break; + case 1: + palClearPad(GPIOB, 3); + break; + case 2: + palClearPad(GPIOB, 18); + break; + case 3: + palClearPad(GPIOB, 19); + break; + case 4: + palClearPad(GPIOC, 0); + break; + case 5: + palClearPad(GPIOC, 8); + break; + case 6: + palClearPad(GPIOC, 9); + break; + case 7: + palClearPad(GPIOD, 0); + break; + case 8: + palClearPad(GPIOD, 1); + break; + case 9: + palClearPad(GPIOD, 4); + break; } - if (matrix_debouncing[row] != data) { - matrix_debouncing[row] = data; - debouncing = true; - debouncing_time = timer_read(); - } - } - - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { - for (int row = 0; row < MATRIX_ROWS; row++) { - matrix[row] = matrix_debouncing[row]; - } - debouncing = false; - } - - matrix_scan_quantum(); - return 1; -} - -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & (1 << col)); -} - -matrix_row_t matrix_get_row(uint8_t row) -{ - return matrix[row]; -} - -void matrix_print(void) -{ - xprintf("\nr/c 01234567\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - xprintf("%02X: ", row); - matrix_row_t data = matrix_get_row(row); - for (int col = 0; col < MATRIX_COLS; col++) { - if (data & (1< Date: Thu, 30 Jul 2020 05:04:14 +1000 Subject: [PATCH 02/17] Declare QMK in product name again --- keyboards/k_type/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h index 76a2496a9617..d43c1208d2f5 100644 --- a/keyboards/k_type/config.h +++ b/keyboards/k_type/config.h @@ -21,8 +21,8 @@ along with this program. If not, see . #define VENDOR_ID 0x1C11 #define PRODUCT_ID 0xB04D #define DEVICE_VER 0x0001 -#define MANUFACTURER Input Club -#define PRODUCT K-Type +#define MANUFACTURER Input:Club +#define PRODUCT K-Type (QMK) /* key matrix size */ #define MATRIX_ROWS 10 From b733b5996af3fcd5ee2f6c38cc06231eedd8db60 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 30 Jul 2020 05:38:49 +1000 Subject: [PATCH 03/17] Hopefully fix matrix scanning --- keyboards/k_type/matrix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/keyboards/k_type/matrix.c b/keyboards/k_type/matrix.c index 486994bc0439..cda3989cb3e4 100644 --- a/keyboards/k_type/matrix.c +++ b/keyboards/k_type/matrix.c @@ -108,9 +108,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { break; } - if (current_matrix[row] != data) { - changed = true; - } + changed |= current_matrix[row] != data; } return changed; From 97b497c9acb733e3d0fd6d2db9a2e4e7ddb1d0f7 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 30 Jul 2020 05:56:57 +1000 Subject: [PATCH 04/17] Maybe this time --- keyboards/k_type/matrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/k_type/matrix.c b/keyboards/k_type/matrix.c index cda3989cb3e4..33c002649e82 100644 --- a/keyboards/k_type/matrix.c +++ b/keyboards/k_type/matrix.c @@ -73,6 +73,8 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { // read col data: { PTD5, PTD6, PTD7, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7 } data = ((palReadPort(GPIOC) & 0xFEUL) << 2) | ((palReadPort(GPIOD) & 0xE0UL) >> 5); + changed |= current_matrix[row] != data; + current_matrix[row] = data; // un-strobe row switch (row) { @@ -107,8 +109,6 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { palClearPad(GPIOD, 4); break; } - - changed |= current_matrix[row] != data; } return changed; From c20e5820fc459f9540730971e8985559c74a2f06 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 30 Jul 2020 10:27:14 +1000 Subject: [PATCH 05/17] Partial (literally) RGB Matrix support --- keyboards/k_type/config.h | 17 +++ keyboards/k_type/k_type.c | 165 ++++++++++++++++++++++ keyboards/k_type/keymaps/default/keymap.c | 2 +- keyboards/k_type/keymaps/rgb/keymap.c | 22 +++ keyboards/k_type/rules.mk | 1 + 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 keyboards/k_type/keymaps/rgb/keymap.c diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h index d43c1208d2f5..abb3e0de8632 100644 --- a/keyboards/k_type/config.h +++ b/keyboards/k_type/config.h @@ -85,6 +85,23 @@ along with this program. If not, see . #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION +// i2c_master defines +#define I2C1_SCL 0 // A2 on pinout = B0 +#define I2C1_SDA 1 // A2 on pinout = B1 +#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 +//#define I2C2_SCL 10 // A2 on pinout = C10 +//#define I2C2_SDA 11 // A2 on pinout = C11 +//#define I2C2_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +//#define I2C2_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 + +#define DRIVER_ADDR_1 0b1010000 +#define DRIVER_ADDR_2 0b1010001 +#define DRIVER_COUNT 2 +#define DRIVER_1_LED_TOTAL 64 +//#define DRIVER_2_LED_TOTAL 55 +#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + /* Bootmagic Lite key configuration */ //#define BOOTMAGIC_LITE_ROW 0 //#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/k_type/k_type.c b/keyboards/k_type/k_type.c index ef3f431dd96d..0b5c679f7657 100644 --- a/keyboards/k_type/k_type.c +++ b/keyboards/k_type/k_type.c @@ -14,4 +14,169 @@ 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 "k_type.h" + +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { + { 0, B_1, A_1, C_1 }, + { 0, B_2, A_2, C_2 }, + { 0, B_3, A_3, C_3 }, + { 0, B_4, A_4, C_4 }, + { 0, B_5, A_5, C_5 }, + { 0, B_6, A_6, C_6 }, + { 0, B_7, A_7, C_7 }, + { 0, B_8, A_8, C_8 }, + { 0, B_9, A_9, C_9 }, + { 0, B_10, A_10, C_10 }, + { 0, B_11, A_11, C_11 }, + { 0, B_12, A_12, C_12 }, + { 0, B_13, A_13, C_13 }, + { 0, B_14, A_14, C_14 }, + { 0, B_15, A_15, C_15 }, + { 0, B_16, A_16, C_16 }, + + { 0, E_1, D_1, F_1 }, + { 0, E_2, D_2, F_2 }, + { 0, E_3, D_3, F_3 }, + { 0, E_4, D_4, F_4 }, + { 0, E_5, D_5, F_5 }, + { 0, E_6, D_6, F_6 }, + { 0, E_7, D_7, F_7 }, + { 0, E_8, D_8, F_8 }, + { 0, E_9, D_9, F_9 }, + { 0, E_10, D_1, F_10 }, + { 0, E_11, D_1, F_11 }, + { 0, E_12, D_1, F_12 }, + { 0, E_13, D_1, F_13 }, + { 0, E_14, D_1, F_14 }, + { 0, E_15, D_15, F_15 }, + { 0, E_16, D_16, F_16 }, + + { 0, H_1, G_1, I_1 }, + { 0, H_2, G_2, I_2 }, + { 0, H_3, G_3, I_3 }, + { 0, H_4, G_4, I_4 }, + { 0, H_5, G_5, I_5 }, + { 0, H_6, G_6, I_6 }, + { 0, H_7, G_7, I_7 }, + { 0, H_8, G_8, I_8 }, + { 0, H_9, G_9, I_9 }, + { 0, H_10, G_1, I_10 }, + { 0, H_11, G_1, I_11 }, + { 0, H_12, G_1, I_12 }, + { 0, H_13, G_1, I_13 }, + { 0, H_14, G_1, I_14 }, + { 0, H_15, G_15, I_15 }, + { 0, H_16, G_16, I_16 }, + + { 0, K_1, J_1, L_1 }, + { 0, K_2, J_2, L_2 }, + { 0, K_3, J_3, L_3 }, + { 0, K_4, J_4, L_4 }, + { 0, K_5, J_5, L_5 }, + { 0, K_6, J_6, L_6 }, + { 0, K_7, J_7, L_7 }, + { 0, K_8, J_8, L_8 }, + { 0, K_9, J_9, L_9 }, + { 0, K_10, J_1, L_10 }, + { 0, K_11, J_1, L_11 }, + { 0, K_12, J_1, L_12 }, + { 0, K_13, J_1, L_13 }, + { 0, K_14, J_1, L_14 }, + { 0, K_15, J_15, L_15 }, + { 0, K_16, J_16, L_16 }, + + // Driver 2 is on I2C2 - currently not usable with i2c_master + //{ 1, B_1, A_1, C_1 }, + //{ 1, B_2, A_2, C_2 }, + //{ 1, B_3, A_3, C_3 }, + //{ 1, B_4, A_4, C_4 }, + //{ 1, B_5, A_5, C_5 }, + //{ 1, B_6, A_6, C_6 }, + //{ 1, B_7, A_7, C_7 }, + //{ 1, B_8, A_8, C_8 }, + //{ 1, B_9, A_9, C_9 }, + //{ 1, B_10, A_10, C_10 }, + //{ 1, B_11, A_11, C_11 }, + //{ 1, B_12, A_12, C_12 }, + //{ 1, B_13, A_13, C_13 }, + //{ 1, B_14, A_14, C_14 }, + //{ 1, B_15, A_15, C_15 }, + //{ 1, B_16, A_16, C_16 }, + + //{ 1, E_1, D_1, F_1 }, + //{ 1, E_2, D_2, F_2 }, + //{ 1, E_3, D_3, F_3 }, + //{ 1, E_4, D_4, F_4 }, + //{ 1, E_5, D_5, F_5 }, + //{ 1, E_6, D_6, F_6 }, + //{ 1, E_7, D_7, F_7 }, + //{ 1, E_8, D_8, F_8 }, + //{ 1, E_9, D_9, F_9 }, + //{ 1, E_10, D_1, F_10 }, + //{ 1, E_11, D_1, F_11 }, + //{ 1, E_12, D_1, F_12 }, + //{ 1, E_13, D_1, F_13 }, + //{ 1, E_14, D_1, F_14 }, + //{ 1, E_15, D_15, F_15 }, + //{ 1, E_16, D_16, F_16 }, + + //{ 1, H_1, G_1, I_1 }, + //{ 1, H_2, G_2, I_2 }, + //{ 1, H_3, G_3, I_3 }, + //{ 1, H_4, G_4, I_4 }, + //{ 1, H_5, G_5, I_5 }, + //{ 1, H_6, G_6, I_6 }, + //{ 1, H_7, G_7, I_7 }, + //{ 1, H_8, G_8, I_8 }, + //{ 1, H_9, G_9, I_9 }, + //{ 1, H_10, G_1, I_10 }, + //{ 1, H_11, G_1, I_11 }, + //{ 1, H_12, G_1, I_12 }, + //{ 1, H_13, G_1, I_13 }, + //{ 1, H_14, G_1, I_14 }, + //{ 1, H_15, G_15, I_15 }, + //{ 1, H_16, G_16, I_16 }, + + //{ 1, K_1, J_1, L_1 }, + //{ 1, K_2, J_2, L_2 }, + //{ 1, K_3, J_3, L_3 }, + //{ 1, K_4, J_4, L_4 }, + //{ 1, K_5, J_5, L_5 }, + //{ 1, K_6, J_6, L_6 }, + //{ 1, K_7, J_7, L_7 } +}; + +led_config_t g_led_config = { + { + // Key Matrix to LED Index + { 0, 10, 20, 29, 38, 47, 57, NO_LED, NO_LED, NO_LED }, + { 1, 11, 21, NO_LED, 39, 48, 58, NO_LED, NO_LED, NO_LED }, + { 2, 12, 22, 30, 40, 49, 59, NO_LED, NO_LED, NO_LED }, + { 3, 13, 23, 31, 41, 50, 60, NO_LED, NO_LED, NO_LED }, + { 4, 14, 24, 32, 42, 51, 61, NO_LED, NO_LED, NO_LED }, + { 5, 15, 25, 33, 43, 52, NO_LED, NO_LED, NO_LED, NO_LED }, + { 6, 16, 26, 34, 44, 53, 62, NO_LED, NO_LED, NO_LED }, + { 7, 17, 27, 35, 45, 54, NO_LED, NO_LED, NO_LED, NO_LED }, + { 8, 18, 28, 36, 46, 55, 63, NO_LED, NO_LED, NO_LED }, + { 9, 19, NO_LED, 37, NO_LED, 56, NO_LED, NO_LED, NO_LED, NO_LED } + }, { + // LED Index to Physical Position + { 0, 0 }, { 26.35, 0 }, { 39.53, 0 }, { 52.71, 0 }, { 65.88, 0 }, { 79.06, 0 }, { 92.24, 0 }, { 105.41, 0 }, { 118.59, 0 }, { 131.77, 0 }, { 144.94, 0 }, { 158.12, 0 }, { 171.29, 0 }, { 197.65, 0 }, { 210.82, 0 }, { 224, 0 }, + + { 0, 21.33 }, { 13.18, 21.33 }, { 26.35, 21.33 }, { 39.53, 21.33 }, { 52.71, 21.33 }, { 65.88, 21.33 }, { 79.06, 21.33 }, { 92.24, 21.33 }, { 105.41, 21.33 }, { 118.59, 21.33 }, { 131.77, 21.33 }, { 144.94, 21.33 }, { 158.12, 21.33 }, { 171.29, 21.33 }, { 197.65, 21.33 }, { 210.82, 21.33 }, { 224, 21.33 }, + { 0, 32 }, { 13.18, 32 }, { 26.35, 32 }, { 39.53, 32 }, { 52.71, 32 }, { 65.88, 32 }, { 79.06, 32 }, { 92.24, 32 }, { 105.41, 32 }, { 118.59, 32 }, { 131.77, 32 }, { 144.94, 32 }, { 158.12, 32 }, { 171.29, 32 }, { 197.65, 32 }, { 210.82, 32 }, { 224, 32 }, + { 0, 42.67 }, { 13.18, 42.67 }, { 26.35, 42.67 }, { 39.53, 42.67 }, { 52.71, 42.67 }, { 65.88, 42.67 }, { 79.06, 42.67 }, { 92.24, 42.67 }, { 105.41, 42.67 }, { 118.59, 42.67 }, { 131.77, 42.67 }, { 144.94, 42.67 }, { 171.29, 42.67 }, + { 0, 53.33 }, //{ 26.35, 53.33 }, { 39.53, 53.33 }, { 52.71, 53.33 }, { 65.88, 53.33 }, { 79.06, 53.33 }, { 92.24, 53.33 }, { 105.41, 53.33 }, { 118.59, 53.33 }, { 131.77, 53.33 }, { 144.94, 53.33 }, { 171.29, 53.33 }, { 210.82, 53.33 }, + //{ 0, 64 }, { 13.18, 64 }, { 26.35, 64 }, { 79.06, 64 }, { 131.77, 64 }, { 144.94, 64 }, { 158.12, 64 }, { 171.29, 64 }, { 197.65, 64 }, { 210.82, 64 }, { 224, 64 } + }, { + // LED Index to Flag + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, //4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + //1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1 + } +}; diff --git a/keyboards/k_type/keymaps/default/keymap.c b/keyboards/k_type/keymaps/default/keymap.c index 39411b1c2c39..b8df4df5ee28 100644 --- a/keyboards/k_type/keymaps/default/keymap.c +++ b/keyboards/k_type/keymaps/default/keymap.c @@ -8,6 +8,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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, KC_DEL, KC_END, KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ) }; diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c new file mode 100644 index 000000000000..5783b417410f --- /dev/null +++ b/keyboards/k_type/keymaps/rgb/keymap.c @@ -0,0 +1,22 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_tkl_ansi( + KC_ESC, 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_PSCR, KC_SLCK, KC_PAUS, + + 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_BSPC, KC_INS, KC_HOME, KC_PGUP, + 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, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [0] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/k_type/rules.mk b/keyboards/k_type/rules.mk index ce4c54a84f72..ec94414f355e 100644 --- a/keyboards/k_type/rules.mk +++ b/keyboards/k_type/rules.mk @@ -26,6 +26,7 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = IS31FL3733 CUSTOM_MATRIX = lite LAYOUTS = tkl_ansi From f2932251fe09dd3bf0411613763d99b54897c843 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 30 Jul 2020 10:29:04 +1000 Subject: [PATCH 06/17] Put RGB_MATRIX_ENABLE into rgb keymap for now --- keyboards/k_type/keymaps/rgb/rules.mk | 1 + keyboards/k_type/rules.mk | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 keyboards/k_type/keymaps/rgb/rules.mk diff --git a/keyboards/k_type/keymaps/rgb/rules.mk b/keyboards/k_type/keymaps/rgb/rules.mk new file mode 100644 index 000000000000..a4206a1ad72e --- /dev/null +++ b/keyboards/k_type/keymaps/rgb/rules.mk @@ -0,0 +1 @@ +RGB_MATRIX_ENABLE = IS31FL3733 diff --git a/keyboards/k_type/rules.mk b/keyboards/k_type/rules.mk index ec94414f355e..ce4c54a84f72 100644 --- a/keyboards/k_type/rules.mk +++ b/keyboards/k_type/rules.mk @@ -26,7 +26,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output -RGB_MATRIX_ENABLE = IS31FL3733 CUSTOM_MATRIX = lite LAYOUTS = tkl_ansi From fb71dcbb3173580ec57a01b976d8492125749f57 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 30 Jul 2020 10:30:00 +1000 Subject: [PATCH 07/17] Add ifdefs for RGB config --- keyboards/k_type/k_type.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/k_type/k_type.c b/keyboards/k_type/k_type.c index 0b5c679f7657..ae62f0e72331 100644 --- a/keyboards/k_type/k_type.c +++ b/keyboards/k_type/k_type.c @@ -17,6 +17,7 @@ along with this program. If not, see . #include "k_type.h" +#ifdef RGB_MATRIX_ENABLE const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { { 0, B_1, A_1, C_1 }, { 0, B_2, A_2, C_2 }, @@ -180,3 +181,4 @@ led_config_t g_led_config = { //1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1 } }; +#endif From 55c78c0db807fa1817d2dd509341639f25009690 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Fri, 31 Jul 2020 13:47:27 +1000 Subject: [PATCH 08/17] Set layer 1 to actually be layer 1... --- keyboards/k_type/keymaps/rgb/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c index 5783b417410f..84f3d1326997 100644 --- a/keyboards/k_type/keymaps/rgb/keymap.c +++ b/keyboards/k_type/keymaps/rgb/keymap.c @@ -10,7 +10,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), - [0] = LAYOUT_tkl_ansi( + [1] = LAYOUT_tkl_ansi( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, From d633f1878dceac165cb08bb64e6f93dfe161f4f4 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 1 Aug 2020 03:36:06 +1000 Subject: [PATCH 09/17] Update keyboards/k_type/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> --- keyboards/k_type/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/k_type/readme.md b/keyboards/k_type/readme.md index f18c06c3575a..11123c357c27 100644 --- a/keyboards/k_type/readme.md +++ b/keyboards/k_type/readme.md @@ -4,7 +4,7 @@ Firmware for custom keyboard PCB with TKL Key Layout * Keyboard Maintainer: [Kaleb Elwert](https://github.com/belak) * Hardware Supported: Input Club K-Type -* Hardware Availability: [Input Club](https://input.club/k-type/), [Massdrop](https://www.massdrop.com/buy/massdrop-x-input-club-k-type-mechanical-keyboard?utm_source=linkshare&referer=WJJG5M) +* Hardware Availability: [Input Club](https://input.club/k-type/), [Massdrop](https://www.massdrop.com/buy/massdrop-x-input-club-k-type-mechanical-keyboard) Make example for this keyboard (after setting up your build environment): From 0e7f91adeb0cd75f21513dccf199c8ce44749fae Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 04:38:11 +1000 Subject: [PATCH 10/17] Put all RGB config in keymap for now --- keyboards/k_type/config.h | 17 ----------------- keyboards/k_type/keymaps/rgb/config.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 keyboards/k_type/keymaps/rgb/config.h diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h index abb3e0de8632..d43c1208d2f5 100644 --- a/keyboards/k_type/config.h +++ b/keyboards/k_type/config.h @@ -85,23 +85,6 @@ along with this program. If not, see . #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION -// i2c_master defines -#define I2C1_SCL 0 // A2 on pinout = B0 -#define I2C1_SDA 1 // A2 on pinout = B1 -#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 -#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 -//#define I2C2_SCL 10 // A2 on pinout = C10 -//#define I2C2_SDA 11 // A2 on pinout = C11 -//#define I2C2_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 -//#define I2C2_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 - -#define DRIVER_ADDR_1 0b1010000 -#define DRIVER_ADDR_2 0b1010001 -#define DRIVER_COUNT 2 -#define DRIVER_1_LED_TOTAL 64 -//#define DRIVER_2_LED_TOTAL 55 -#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL - /* Bootmagic Lite key configuration */ //#define BOOTMAGIC_LITE_ROW 0 //#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/k_type/keymaps/rgb/config.h b/keyboards/k_type/keymaps/rgb/config.h new file mode 100644 index 000000000000..206b76f2b674 --- /dev/null +++ b/keyboards/k_type/keymaps/rgb/config.h @@ -0,0 +1,23 @@ +#pragma once + +#ifdef RGB_MATRIX_ENABLE +# define RGB_MATRIX_KEYPRESSES +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL + +// i2c_master defines +# define I2C1_SCL 0 // A2 on pinout = B0 +# define I2C1_SDA 1 // A2 on pinout = B1 +# define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +# define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 +//# define I2C2_SCL 10 // A2 on pinout = C10 +//# define I2C2_SDA 11 // A2 on pinout = C11 +//# define I2C2_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +//# define I2C2_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 + +# define DRIVER_ADDR_1 0b1010000 +# define DRIVER_ADDR_2 0b1010001 +# define DRIVER_COUNT 2 +# define DRIVER_1_LED_TOTAL 64 +//# define DRIVER_2_LED_TOTAL 55 +# define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL +#endif From 93811c0055e577360fed278d7a294a5ca6a2ace8 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 05:12:58 +1000 Subject: [PATCH 11/17] Set SDB high? --- keyboards/k_type/keymaps/rgb/keymap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c index 84f3d1326997..241000b3f125 100644 --- a/keyboards/k_type/keymaps/rgb/keymap.c +++ b/keyboards/k_type/keymaps/rgb/keymap.c @@ -20,3 +20,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; + +#ifdef RGB_MATRIX_ENABLE +// Turn off SDB +void keyboard_post_init_kb() { + palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); + palSetPad(GPIOB, 16); +} +#endif From 8c8dd7856d5c0e35c284c25733001fec2d0813cf Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 05:30:20 +1000 Subject: [PATCH 12/17] Before `rgb_matrix_init()` would be best --- keyboards/k_type/keymaps/rgb/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c index 241000b3f125..77e024356ac4 100644 --- a/keyboards/k_type/keymaps/rgb/keymap.c +++ b/keyboards/k_type/keymaps/rgb/keymap.c @@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef RGB_MATRIX_ENABLE // Turn off SDB -void keyboard_post_init_kb() { +void keyboard_pre_init_kb() { palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(GPIOB, 16); } From e2b705c96c9815f30758f32f3ff93e978653b4f8 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 05:46:11 +1000 Subject: [PATCH 13/17] User level, not keyboard --- keyboards/k_type/keymaps/rgb/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c index 77e024356ac4..4ed15e5d6658 100644 --- a/keyboards/k_type/keymaps/rgb/keymap.c +++ b/keyboards/k_type/keymaps/rgb/keymap.c @@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef RGB_MATRIX_ENABLE // Turn off SDB -void keyboard_pre_init_kb() { +void keyboard_pre_init_user() { palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(GPIOB, 16); } From 8ffdc211efe60f1e79ec84a8f7e7972c3dbca9b6 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 05:52:52 +1000 Subject: [PATCH 14/17] Combating dropped keys --- keyboards/k_type/keymaps/rgb/config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/keyboards/k_type/keymaps/rgb/config.h b/keyboards/k_type/keymaps/rgb/config.h index 206b76f2b674..724fae3894f8 100644 --- a/keyboards/k_type/keymaps/rgb/config.h +++ b/keyboards/k_type/keymaps/rgb/config.h @@ -3,6 +3,8 @@ #ifdef RGB_MATRIX_ENABLE # define RGB_MATRIX_KEYPRESSES # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL +# define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 +# define RGB_MATRIX_LED_FLUSH_LIMIT 16 // i2c_master defines # define I2C1_SCL 0 // A2 on pinout = B0 From cc2e63c4064c64043ebb288c1a6f72b79f924fd5 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 1 Aug 2020 05:56:55 +1000 Subject: [PATCH 15/17] Nope --- keyboards/k_type/keymaps/rgb/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/k_type/keymaps/rgb/config.h b/keyboards/k_type/keymaps/rgb/config.h index 724fae3894f8..206b76f2b674 100644 --- a/keyboards/k_type/keymaps/rgb/config.h +++ b/keyboards/k_type/keymaps/rgb/config.h @@ -3,8 +3,6 @@ #ifdef RGB_MATRIX_ENABLE # define RGB_MATRIX_KEYPRESSES # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL -# define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 -# define RGB_MATRIX_LED_FLUSH_LIMIT 16 // i2c_master defines # define I2C1_SCL 0 // A2 on pinout = B0 From edc0948e0c257d52f6a6d536466a738d55b0e415 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 8 Aug 2020 14:17:42 +1000 Subject: [PATCH 16/17] Readme for RGB keymap --- keyboards/k_type/keymaps/rgb/readme.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 keyboards/k_type/keymaps/rgb/readme.md diff --git a/keyboards/k_type/keymaps/rgb/readme.md b/keyboards/k_type/keymaps/rgb/readme.md new file mode 100644 index 000000000000..794052c57af2 --- /dev/null +++ b/keyboards/k_type/keymaps/rgb/readme.md @@ -0,0 +1,5 @@ +# K-Type RGB Matrix Keymap + +This is an experimental keymap adding support for RGB Matrix on the K-Type. + +The board has two IS31FL3733 LED controllers, but they are each on different I2C buses, which QMK's `i2c_master` implementation currently does not support. As a result, all the keys after the left shift will not be lit. From 3118d778aa508e188c73ce701af281eeb847e22d Mon Sep 17 00:00:00 2001 From: fauxpark Date: Fri, 21 Aug 2020 13:17:09 +1000 Subject: [PATCH 17/17] Remove custom matrix --- keyboards/k_type/config.h | 19 ++++++- keyboards/k_type/k_type.h | 32 +++++------ keyboards/k_type/matrix.c | 115 -------------------------------------- keyboards/k_type/rules.mk | 4 -- quantum/config_common.h | 2 + 5 files changed, 35 insertions(+), 137 deletions(-) delete mode 100644 keyboards/k_type/matrix.c diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h index d43c1208d2f5..82f641c533a7 100644 --- a/keyboards/k_type/config.h +++ b/keyboards/k_type/config.h @@ -28,6 +28,23 @@ along with this program. If not, see . #define MATRIX_ROWS 10 #define MATRIX_COLS 10 +/* + * 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 { D5, D6, D7, C1, C2, C3, C4, C5, C6, C7 } +#define MATRIX_COL_PINS { B2, B3, B18, B19, C0, C8, C9, D0, D1, D4 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 @@ -88,5 +105,3 @@ along with this program. If not, see . /* Bootmagic Lite key configuration */ //#define BOOTMAGIC_LITE_ROW 0 //#define BOOTMAGIC_LITE_COLUMN 0 - -#define KIIBOHD_BOOTLOADER diff --git a/keyboards/k_type/k_type.h b/keyboards/k_type/k_type.h index ef710fffa4aa..077c0130662f 100644 --- a/keyboards/k_type/k_type.h +++ b/keyboards/k_type/k_type.h @@ -22,21 +22,21 @@ along with this program. If not, see . #define XXX KC_NO #define LAYOUT_tkl_ansi( \ - k00, k10, k20, k30, k40, k50, k60, k70, k80, k90, k01, k11, k21, k31, k41, k51, \ - k61, k71, k81, k91, k02, k12, k22, k32, k42, k52, k62, k72, k82, k03, k23, k33, k43, \ - k53, k63, k73, k83, k93, k04, k14, k24, k34, k44, k54, k64, k74, k84, k05, k15, k25, \ - k35, k45, k55, k65, k75, k85, k95, k06, k16, k26, k36, k46, k66, \ - k86, k07, k17, k27, k37, k47, k57, k67, k77, k87, k97, k18, k38, \ - k48, k58, k68, k78, k88, k98, k09, k19, k29, k39, k49 \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, k14, k15, \ + k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, k28, k30, k32, k33, k34, \ + k35, k36, k37, k38, k39, k40, k41, k42, k43, k44, k45, k46, k47, k48, k50, k51, k52, \ + k53, k54, k55, k56, k57, k58, k59, k60, k61, k62, k63, k64, k66, \ + k68, k70, k71, k72, k73, k74, k75, k76, k77, k78, k79, k81, k83, \ + k84, k85, k86, k87, k88, k89, k90, k91, k92, k93, k94 \ ) { \ - { k00, k01, k02, k03, k04, k05, k06, k07, XXX, k09 }, \ - { k10, k11, k12, XXX, k14, k15, k16, k17, k18, k19 }, \ - { k20, k21, k22, k23, k24, k25, k26, k27, XXX, k29 }, \ - { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39 }, \ - { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49 }, \ - { k50, k51, k52, k53, k54, k55, XXX, k57, k58, XXX }, \ - { k60, k61, k62, k63, k64, k65, k66, k67, k68, XXX }, \ - { k70, k71, k72, k73, k74, k75, XXX, k77, k78, XXX }, \ - { k80, k81, k82, k83, k84, k85, k86, k87, k88, XXX }, \ - { k90, k91, XXX, k93, XXX, k95, XXX, k97, k98, XXX } \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, XXX }, \ + { k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39 }, \ + { k40, k41, k42, k43, k44, k45, k46, k47, k48, XXX }, \ + { k50, k51, k52, k53, k54, k55, k56, k57, k58, k59 }, \ + { k60, k61, k62, k63, k64, XXX, k66, XXX, k68, XXX }, \ + { k70, k71, k72, k73, k74, k75, k76, k77, k78, k79 }, \ + { XXX, k81, XXX, k83, k84, k85, k86, k87, k88, k89 }, \ + { k90, k91, k92, k93, k94, XXX, XXX, XXX, XXX, XXX } \ } diff --git a/keyboards/k_type/matrix.c b/keyboards/k_type/matrix.c deleted file mode 100644 index 33c002649e82..000000000000 --- a/keyboards/k_type/matrix.c +++ /dev/null @@ -1,115 +0,0 @@ -#include "matrix.h" - -#include "quantum.h" - -void matrix_init_custom(void) { - /* Column(sense) */ - palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 6, PAL_MODE_INPUT_PULLDOWN); - palSetPadMode(GPIOC, 7, PAL_MODE_INPUT_PULLDOWN); - - /* Row(strobe) */ - palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 18, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOB, 19, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 8, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL); - palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); -} - -bool matrix_scan_custom(matrix_row_t current_matrix[]) { - bool changed = false; - - for (int row = 0; row < MATRIX_ROWS; row++) { - matrix_row_t data = 0; - - // strobe row - switch (row) { - case 0: - palSetPad(GPIOB, 2); - break; - case 1: - palSetPad(GPIOB, 3); - break; - case 2: - palSetPad(GPIOB, 18); - break; - case 3: - palSetPad(GPIOB, 19); - break; - case 4: - palSetPad(GPIOC, 0); - break; - case 5: - palSetPad(GPIOC, 8); - break; - case 6: - palSetPad(GPIOC, 9); - break; - case 7: - palSetPad(GPIOD, 0); - break; - case 8: - palSetPad(GPIOD, 1); - break; - case 9: - palSetPad(GPIOD, 4); - break; - } - - matrix_io_delay(); - - // read col data: { PTD5, PTD6, PTD7, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7 } - data = ((palReadPort(GPIOC) & 0xFEUL) << 2) | - ((palReadPort(GPIOD) & 0xE0UL) >> 5); - changed |= current_matrix[row] != data; - current_matrix[row] = data; - - // un-strobe row - switch (row) { - case 0: - palClearPad(GPIOB, 2); - break; - case 1: - palClearPad(GPIOB, 3); - break; - case 2: - palClearPad(GPIOB, 18); - break; - case 3: - palClearPad(GPIOB, 19); - break; - case 4: - palClearPad(GPIOC, 0); - break; - case 5: - palClearPad(GPIOC, 8); - break; - case 6: - palClearPad(GPIOC, 9); - break; - case 7: - palClearPad(GPIOD, 0); - break; - case 8: - palClearPad(GPIOD, 1); - break; - case 9: - palClearPad(GPIOD, 4); - break; - } - } - - return changed; -} diff --git a/keyboards/k_type/rules.mk b/keyboards/k_type/rules.mk index ce4c54a84f72..5d2991c8c0bf 100644 --- a/keyboards/k_type/rules.mk +++ b/keyboards/k_type/rules.mk @@ -26,12 +26,8 @@ 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 LAYOUTS = tkl_ansi -# project specific files -SRC += matrix.c - # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE diff --git a/quantum/config_common.h b/quantum/config_common.h index 9b28e8d63f8c..84edc46395e6 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -218,6 +218,8 @@ # define B15 PAL_LINE(GPIOB, 15) # define B16 PAL_LINE(GPIOB, 16) # define B17 PAL_LINE(GPIOB, 17) +# define B18 PAL_LINE(GPIOB, 18) +# define B19 PAL_LINE(GPIOB, 19) # define C0 PAL_LINE(GPIOC, 0) # define C1 PAL_LINE(GPIOC, 1) # define C2 PAL_LINE(GPIOC, 2)