From 4a9771c0ecc9ffe8c7b9ad69f11df03406dc4cfc Mon Sep 17 00:00:00 2001 From: Huy Ta Ba Thanh Date: Sun, 23 Oct 2022 05:59:43 +0700 Subject: Add H50 keyboard from huytbt (#18752) * Add H50 keyboard from huytbt Add H50 keyboard The H50 is a mini keyboard with a 50 percent layout. The keyboard consists of 53 keys. * Optimize code * Optimize keymap code * Optimize code H50 keyboard --- keyboards/huytbt/h50/config.h | 42 ++++++++++++++++ keyboards/huytbt/h50/h50.c | 17 +++++++ keyboards/huytbt/h50/h50.h | 35 +++++++++++++ keyboards/huytbt/h50/info.json | 72 +++++++++++++++++++++++++++ keyboards/huytbt/h50/keymaps/default/keymap.c | 51 +++++++++++++++++++ keyboards/huytbt/h50/keymaps/via/keymap.c | 51 +++++++++++++++++++ keyboards/huytbt/h50/keymaps/via/rules.mk | 1 + keyboards/huytbt/h50/readme.md | 27 ++++++++++ keyboards/huytbt/h50/rules.mk | 16 ++++++ 9 files changed, 312 insertions(+) create mode 100644 keyboards/huytbt/h50/config.h create mode 100644 keyboards/huytbt/h50/h50.c create mode 100644 keyboards/huytbt/h50/h50.h create mode 100644 keyboards/huytbt/h50/info.json create mode 100644 keyboards/huytbt/h50/keymaps/default/keymap.c create mode 100644 keyboards/huytbt/h50/keymaps/via/keymap.c create mode 100644 keyboards/huytbt/h50/keymaps/via/rules.mk create mode 100644 keyboards/huytbt/h50/readme.md create mode 100644 keyboards/huytbt/h50/rules.mk (limited to 'keyboards/huytbt/h50') diff --git a/keyboards/huytbt/h50/config.h b/keyboards/huytbt/h50/config.h new file mode 100644 index 0000000000..a89fe3763e --- /dev/null +++ b/keyboards/huytbt/h50/config.h @@ -0,0 +1,42 @@ +/* Copyright 2022 Huy Ta (@huytbt) + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 14 + +/* + * Keyboard Matrix Assignments + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + */ +#define MATRIX_ROW_PINS { D1, D0, D4, C6 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, D7, E6, B4, B5, D2, D3 } + +#define LED_CAPS_LOCK_PIN D5 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +// #define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 diff --git a/keyboards/huytbt/h50/h50.c b/keyboards/huytbt/h50/h50.c new file mode 100644 index 0000000000..bb80f14583 --- /dev/null +++ b/keyboards/huytbt/h50/h50.c @@ -0,0 +1,17 @@ +/* Copyright 2022 Huy Ta (@huytbt) + * + * 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 . + */ + +#include "h50.h" diff --git a/keyboards/huytbt/h50/h50.h b/keyboards/huytbt/h50/h50.h new file mode 100644 index 0000000000..9d710de915 --- /dev/null +++ b/keyboards/huytbt/h50/h50.h @@ -0,0 +1,35 @@ +/* Copyright 2022 Huy Ta (@huytbt) + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +#define XXX KC_NO + +/* h50 keymap definition macro + */ +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, \ + k30, k31, k32, k33, k35, k37, k39, k3A, k3B, k3C, k3D \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D }, \ + { k30, k31, k32, k33, XXX, k35, XXX, k37, XXX, k39, k3A, k3B, k3C, k3D } \ +} diff --git a/keyboards/huytbt/h50/info.json b/keyboards/huytbt/h50/info.json new file mode 100644 index 0000000000..14326061c9 --- /dev/null +++ b/keyboards/huytbt/h50/info.json @@ -0,0 +1,72 @@ +{ + "keyboard_name": "H50", + "url": "https://github.com/huytbt/h50-keyboard", + "maintainer": "huytbt", + "usb": { + "vid": "0x4859", + "pid": "0x0002", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Tab", "x": 0, "y": 0 }, + { "label": "Q", "x": 1, "y": 0 }, + { "label": "W", "x": 2, "y": 0 }, + { "label": "E", "x": 3, "y": 0 }, + { "label": "R", "x": 4, "y": 0 }, + { "label": "T", "x": 5, "y": 0 }, + { "label": "Y", "x": 6, "y": 0 }, + { "label": "U", "x": 7, "y": 0 }, + { "label": "I", "x": 8, "y": 0 }, + { "label": "O", "x": 9, "y": 0 }, + { "label": "P", "x": 10, "y": 0 }, + { "label": "[", "x": 11, "y": 0 }, + { "label": "]", "x": 12, "y": 0 }, + { "label": "Back
Space", "x": 13, "y": 0 }, + + { "label": "Caps", "x": 0, "y": 1, "w": 1.25 }, + { "label": "A", "x": 1.25, "y": 1 }, + { "label": "S", "x": 2.25, "y": 1 }, + { "label": "D", "x": 3.25, "y": 1 }, + { "label": "F", "x": 4.25, "y": 1 }, + { "label": "G", "x": 5.25, "y": 1 }, + { "label": "H", "x": 6.25, "y": 1 }, + { "label": "J", "x": 7.25, "y": 1 }, + { "label": "K", "x": 8.25, "y": 1 }, + { "label": "L", "x": 9.25, "y": 1 }, + { "label": ";", "x": 10.25, "y": 1 }, + { "label": "'", "x": 11.25, "y": 1 }, + { "label": "Enter", "x": 12.25, "y": 1, "w": 1.75 }, + { "label": "PGUP", "x": 14, "y": 1 }, + + { "label": "Shift", "x": 0, "y": 2, "w": 1.75 }, + { "label": "Z", "x": 1.75, "y": 2 }, + { "label": "X", "x": 2.75, "y": 2 }, + { "label": "C", "x": 3.75, "y": 2 }, + { "label": "V", "x": 4.75, "y": 2 }, + { "label": "B", "x": 5.75, "y": 2 }, + { "label": "N", "x": 6.75, "y": 2 }, + { "label": "M", "x": 7.75, "y": 2 }, + { "label": ",", "x": 8.75, "y": 2 }, + { "label": ".", "x": 9.75, "y": 2 }, + { "label": "/", "x": 10.75, "y": 2 }, + { "label": "Shift", "x": 11.75, "y": 2, "w": 1.25 }, + { "label": "Up", "x": 13, "y": 2 }, + { "label": "PGDN", "x": 14, "y": 2 }, + + { "label": "Ctrl", "x": 0, "y": 3, "w": 1.25 }, + { "label": "Alt", "x": 1.25, "y": 3, "w": 1.25 }, + { "label": "Super", "x": 2.5, "y": 3, "w": 1.25 }, + { "x": 3.75, "y": 3, "w": 1.75 }, + { "x": 5.5, "y": 3, "w": 1.75 }, + { "label": "Fn1", "x": 7.25, "y": 3, "w": 1.75 }, + { "label": "Fn2", "x": 9, "y": 3, "w": 1.25 }, + { "label": "Fn3", "x": 10.25, "y": 3, "w": 1.25 }, + { "label": "Left", "x": 12, "y": 3 }, + { "label": "Down", "x": 13, "y": 3 }, + { "label": "Right", "x": 14, "y": 3 } + ] + } + } +} diff --git a/keyboards/huytbt/h50/keymaps/default/keymap.c b/keyboards/huytbt/h50/keymaps/default/keymap.c new file mode 100644 index 0000000000..209a396ac5 --- /dev/null +++ b/keyboards/huytbt/h50/keymaps/default/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2022 Huy Ta (@huytbt) + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +/* this keymap is to provide a basic keyboard layout for testing the matrix + * for more practical and complicated keymap refer to other keymaps in the same folder + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + 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_BSPC, + 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, KC_PGUP, + 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, KC_PGDN, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, MO(1), MO(2), MO(3), KC_LEFT, KC_DOWN, KC_RGHT + ), + + [1] = LAYOUT( + 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_BSLS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT( + 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_DEL, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; diff --git a/keyboards/huytbt/h50/keymaps/via/keymap.c b/keyboards/huytbt/h50/keymaps/via/keymap.c new file mode 100644 index 0000000000..209a396ac5 --- /dev/null +++ b/keyboards/huytbt/h50/keymaps/via/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2022 Huy Ta (@huytbt) + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +/* this keymap is to provide a basic keyboard layout for testing the matrix + * for more practical and complicated keymap refer to other keymaps in the same folder + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + 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_BSPC, + 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, KC_PGUP, + 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, KC_PGDN, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, MO(1), MO(2), MO(3), KC_LEFT, KC_DOWN, KC_RGHT + ), + + [1] = LAYOUT( + 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_BSLS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT( + 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_DEL, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; diff --git a/keyboards/huytbt/h50/keymaps/via/rules.mk b/keyboards/huytbt/h50/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/huytbt/h50/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/huytbt/h50/readme.md b/keyboards/huytbt/h50/readme.md new file mode 100644 index 0000000000..4e08f807ef --- /dev/null +++ b/keyboards/huytbt/h50/readme.md @@ -0,0 +1,27 @@ +# H50 + +![h50](https://i.imgur.com/1dB2mfMh.jpeg) + +The H50 is a mini keyboard with a 50 percent layout. The keyboard consists of 53 keys. + +* Keyboard Maintainer: [huytbt](https://github.com/huytbt) +* Hardware Supported: Handwired +* Hardware Availability: You can follow the build guide here + +Make example for this keyboard (after setting up your build environment): + + make huytbt/h50:default + +Flashing example for this keyboard: + + make huytbt/h50: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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/huytbt/h50/rules.mk b/keyboards/huytbt/h50/rules.mk new file mode 100644 index 0000000000..288fe84296 --- /dev/null +++ b/keyboards/huytbt/h50/rules.mk @@ -0,0 +1,16 @@ +# 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 = 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 +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Disable keyboard backlight functionality -- cgit v1.2.3