From 4237d35e83826d0d8949a45dffa27d6c68d3d4f9 Mon Sep 17 00:00:00 2001 From: Yu-Xi Lim Date: Tue, 18 Aug 2020 15:06:19 +0800 Subject: [PATCH] [Keyboard] HHKB Lite 2 (#9188) * Initial commit for HHKB Lite 2 * Rearrange keymap * Clean up config * Fix pin assignments * Code and filename cleanup * Add README * Apply suggestions from code review Code cleanup * Update keyboards/hhkb_lite_2/README.md Documentation cleanup * Change Vendor ID to unused * One more LAYOUT * Via keymap for HHKB Lite 2 * Remove redundant keymap.c * Add README for Via keymap * Fix vendorId for Via keymap * Apply suggestions from code review Cleanup based on review feedback * Clean up via keymap makefile rules * Switch to C keymap instead of JSON for Via layout * Move bootmagic key config to main Moved to main keyboard config to be shared by all keymaps. * Address PR feedback * Reformat config comments * Format rules.mk comments * Rename README -> readme * Use `make` instead of `qmk` in examples --- keyboards/hhkb_lite_2/config.h | 29 +++++++++++++++++ keyboards/hhkb_lite_2/hhkb_lite_2.c | 1 + keyboards/hhkb_lite_2/hhkb_lite_2.h | 22 +++++++++++++ .../hhkb_lite_2/keymaps/default/keymap.c | 22 +++++++++++++ keyboards/hhkb_lite_2/keymaps/via/config.h | 3 ++ keyboards/hhkb_lite_2/keymaps/via/keymap.c | 31 +++++++++++++++++++ keyboards/hhkb_lite_2/keymaps/via/readme.md | 3 ++ keyboards/hhkb_lite_2/keymaps/via/rules.mk | 2 ++ keyboards/hhkb_lite_2/readme.md | 28 +++++++++++++++++ keyboards/hhkb_lite_2/rules.mk | 23 ++++++++++++++ 10 files changed, 164 insertions(+) create mode 100644 keyboards/hhkb_lite_2/config.h create mode 100644 keyboards/hhkb_lite_2/hhkb_lite_2.c create mode 100644 keyboards/hhkb_lite_2/hhkb_lite_2.h create mode 100644 keyboards/hhkb_lite_2/keymaps/default/keymap.c create mode 100644 keyboards/hhkb_lite_2/keymaps/via/config.h create mode 100644 keyboards/hhkb_lite_2/keymaps/via/keymap.c create mode 100644 keyboards/hhkb_lite_2/keymaps/via/readme.md create mode 100644 keyboards/hhkb_lite_2/keymaps/via/rules.mk create mode 100644 keyboards/hhkb_lite_2/readme.md create mode 100644 keyboards/hhkb_lite_2/rules.mk diff --git a/keyboards/hhkb_lite_2/config.h b/keyboards/hhkb_lite_2/config.h new file mode 100644 index 0000000000..d9dd641951 --- /dev/null +++ b/keyboards/hhkb_lite_2/config.h @@ -0,0 +1,29 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x88B2 +#define PRODUCT_ID 0x88B2 +#define DEVICE_VER 0x0002 +#define MANUFACTURER PFU +#define PRODUCT HHKB Lite 2 + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 14 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { F5, F4, F1, F0, B0, B1, B2, B3 } +#define MATRIX_COL_PINS { F6, F7, B6, B5, B4, D7, D6, D4, D5, C7, C6, D3, D2, D1} +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Bootmagic keys are non-standard because of matrix */ +#define BOOTMAGIC_LITE_ROW 5 +#define BOOTMAGIC_LITE_COLUMN 9 diff --git a/keyboards/hhkb_lite_2/hhkb_lite_2.c b/keyboards/hhkb_lite_2/hhkb_lite_2.c new file mode 100644 index 0000000000..d0eaf250d6 --- /dev/null +++ b/keyboards/hhkb_lite_2/hhkb_lite_2.c @@ -0,0 +1 @@ +#include "hhkb_lite_2.h" diff --git a/keyboards/hhkb_lite_2/hhkb_lite_2.h b/keyboards/hhkb_lite_2/hhkb_lite_2.h new file mode 100644 index 0000000000..ccdd765a23 --- /dev/null +++ b/keyboards/hhkb_lite_2/hhkb_lite_2.h @@ -0,0 +1,22 @@ +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + K509, K109, K108, K107, K106, K006, K005, K105, K104, K103, K102, K002, K004, K413, K009, \ + K309, K209, K208, K207, K206, K306, K305, K205, K204, K203, K202, K302, K304, K313, \ + K010, K409, K408, K407, K406, K506, K505, K405, K404, K403, K402, K502, K613, \ + K311, K609, K608, K607, K606, K706, K705, K605, K600, K603, K702, K611, \ + K001, K512, K400, K713, K300, K712, \ + K000, \ + K303, K100, K200 \ +) { \ + { K000, K001, K002, KC_NO, K004, K005, K006, KC_NO, KC_NO, K009, K010, KC_NO, KC_NO, KC_NO }, \ + { K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K300, KC_NO, K302, K303, K304, K305, K306, KC_NO, KC_NO, K309, KC_NO, K311, KC_NO, K313 }, \ + { K400, KC_NO, K402, K403, K404, K405, K406, K407, K408, K409, KC_NO, KC_NO, KC_NO, K413 }, \ + { KC_NO, KC_NO, K502, KC_NO, KC_NO, K505, K506, KC_NO, KC_NO, K509, KC_NO, KC_NO, K512, KC_NO }, \ + { K600, KC_NO, KC_NO, K603, KC_NO, K605, K606, K607, K608, K609, KC_NO, K611, KC_NO, K613 }, \ + { KC_NO, KC_NO, K702, KC_NO, KC_NO, K705, K706, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K712, K713 } \ +} diff --git a/keyboards/hhkb_lite_2/keymaps/default/keymap.c b/keyboards/hhkb_lite_2/keymaps/default/keymap.c new file mode 100644 index 0000000000..dd2d552e0b --- /dev/null +++ b/keyboards/hhkb_lite_2/keymaps/default/keymap.c @@ -0,0 +1,22 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT( + KC_ESC, 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_GRV, + 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_LCTL, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, + KC_UP, + KC_LEFT, KC_DOWN, KC_RGHT + ), + LAYOUT( + RESET, 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_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_NO, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_PGUP, + KC_HOME, KC_PGDN, KC_END + ), +}; diff --git a/keyboards/hhkb_lite_2/keymaps/via/config.h b/keyboards/hhkb_lite_2/keymaps/via/config.h new file mode 100644 index 0000000000..a3b77a5b4d --- /dev/null +++ b/keyboards/hhkb_lite_2/keymaps/via/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define DYNAMIC_KEYMAP_LAYER_COUNT 3 diff --git a/keyboards/hhkb_lite_2/keymaps/via/keymap.c b/keyboards/hhkb_lite_2/keymaps/via/keymap.c new file mode 100644 index 0000000000..7cbe7331c3 --- /dev/null +++ b/keyboards/hhkb_lite_2/keymaps/via/keymap.c @@ -0,0 +1,31 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT( + KC_ESC, 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_GRV, + 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_LCTL, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, + KC_UP, + KC_LEFT, KC_DOWN, KC_RGHT + ), + LAYOUT( + RESET, 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_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_NO, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_PGUP, + KC_HOME, KC_PGDN, KC_END + ), + LAYOUT( + 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, 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/hhkb_lite_2/keymaps/via/readme.md b/keyboards/hhkb_lite_2/keymaps/via/readme.md new file mode 100644 index 0000000000..6eee36480e --- /dev/null +++ b/keyboards/hhkb_lite_2/keymaps/via/readme.md @@ -0,0 +1,3 @@ +# Via-enabled keymap for HHKB Lite 2 + +See https://caniusevia.com/ diff --git a/keyboards/hhkb_lite_2/keymaps/via/rules.mk b/keyboards/hhkb_lite_2/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/hhkb_lite_2/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/hhkb_lite_2/readme.md b/keyboards/hhkb_lite_2/readme.md new file mode 100644 index 0000000000..a4b9f16115 --- /dev/null +++ b/keyboards/hhkb_lite_2/readme.md @@ -0,0 +1,28 @@ +# HHKB Lite 2 + +![HHKB Lite 2](https://deskthority.net/wiki/images/e/ed/HHKB_Lite_2.jpg) + +This is for the [HHKB Lite 2](https://deskthority.net/wiki/HHKB_Lite) +by PFU, identified by model numbers PD-KB200W/U or PD-KB200B/U. It +uses the replacement Teensy 2.0 board from [my other +project](https://github.com/thirteen37/HHKB-Lite-2-Teensy). + +Make example for this keyboard (after setting up your build environment): + + make hhkb_lite_2:default + +Flashing example for this keyboard: + + make hhkb_lite_2: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). + +## Details + +The `default` keymap is nearly the official standard US QWERTY, except +with the `Delete` key behaving like `BS`, which is as if DIP `SW3` is +set. + +While there are two physical `Fn` keys on the keyboard, they are +electrically indistinguishable (same wiring matrix) so they can not be +assigned different keycodes. diff --git a/keyboards/hhkb_lite_2/rules.mk b/keyboards/hhkb_lite_2/rules.mk new file mode 100644 index 0000000000..dd02717921 --- /dev/null +++ b/keyboards/hhkb_lite_2/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = halfkay + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # 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 = yes # 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 +UNICODE_ENABLE = yes