K-Type refactor (#9864)

* K-Type refactor

* Declare QMK in product name again

* Hopefully fix matrix scanning

* Maybe this time

* Partial (literally) RGB Matrix support

* Put RGB_MATRIX_ENABLE into rgb keymap for now

* Add ifdefs for RGB config

* Set layer 1 to actually be layer 1...

* Update keyboards/k_type/readme.md

* Put all RGB config in keymap for now

* Set SDB high?

* Before `rgb_matrix_init()` would be best

* User level, not keyboard

* Combating dropped keys

* Nope

* Readme for RGB keymap

* Remove custom matrix
master
Ryan 2020-08-26 18:41:32 +10:00 committed by James Young
parent 0f596881b3
commit 629cfc7f5e
14 changed files with 468 additions and 245 deletions

View File

@ -15,30 +15,73 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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 MANUFACTURER Input Club
#define PRODUCT K-Type/QMK
#define VENDOR_ID 0x1C11
#define PRODUCT_ID 0xB04D
#define DEVICE_VER 0x0001
#define MANUFACTURER Input:Club
#define PRODUCT K-Type (QMK)
/* key matrix size */
#define MATRIX_ROWS 10
#define MATRIX_COLS 10
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/*
* 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
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* 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.
@ -54,7 +97,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#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

View File

@ -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}
]
}
}
}

View File

@ -14,20 +14,171 @@ 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 "k_type.h"
__attribute__ ((weak))
void matrix_init_user(void) {
}
#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 },
{ 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 },
__attribute__ ((weak))
void matrix_scan_user(void) {
}
{ 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 },
void matrix_init_kb(void) {
matrix_init_user();
{ 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 }
};
void matrix_scan_kb(void) {
matrix_scan_user();
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
}
};
#endif

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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 \
) { \
{ 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, }, \
}
#define XXX KC_NO
#endif
#define LAYOUT_tkl_ansi( \
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, 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 } \
}

View File

@ -1,31 +1,27 @@
#include "k_type.h"
#include QMK_KEYBOARD_H
#define _QW 0
#define _L1 1
enum layer_names {
_QW,
_L1
};
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),
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
[_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,
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
)
};

View File

@ -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_APP , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
)
};

View File

@ -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

View File

@ -0,0 +1,30 @@
#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
),
[1] = LAYOUT_tkl_ansi(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
#ifdef RGB_MATRIX_ENABLE
// Turn off SDB
void keyboard_pre_init_user() {
palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOB, 16);
}
#endif

View File

@ -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.

View File

@ -0,0 +1 @@
RGB_MATRIX_ENABLE = IS31FL3733

View File

@ -1,138 +0,0 @@
//#include <stdint.h>
//#include <stdbool.h>
#include <string.h>
#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;
/* 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);
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum();
}
uint8_t matrix_scan(void)
{
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;
}
// 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);
// read col data: { PTD5, PTD6, PTD7, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7 }
data = ((palReadPort(GPIOC) & 0xFEUL) << 2) |
((palReadPort(GPIOD) & 0xE0UL) >> 5);
// 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;
}
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<<col))
xprintf("1");
else
xprintf("0");
}
xprintf("\n");
}
wait_ms(50);
}

View File

@ -2,12 +2,16 @@
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)
* 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)
Make example for this keyboard (after setting up your build environment):
make k_type:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
Flashing example for this keyboard:
make k_type: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).

View File

@ -11,21 +11,23 @@ BOOTLOADER = kiibohd
BOARD = IC_TEENSY_3_1
# Build Options
# comment out to disable the options.
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file
DEBUG_ENABLE = yes
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # 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 = yes # 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
# project specific files
SRC = matrix.c
LAYOUTS = tkl_ansi
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE

View File

@ -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)