From f79e1ab7481525cfa2b63e6bc062fb7d8250c8db Mon Sep 17 00:00:00 2001 From: JP Date: Sat, 18 Dec 2021 16:48:33 +0800 Subject: [PATCH] [Keyboard] Add k34 keyboard (#15250) Co-authored-by: Ryan Co-authored-by: jingpingw --- keyboards/k34/config.h | 38 +++++++++++++++ keyboards/k34/info.json | 52 +++++++++++++++++++++ keyboards/k34/k34.c | 4 ++ keyboards/k34/k34.h | 26 +++++++++++ keyboards/k34/keymaps/default/config.h | 24 ++++++++++ keyboards/k34/keymaps/default/keymap.c | 61 +++++++++++++++++++++++++ keyboards/k34/keymaps/default/readme.md | 1 + keyboards/k34/keymaps/default/rules.mk | 1 + keyboards/k34/readme.md | 25 ++++++++++ keyboards/k34/rules.mk | 18 ++++++++ 10 files changed, 250 insertions(+) create mode 100644 keyboards/k34/config.h create mode 100644 keyboards/k34/info.json create mode 100644 keyboards/k34/k34.c create mode 100644 keyboards/k34/k34.h create mode 100644 keyboards/k34/keymaps/default/config.h create mode 100644 keyboards/k34/keymaps/default/keymap.c create mode 100644 keyboards/k34/keymaps/default/readme.md create mode 100644 keyboards/k34/keymaps/default/rules.mk create mode 100644 keyboards/k34/readme.md create mode 100644 keyboards/k34/rules.mk diff --git a/keyboards/k34/config.h b/keyboards/k34/config.h new file mode 100644 index 00000000000..4d9910d50dc --- /dev/null +++ b/keyboards/k34/config.h @@ -0,0 +1,38 @@ +// Copyright 2021 jp_smasher (@jp_smasher) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER jp_smasher +#define PRODUCT k34 + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 10 + +/* + * 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 { F4, B2, E6, B4 } +#define MATRIX_COL_PINS { D1, D0, D4, C6, D7, F5, F6, F7, B1, B3 } +#define UNUSED_PINS { B5, B6, D2, D3 } + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + diff --git a/keyboards/k34/info.json b/keyboards/k34/info.json new file mode 100644 index 00000000000..0917e44961c --- /dev/null +++ b/keyboards/k34/info.json @@ -0,0 +1,52 @@ +{ + "keyboard_name": "k34", + "url": "https://github.com/wongjingping/k34", + "maintainer": "qmk", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Q", "x": 0, "y": 0.3 }, + { "label": "W", "x": 1, "y": 0.1 }, + { "label": "E", "x": 2, "y": 0 }, + { "label": "R", "x": 3, "y": 0.1 }, + { "label": "T", "x": 4, "y": 0.2 }, + + { "label": "Y", "x": 8, "y": 0.2 }, + { "label": "U", "x": 9, "y": 0.1 }, + { "label": "I", "x": 10, "y": 0 }, + { "label": "O", "x": 11, "y": 0.1 }, + { "label": "P", "x": 12, "y": 0.3 }, + + { "label": "A", "x": 0, "y": 1.3 }, + { "label": "S", "x": 1, "y": 1.1 }, + { "label": "D", "x": 2, "y": 1 }, + { "label": "F", "x": 3, "y": 1.1 }, + { "label": "G", "x": 4, "y": 1.2 }, + + { "label": "H", "x": 8, "y": 1.2 }, + { "label": "J", "x": 9, "y": 1.1 }, + { "label": "K", "x": 10, "y": 1 }, + { "label": "L", "x": 11, "y": 1.1 }, + { "label": ";", "x": 12, "y": 1.3 }, + + { "label": "Z", "x": 0, "y": 2.3 }, + { "label": "X", "x": 1, "y": 2.1 }, + { "label": "C", "x": 2, "y": 2 }, + { "label": "V", "x": 3, "y": 2.1 }, + { "label": "B", "x": 4, "y": 2.2 }, + + { "label": "N", "x": 8, "y": 2.2 }, + { "label": "M", "x": 9, "y": 2.1 }, + { "label": ",", "x": 10, "y": 2 }, + { "label": ".", "x": 11, "y": 2.1 }, + { "label": "/", "x": 12, "y": 2.3 }, + + { "label": "GUI / KC_HANJ", "x": 3, "y": 3.7 }, + { "label": "Lower", "x": 4, "y": 3.7 }, + + { "label": "Raise", "x": 8, "y": 3.7 }, + { "label": "Alt / KC_HAEN", "x": 9, "y": 3.7 } + ] + } + } +} \ No newline at end of file diff --git a/keyboards/k34/k34.c b/keyboards/k34/k34.c new file mode 100644 index 00000000000..0dffa61ffda --- /dev/null +++ b/keyboards/k34/k34.c @@ -0,0 +1,4 @@ +// Copyright 2021 jp_smasher (@jp_smasher) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "k34.h" diff --git a/keyboards/k34/k34.h b/keyboards/k34/k34.h new file mode 100644 index 00000000000..e34f5408d4b --- /dev/null +++ b/keyboards/k34/k34.h @@ -0,0 +1,26 @@ +// Copyright 2021 jp_smasher (@jp_smasher) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "quantum.h" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ + k33, k34, k35, k36 \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \ + { KC_NO, KC_NO, KC_NO, k33, k34, k35, k36, KC_NO, KC_NO, KC_NO }, \ +} diff --git a/keyboards/k34/keymaps/default/config.h b/keyboards/k34/keymaps/default/config.h new file mode 100644 index 00000000000..803471e5504 --- /dev/null +++ b/keyboards/k34/keymaps/default/config.h @@ -0,0 +1,24 @@ + /* Copyright Wong Jing Ping <@wongjingping> + * + * 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. + * + */ + +#pragma once + +// use 1 combo +#define COMBO_COUNT 1 +#define COMBO_TERM 300 + +// mod taps for home row mods +#define TAPPING_TERM_PER_KEY +#define IGNORE_MOD_TAP_INTERRUPT + diff --git a/keyboards/k34/keymaps/default/keymap.c b/keyboards/k34/keymaps/default/keymap.c new file mode 100644 index 00000000000..6bd8e402da6 --- /dev/null +++ b/keyboards/k34/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +// Copyright 2021 jp_smasher (@jp_smasher) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _L1, + _L2 +}; + +// define layers +#define L1 MO(_L1) +#define L2 LT(_L2, KC_ENT) + +// define home-row styled alpha-mods +#define C_C LCTL_T(KC_C) +#define C_COMM LCTL_T(KC_COMM) +#define G_A CMD_T(KC_A) +#define G_SC CMD_T(KC_SCLN) +#define A_X LOPT_T(KC_X) +#define A_DOT LOPT_T(KC_DOT) +#define S_Z SFT_T(KC_Z) +#define S_SLSH SFT_T(KC_SLSH) + +// combos for application shortcuts +#define SG_LBRC SGUI(KC_LBRC) +#define SG_RBRC SGUI(KC_RBRC) +#define G_LBRC G(KC_LBRC) +#define G_RBRC G(KC_RBRC) +#define A_SLSH A(KC_SLSH) + +/* combos */ +const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END}; +combo_t key_combos[COMBO_COUNT] = {COMBO(jk_combo, KC_ESC)}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + G_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, G_SC, + S_Z, A_X, C_C, KC_V, KC_B, KC_N, KC_M, C_COMM, A_DOT, S_SLSH, + L1, KC_SPC, KC_SPC, L2 + ), + + + [_L1] = LAYOUT( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_MINS, KC_EQL, + KC_LPRN, KC_RPRN, KC_LCBR, KC_RCBR, KC_GRV, KC_QUOT, KC_LBRC, KC_RBRC, KC_BSLS, KC_PIPE, + _______, _______, _______, KC_TAB, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_MNXT, + _______, _______, _______, _______ + ), + + [_L2] = LAYOUT( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, + _______, _______, _______, _______, KC_DOT, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_BSPC, + _______, _______, _______, _______, _______, A_SLSH, SG_LBRC, SG_RBRC, G_LBRC, G_RBRC, + KC_LALT, KC_LGUI, _______, _______ + ), +}; diff --git a/keyboards/k34/keymaps/default/readme.md b/keyboards/k34/keymaps/default/readme.md new file mode 100644 index 00000000000..bad277222b0 --- /dev/null +++ b/keyboards/k34/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for k34 diff --git a/keyboards/k34/keymaps/default/rules.mk b/keyboards/k34/keymaps/default/rules.mk new file mode 100644 index 00000000000..439d48d6e65 --- /dev/null +++ b/keyboards/k34/keymaps/default/rules.mk @@ -0,0 +1 @@ +COMBO_ENABLE = yes # enable combo diff --git a/keyboards/k34/readme.md b/keyboards/k34/readme.md new file mode 100644 index 00000000000..8f17c7e5de1 --- /dev/null +++ b/keyboards/k34/readme.md @@ -0,0 +1,25 @@ +# k34 + +![k34](https://i.imgur.com/tarkFIph.jpeg) + +## Keyboard Info + +The K34 is a custom 34-key unibody keyboard. + +* Keyboard Maintainer: [wongjingping](https://github.com/wongjingping) +All hardware supported can be found in the [k34 repository](https://github.com/wongjingping/k34) + +## Flashing Instructions + +To enter the bootloader, short the RST and GND pins, or press the key mapped to `RESET`. + +Make example for this keyboard (after setting up your build environment): + + make k34:default + +Flashing example for this keyboard: + + make k34:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + diff --git a/keyboards/k34/rules.mk b/keyboards/k34/rules.mk new file mode 100644 index 00000000000..a61e60c8a40 --- /dev/null +++ b/keyboards/k34/rules.mk @@ -0,0 +1,18 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output