1
0
Fork 0

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>
This commit is contained in:
Erovia 2021-05-26 20:49:30 +02:00 committed by GitHub
parent 0211e30032
commit 8ba537fa23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 600 additions and 4 deletions

View file

@ -12,8 +12,8 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
__attribute__ ((weak))
void matrix_init_kb(void) {
// Turn status LED on
#ifdef __AVR__
// Turn status LED on, with the exception of THK
#if defined(__AVR_ATmega32U4__)
setPinOutput(E6);
writePinHigh(E6);
#endif

View file

@ -9,6 +9,8 @@
#include "ez.h"
#elif defined(KEYBOARD_planck_light)
#include "light.h"
#elif defined(KEYBOARD_planck_thk)
#include "thk.h"
#elif defined(KEYBOARD_planck_rev1)
#include "rev1.h"
#elif defined(KEYBOARD_planck_rev2)

View file

@ -0,0 +1,46 @@
/*
* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
* Copyright 2021 Erovia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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/>.
*/
#pragma once
#include "config_common.h"
#define DEVICE_VER 0x0000
#undef PRODUCT
#define PRODUCT Planck THK
#define PRODUCT_ID 0x25A7
// THK has a different pin-out
#undef MATRIX_ROW_PINS
#undef MATRIX_COL_PINS
#define MATRIX_ROW_PINS { A7, A6, A5, A4 }
#define MATRIX_COL_PINS { D7, C2, C3, C4, C5, C6, C7, A3, A2, A1, A0, B0 }
#define ENCODERS_PAD_A { B4, B2 }
#define ENCODERS_PAD_B { B3, B1 }
#define TAPPING_TOGGLE 3
#define DIP_SWITCH_PINS { D0, D1, D4, D6 }
// THK uses D5 for audio
#undef AUDIO_PIN
#define AUDIO_PIN D5
// VUSB D- port
#define USB_CFG_DMINUS_BIT 3

View file

@ -0,0 +1,158 @@
{
"manufacturer": "OLKB",
"keyboard_name": "Planck THK",
"maintainer": "Erovia",
"height": 4,
"width": 12,
"bootloader": "USBasp",
"debounce": 5,
"diode_direction": "COL2ROW",
"features": {
"audio": false,
"backlight": false,
"bluetooth": false,
"bootmagic_lite": true,
"command": false,
"console": false,
"dip_switch": true,
"encoder": true,
"extrakey": true,
"mousekey": true,
"nkro": false,
"rgblight": false,
"sleep_led": false
},
"matrix_pins": {
"cols": ["D7", "C2", "C3", "C4", "C5", "C6", "C7", "A3", "A2", "A1", "A0", "B0"],
"rows": ["A7", "A6", "A5", "A4"]
},
"processor": "atmega32a",
"qmk_lufa_bootloader": {
"esc_input": "D5",
"esc_output": "F1",
"led": "E6",
"speaker": "C6"
},
"url": "https://olkb.com/planck",
"usb": {
"device_ver": "0x0000",
"pid": "0x25A7",
"vid": "0x03A8"
},
"community_layouts": ["ortho_4x12", "planck_mit"],
"layout_aliases": {
"LAYOUT_planck_grid": "LAYOUT_ortho_4x12",
"LAYOUT_planck_mit": "LAYOUT_planck_1x2uC"
},
"layouts": {
"LAYOUT_ortho_4x12": {
"c_macro": true,
"filename": "keyboards/planck/thk/thk.h",
"key_count": 48,
"layout": [
{ "label": "k00", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 },
{ "label": "k01", "matrix": [0, 1], "w": 1, "x": 1, "y": 0 },
{ "label": "k02", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 },
{ "label": "k03", "matrix": [0, 3], "w": 1, "x": 3, "y": 0 },
{ "label": "k04", "matrix": [0, 4], "w": 1, "x": 4, "y": 0 },
{ "label": "k05", "matrix": [0, 5], "w": 1, "x": 5, "y": 0 },
{ "label": "k06", "matrix": [0, 6], "w": 1, "x": 6, "y": 0 },
{ "label": "k07", "matrix": [0, 7], "w": 1, "x": 7, "y": 0 },
{ "label": "k08", "matrix": [0, 8], "w": 1, "x": 8, "y": 0 },
{ "label": "k09", "matrix": [0, 9], "w": 1, "x": 9, "y": 0 },
{ "label": "k0a", "matrix": [0, 10], "w": 1, "x": 10, "y": 0 },
{ "label": "k0b", "matrix": [0, 11], "w": 1, "x": 11, "y": 0 },
{ "label": "k10", "matrix": [1, 0], "w": 1, "x": 0, "y": 1 },
{ "label": "k11", "matrix": [1, 1], "w": 1, "x": 1, "y": 1 },
{ "label": "k12", "matrix": [1, 2], "w": 1, "x": 2, "y": 1 },
{ "label": "k13", "matrix": [1, 3], "w": 1, "x": 3, "y": 1 },
{ "label": "k14", "matrix": [1, 4], "w": 1, "x": 4, "y": 1 },
{ "label": "k15", "matrix": [1, 5], "w": 1, "x": 5, "y": 1 },
{ "label": "k16", "matrix": [1, 6], "w": 1, "x": 6, "y": 1 },
{ "label": "k17", "matrix": [1, 7], "w": 1, "x": 7, "y": 1 },
{ "label": "k18", "matrix": [1, 8], "w": 1, "x": 8, "y": 1 },
{ "label": "k19", "matrix": [1, 9], "w": 1, "x": 9, "y": 1 },
{ "label": "k1a", "matrix": [1, 10], "w": 1, "x": 10, "y": 1 },
{ "label": "k1b", "matrix": [1, 11], "w": 1, "x": 11, "y": 1 },
{ "label": "k20", "matrix": [2, 0], "w": 1, "x": 0, "y": 2 },
{ "label": "k21", "matrix": [2, 1], "w": 1, "x": 1, "y": 2 },
{ "label": "k22", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
{ "label": "k23", "matrix": [2, 3], "w": 1, "x": 3, "y": 2 },
{ "label": "k24", "matrix": [2, 4], "w": 1, "x": 4, "y": 2 },
{ "label": "k25", "matrix": [2, 5], "w": 1, "x": 5, "y": 2 },
{ "label": "k26", "matrix": [2, 6], "w": 1, "x": 6, "y": 2 },
{ "label": "k27", "matrix": [2, 7], "w": 1, "x": 7, "y": 2 },
{ "label": "k28", "matrix": [2, 8], "w": 1, "x": 8, "y": 2 },
{ "label": "k29", "matrix": [2, 9], "w": 1, "x": 9, "y": 2 },
{ "label": "k2a", "matrix": [2, 10], "w": 1, "x": 10, "y": 2 },
{ "label": "k2b", "matrix": [2, 11], "w": 1, "x": 11, "y": 2 },
{ "label": "k30", "matrix": [3, 0], "w": 1, "x": 0, "y": 3 },
{ "label": "k31", "matrix": [3, 1], "w": 1, "x": 1, "y": 3 },
{ "label": "k32", "matrix": [3, 2], "w": 1, "x": 2, "y": 3 },
{ "label": "k33", "matrix": [3, 3], "w": 1, "x": 3, "y": 3 },
{ "label": "k34", "matrix": [3, 4], "w": 1, "x": 4, "y": 3 },
{ "label": "k35", "matrix": [3, 5], "w": 1, "x": 5, "y": 3 },
{ "label": "k36", "matrix": [3, 6], "w": 1, "x": 6, "y": 3 },
{ "label": "k37", "matrix": [3, 7], "w": 1, "x": 7, "y": 3 },
{ "label": "k38", "matrix": [3, 8], "w": 1, "x": 8, "y": 3 },
{ "label": "k39", "matrix": [3, 9], "w": 1, "x": 9, "y": 3 },
{ "label": "k3a", "matrix": [3, 10], "w": 1, "x": 10, "y": 3 },
{ "label": "k3b", "matrix": [3, 11], "w": 1, "x": 11, "y": 3 }
]
},
"LAYOUT_planck_1x2uC": {
"c_macro": true,
"filename": "keyboards/planck/thk/thk.h",
"key_count": 47,
"layout": [
{ "label": "k00", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 },
{ "label": "k01", "matrix": [0, 1], "w": 1, "x": 1, "y": 0 },
{ "label": "k02", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 },
{ "label": "k03", "matrix": [0, 3], "w": 1, "x": 3, "y": 0 },
{ "label": "k04", "matrix": [0, 4], "w": 1, "x": 4, "y": 0 },
{ "label": "k05", "matrix": [0, 5], "w": 1, "x": 5, "y": 0 },
{ "label": "k06", "matrix": [0, 6], "w": 1, "x": 6, "y": 0 },
{ "label": "k07", "matrix": [0, 7], "w": 1, "x": 7, "y": 0 },
{ "label": "k08", "matrix": [0, 8], "w": 1, "x": 8, "y": 0 },
{ "label": "k09", "matrix": [0, 9], "w": 1, "x": 9, "y": 0 },
{ "label": "k0a", "matrix": [0, 10], "w": 1, "x": 10, "y": 0 },
{ "label": "k0b", "matrix": [0, 11], "w": 1, "x": 11, "y": 0 },
{ "label": "k10", "matrix": [1, 0], "w": 1, "x": 0, "y": 1 },
{ "label": "k11", "matrix": [1, 1], "w": 1, "x": 1, "y": 1 },
{ "label": "k12", "matrix": [1, 2], "w": 1, "x": 2, "y": 1 },
{ "label": "k13", "matrix": [1, 3], "w": 1, "x": 3, "y": 1 },
{ "label": "k14", "matrix": [1, 4], "w": 1, "x": 4, "y": 1 },
{ "label": "k15", "matrix": [1, 5], "w": 1, "x": 5, "y": 1 },
{ "label": "k16", "matrix": [1, 6], "w": 1, "x": 6, "y": 1 },
{ "label": "k17", "matrix": [1, 7], "w": 1, "x": 7, "y": 1 },
{ "label": "k18", "matrix": [1, 8], "w": 1, "x": 8, "y": 1 },
{ "label": "k19", "matrix": [1, 9], "w": 1, "x": 9, "y": 1 },
{ "label": "k1a", "matrix": [1, 10], "w": 1, "x": 10, "y": 1 },
{ "label": "k1b", "matrix": [1, 11], "w": 1, "x": 11, "y": 1 },
{ "label": "k20", "matrix": [2, 0], "w": 1, "x": 0, "y": 2 },
{ "label": "k21", "matrix": [2, 1], "w": 1, "x": 1, "y": 2 },
{ "label": "k22", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
{ "label": "k23", "matrix": [2, 3], "w": 1, "x": 3, "y": 2 },
{ "label": "k24", "matrix": [2, 4], "w": 1, "x": 4, "y": 2 },
{ "label": "k25", "matrix": [2, 5], "w": 1, "x": 5, "y": 2 },
{ "label": "k26", "matrix": [2, 6], "w": 1, "x": 6, "y": 2 },
{ "label": "k27", "matrix": [2, 7], "w": 1, "x": 7, "y": 2 },
{ "label": "k28", "matrix": [2, 8], "w": 1, "x": 8, "y": 2 },
{ "label": "k29", "matrix": [2, 9], "w": 1, "x": 9, "y": 2 },
{ "label": "k2a", "matrix": [2, 10], "w": 1, "x": 10, "y": 2 },
{ "label": "k2b", "matrix": [2, 11], "w": 1, "x": 11, "y": 2 },
{ "label": "k30", "matrix": [3, 0], "w": 1, "x": 0, "y": 3 },
{ "label": "k31", "matrix": [3, 1], "w": 1, "x": 1, "y": 3 },
{ "label": "k32", "matrix": [3, 2], "w": 1, "x": 2, "y": 3 },
{ "label": "k33", "matrix": [3, 3], "w": 1, "x": 3, "y": 3 },
{ "label": "k34", "matrix": [3, 4], "w": 1, "x": 4, "y": 3 },
{ "label": "k35", "matrix": [3, 6], "w": 2, "x": 5, "y": 3 },
{ "label": "k37", "matrix": [3, 7], "w": 1, "x": 7, "y": 3 },
{ "label": "k38", "matrix": [3, 8], "w": 1, "x": 8, "y": 3 },
{ "label": "k39", "matrix": [3, 9], "w": 1, "x": 9, "y": 3 },
{ "label": "k3a", "matrix": [3, 10], "w": 1, "x": 10, "y": 3 },
{ "label": "k3b", "matrix": [3, 11], "w": 1, "x": 11, "y": 3 }
]
}
}
}

View file

@ -0,0 +1,239 @@
/* Copyright 2015-2017 Jack Humbert
* Copyright 2021 Erovia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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 QMK_KEYBOARD_H
enum planck_layers {
_QWERTY,
_COLEMAK,
_DVORAK,
_LOWER,
_RAISE,
_ADJUST
};
enum planck_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
THK,
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = LAYOUT_planck_grid(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT_planck_grid(
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | THK | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = LAYOUT_planck_grid(
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC,
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH,
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT ,
THK, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = LAYOUT_planck_grid(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = LAYOUT_planck_grid(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset|Debug | | | | | | | | | Del |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | |AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | |TermOn|TermOf| | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT_planck_grid(
_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL ,
_______, _______, _______, _______, _______, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______,
_______, _______, _______, _______, _______, _______, _______, TERM_ON, TERM_OFF, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
return false;
case COLEMAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_COLEMAK);
}
return false;
case DVORAK:
if (record->event.pressed) {
set_single_persistent_default_layer(_DVORAK);
}
return false;
case THK:
if (record->event.pressed) {
SEND_STRING("Pretty cool keyboard, eh?");
}
return false;
}
return true;
}
bool encoder_mode = false;
void encoder_update(bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
#ifdef MOUSEKEY_ENABLE
tap_code(KC_MS_WH_DOWN);
#else
tap_code(KC_PGDN);
#endif
} else {
#ifdef MOUSEKEY_ENABLE
tap_code(KC_MS_WH_UP);
#else
tap_code(KC_PGUP);
#endif
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
if (encoder_mode) {
tap_code(KC_RGHT);
} else {
tap_code_delay(KC_VOLU, 60);
}
} else {
if (encoder_mode) {
tap_code(KC_LEFT);
} else {
tap_code_delay(KC_VOLD, 60);
}
}
}
}
void dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
case 0: {
if (active) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
}
break;
case 1:
if (active) {
encoder_mode = true;
} else {
encoder_mode = false;
}
break;
case 2:
SEND_STRING("QMK is the best thing ever");
break;
case 3:
SEND_STRING("This is a Planck THK");
break;
}
}

View file

@ -0,0 +1,3 @@
# Keymap specifically for the Planck T.H.K.
Based on the `default` Planck keymap.

View file

@ -0,0 +1,28 @@
# Planck Through Hole Kit
![THK](https://i.imgur.com/Fj8X0TDl.jpg)
The OG 4x12, through-hole, ortho board.
[Buildlog](https://erovia.github.io/posts/thk/)
* Keyboard Maintainer: [Erovia](https://github.com/Erovia)
* Hardware Supported: [Planck THK](https://github.com/olkb/planck_thk)
* Hardware Availability: The hardware was released under GPLv3, see link above.
Make example for this keyboard (after setting up your build environment):
make planck/thk:thk
Flashing example for this keyboard:
make planck/thk:thk:flash
**Reset**: With [the recommended bootloader](https://github.com/Erovia/planck_thk_usbasploader) a single press on the RESET button.
## Audio
The board has rudimental [audio](https://docs.qmk.fm/#/feature_audio) support.
As 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.
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

@ -0,0 +1,43 @@
# Copyright 2021 Erovia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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/>.
# MCU name
MCU = atmega32a
# Processor frequency
F_CPU = 16000000
# Bootloader selection
BOOTLOADER = USBasp
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # 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 = no # 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
ENCODER_ENABLE = yes
DIP_SWITCH_ENABLE = yes
LAYOUTS = ortho_4x12 planck_mit

View file

@ -0,0 +1,18 @@
/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
* Copyright 2021 Erovia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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 "thk.h"

View file

@ -0,0 +1,49 @@
/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
* Copyright 2021 Erovia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
*/
#pragma once
#include "planck.h"
#define LAYOUT_planck_1x2uC( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
{ k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
}
#define LAYOUT_ortho_4x12( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
}
#define LAYOUT_planck_mit LAYOUT_planck_1x2uC
#define LAYOUT_planck_grid LAYOUT_ortho_4x12

View file

@ -40,7 +40,7 @@ extern uint8_t note_timbre;
alternatively, the PWM pins on PORTB can be used as only/primary speaker
*/
#if defined(AUDIO_PIN) && (AUDIO_PIN != C4) && (AUDIO_PIN != C5) && (AUDIO_PIN != C6) && (AUDIO_PIN != B5) && (AUDIO_PIN != B6) && (AUDIO_PIN != B7)
#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)
# error "Audio feature enabled, but no suitable pin selected as AUDIO_PIN - see docs/feature_audio under the AVR settings for available options."
#endif
@ -94,7 +94,7 @@ extern uint8_t note_timbre;
# error "Audio feature: the pin selected as AUDIO_PIN_ALT is not supported."
#endif
#if (AUDIO_PIN == B5) || (AUDIO_PIN == B6) || (AUDIO_PIN == B7) || (AUDIO_PIN_ALT == B5) || (AUDIO_PIN_ALT == B6) || (AUDIO_PIN_ALT == B7)
#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)
# define AUDIO2_PIN_SET
# define AUDIO2_TIMSKx TIMSK1
# define AUDIO2_TCCRxA TCCR1A
@ -129,6 +129,16 @@ extern uint8_t note_timbre;
# define AUDIO2_OCRxy OCR1C
# define AUDIO2_PIN B7
# define AUDIO2_TIMERx_COMPy_vect TIMER1_COMPC_vect
# elif (AUDIO_PIN == D5) && defined(__AVR_ATmega32A__)
# pragma message "Audio support for ATmega32A is experimental and can cause crashes."
# undef AUDIO2_TIMSKx
# define AUDIO2_TIMSKx TIMSK
# define AUDIO2_COMxy0 COM1A0
# define AUDIO2_COMxy1 COM1A1
# define AUDIO2_OCIExy OCIE1A
# define AUDIO2_OCRxy OCR1A
# define AUDIO2_PIN D5
# define AUDIO2_TIMERx_COMPy_vect TIMER1_COMPA_vect
# endif
#endif