aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErovia <Erovia@users.noreply.github.com>2021-05-26 20:49:30 +0200
committerGitHub <noreply@github.com>2021-05-26 20:49:30 +0200
commit8ba537fa23aa1520949981f1afe1a71338bf8a7a (patch)
tree5f91dde22e11e39cbe99062267a3d96ab1df027a
parent0211e3003280a52e5f0ce262cfe347aeb68be722 (diff)
downloadqmk_firmware-8ba537fa23aa1520949981f1afe1a71338bf8a7a.tar.gz
qmk_firmware-8ba537fa23aa1520949981f1afe1a71338bf8a7a.zip
Keyboard: Planck THK (#12597)
Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Jack Humbert <jack.humb@gmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
-rw-r--r--keyboards/planck/planck.c4
-rw-r--r--keyboards/planck/planck.h2
-rw-r--r--keyboards/planck/thk/config.h46
-rw-r--r--keyboards/planck/thk/info.json158
-rw-r--r--keyboards/planck/thk/keymaps/thk/keymap.c239
-rw-r--r--keyboards/planck/thk/keymaps/thk/readme.md3
-rw-r--r--keyboards/planck/thk/readme.md28
-rw-r--r--keyboards/planck/thk/rules.mk43
-rw-r--r--keyboards/planck/thk/thk.c18
-rw-r--r--keyboards/planck/thk/thk.h49
-rw-r--r--quantum/audio/driver_avr_pwm_hardware.c14
11 files changed, 600 insertions, 4 deletions
diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c
index 5a65d5e5f..80aa9f3ba 100644
--- a/keyboards/planck/planck.c
+++ b/keyboards/planck/planck.c
@@ -12,8 +12,8 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
12 12
13__attribute__ ((weak)) 13__attribute__ ((weak))
14void matrix_init_kb(void) { 14void matrix_init_kb(void) {
15 // Turn status LED on 15 // Turn status LED on, with the exception of THK
16 #ifdef __AVR__ 16 #if defined(__AVR_ATmega32U4__)
17 setPinOutput(E6); 17 setPinOutput(E6);
18 writePinHigh(E6); 18 writePinHigh(E6);
19 #endif 19 #endif
diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h
index 1beafa776..ef037f369 100644
--- a/keyboards/planck/planck.h
+++ b/keyboards/planck/planck.h
@@ -9,6 +9,8 @@
9 #include "ez.h" 9 #include "ez.h"
10#elif defined(KEYBOARD_planck_light) 10#elif defined(KEYBOARD_planck_light)
11 #include "light.h" 11 #include "light.h"
12#elif defined(KEYBOARD_planck_thk)
13 #include "thk.h"
12#elif defined(KEYBOARD_planck_rev1) 14#elif defined(KEYBOARD_planck_rev1)
13 #include "rev1.h" 15 #include "rev1.h"
14#elif defined(KEYBOARD_planck_rev2) 16#elif defined(KEYBOARD_planck_rev2)
diff --git a/keyboards/planck/thk/config.h b/keyboards/planck/thk/config.h
new file mode 100644
index 000000000..845ef60b0
--- /dev/null
+++ b/keyboards/planck/thk/config.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
3 * Copyright 2021 Erovia
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include "config_common.h"
22#define DEVICE_VER 0x0000
23#undef PRODUCT
24#define PRODUCT Planck THK
25#define PRODUCT_ID 0x25A7
26
27// THK has a different pin-out
28#undef MATRIX_ROW_PINS
29#undef MATRIX_COL_PINS
30
31#define MATRIX_ROW_PINS { A7, A6, A5, A4 }
32#define MATRIX_COL_PINS { D7, C2, C3, C4, C5, C6, C7, A3, A2, A1, A0, B0 }
33
34#define ENCODERS_PAD_A { B4, B2 }
35#define ENCODERS_PAD_B { B3, B1 }
36
37#define TAPPING_TOGGLE 3
38
39#define DIP_SWITCH_PINS { D0, D1, D4, D6 }
40
41// THK uses D5 for audio
42#undef AUDIO_PIN
43#define AUDIO_PIN D5
44
45// VUSB D- port
46#define USB_CFG_DMINUS_BIT 3
diff --git a/keyboards/planck/thk/info.json b/keyboards/planck/thk/info.json
new file mode 100644
index 000000000..cffc9fd36
--- /dev/null
+++ b/keyboards/planck/thk/info.json
@@ -0,0 +1,158 @@
1{
2 "manufacturer": "OLKB",
3 "keyboard_name": "Planck THK",
4 "maintainer": "Erovia",
5 "height": 4,
6 "width": 12,
7 "bootloader": "USBasp",
8 "debounce": 5,
9 "diode_direction": "COL2ROW",
10 "features": {
11 "audio": false,
12 "backlight": false,
13 "bluetooth": false,
14 "bootmagic_lite": true,
15 "command": false,
16 "console": false,
17 "dip_switch": true,
18 "encoder": true,
19 "extrakey": true,
20 "mousekey": true,
21 "nkro": false,
22 "rgblight": false,
23 "sleep_led": false
24 },
25 "matrix_pins": {
26 "cols": ["D7", "C2", "C3", "C4", "C5", "C6", "C7", "A3", "A2", "A1", "A0", "B0"],
27 "rows": ["A7", "A6", "A5", "A4"]
28 },
29 "processor": "atmega32a",
30 "qmk_lufa_bootloader": {
31 "esc_input": "D5",
32 "esc_output": "F1",
33 "led": "E6",
34 "speaker": "C6"
35 },
36 "url": "https://olkb.com/planck",
37 "usb": {
38 "device_ver": "0x0000",
39 "pid": "0x25A7",
40 "vid": "0x03A8"
41 },
42 "community_layouts": ["ortho_4x12", "planck_mit"],
43 "layout_aliases": {
44 "LAYOUT_planck_grid": "LAYOUT_ortho_4x12",
45 "LAYOUT_planck_mit": "LAYOUT_planck_1x2uC"
46 },
47 "layouts": {
48 "LAYOUT_ortho_4x12": {
49 "c_macro": true,
50 "filename": "keyboards/planck/thk/thk.h",
51 "key_count": 48,
52 "layout": [
53 { "label": "k00", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 },
54 { "label": "k01", "matrix": [0, 1], "w": 1, "x": 1, "y": 0 },
55 { "label": "k02", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 },
56 { "label": "k03", "matrix": [0, 3], "w": 1, "x": 3, "y": 0 },
57 { "label": "k04", "matrix": [0, 4], "w": 1, "x": 4, "y": 0 },
58 { "label": "k05", "matrix": [0, 5], "w": 1, "x": 5, "y": 0 },
59 { "label": "k06", "matrix": [0, 6], "w": 1, "x": 6, "y": 0 },
60 { "label": "k07", "matrix": [0, 7], "w": 1, "x": 7, "y": 0 },
61 { "label": "k08", "matrix": [0, 8], "w": 1, "x": 8, "y": 0 },
62 { "label": "k09", "matrix": [0, 9], "w": 1, "x": 9, "y": 0 },
63 { "label": "k0a", "matrix": [0, 10], "w": 1, "x": 10, "y": 0 },
64 { "label": "k0b", "matrix": [0, 11], "w": 1, "x": 11, "y": 0 },
65 { "label": "k10", "matrix": [1, 0], "w": 1, "x": 0, "y": 1 },
66 { "label": "k11", "matrix": [1, 1], "w": 1, "x": 1, "y": 1 },
67 { "label": "k12", "matrix": [1, 2], "w": 1, "x": 2, "y": 1 },
68 { "label": "k13", "matrix": [1, 3], "w": 1, "x": 3, "y": 1 },
69 { "label": "k14", "matrix": [1, 4], "w": 1, "x": 4, "y": 1 },
70 { "label": "k15", "matrix": [1, 5], "w": 1, "x": 5, "y": 1 },
71 { "label": "k16", "matrix": [1, 6], "w": 1, "x": 6, "y": 1 },
72 { "label": "k17", "matrix": [1, 7], "w": 1, "x": 7, "y": 1 },
73 { "label": "k18", "matrix": [1, 8], "w": 1, "x": 8, "y": 1 },
74 { "label": "k19", "matrix": [1, 9], "w": 1, "x": 9, "y": 1 },
75 { "label": "k1a", "matrix": [1, 10], "w": 1, "x": 10, "y": 1 },
76 { "label": "k1b", "matrix": [1, 11], "w": 1, "x": 11, "y": 1 },
77 { "label": "k20", "matrix": [2, 0], "w": 1, "x": 0, "y": 2 },
78 { "label": "k21", "matrix": [2, 1], "w": 1, "x": 1, "y": 2 },
79 { "label": "k22", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
80 { "label": "k23", "matrix": [2, 3], "w": 1, "x": 3, "y": 2 },
81 { "label": "k24", "matrix": [2, 4], "w": 1, "x": 4, "y": 2 },
82 { "label": "k25", "matrix": [2, 5], "w": 1, "x": 5, "y": 2 },
83 { "label": "k26", "matrix": [2, 6], "w": 1, "x": 6, "y": 2 },
84 { "label": "k27", "matrix": [2, 7], "w": 1, "x": 7, "y": 2 },
85 { "label": "k28", "matrix": [2, 8], "w": 1, "x": 8, "y": 2 },
86 { "label": "k29", "matrix": [2, 9], "w": 1, "x": 9, "y": 2 },
87 { "label": "k2a", "matrix": [2, 10], "w": 1, "x": 10, "y": 2 },
88 { "label": "k2b", "matrix": [2, 11], "w": 1, "x": 11, "y": 2 },
89 { "label": "k30", "matrix": [3, 0], "w": 1, "x": 0, "y": 3 },
90 { "label": "k31", "matrix": [3, 1], "w": 1, "x": 1, "y": 3 },
91 { "label": "k32", "matrix": [3, 2], "w": 1, "x": 2, "y": 3 },
92 { "label": "k33", "matrix": [3, 3], "w": 1, "x": 3, "y": 3 },
93 { "label": "k34", "matrix": [3, 4], "w": 1, "x": 4, "y": 3 },
94 { "label": "k35", "matrix": [3, 5], "w": 1, "x": 5, "y": 3 },
95 { "label": "k36", "matrix": [3, 6], "w": 1, "x": 6, "y": 3 },
96 { "label": "k37", "matrix": [3, 7], "w": 1, "x": 7, "y": 3 },
97 { "label": "k38", "matrix": [3, 8], "w": 1, "x": 8, "y": 3 },
98 { "label": "k39", "matrix": [3, 9], "w": 1, "x": 9, "y": 3 },
99 { "label": "k3a", "matrix": [3, 10], "w": 1, "x": 10, "y": 3 },
100 { "label": "k3b", "matrix": [3, 11], "w": 1, "x": 11, "y": 3 }
101 ]
102 },
103 "LAYOUT_planck_1x2uC": {
104 "c_macro": true,
105 "filename": "keyboards/planck/thk/thk.h",
106 "key_count": 47,
107 "layout": [
108 { "label": "k00", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 },
109 { "label": "k01", "matrix": [0, 1], "w": 1, "x": 1, "y": 0 },
110 { "label": "k02", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 },
111 { "label": "k03", "matrix": [0, 3], "w": 1, "x": 3, "y": 0 },
112 { "label": "k04", "matrix": [0, 4], "w": 1, "x": 4, "y": 0 },
113 { "label": "k05", "matrix": [0, 5], "w": 1, "x": 5, "y": 0 },
114 { "label": "k06", "matrix": [0, 6], "w": 1, "x": 6, "y": 0 },
115 { "label": "k07", "matrix": [0, 7], "w": 1, "x": 7, "y": 0 },
116 { "label": "k08", "matrix": [0, 8], "w": 1, "x": 8, "y": 0 },
117 { "label": "k09", "matrix": [0, 9], "w": 1, "x": 9, "y": 0 },
118 { "label": "k0a", "matrix": [0, 10], "w": 1, "x": 10, "y": 0 },
119 { "label": "k0b", "matrix": [0, 11], "w": 1, "x": 11, "y": 0 },
120 { "label": "k10", "matrix": [1, 0], "w": 1, "x": 0, "y": 1 },
121 { "label": "k11", "matrix": [1, 1], "w": 1, "x": 1, "y": 1 },
122 { "label": "k12", "matrix": [1, 2], "w": 1, "x": 2, "y": 1 },
123 { "label": "k13", "matrix": [1, 3], "w": 1, "x": 3, "y": 1 },
124 { "label": "k14", "matrix": [1, 4], "w": 1, "x": 4, "y": 1 },
125 { "label": "k15", "matrix": [1, 5], "w": 1, "x": 5, "y": 1 },
126 { "label": "k16", "matrix": [1, 6], "w": 1, "x": 6, "y": 1 },
127 { "label": "k17", "matrix": [1, 7], "w": 1, "x": 7, "y": 1 },
128 { "label": "k18", "matrix": [1, 8], "w": 1, "x": 8, "y": 1 },
129 { "label": "k19", "matrix": [1, 9], "w": 1, "x": 9, "y": 1 },
130 { "label": "k1a", "matrix": [1, 10], "w": 1, "x": 10, "y": 1 },
131 { "label": "k1b", "matrix": [1, 11], "w": 1, "x": 11, "y": 1 },
132 { "label": "k20", "matrix": [2, 0], "w": 1, "x": 0, "y": 2 },
133 { "label": "k21", "matrix": [2, 1], "w": 1, "x": 1, "y": 2 },
134 { "label": "k22", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
135 { "label": "k23", "matrix": [2, 3], "w": 1, "x": 3, "y": 2 },
136 { "label": "k24", "matrix": [2, 4], "w": 1, "x": 4, "y": 2 },
137 { "label": "k25", "matrix": [2, 5], "w": 1, "x": 5, "y": 2 },
138 { "label": "k26", "matrix": [2, 6], "w": 1, "x": 6, "y": 2 },
139 { "label": "k27", "matrix": [2, 7], "w": 1, "x": 7, "y": 2 },
140 { "label": "k28", "matrix": [2, 8], "w": 1, "x": 8, "y": 2 },
141 { "label": "k29", "matrix": [2, 9], "w": 1, "x": 9, "y": 2 },
142 { "label": "k2a", "matrix": [2, 10], "w": 1, "x": 10, "y": 2 },
143 { "label": "k2b", "matrix": [2, 11], "w": 1, "x": 11, "y": 2 },
144 { "label": "k30", "matrix": [3, 0], "w": 1, "x": 0, "y": 3 },
145 { "label": "k31", "matrix": [3, 1], "w": 1, "x": 1, "y": 3 },
146 { "label": "k32", "matrix": [3, 2], "w": 1, "x": 2, "y": 3 },
147 { "label": "k33", "matrix": [3, 3], "w": 1, "x": 3, "y": 3 },
148 { "label": "k34", "matrix": [3, 4], "w": 1, "x": 4, "y": 3 },
149 { "label": "k35", "matrix": [3, 6], "w": 2, "x": 5, "y": 3 },
150 { "label": "k37", "matrix": [3, 7], "w": 1, "x": 7, "y": 3 },
151 { "label": "k38", "matrix": [3, 8], "w": 1, "x": 8, "y": 3 },
152 { "label": "k39", "matrix": [3, 9], "w": 1, "x": 9, "y": 3 },
153 { "label": "k3a", "matrix": [3, 10], "w": 1, "x": 10, "y": 3 },
154 { "label": "k3b", "matrix": [3, 11], "w": 1, "x": 11, "y": 3 }
155 ]
156 }
157 }
158}
diff --git a/keyboards/planck/thk/keymaps/thk/keymap.c b/keyboards/planck/thk/keymaps/thk/keymap.c
new file mode 100644
index 000000000..44cd33370
--- /dev/null
+++ b/keyboards/planck/thk/keymaps/thk/keymap.c
@@ -0,0 +1,239 @@
1/* Copyright 2015-2017 Jack Humbert
2 * Copyright 2021 Erovia
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include QMK_KEYBOARD_H
19
20enum planck_layers {
21 _QWERTY,
22 _COLEMAK,
23 _DVORAK,
24 _LOWER,
25 _RAISE,
26 _ADJUST
27};
28
29enum planck_keycodes {
30 QWERTY = SAFE_RANGE,
31 COLEMAK,
32 DVORAK,
33 THK,
34};
35
36#define LOWER MO(_LOWER)
37#define RAISE MO(_RAISE)
38
39const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
40
41/* Qwerty
42 * ,-----------------------------------------------------------------------------------.
43 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
44 * |------+------+------+------+------+------+------+------+------+------+------+------|
45 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
46 * |------+------+------+------+------+------+------+------+------+------+------+------|
47 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
48 * |------+------+------+------+------+------+------+------+------+------+------+------|
49 * | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
50 * `-----------------------------------------------------------------------------------'
51 */
52[_QWERTY] = LAYOUT_planck_grid(
53 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
54 KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
55 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
56 THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
57),
58
59/* Colemak
60 * ,-----------------------------------------------------------------------------------.
61 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
62 * |------+------+------+------+------+------+------+------+------+------+------+------|
63 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
64 * |------+------+------+------+------+------+------+------+------+------+------+------|
65 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
66 * |------+------+------+------+------+------+------+------+------+------+------+------|
67 * | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
68 * `-----------------------------------------------------------------------------------'
69 */
70[_COLEMAK] = LAYOUT_planck_grid(
71 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
72 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
73 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
74 THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
75),
76
77/* Dvorak
78 * ,-----------------------------------------------------------------------------------.
79 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
80 * |------+------+------+------+------+------+------+------+------+------+------+------|
81 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
82 * |------+------+------+------+------+------+------+------+------+------+------+------|
83 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
84 * |------+------+------+------+------+------+------+------+------+------+------+------|
85 * | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
86 * `-----------------------------------------------------------------------------------'
87 */
88[_DVORAK] = LAYOUT_planck_grid(
89 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC,
90 KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH,
91 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT ,
92 THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
93),
94
95/* Lower
96 * ,-----------------------------------------------------------------------------------.
97 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
98 * |------+------+------+------+------+------+------+------+------+------+------+------|
99 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
100 * |------+------+------+------+------+------+------+------+------+------+------+------|
101 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
102 * |------+------+------+------+------+------+------+------+------+------+------+------|
103 * | | | | | | | | Next | Vol- | Vol+ | Play |
104 * `-----------------------------------------------------------------------------------'
105 */
106[_LOWER] = LAYOUT_planck_grid(
107 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
108 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
109 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
110 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
111),
112
113/* Raise
114 * ,-----------------------------------------------------------------------------------.
115 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
116 * |------+------+------+------+------+------+------+------+------+------+------+------|
117 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
118 * |------+------+------+------+------+------+------+------+------+------+------+------|
119 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
120 * |------+------+------+------+------+------+------+------+------+------+------+------|
121 * | | | | | | | | Next | Vol- | Vol+ | Play |
122 * `-----------------------------------------------------------------------------------'
123 */
124[_RAISE] = LAYOUT_planck_grid(
125 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
126 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
127 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
128 _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
129),
130
131/* Adjust (Lower + Raise)
132 * ,-----------------------------------------------------------------------------------.
133 * | | Reset|Debug | | | | | | | | | Del |
134 * |------+------+------+------+------+------+------+------+------+------+------+------|
135 * | | | | | |AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
136 * |------+------+------+------+------+------+------+------+------+------+------+------|
137 * | | | | | | | |TermOn|TermOf| | | |
138 * |------+------+------+------+------+------+------+------+------+------+------+------|
139 * | | | | | | | | | | | |
140 * `-----------------------------------------------------------------------------------'
141 */
142[_ADJUST] = LAYOUT_planck_grid(
143 _______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL ,
144 _______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
145 _______, _______, _______, _______, _______, _______, _______, TERM_ON, TERM_OFF, _______, _______, _______,
146 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
147)
148
149};
150
151layer_state_t layer_state_set_user(layer_state_t state) {
152 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
153}
154
155bool process_record_user(uint16_t keycode, keyrecord_t *record) {
156 switch (keycode) {
157 case QWERTY:
158 if (record->event.pressed) {
159 set_single_persistent_default_layer(_QWERTY);
160 }
161 return false;
162 case COLEMAK:
163 if (record->event.pressed) {
164 set_single_persistent_default_layer(_COLEMAK);
165 }
166 return false;
167 case DVORAK:
168 if (record->event.pressed) {
169 set_single_persistent_default_layer(_DVORAK);
170 }
171 return false;
172 case THK:
173 if (record->event.pressed) {
174 SEND_STRING("Pretty cool keyboard, eh?");
175 }
176 return false;
177 }
178 return true;
179}
180
181bool encoder_mode = false;
182
183void encoder_update(bool clockwise) {
184 if (index == 0) { /* First encoder */
185 if (clockwise) {
186 #ifdef MOUSEKEY_ENABLE
187 tap_code(KC_MS_WH_DOWN);
188 #else
189 tap_code(KC_PGDN);
190 #endif
191 } else {
192 #ifdef MOUSEKEY_ENABLE
193 tap_code(KC_MS_WH_UP);
194 #else
195 tap_code(KC_PGUP);
196 #endif
197 }
198 } else if (index == 1) { /* Second encoder */
199 if (clockwise) {
200 if (encoder_mode) {
201 tap_code(KC_RGHT);
202 } else {
203 tap_code_delay(KC_VOLU, 60);
204 }
205 } else {
206 if (encoder_mode) {
207 tap_code(KC_LEFT);
208 } else {
209 tap_code_delay(KC_VOLD, 60);
210 }
211 }
212 }
213}
214
215void dip_switch_update_user(uint8_t index, bool active) {
216 switch (index) {
217 case 0: {
218 if (active) {
219 layer_on(_ADJUST);
220 } else {
221 layer_off(_ADJUST);
222 }
223 }
224 break;
225 case 1:
226 if (active) {
227 encoder_mode = true;
228 } else {
229 encoder_mode = false;
230 }
231 break;
232 case 2:
233 SEND_STRING("QMK is the best thing ever");
234 break;
235 case 3:
236 SEND_STRING("This is a Planck THK");
237 break;
238 }
239}
diff --git a/keyboards/planck/thk/keymaps/thk/readme.md b/keyboards/planck/thk/keymaps/thk/readme.md
new file mode 100644
index 000000000..bae51e067
--- /dev/null
+++ b/keyboards/planck/thk/keymaps/thk/readme.md
@@ -0,0 +1,3 @@
1# Keymap specifically for the Planck T.H.K.
2
3Based on the `default` Planck keymap.
diff --git a/keyboards/planck/thk/readme.md b/keyboards/planck/thk/readme.md
new file mode 100644
index 000000000..d9dde7401
--- /dev/null
+++ b/keyboards/planck/thk/readme.md
@@ -0,0 +1,28 @@
1# Planck Through Hole Kit
2
3![THK](https://i.imgur.com/Fj8X0TDl.jpg)
4
5The OG 4x12, through-hole, ortho board.
6
7[Buildlog](https://erovia.github.io/posts/thk/)
8
9* Keyboard Maintainer: [Erovia](https://github.com/Erovia)
10* Hardware Supported: [Planck THK](https://github.com/olkb/planck_thk)
11* Hardware Availability: The hardware was released under GPLv3, see link above.
12
13Make example for this keyboard (after setting up your build environment):
14
15 make planck/thk:thk
16
17Flashing example for this keyboard:
18
19 make planck/thk:thk:flash
20
21**Reset**: With [the recommended bootloader](https://github.com/Erovia/planck_thk_usbasploader) a single press on the RESET button.
22
23## Audio
24
25The board has rudimental [audio](https://docs.qmk.fm/#/feature_audio) support.
26As it can cause the USB connection to crash, likely due the mcu not being able to keep up with the USB's strict timing requirements, it's is disabled for the `thk` keymap.
27
28See 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/planck/thk/rules.mk b/keyboards/planck/thk/rules.mk
new file mode 100644
index 000000000..8d584afa3
--- /dev/null
+++ b/keyboards/planck/thk/rules.mk
@@ -0,0 +1,43 @@
1# Copyright 2021 Erovia
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# MCU name
17MCU = atmega32a
18# Processor frequency
19F_CPU = 16000000
20
21# Bootloader selection
22BOOTLOADER = USBasp
23
24# Build Options
25# change yes to no to disable
26#
27BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
28MOUSEKEY_ENABLE = yes # Mouse keys
29EXTRAKEY_ENABLE = yes # Audio control and System control
30CONSOLE_ENABLE = no # Console for debug
31COMMAND_ENABLE = no # Commands for debug and configuration
32# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
33SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
34# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
35NKRO_ENABLE = no # USB Nkey Rollover
36BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
37RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
38BLUETOOTH_ENABLE = no # Enable Bluetooth
39AUDIO_ENABLE = no # Audio output
40ENCODER_ENABLE = yes
41DIP_SWITCH_ENABLE = yes
42
43LAYOUTS = ortho_4x12 planck_mit
diff --git a/keyboards/planck/thk/thk.c b/keyboards/planck/thk/thk.c
new file mode 100644
index 000000000..e9912fcbb
--- /dev/null
+++ b/keyboards/planck/thk/thk.c
@@ -0,0 +1,18 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 * Copyright 2021 Erovia
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "thk.h"
diff --git a/keyboards/planck/thk/thk.h b/keyboards/planck/thk/thk.h
new file mode 100644
index 000000000..6cbbf7262
--- /dev/null
+++ b/keyboards/planck/thk/thk.h
@@ -0,0 +1,49 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 * Copyright 2021 Erovia
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "planck.h"
21
22#define LAYOUT_planck_1x2uC( \
23 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
24 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
25 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
26 k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
27) \
28{ \
29 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
30 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
31 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
32 { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
33}
34
35#define LAYOUT_ortho_4x12( \
36 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
37 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
38 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
39 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
40) \
41{ \
42 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
43 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
44 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
45 { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
46}
47
48#define LAYOUT_planck_mit LAYOUT_planck_1x2uC
49#define LAYOUT_planck_grid LAYOUT_ortho_4x12
diff --git a/quantum/audio/driver_avr_pwm_hardware.c b/quantum/audio/driver_avr_pwm_hardware.c
index 492b9bfb0..df03a4558 100644
--- a/quantum/audio/driver_avr_pwm_hardware.c
+++ b/quantum/audio/driver_avr_pwm_hardware.c
@@ -40,7 +40,7 @@ extern uint8_t note_timbre;
40 alternatively, the PWM pins on PORTB can be used as only/primary speaker 40 alternatively, the PWM pins on PORTB can be used as only/primary speaker
41*/ 41*/
42 42
43#if defined(AUDIO_PIN) && (AUDIO_PIN != C4) && (AUDIO_PIN != C5) && (AUDIO_PIN != C6) && (AUDIO_PIN != B5) && (AUDIO_PIN != B6) && (AUDIO_PIN != B7) 43#if defined(AUDIO_PIN) && (AUDIO_PIN != C4) && (AUDIO_PIN != C5) && (AUDIO_PIN != C6) && (AUDIO_PIN != B5) && (AUDIO_PIN != B6) && (AUDIO_PIN != B7) && (AUDIO_PIN != D5)
44# error "Audio feature enabled, but no suitable pin selected as AUDIO_PIN - see docs/feature_audio under the AVR settings for available options." 44# error "Audio feature enabled, but no suitable pin selected as AUDIO_PIN - see docs/feature_audio under the AVR settings for available options."
45#endif 45#endif
46 46
@@ -94,7 +94,7 @@ extern uint8_t note_timbre;
94# error "Audio feature: the pin selected as AUDIO_PIN_ALT is not supported." 94# error "Audio feature: the pin selected as AUDIO_PIN_ALT is not supported."
95#endif 95#endif
96 96
97#if (AUDIO_PIN == B5) || (AUDIO_PIN == B6) || (AUDIO_PIN == B7) || (AUDIO_PIN_ALT == B5) || (AUDIO_PIN_ALT == B6) || (AUDIO_PIN_ALT == B7) 97#if (AUDIO_PIN == B5) || (AUDIO_PIN == B6) || (AUDIO_PIN == B7) || (AUDIO_PIN_ALT == B5) || (AUDIO_PIN_ALT == B6) || (AUDIO_PIN_ALT == B7) || (AUDIO_PIN == D5)
98# define AUDIO2_PIN_SET 98# define AUDIO2_PIN_SET
99# define AUDIO2_TIMSKx TIMSK1 99# define AUDIO2_TIMSKx TIMSK1
100# define AUDIO2_TCCRxA TCCR1A 100# define AUDIO2_TCCRxA TCCR1A
@@ -129,6 +129,16 @@ extern uint8_t note_timbre;
129# define AUDIO2_OCRxy OCR1C 129# define AUDIO2_OCRxy OCR1C
130# define AUDIO2_PIN B7 130# define AUDIO2_PIN B7
131# define AUDIO2_TIMERx_COMPy_vect TIMER1_COMPC_vect 131# define AUDIO2_TIMERx_COMPy_vect TIMER1_COMPC_vect
132# elif (AUDIO_PIN == D5) && defined(__AVR_ATmega32A__)
133# pragma message "Audio support for ATmega32A is experimental and can cause crashes."
134# undef AUDIO2_TIMSKx
135# define AUDIO2_TIMSKx TIMSK
136# define AUDIO2_COMxy0 COM1A0
137# define AUDIO2_COMxy1 COM1A1
138# define AUDIO2_OCIExy OCIE1A
139# define AUDIO2_OCRxy OCR1A
140# define AUDIO2_PIN D5
141# define AUDIO2_TIMERx_COMPy_vect TIMER1_COMPA_vect
132# endif 142# endif
133#endif 143#endif
134 144