From 5cbac94d08257a6149c5717d7f25efab7af9c0fa Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 27 Jul 2020 20:44:05 +0200 Subject: [PATCH] [Keyboard] add support for the kinT kinesis keyboard controller (kint2pp variant) (#9687) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * branch keyboards/kinesis/kint2pp from keyboards/kinesis/stapelberg Changes will be made in the next commit * [Keyboard] update wiring for kinT (kint2pp variant) * add QMK plumbing * Apply zvecr’s suggestions from code review * Update keyboards/kinesis/kint2pp/config.h * Update keyboards/kinesis/kint2pp/config.h * remove superfluous config.h include --- keyboards/kinesis/config.h | 3 + keyboards/kinesis/kinesis.h | 3 + keyboards/kinesis/kint2pp/config.h | 33 ++++++++++ keyboards/kinesis/kint2pp/kint2pp.c | 26 ++++++++ keyboards/kinesis/kint2pp/kint2pp.h | 99 +++++++++++++++++++++++++++++ keyboards/kinesis/kint2pp/readme.md | 3 + keyboards/kinesis/kint2pp/rules.mk | 0 7 files changed, 167 insertions(+) create mode 100644 keyboards/kinesis/kint2pp/config.h create mode 100644 keyboards/kinesis/kint2pp/kint2pp.c create mode 100644 keyboards/kinesis/kint2pp/kint2pp.h create mode 100644 keyboards/kinesis/kint2pp/readme.md create mode 100644 keyboards/kinesis/kint2pp/rules.mk diff --git a/keyboards/kinesis/config.h b/keyboards/kinesis/config.h index 368037d8b2..db5c458bba 100644 --- a/keyboards/kinesis/config.h +++ b/keyboards/kinesis/config.h @@ -136,5 +136,8 @@ along with this program. If not, see . #ifdef SUBPROJECT_stapelberg #include "stapelberg/config.h" #endif +#ifdef SUBPROJECT_kint2pp + #include "kint2pp/config.h" +#endif #endif diff --git a/keyboards/kinesis/kinesis.h b/keyboards/kinesis/kinesis.h index 94e913ebd9..42df64bf3b 100644 --- a/keyboards/kinesis/kinesis.h +++ b/keyboards/kinesis/kinesis.h @@ -7,6 +7,9 @@ #ifdef KEYBOARD_kinesis_stapelberg #include "stapelberg.h" #endif +#ifdef KEYBOARD_kinesis_kint2pp + #include "kint2pp.h" +#endif #include "quantum.h" diff --git a/keyboards/kinesis/kint2pp/config.h b/keyboards/kinesis/kint2pp/config.h new file mode 100644 index 0000000000..2acaf9be6e --- /dev/null +++ b/keyboards/kinesis/kint2pp/config.h @@ -0,0 +1,33 @@ +#pragma once + +/* USB Device descriptor parameter */ +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0002 + +/* key matrix size */ +#define MATRIX_ROWS 15 +#define MATRIX_COLS 7 + +/* + * 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 { D7, E0, E1, C0, C6, F6, D4, D2, D3, D0, B7, D1, E6, B4, B2 } +#define MATRIX_COL_PINS { E7, F0, F7, B1, B3, B0, D5 } + +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +#define IGNORE_MOD_TAP_INTERRUPT diff --git a/keyboards/kinesis/kint2pp/kint2pp.c b/keyboards/kinesis/kint2pp/kint2pp.c new file mode 100644 index 0000000000..7e2b4348c5 --- /dev/null +++ b/keyboards/kinesis/kint2pp/kint2pp.c @@ -0,0 +1,26 @@ +#include "kint2pp.h" + +void matrix_init_kb(void) { + led_init_ports(); + + + matrix_init_user(); +} +void led_init_ports() { + // * Set our LED pins as output + setPinOutput(C3); // Keypad LED + setPinOutput(C4); // ScrLock LED + setPinOutput(C5); // NumLock LED + setPinOutput(C1); // CapsLock LED +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + writePin(C3, !led_state.compose); + writePin(C4, !led_state.scroll_lock); + writePin(C5, !led_state.num_lock); + writePin(C1, !led_state.caps_lock); + } + return res; +} diff --git a/keyboards/kinesis/kint2pp/kint2pp.h b/keyboards/kinesis/kint2pp/kint2pp.h new file mode 100644 index 0000000000..57265d7313 --- /dev/null +++ b/keyboards/kinesis/kint2pp/kint2pp.h @@ -0,0 +1,99 @@ +#pragma once + +#include "quantum.h" + +#define ___ KC_NO + +// This a shortcut to help you visually see your layout. +// The first section contains all of the arguments as on the physical keyboard +// The second converts the arguments into the 2-D scanned array + +#define LAYOUT( \ + kC0, kD0, kE0, kC1, kD1, kE1, kC2, kD2, kE2, \ + k00, k10, k20, k30, k40, k50, \ + k01, k11, k21, k31, k41, k51, \ + k02, k12, k22, k32, k42, k52, \ + k03, k13, k23, k33, k43, k53, \ + k14, k24, k34, k54, \ + k56, k55, \ + k35, \ + k36, k46, k25, \ + \ + kC3, kD3, kE3, kC4, kD4, kE4, kC5, kE5, kD5, \ + k60, k70, k80, k90, kA0, kB0, \ + k61, k71, k81, k91, kA1, kB1, \ + k62, k72, k82, k92, kA2, kB2, \ + k63, k73, k83, k93, kA3, kB3, \ + k64, k84, k94, kA4, \ + k96, k85, \ + k86, \ + k66, k75, k65 \ +) { \ + { k00, k01, k02, k03, ___, ___, ___ }, \ + { k10, k11, k12, k13, k14, ___, ___ }, \ + { k20, k21, k22, k23, k24, k25, ___ }, \ + { k30, k31, k32, k33, k34, k35, k36 }, \ + { k40, k41, k42, k43, ___, ___, k46 }, \ + { k50, k51, k52, k53, k54, k55, k56 }, \ + { k60, k61, k62, k63, k64, k65, k66 }, \ + { k70, k71, k72, k73, ___, k75, ___ }, \ + { k80, k81, k82, k83, k84, k85, k86 }, \ + { k90, k91, k92, k93, k94, ___, k96 }, \ + { kA0, kA1, kA2, kA3, kA4, ___, ___ }, \ + { kB0, kB1, kB2, kB3, ___, ___, ___ }, \ + { kC0, kC1, kC2, kC3, kC4, kC5, ___ }, \ + { kD0, kD1, kD2, kD3, kD4, kD5, ___ }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, ___ } \ +} + +/* ---------------- LEFT HAND ----------------- ---------------- RIGHT HAND ---------------- */ +#define LAYOUT_pretty( \ + kC0, kD0, kE0, kC1, kD1, kE1, kC2, kD2, kE2, kC3, kD3, kE3, kC4, kD4, kE4, kC5, kE5, kD5, \ + k00, k10, k20, k30, k40, k50, k60, k70, k80, k90, kA0, kB0, \ + k01, k11, k21, k31, k41, k51, k61, k71, k81, k91, kA1, kB1, \ + k02, k12, k22, k32, k42, k52, k62, k72, k82, k92, kA2, kB2, \ + k03, k13, k23, k33, k43, k53, k63, k73, k83, k93, kA3, kB3, \ + k14, k24, k34, k54, k64, k84, k94, kA4, \ + k56, k55, k96, k85, \ + k35, k86, \ + k36, k46, k25, k66, k75, k65 \ +) { \ + { k00, k01, k02, k03, ___, ___, ___ }, \ + { k10, k11, k12, k13, k14, ___, ___ }, \ + { k20, k21, k22, k23, k24, k25, ___ }, \ + { k30, k31, k32, k33, k34, k35, k36 }, \ + { k40, k41, k42, k43, ___, ___, k46 }, \ + { k50, k51, k52, k53, k54, k55, k56 }, \ + { k60, k61, k62, k63, k64, k65, k66 }, \ + { k70, k71, k72, k73, ___, k75, ___ }, \ + { k80, k81, k82, k83, k84, k85, k86 }, \ + { k90, k91, k92, k93, k94, ___, k96 }, \ + { kA0, kA1, kA2, kA3, kA4, ___, ___ }, \ + { kB0, kB1, kB2, kB3, ___, ___, ___ }, \ + { kC0, kC1, kC2, kC3, kC4, kC5, ___ }, \ + { kD0, kD1, kD2, kD3, kD4, kD5, ___ }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, ___ } \ +} + +/* +This is the Stapelberg matrix as published at +https://github.com/stapelberg/kinesis-firmware/blob/master/kb_kinesis/config.kspec +Along with the pins for each row and column + PB0 PB1 PB2 PB3 PB4 PB5 PB6 + kx0 kx1 kx2 kx3 kx4 kx5 kx6 +PD0 k0x Row: EQL TAB CAP LSH X2 -- -- +PD1 k1x Row: 1 Q A Z BQ -- -- +PD2 k2x Row: 2 W S X INS END -- +PD3 k3x Row: 3 E D C LFT HOM BAK +PD4 k4x Row: 4 R F V -- -- DEL +PD5 k5x Row: 5 T G B RT LAL LCT +PD6 k6x Row: 6 Y H N UP SPC PGD +PD7 k7x Row: 7 U J M -- RET -- +PC0 k8x Row: 8 I K COM DWN RCT PGU +PC1 k9x Row: 9 O L PER LBR -- RAL +PC2 kAx Row: 0 P SEM SLA RBR -- -- +PC3 kBx Row: MIN BSL APO RSH X1 -- -- +PC4 kCx Row: ESC F3 F6 F9 F12 PAU -- +PC5 kDx Row: F1 F4 F7 F10 PRT PRG -- +PC6 kEx Row: F2 F5 F8 F11 SLK KEY -- +*/ diff --git a/keyboards/kinesis/kint2pp/readme.md b/keyboards/kinesis/kint2pp/readme.md new file mode 100644 index 0000000000..97f67abb59 --- /dev/null +++ b/keyboards/kinesis/kint2pp/readme.md @@ -0,0 +1,3 @@ +# kinesis_kint2pp keyboard firmware + +Please see https://github.com/kinx-project/kint for details. diff --git a/keyboards/kinesis/kint2pp/rules.mk b/keyboards/kinesis/kint2pp/rules.mk new file mode 100644 index 0000000000..e69de29bb2