aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2020-08-26 18:41:32 +1000
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit629cfc7f5ebd815231c9e3f969170995db1481c6 (patch)
tree304d39adec9eaddcccdc25be04fbc1e306b22122
parent0f596881b36587a298568192078f9b467c51c109 (diff)
downloadqmk_firmware-629cfc7f5ebd815231c9e3f969170995db1481c6.tar.gz
qmk_firmware-629cfc7f5ebd815231c9e3f969170995db1481c6.zip
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
-rw-r--r--keyboards/k_type/config.h75
-rw-r--r--keyboards/k_type/info.json118
-rw-r--r--keyboards/k_type/k_type.c171
-rw-r--r--keyboards/k_type/k_type.h42
-rw-r--r--keyboards/k_type/keymaps/belak/keymap.c46
-rw-r--r--keyboards/k_type/keymaps/default/keymap.c16
-rw-r--r--keyboards/k_type/keymaps/rgb/config.h23
-rw-r--r--keyboards/k_type/keymaps/rgb/keymap.c30
-rw-r--r--keyboards/k_type/keymaps/rgb/readme.md5
-rw-r--r--keyboards/k_type/keymaps/rgb/rules.mk1
-rw-r--r--keyboards/k_type/matrix.c138
-rw-r--r--keyboards/k_type/readme.md12
-rw-r--r--keyboards/k_type/rules.mk28
-rw-r--r--quantum/config_common.h2
14 files changed, 465 insertions, 242 deletions
diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h
index 86b08769d..82f641c53 100644
--- a/keyboards/k_type/config.h
+++ b/keyboards/k_type/config.h
@@ -15,30 +15,73 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_H 18#pragma once
19#define CONFIG_H
20 19
21/* USB Device descriptor parameter */ 20/* USB Device descriptor parameter */
22#define VENDOR_ID 0x1c11 21#define VENDOR_ID 0x1C11
23#define PRODUCT_ID 0xb04d 22#define PRODUCT_ID 0xB04D
24#define DEVICE_VER 0x0001 23#define DEVICE_VER 0x0001
25#define MANUFACTURER Input Club 24#define MANUFACTURER Input:Club
26#define PRODUCT K-Type/QMK 25#define PRODUCT K-Type (QMK)
26
27/* key matrix size */ 27/* key matrix size */
28#define MATRIX_ROWS 10 28#define MATRIX_ROWS 10
29#define MATRIX_COLS 10 29#define MATRIX_COLS 10
30 30
31/* define if matrix has ghost */ 31/*
32//#define MATRIX_HAS_GHOST 32 * Keyboard Matrix Assignments
33 *
34 * Change this to how you wired your keyboard
35 * COLS: AVR pins used for columns, left to right
36 * ROWS: AVR pins used for rows, top to bottom
37 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
38 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
39 *
40 */
41#define MATRIX_ROW_PINS { D5, D6, D7, C1, C2, C3, C4, C5, C6, C7 }
42#define MATRIX_COL_PINS { B2, B3, B18, B19, C0, C8, C9, D0, D1, D4 }
43#define UNUSED_PINS
33 44
34/* Set 0 if debouncing isn't needed */ 45/* COL2ROW, ROW2COL */
35#define DEBOUNCE 5 46#define DIODE_DIRECTION COL2ROW
47
48/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
49#define DEBOUNCE 5
50
51/* define if matrix has ghost (lacks anti-ghosting diodes) */
52//#define MATRIX_HAS_GHOST
36 53
37/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ 54/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
38//#define LOCKING_SUPPORT_ENABLE 55//#define LOCKING_SUPPORT_ENABLE
39/* Locking resynchronize hack */ 56/* Locking resynchronize hack */
40//#define LOCKING_RESYNC_ENABLE 57//#define LOCKING_RESYNC_ENABLE
41 58
59/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
60 * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
61 */
62//#define GRAVE_ESC_CTRL_OVERRIDE
63
64/*
65 * Force NKRO
66 *
67 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
68 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
69 * makefile for this to work.)
70 *
71 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
72 * until the next keyboard reset.
73 *
74 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
75 * fully operational during normal computer usage.
76 *
77 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
78 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
79 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
80 * power-up.
81 *
82 */
83//#define FORCE_NKRO
84
42/* 85/*
43 * Feature disable options 86 * Feature disable options
44 * These options are also useful to firmware size reduction. 87 * 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/>.
54//#define NO_ACTION_LAYER 97//#define NO_ACTION_LAYER
55//#define NO_ACTION_TAPPING 98//#define NO_ACTION_TAPPING
56//#define NO_ACTION_ONESHOT 99//#define NO_ACTION_ONESHOT
57//#define NO_ACTION_MACRO
58//#define NO_ACTION_FUNCTION
59 100
60#endif 101/* disable these deprecated features by default */
102#define NO_ACTION_MACRO
103#define NO_ACTION_FUNCTION
104
105/* Bootmagic Lite key configuration */
106//#define BOOTMAGIC_LITE_ROW 0
107//#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/k_type/info.json b/keyboards/k_type/info.json
index 9d3e10568..fd4c95274 100644
--- a/keyboards/k_type/info.json
+++ b/keyboards/k_type/info.json
@@ -1,12 +1,110 @@
1{ 1{
2 "keyboard_name": "K-Type", 2 "keyboard_name": "K-Type",
3 "url": "", 3 "url": "",
4 "maintainer": "qmk", 4 "maintainer": "qmk",
5 "width": 18.25, 5 "width": 18.25,
6 "height": 6.5, 6 "height": 6.5,
7 "layouts": { 7 "layouts": {
8 "KEYMAP": { 8 "LAYOUT_tkl_ansi": {
9 "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}] 9 "layout": [
10 } 10 {"x": 0, "y": 0},
11 } 11 {"x": 2, "y": 0},
12 {"x": 3, "y": 0},
13 {"x": 4, "y": 0},
14 {"x": 5, "y": 0},
15 {"x": 6.5, "y": 0},
16 {"x": 7.5, "y": 0},
17 {"x": 8.5, "y": 0},
18 {"x": 9.5, "y": 0},
19 {"x": 11, "y": 0},
20 {"x": 12, "y": 0},
21 {"x": 13, "y": 0},
22 {"x": 14, "y": 0},
23
24 {"x": 15.25, "y": 0},
25 {"x": 16.25, "y": 0},
26 {"x": 17.25, "y": 0},
27
28 {"x": 0, "y": 1.5},
29 {"x": 1, "y": 1.5},
30 {"x": 2, "y": 1.5},
31 {"x": 3, "y": 1.5},
32 {"x": 4, "y": 1.5},
33 {"x": 5, "y": 1.5},
34 {"x": 6, "y": 1.5},
35 {"x": 7, "y": 1.5},
36 {"x": 8, "y": 1.5},
37 {"x": 9, "y": 1.5},
38 {"x": 10, "y": 1.5},
39 {"x": 11, "y": 1.5},
40 {"x": 12, "y": 1.5},
41 {"x": 13, "y": 1.5, "w": 2},
42
43 {"x": 15.25, "y": 1.5},
44 {"x": 16.25, "y": 1.5},
45 {"x": 17.25, "y": 1.5},
46
47 {"x": 0, "y": 2.5, "w": 1.5},
48 {"x": 1.5, "y": 2.5},
49 {"x": 2.5, "y": 2.5},
50 {"x": 3.5, "y": 2.5},
51 {"x": 4.5, "y": 2.5},
52 {"x": 5.5, "y": 2.5},
53 {"x": 6.5, "y": 2.5},
54 {"x": 7.5, "y": 2.5},
55 {"x": 8.5, "y": 2.5},
56 {"x": 9.5, "y": 2.5},
57 {"x": 10.5, "y": 2.5},
58 {"x": 11.5, "y": 2.5},
59 {"x": 12.5, "y": 2.5},
60 {"x": 13.5, "y": 2.5, "w": 1.5},
61
62 {"x": 15.25, "y": 2.5},
63 {"x": 16.25, "y": 2.5},
64 {"x": 17.25, "y": 2.5},
65
66 {"x": 0, "y": 3.5, "w": 1.75},
67 {"x": 1.75, "y": 3.5},
68 {"x": 2.75, "y": 3.5},
69 {"x": 3.75, "y": 3.5},
70 {"x": 4.75, "y": 3.5},
71 {"x": 5.75, "y": 3.5},
72 {"x": 6.75, "y": 3.5},
73 {"x": 7.75, "y": 3.5},
74 {"x": 8.75, "y": 3.5},
75 {"x": 9.75, "y": 3.5},
76 {"x": 10.75, "y": 3.5},
77 {"x": 11.75, "y": 3.5},
78 {"x": 12.75, "y": 3.5, "w": 2.25},
79
80 {"x": 0, "y": 4.5, "w": 2.25},
81 {"x": 2.25, "y": 4.5},
82 {"x": 3.25, "y": 4.5},
83 {"x": 4.25, "y": 4.5},
84 {"x": 5.25, "y": 4.5},
85 {"x": 6.25, "y": 4.5},
86 {"x": 7.25, "y": 4.5},
87 {"x": 8.25, "y": 4.5},
88 {"x": 9.25, "y": 4.5},
89 {"x": 10.25, "y": 4.5},
90 {"x": 11.25, "y": 4.5},
91 {"x": 12.25, "y": 4.5, "w": 2.75},
92
93 {"x": 16.25, "y": 4.5},
94
95 {"x": 0, "y": 5.5, "w": 1.25},
96 {"x": 1.25, "y": 5.5, "w": 1.25},
97 {"x": 2.5, "y": 5.5, "w": 1.25},
98 {"x": 3.75, "y": 5.5, "w": 6.25},
99 {"x": 10, "y": 5.5, "w": 1.25},
100 {"x": 11.25, "y": 5.5, "w": 1.25},
101 {"x": 12.5, "y": 5.5, "w": 1.25},
102 {"x": 13.75, "y": 5.5, "w": 1.25},
103
104 {"x": 15.25, "y": 5.5},
105 {"x": 16.25, "y": 5.5},
106 {"x": 17.25, "y": 5.5}
107 ]
108 }
109 }
12} 110}
diff --git a/keyboards/k_type/k_type.c b/keyboards/k_type/k_type.c
index 0cffbedfd..ae62f0e72 100644
--- a/keyboards/k_type/k_type.c
+++ b/keyboards/k_type/k_type.c
@@ -14,20 +14,171 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17
17#include "k_type.h" 18#include "k_type.h"
18 19
19__attribute__ ((weak)) 20#ifdef RGB_MATRIX_ENABLE
20void matrix_init_user(void) { 21const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
21} 22 { 0, B_1, A_1, C_1 },
23 { 0, B_2, A_2, C_2 },
24 { 0, B_3, A_3, C_3 },
25 { 0, B_4, A_4, C_4 },
26 { 0, B_5, A_5, C_5 },
27 { 0, B_6, A_6, C_6 },
28 { 0, B_7, A_7, C_7 },
29 { 0, B_8, A_8, C_8 },
30 { 0, B_9, A_9, C_9 },
31 { 0, B_10, A_10, C_10 },
32 { 0, B_11, A_11, C_11 },
33 { 0, B_12, A_12, C_12 },
34 { 0, B_13, A_13, C_13 },
35 { 0, B_14, A_14, C_14 },
36 { 0, B_15, A_15, C_15 },
37 { 0, B_16, A_16, C_16 },
38
39 { 0, E_1, D_1, F_1 },
40 { 0, E_2, D_2, F_2 },
41 { 0, E_3, D_3, F_3 },
42 { 0, E_4, D_4, F_4 },
43 { 0, E_5, D_5, F_5 },
44 { 0, E_6, D_6, F_6 },
45 { 0, E_7, D_7, F_7 },
46 { 0, E_8, D_8, F_8 },
47 { 0, E_9, D_9, F_9 },
48 { 0, E_10, D_1, F_10 },
49 { 0, E_11, D_1, F_11 },
50 { 0, E_12, D_1, F_12 },
51 { 0, E_13, D_1, F_13 },
52 { 0, E_14, D_1, F_14 },
53 { 0, E_15, D_15, F_15 },
54 { 0, E_16, D_16, F_16 },
55
56 { 0, H_1, G_1, I_1 },
57 { 0, H_2, G_2, I_2 },
58 { 0, H_3, G_3, I_3 },
59 { 0, H_4, G_4, I_4 },
60 { 0, H_5, G_5, I_5 },
61 { 0, H_6, G_6, I_6 },
62 { 0, H_7, G_7, I_7 },
63 { 0, H_8, G_8, I_8 },
64 { 0, H_9, G_9, I_9 },
65 { 0, H_10, G_1, I_10 },
66 { 0, H_11, G_1, I_11 },
67 { 0, H_12, G_1, I_12 },
68 { 0, H_13, G_1, I_13 },
69 { 0, H_14, G_1, I_14 },
70 { 0, H_15, G_15, I_15 },
71 { 0, H_16, G_16, I_16 },
72
73 { 0, K_1, J_1, L_1 },
74 { 0, K_2, J_2, L_2 },
75 { 0, K_3, J_3, L_3 },
76 { 0, K_4, J_4, L_4 },
77 { 0, K_5, J_5, L_5 },
78 { 0, K_6, J_6, L_6 },
79 { 0, K_7, J_7, L_7 },
80 { 0, K_8, J_8, L_8 },
81 { 0, K_9, J_9, L_9 },
82 { 0, K_10, J_1, L_10 },
83 { 0, K_11, J_1, L_11 },
84 { 0, K_12, J_1, L_12 },
85 { 0, K_13, J_1, L_13 },
86 { 0, K_14, J_1, L_14 },
87 { 0, K_15, J_15, L_15 },
88 { 0, K_16, J_16, L_16 },
22 89
23__attribute__ ((weak)) 90 // Driver 2 is on I2C2 - currently not usable with i2c_master
24void matrix_scan_user(void) { 91 //{ 1, B_1, A_1, C_1 },
25} 92 //{ 1, B_2, A_2, C_2 },
93 //{ 1, B_3, A_3, C_3 },
94 //{ 1, B_4, A_4, C_4 },
95 //{ 1, B_5, A_5, C_5 },
96 //{ 1, B_6, A_6, C_6 },
97 //{ 1, B_7, A_7, C_7 },
98 //{ 1, B_8, A_8, C_8 },
99 //{ 1, B_9, A_9, C_9 },
100 //{ 1, B_10, A_10, C_10 },
101 //{ 1, B_11, A_11, C_11 },
102 //{ 1, B_12, A_12, C_12 },
103 //{ 1, B_13, A_13, C_13 },
104 //{ 1, B_14, A_14, C_14 },
105 //{ 1, B_15, A_15, C_15 },
106 //{ 1, B_16, A_16, C_16 },
26 107
27void matrix_init_kb(void) { 108 //{ 1, E_1, D_1, F_1 },
28 matrix_init_user(); 109 //{ 1, E_2, D_2, F_2 },
110 //{ 1, E_3, D_3, F_3 },
111 //{ 1, E_4, D_4, F_4 },
112 //{ 1, E_5, D_5, F_5 },
113 //{ 1, E_6, D_6, F_6 },
114 //{ 1, E_7, D_7, F_7 },
115 //{ 1, E_8, D_8, F_8 },
116 //{ 1, E_9, D_9, F_9 },
117 //{ 1, E_10, D_1, F_10 },
118 //{ 1, E_11, D_1, F_11 },
119 //{ 1, E_12, D_1, F_12 },
120 //{ 1, E_13, D_1, F_13 },
121 //{ 1, E_14, D_1, F_14 },
122 //{ 1, E_15, D_15, F_15 },
123 //{ 1, E_16, D_16, F_16 },
124
125 //{ 1, H_1, G_1, I_1 },
126 //{ 1, H_2, G_2, I_2 },
127 //{ 1, H_3, G_3, I_3 },
128 //{ 1, H_4, G_4, I_4 },
129 //{ 1, H_5, G_5, I_5 },
130 //{ 1, H_6, G_6, I_6 },
131 //{ 1, H_7, G_7, I_7 },
132 //{ 1, H_8, G_8, I_8 },
133 //{ 1, H_9, G_9, I_9 },
134 //{ 1, H_10, G_1, I_10 },
135 //{ 1, H_11, G_1, I_11 },
136 //{ 1, H_12, G_1, I_12 },
137 //{ 1, H_13, G_1, I_13 },
138 //{ 1, H_14, G_1, I_14 },
139 //{ 1, H_15, G_15, I_15 },
140 //{ 1, H_16, G_16, I_16 },
141
142 //{ 1, K_1, J_1, L_1 },
143 //{ 1, K_2, J_2, L_2 },
144 //{ 1, K_3, J_3, L_3 },
145 //{ 1, K_4, J_4, L_4 },
146 //{ 1, K_5, J_5, L_5 },
147 //{ 1, K_6, J_6, L_6 },
148 //{ 1, K_7, J_7, L_7 }
29}; 149};
30 150
31void matrix_scan_kb(void) { 151led_config_t g_led_config = {
32 matrix_scan_user(); 152 {
153 // Key Matrix to LED Index
154 { 0, 10, 20, 29, 38, 47, 57, NO_LED, NO_LED, NO_LED },
155 { 1, 11, 21, NO_LED, 39, 48, 58, NO_LED, NO_LED, NO_LED },
156 { 2, 12, 22, 30, 40, 49, 59, NO_LED, NO_LED, NO_LED },
157 { 3, 13, 23, 31, 41, 50, 60, NO_LED, NO_LED, NO_LED },
158 { 4, 14, 24, 32, 42, 51, 61, NO_LED, NO_LED, NO_LED },
159 { 5, 15, 25, 33, 43, 52, NO_LED, NO_LED, NO_LED, NO_LED },
160 { 6, 16, 26, 34, 44, 53, 62, NO_LED, NO_LED, NO_LED },
161 { 7, 17, 27, 35, 45, 54, NO_LED, NO_LED, NO_LED, NO_LED },
162 { 8, 18, 28, 36, 46, 55, 63, NO_LED, NO_LED, NO_LED },
163 { 9, 19, NO_LED, 37, NO_LED, 56, NO_LED, NO_LED, NO_LED, NO_LED }
164 }, {
165 // LED Index to Physical Position
166 { 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 },
167
168 { 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 },
169 { 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 },
170 { 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 },
171 { 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 },
172 //{ 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 }
173 }, {
174 // LED Index to Flag
175 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
176
177 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
178 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
179 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
180 1, //4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
181 //1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1
182 }
33}; 183};
184#endif
diff --git a/keyboards/k_type/k_type.h b/keyboards/k_type/k_type.h
index b0c1f2d65..077c01306 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.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#ifndef K_TYPE_H 17
18#define K_TYPE_H 18#pragma once
19 19
20#include "quantum.h" 20#include "quantum.h"
21 21
22#define KEYMAP( \ 22#define XXX KC_NO
23 K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, K14, K15, K16, \ 23
24 K17, K18, K19, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K30, K31, K32, K33, \ 24#define LAYOUT_tkl_ansi( \
25 K34, K35, K36, K37, K38, K39, K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K50, \ 25 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, k14, k15, \
26 K51, K52, K53, K54, K55, K56, K57, K58, K59, K60, K61, K62, K63, \ 26 k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, k28, k30, k32, k33, k34, \
27 K64, K65, K66, K67, K68, K69, K70, K71, K72, K73, K74, K75, K76, \ 27 k35, k36, k37, k38, k39, k40, k41, k42, k43, k44, k45, k46, k47, k48, k50, k51, k52, \
28 K77, K78, K79, K80, K81, K82, K83, K84, K85, K86, K87 \ 28 k53, k54, k55, k56, k57, k58, k59, k60, k61, k62, k63, k64, k66, \
29 k68, k70, k71, k72, k73, k74, k75, k76, k77, k78, k79, k81, k83, \
30 k84, k85, k86, k87, k88, k89, k90, k91, k92, k93, k94 \
29) { \ 31) { \
30 { K01, K11, K21, K30, K39, K48, K58, K65, KC_NO, K83, }, \ 32 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \
31 { K02, K12, K22, KC_NO, K40, K49, K59, K66, K75, K84, }, \ 33 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \
32 { K03, K13, K23, K31, K41, K50, K60, K67, KC_NO, K85, }, \ 34 { k20, k21, k22, k23, k24, k25, k26, k27, k28, XXX }, \
33 { K04, K14, K24, K32, K42, K51, K61, K68, K76, K86, }, \ 35 { k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39 }, \
34 { K05, K15, K25, K33, K43, K52, K62, K69, K77, K87, }, \ 36 { k40, k41, k42, k43, k44, k45, k46, k47, k48, XXX }, \
35 { K06, K16, K26, K34, K44, K53, KC_NO, K70, K78, KC_NO, }, \ 37 { k50, k51, k52, k53, k54, k55, k56, k57, k58, k59 }, \
36 { K07, K17, K27, K35, K45, K54, K63, K71, K79, KC_NO, }, \ 38 { k60, k61, k62, k63, k64, XXX, k66, XXX, k68, XXX }, \
37 { K08, K18, K28, K36, K46, K55, KC_NO, K72, K80, KC_NO, }, \ 39 { k70, k71, k72, k73, k74, k75, k76, k77, k78, k79 }, \
38 { K09, K19, K29, K37, K47, K56, K64, K73, K81, KC_NO, }, \ 40 { XXX, k81, XXX, k83, k84, k85, k86, k87, k88, k89 }, \
39 { K10, K20, KC_NO, K38, KC_NO, K57, KC_NO, K74, K82, KC_NO, }, \ 41 { k90, k91, k92, k93, k94, XXX, XXX, XXX, XXX, XXX } \
40} 42}
41
42#endif
diff --git a/keyboards/k_type/keymaps/belak/keymap.c b/keyboards/k_type/keymaps/belak/keymap.c
index ed9392a2a..e92057931 100644
--- a/keyboards/k_type/keymaps/belak/keymap.c
+++ b/keyboards/k_type/keymaps/belak/keymap.c
@@ -1,31 +1,27 @@
1#include "k_type.h" 1#include QMK_KEYBOARD_H
2 2
3#define _QW 0 3enum layer_names {
4#define _L1 1 4 _QW,
5 5 _L1
6const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 [_QW] = KEYMAP(
8 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, \
9 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, \
10 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, \
11 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, \
12 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, \
13 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
14 [_L1] = KEYMAP(
15 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
16 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_VOLU, \
17 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPRV, KC_VOLD, \
18 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
19 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, \
20 _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END),
21}; 6};
22 7
23// Runs just one time when the keyboard initializes. 8const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24void matrix_init_user(void) { 9 [_QW] = LAYOUT_tkl_ansi(
25 10 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,
26};
27 11
28// Runs constantly in the background, in a loop. 12 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,
29void matrix_scan_user(void) { 13 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,
14 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,
15 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,
16 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(_L1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
17 ),
18 [_L1] = LAYOUT_tkl_ansi(
19 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
30 20
21 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_VOLU,
22 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MSTP, KC_MPRV, KC_VOLD,
23 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
24 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP,
25 _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
26 )
31}; 27};
diff --git a/keyboards/k_type/keymaps/default/keymap.c b/keyboards/k_type/keymaps/default/keymap.c
index 4f304b012..b8df4df5e 100644
--- a/keyboards/k_type/keymaps/default/keymap.c
+++ b/keyboards/k_type/keymaps/default/keymap.c
@@ -1,11 +1,13 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = KEYMAP( 4 [0] = LAYOUT_tkl_ansi(
5 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, \ 5 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,
6 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, \ 6
7 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, \ 7 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,
8 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, \ 8 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,
9 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, \ 9 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,
10 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), 10 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,
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
12 )
11}; 13};
diff --git a/keyboards/k_type/keymaps/rgb/config.h b/keyboards/k_type/keymaps/rgb/config.h
new file mode 100644
index 000000000..206b76f2b
--- /dev/null
+++ b/keyboards/k_type/keymaps/rgb/config.h
@@ -0,0 +1,23 @@
1#pragma once
2
3#ifdef RGB_MATRIX_ENABLE
4# define RGB_MATRIX_KEYPRESSES
5# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL
6
7// i2c_master defines
8# define I2C1_SCL 0 // A2 on pinout = B0
9# define I2C1_SDA 1 // A2 on pinout = B1
10# define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
11# define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
12//# define I2C2_SCL 10 // A2 on pinout = C10
13//# define I2C2_SDA 11 // A2 on pinout = C11
14//# define I2C2_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
15//# define I2C2_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
16
17# define DRIVER_ADDR_1 0b1010000
18# define DRIVER_ADDR_2 0b1010001
19# define DRIVER_COUNT 2
20# define DRIVER_1_LED_TOTAL 64
21//# define DRIVER_2_LED_TOTAL 55
22# define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
23#endif
diff --git a/keyboards/k_type/keymaps/rgb/keymap.c b/keyboards/k_type/keymaps/rgb/keymap.c
new file mode 100644
index 000000000..4ed15e5d6
--- /dev/null
+++ b/keyboards/k_type/keymaps/rgb/keymap.c
@@ -0,0 +1,30 @@
1#include QMK_KEYBOARD_H
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = LAYOUT_tkl_ansi(
5 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,
6
7 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,
8 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,
9 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,
10 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,
11 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
12 ),
13 [1] = LAYOUT_tkl_ansi(
14 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_MOD, _______,
15
16 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI,
17 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD,
18 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
19 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
20 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
21 )
22};
23
24#ifdef RGB_MATRIX_ENABLE
25// Turn off SDB
26void keyboard_pre_init_user() {
27 palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
28 palSetPad(GPIOB, 16);
29}
30#endif
diff --git a/keyboards/k_type/keymaps/rgb/readme.md b/keyboards/k_type/keymaps/rgb/readme.md
new file mode 100644
index 000000000..794052c57
--- /dev/null
+++ b/keyboards/k_type/keymaps/rgb/readme.md
@@ -0,0 +1,5 @@
1# K-Type RGB Matrix Keymap
2
3This is an experimental keymap adding support for RGB Matrix on the K-Type.
4
5The 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.
diff --git a/keyboards/k_type/keymaps/rgb/rules.mk b/keyboards/k_type/keymaps/rgb/rules.mk
new file mode 100644
index 000000000..a4206a1ad
--- /dev/null
+++ b/keyboards/k_type/keymaps/rgb/rules.mk
@@ -0,0 +1 @@
RGB_MATRIX_ENABLE = IS31FL3733
diff --git a/keyboards/k_type/matrix.c b/keyboards/k_type/matrix.c
deleted file mode 100644
index d919bb880..000000000
--- a/keyboards/k_type/matrix.c
+++ /dev/null
@@ -1,138 +0,0 @@
1//#include <stdint.h>
2//#include <stdbool.h>
3#include <string.h>
4#include "hal.h"
5#include "timer.h"
6#include "wait.h"
7#include "print.h"
8#include "matrix.h"
9#include "debug.h"
10
11/* matrix state(1:on, 0:off) */
12static matrix_row_t matrix[MATRIX_ROWS];
13static matrix_row_t matrix_debouncing[MATRIX_ROWS];
14static bool debouncing = false;
15static uint16_t debouncing_time = 0;
16
17void matrix_init(void)
18{
19 debug_matrix = true;
20
21 /* Column(sense) */
22 palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLDOWN);
23 palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN);
24 palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN);
25 palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_PULLDOWN);
26 palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_PULLDOWN);
27 palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_PULLDOWN);
28 palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLDOWN);
29 palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_PULLDOWN);
30 palSetPadMode(GPIOC, 6, PAL_MODE_INPUT_PULLDOWN);
31 palSetPadMode(GPIOC, 7, PAL_MODE_INPUT_PULLDOWN);
32
33 /* Row(strobe) */
34 palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
35 palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
36 palSetPadMode(GPIOB, 18, PAL_MODE_OUTPUT_PUSHPULL);
37 palSetPadMode(GPIOB, 19, PAL_MODE_OUTPUT_PUSHPULL);
38 palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
39 palSetPadMode(GPIOC, 8, PAL_MODE_OUTPUT_PUSHPULL);
40 palSetPadMode(GPIOC, 9, PAL_MODE_OUTPUT_PUSHPULL);
41 palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
42 palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL);
43 palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL);
44
45 memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
46 memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
47
48 matrix_init_quantum();
49}
50
51uint8_t matrix_scan(void)
52{
53 for (int row = 0; row < MATRIX_ROWS; row++) {
54 matrix_row_t data = 0;
55 // strobe row
56 switch (row) {
57 case 0: palSetPad(GPIOB, 2); break;
58 case 1: palSetPad(GPIOB, 3); break;
59 case 2: palSetPad(GPIOB, 18); break;
60 case 3: palSetPad(GPIOB, 19); break;
61 case 4: palSetPad(GPIOC, 0); break;
62 case 5: palSetPad(GPIOC, 8); break;
63 case 6: palSetPad(GPIOC, 9); break;
64 case 7: palSetPad(GPIOD, 0); break;
65 case 8: palSetPad(GPIOD, 1); break;
66 case 9: palSetPad(GPIOD, 4); break;
67 }
68
69 // need wait to settle pin state
70 // if you wait too short, or have a too high update rate
71 // the keyboard might freeze, or there might not be enough
72 // processing power to update the LCD screen properly.
73 // 20us, or two ticks at 100000Hz seems to be OK
74 wait_us(20);
75
76 // read col data: { PTD5, PTD6, PTD7, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7 }
77 data = ((palReadPort(GPIOC) & 0xFEUL) << 2) |
78 ((palReadPort(GPIOD) & 0xE0UL) >> 5);
79
80 // un-strobe row
81 switch (row) {
82 case 0: palClearPad(GPIOB, 2); break;
83 case 1: palClearPad(GPIOB, 3); break;
84 case 2: palClearPad(GPIOB, 18); break;
85 case 3: palClearPad(GPIOB, 19); break;
86 case 4: palClearPad(GPIOC, 0); break;
87 case 5: palClearPad(GPIOC, 8); break;
88 case 6: palClearPad(GPIOC, 9); break;
89 case 7: palClearPad(GPIOD, 0); break;
90 case 8: palClearPad(GPIOD, 1); break;
91 case 9: palClearPad(GPIOD, 4); break;
92 }
93
94 if (matrix_debouncing[row] != data) {
95 matrix_debouncing[row] = data;
96 debouncing = true;
97 debouncing_time = timer_read();
98 }
99 }
100
101 if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
102 for (int row = 0; row < MATRIX_ROWS; row++) {
103 matrix[row] = matrix_debouncing[row];
104 }
105 debouncing = false;
106 }
107
108 matrix_scan_quantum();
109 return 1;
110}
111
112bool matrix_is_on(uint8_t row, uint8_t col)
113{
114 return (matrix[row] & (1 << col));
115}
116
117matrix_row_t matrix_get_row(uint8_t row)
118{
119 return matrix[row];
120}
121
122void matrix_print(void)
123{
124 xprintf("\nr/c 01234567\n");
125 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
126 xprintf("%02X: ", row);
127 matrix_row_t data = matrix_get_row(row);
128 for (int col = 0; col < MATRIX_COLS; col++) {
129 if (data & (1<<col))
130 xprintf("1");
131 else
132 xprintf("0");
133 }
134 xprintf("\n");
135 }
136
137 wait_ms(50);
138}
diff --git a/keyboards/k_type/readme.md b/keyboards/k_type/readme.md
index 1118f8655..11123c357 100644
--- a/keyboards/k_type/readme.md
+++ b/keyboards/k_type/readme.md
@@ -2,12 +2,16 @@
2 2
3Firmware for custom keyboard PCB with TKL Key Layout 3Firmware for custom keyboard PCB with TKL Key Layout
4 4
5Keyboard Maintainer: [Kaleb Elwert](https://github.com/belak) 5* Keyboard Maintainer: [Kaleb Elwert](https://github.com/belak)
6Hardware Supported: Input Club K-Type 6* Hardware Supported: Input Club K-Type
7Hardware 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) 7* Hardware Availability: [Input Club](https://input.club/k-type/), [Massdrop](https://www.massdrop.com/buy/massdrop-x-input-club-k-type-mechanical-keyboard)
8 8
9Make example for this keyboard (after setting up your build environment): 9Make example for this keyboard (after setting up your build environment):
10 10
11 make k_type:default 11 make k_type:default
12 12
13See [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. 13Flashing example for this keyboard:
14
15 make k_type:default:flash
16
17See 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/k_type/rules.mk b/keyboards/k_type/rules.mk
index 52a9b8ee6..5d2991c8c 100644
--- a/keyboards/k_type/rules.mk
+++ b/keyboards/k_type/rules.mk
@@ -11,21 +11,23 @@ BOOTLOADER = kiibohd
11BOARD = IC_TEENSY_3_1 11BOARD = IC_TEENSY_3_1
12 12
13# Build Options 13# Build Options
14# comment out to disable the options. 14# change yes to no to disable
15# 15#
16BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration 16BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
17## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) 17MOUSEKEY_ENABLE = yes # Mouse keys
18MOUSEKEY_ENABLE = yes # Mouse keys 18EXTRAKEY_ENABLE = yes # Audio control and System control
19EXTRAKEY_ENABLE = yes # Audio control and System control 19CONSOLE_ENABLE = yes # Console for debug
20CONSOLE_ENABLE = yes # Console for debug 20COMMAND_ENABLE = yes # Commands for debug and configuration
21COMMAND_ENABLE = yes # Commands for debug and configuration 21# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
22SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 22SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
23NKRO_ENABLE = yes # USB Nkey Rollover 23# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
24CUSTOM_MATRIX = yes # Custom matrix file 24NKRO_ENABLE = yes # USB Nkey Rollover
25DEBUG_ENABLE = yes 25BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
26RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
27BLUETOOTH_ENABLE = no # Enable Bluetooth
28AUDIO_ENABLE = no # Audio output
26 29
27# project specific files 30LAYOUTS = tkl_ansi
28SRC = matrix.c
29 31
30# Enter lower-power sleep mode when on the ChibiOS idle thread 32# Enter lower-power sleep mode when on the ChibiOS idle thread
31OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE 33OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 9b28e8d63..84edc4639 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -218,6 +218,8 @@
218# define B15 PAL_LINE(GPIOB, 15) 218# define B15 PAL_LINE(GPIOB, 15)
219# define B16 PAL_LINE(GPIOB, 16) 219# define B16 PAL_LINE(GPIOB, 16)
220# define B17 PAL_LINE(GPIOB, 17) 220# define B17 PAL_LINE(GPIOB, 17)
221# define B18 PAL_LINE(GPIOB, 18)
222# define B19 PAL_LINE(GPIOB, 19)
221# define C0 PAL_LINE(GPIOC, 0) 223# define C0 PAL_LINE(GPIOC, 0)
222# define C1 PAL_LINE(GPIOC, 1) 224# define C1 PAL_LINE(GPIOC, 1)
223# define C2 PAL_LINE(GPIOC, 2) 225# define C2 PAL_LINE(GPIOC, 2)