summaryrefslogtreecommitdiff
path: root/keyboards/hhkb/jp
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/hhkb/jp')
-rw-r--r--keyboards/hhkb/jp/config.h104
-rw-r--r--keyboards/hhkb/jp/hhkb_avr.h164
-rw-r--r--keyboards/hhkb/jp/info.json82
-rw-r--r--keyboards/hhkb/jp/jp.c1
-rw-r--r--keyboards/hhkb/jp/jp.h28
-rw-r--r--keyboards/hhkb/jp/keymaps/bakingpy/keymap.c16
-rw-r--r--keyboards/hhkb/jp/keymaps/bakingpy/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/default/keymap.c49
-rw-r--r--keyboards/hhkb/jp/keymaps/default/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/default_mac/keymap.c49
-rw-r--r--keyboards/hhkb/jp/keymaps/default_mac/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/config.h1
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/keymap.c84
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/keymap.h7
-rw-r--r--keyboards/hhkb/jp/keymaps/dhertz/rules.mk2
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c71
-rw-r--r--keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk3
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md49
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c76
-rw-r--r--keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c55
-rw-r--r--keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/README.md86
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/keymap.c50
-rw-r--r--keyboards/hhkb/jp/keymaps/sh_jp/rules.mk1
-rw-r--r--keyboards/hhkb/jp/keymaps/via/config.h2
-rw-r--r--keyboards/hhkb/jp/keymaps/via/keymap.c58
-rw-r--r--keyboards/hhkb/jp/keymaps/via/rules.mk1
-rw-r--r--keyboards/hhkb/jp/matrix.c212
-rw-r--r--keyboards/hhkb/jp/readme.md14
-rw-r--r--keyboards/hhkb/jp/rules.mk69
31 files changed, 1339 insertions, 0 deletions
diff --git a/keyboards/hhkb/jp/config.h b/keyboards/hhkb/jp/config.h
new file mode 100644
index 0000000000..01dab6d440
--- /dev/null
+++ b/keyboards/hhkb/jp/config.h
@@ -0,0 +1,104 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0x4848 // HH = happy hacking
+#define PRODUCT_ID 0x0002 // HHKB JP
+#define DEVICE_VER 0x0104
+#define MANUFACTURER q.m.k
+#define PRODUCT HHKB mod
+#define DESCRIPTION q.m.k keyboard firmware for HHKB
+
+/* key matrix size */
+#define MATRIX_ROWS 16
+#define MATRIX_COLS 8
+
+#define TAPPING_TERM 200
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 3
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+//#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+//#define LOCKING_RESYNC_ENABLE
+
+#ifdef HHKB_RN42_ENABLE
+// rn42 support -- acquired from the tmk repo. This is almost certainly not
+// integrated with qmk in the correct way.
+
+#define SUART_OUT_PORT PORTD
+#define SUART_OUT_BIT 0
+#define SUART_IN_PIN PIND
+#define SUART_IN_BIT 1
+
+#ifdef __AVR_ATmega32U4__
+ /* iom32u4.h has no definition of UCSR1D. copy from iom32u2.h */
+ #define UCSR1D _SFR_MEM8(0xCB)
+ #define RTSEN 0
+ #define CTSEN 1
+
+ #define SERIAL_UART_BAUD 115200
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16.0*SERIAL_UART_BAUD)-1+0.5))
+ #define SERIAL_UART_RXD_VECT USART1_RX_vect
+ #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
+ #define SERIAL_UART_INIT() do { \
+ UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
+ UBRR1H = ((uint16_t)SERIAL_UART_UBRR>>8); /* baud rate */ \
+ UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
+ UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
+ UCSR1C |= (0<<UPM11) | (0<<UPM10); /* parity: none(00), even(01), odd(11) */ \
+ UCSR1D |= (0<<RTSEN) | (0<<CTSEN); /* RTS, CTS(no flow control by hardware) */ \
+ DDRD |= (1<<5); PORTD &= ~(1<<5); /* RTS for flow control by firmware */ \
+ sei(); \
+ } while(0)
+ #define SERIAL_UART_RTS_LO() do { PORTD &= ~(1<<5); } while (0)
+ #define SERIAL_UART_RTS_HI() do { PORTD |= (1<<5); } while (0)
+#else
+ #error "USART configuration is needed."
+#endif
+
+/* power control of key switch board */
+#define HHKB_POWER_SAVING
+
+#endif
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+*/
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
diff --git a/keyboards/hhkb/jp/hhkb_avr.h b/keyboards/hhkb/jp/hhkb_avr.h
new file mode 100644
index 0000000000..a1f825cfb0
--- /dev/null
+++ b/keyboards/hhkb/jp/hhkb_avr.h
@@ -0,0 +1,164 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+
+
+// Timer resolution check
+#if (1000000/TIMER_RAW_FREQ > 20)
+# error "Timer resolution(>20us) is not enough for HHKB matrix scan tweak on V-USB."
+#endif
+
+
+/*
+ * HHKB Matrix I/O
+ *
+ * row: HC4051[A,B,C] selects scan row0-7
+ * row-ext: [En0,En1] row extention for JP
+ * col: LS145[A,B,C,D] selects scan col0-7 and enable(D)
+ * key: on: 0/off: 1
+ * prev: hysteresis control: assert(1) when previous key state is on
+ */
+
+
+#if defined(__AVR_ATmega32U4__)
+/*
+ * For TMK HHKB alt controller(ATMega32U4)
+ *
+ * row: PB0-2
+ * col: PB3-5,6
+ * key: PD7(pull-uped)
+ * prev: PB7
+ * power: PD4(L:off/H:on)
+ * row-ext: PC6,7 for HHKB JP(active low)
+ */
+static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); }
+static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); }
+static inline bool KEY_STATE(void) { return (PIND & (1<<7)); }
+static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); }
+static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); }
+#ifdef HHKB_POWER_SAVING
+static inline void KEY_POWER_ON(void) {
+ DDRB = 0xFF; PORTB = 0x40; // change pins output
+ DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on
+ /* Without this wait you will miss or get false key events. */
+ _delay_ms(5); // wait for powering up
+}
+static inline void KEY_POWER_OFF(void) {
+ /* input with pull-up consumes less than without it when pin is open. */
+ DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up
+ DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off
+}
+static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); }
+#else
+static inline void KEY_POWER_ON(void) {}
+static inline void KEY_POWER_OFF(void) {}
+static inline bool KEY_POWER_STATE(void) { return true; }
+#endif
+static inline void KEY_INIT(void)
+{
+ /* row,col,prev: output */
+ DDRB = 0xFF;
+ PORTB = 0x40; // unable
+ /* key: input with pull-up */
+ DDRD &= ~0x80;
+ PORTD |= 0x80;
+
+ /* row extention for HHKB JP */
+ DDRC |= (1<<6|1<<7);
+ PORTC |= (1<<6|1<<7);
+
+ KEY_UNABLE();
+ KEY_PREV_OFF();
+
+ KEY_POWER_OFF();
+}
+static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
+{
+ PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
+
+ if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6);
+ else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7);
+
+}
+
+
+#elif defined(__AVR_AT90USB1286__)
+/*
+ * For Teensy++(AT90USB1286)
+ *
+ * HHKB pro HHKB pro2
+ * row: PB0-2 (6-8) (5-7)
+ * col: PB3-5,6 (9-12) (8-11)
+ * key: PE6(pull-uped) (4) (3)
+ * prev: PE7 (5) (4)
+ *
+ * TODO: convert into 'staitc inline' function
+ */
+#define KEY_INIT() do { \
+ DDRB |= 0x7F; \
+ DDRE |= (1<<7); \
+ DDRE &= ~(1<<6); \
+ PORTE |= (1<<6); \
+} while (0)
+#define KEY_SELECT(ROW, COL) (PORTB = (PORTB & 0xC0) | \
+ (((COL) & 0x07)<<3) | \
+ ((ROW) & 0x07))
+#define KEY_ENABLE() (PORTB &= ~(1<<6))
+#define KEY_UNABLE() (PORTB |= (1<<6))
+#define KEY_STATE() (PINE & (1<<6))
+#define KEY_PREV_ON() (PORTE |= (1<<7))
+#define KEY_PREV_OFF() (PORTE &= ~(1<<7))
+#define KEY_POWER_ON()
+#define KEY_POWER_OFF()
+#define KEY_POWER_STATE() true
+
+
+#else
+# error "define code for matrix scan"
+#endif
+
+
+#if 0
+// For ATMega328P with V-USB
+//
+// #elif defined(__AVR_ATmega328P__)
+// Ports for V-USB
+// key: PB0(pull-uped)
+// prev: PB1
+// row: PB2-4
+// col: PC0-2,3
+// power: PB5(Low:on/Hi-z:off)
+#define KEY_INIT() do { \
+ DDRB |= 0x3E; \
+ DDRB &= ~(1<<0); \
+ PORTB |= 1<<0; \
+ DDRC |= 0x0F; \
+ KEY_UNABLE(); \
+ KEY_PREV_OFF(); \
+} while (0)
+#define KEY_SELECT(ROW, COL) do { \
+ PORTB = (PORTB & 0xE3) | ((ROW) & 0x07)<<2; \
+ PORTC = (PORTC & 0xF8) | ((COL) & 0x07); \
+} while (0)
+#define KEY_ENABLE() (PORTC &= ~(1<<3))
+#define KEY_UNABLE() (PORTC |= (1<<3))
+#define KEY_STATE() (PINB & (1<<0))
+#define KEY_PREV_ON() (PORTB |= (1<<1))
+#define KEY_PREV_OFF() (PORTB &= ~(1<<1))
+// Power supply switching
+#define KEY_POWER_ON() do { \
+ KEY_INIT(); \
+ PORTB &= ~(1<<5); \
+ _delay_ms(1); \
+} while (0)
+#define KEY_POWER_OFF() do { \
+ DDRB &= ~0x3F; \
+ PORTB &= ~0x3F; \
+ DDRC &= ~0x0F; \
+ PORTC &= ~0x0F; \
+} while (0)
+#endif
diff --git a/keyboards/hhkb/jp/info.json b/keyboards/hhkb/jp/info.json
new file mode 100644
index 0000000000..7594987d96
--- /dev/null
+++ b/keyboards/hhkb/jp/info.json
@@ -0,0 +1,82 @@
+{
+ "keyboard_name": "HHKB JP",
+ "url": "",
+ "maintainer": "qmk",
+ "width": 15,
+ "height": 5,
+ "layouts": {
+ "LAYOUT_JP": {
+ "layout": [
+ { "label": "Esc", "x": 0, "y": 0 },
+ { "label": "!", "x": 1, "y": 0 },
+ { "label": "\"", "x": 2, "y": 0 },
+ { "label": "#", "x": 3, "y": 0 },
+ { "label": "$", "x": 4, "y": 0 },
+ { "label": "%", "x": 5, "y": 0 },
+ { "label": "&", "x": 6, "y": 0 },
+ { "label": "'", "x": 7, "y": 0 },
+ { "label": "(", "x": 8, "y": 0 },
+ { "label": ")", "x": 9, "y": 0 },
+ { "label": "", "x": 10, "y": 0 },
+ { "label": "=", "x": 11, "y": 0 },
+ { "label": "~", "x": 12, "y": 0 },
+ { "label": "|", "x": 13, "y": 0 },
+ { "label": "BS", "x": 14, "y": 0 },
+ { "label": "Tab", "x": 0, "y": 1, "w": 1.5 },
+ { "label": "Q", "x": 1.5, "y": 1 },
+ { "label": "W", "x": 2.5, "y": 1 },
+ { "label": "E", "x": 3.5, "y": 1 },
+ { "label": "R", "x": 4.5, "y": 1 },
+ { "label": "T", "x": 5.5, "y": 1 },
+ { "label": "Y", "x": 6.5, "y": 1 },
+ { "label": "U", "x": 7.5, "y": 1 },
+ { "label": "I", "x": 8.5, "y": 1 },
+ { "label": "O", "x": 9.5, "y": 1 },
+ { "label": "P", "x": 10.5, "y": 1 },
+ { "label": "`", "x": 11.5, "y": 1 },
+ { "label": "{", "x": 12.5, "y": 1 },
+ { "label": "Enter", "x": 13.75, "y": 1, "w": 1.25, "h": 2 },
+ { "label": "Control", "x": 0, "y": 2, "w": 1.75 },
+ { "label": "A", "x": 1.75, "y": 2 },
+ { "label": "S", "x": 2.75, "y": 2 },
+ { "label": "D", "x": 3.75, "y": 2 },
+ { "label": "F", "x": 4.75, "y": 2 },
+ { "label": "G", "x": 5.75, "y": 2 },
+ { "label": "H", "x": 6.75, "y": 2 },
+ { "label": "J", "x": 7.75, "y": 2 },
+ { "label": "K", "x": 8.75, "y": 2 },
+ { "label": "L", "x": 9.75, "y": 2 },
+ { "label": "+", "x": 10.75, "y": 2 },
+ { "label": "*", "x": 11.75, "y": 2 },
+ { "label": "}", "x": 12.75, "y": 2 },
+ { "label": "Shift", "x": 0, "y": 3, "w": 2 },
+ { "label": "Z", "x": 2, "y": 3 },
+ { "label": "X", "x": 3, "y": 3 },
+ { "label": "C", "x": 4, "y": 3 },
+ { "label": "V", "x": 5, "y": 3 },
+ { "label": "B", "x": 6, "y": 3 },
+ { "label": "N", "x": 7, "y": 3 },
+ { "label": "M", "x": 8, "y": 3 },
+ { "label": "<", "x": 9, "y": 3 },
+ { "label": ">", "x": 10, "y": 3 },
+ { "label": "?", "x": 11, "y": 3 },
+ { "label": "_", "x": 12, "y": 3 },
+ { "label": "\u2191", "x": 13, "y": 3 },
+ { "label": "Shift", "x": 14, "y": 3 },
+ { "label": "Fn", "x": 0, "y": 4 },
+ { "label": "HH", "x": 1.25, "y": 4 },
+ { "label": "\u2662", "x": 2.25, "y": 4 },
+ { "label": "", "x": 3.25, "y": 4 },
+ { "label": "NN", "x": 4.25, "y": 4 },
+ { "x": 5.25, "y": 4, "w": 2.5 },
+ { "label": "\u25cc", "x": 7.75, "y": 4 },
+ { "label": "Kana", "x": 8.75, "y": 4 },
+ { "label": "", "x": 9.75, "y": 4 },
+ { "label": "Fn", "x": 10.75, "y": 4 },
+ { "label": "\u2190", "x": 12, "y": 4 },
+ { "label": "\u2193", "x": 13, "y": 4 },
+ { "label": "\u2192", "x": 14, "y": 4 }
+ ]
+ }
+ }
+}
diff --git a/keyboards/hhkb/jp/jp.c b/keyboards/hhkb/jp/jp.c
new file mode 100644
index 0000000000..f1f1388c77
--- /dev/null
+++ b/keyboards/hhkb/jp/jp.c
@@ -0,0 +1 @@
+#include "jp.h" \ No newline at end of file
diff --git a/keyboards/hhkb/jp/jp.h b/keyboards/hhkb/jp/jp.h
new file mode 100644
index 0000000000..a95796f25f
--- /dev/null
+++ b/keyboards/hhkb/jp/jp.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT_JP( \
+ K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \
+ K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \
+ K06, K66, K26, K16, K56, K76, KA6, K96, K86, KB6, KE6, KF6, KD6, KC6, \
+ K05, K65, K25, K15, K55, K75, KA5, K95, K85, KB5, KE5, KF5, KD5, KC5, \
+ K04, K34, K64, K24, K14, K74, K94, K84, KB4, KE4, KF4, KD4, KC4) \
+{ \
+ { KC_NO, KC_NO, K02, K03, K04, K05, K06, KC_NO }, \
+ { KC_NO, KC_NO, K12, K13, K14, K15, K16, KC_NO }, \
+ { KC_NO, KC_NO, K22, K23, K24, K25, K26, KC_NO }, \
+ { KC_NO, KC_NO, K32, KC_NO, K34, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, K52, K53, KC_NO, K55, K56, KC_NO }, \
+ { KC_NO, KC_NO, K62, K63, K64, K65, K66, KC_NO }, \
+ { KC_NO, KC_NO, K72, K73, K74, K75, K76, KC_NO }, \
+ { KC_NO, KC_NO, K82, K83, K84, K85, K86, KC_NO }, \
+ { KC_NO, KC_NO, K92, K93, K94, K95, K96, KC_NO }, \
+ { KC_NO, KC_NO, KA2, KA3, KC_NO, KA5, KA6, KC_NO }, \
+ { KC_NO, KC_NO, KB2, KB3, KB4, KB5, KB6, KC_NO }, \
+ { KC_NO, KC_NO, KC2, KC_NO, KC4, KC5, KC6, KC_NO }, \
+ { KC_NO, KC_NO, KD2, KD3, KD4, KD5, KD6, KC_NO }, \
+ { KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \
+ { KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \
+}
diff --git a/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
new file mode 100644
index 0000000000..04d79f9247
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
@@ -0,0 +1,16 @@
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_JP(
+ 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_DEL, KC_BSPC,
+ 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_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_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, KC_UP, KC_BSLS,
+ MO(1), KC_GRV, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_RGUI, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [1] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, _______)};
diff --git a/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/default/keymap.c b/keyboards/hhkb/jp/keymaps/default/keymap.c
new file mode 100644
index 0000000000..6fd06638ce
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/default/keymap.c
@@ -0,0 +1,49 @@
+#include QMK_KEYBOARD_H
+
+/* Layer 0: HHKB JP
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ * |------------------------------------------------------` Ent|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ * |-----------------------------------------------------------|
+ * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ * |-----------------------------------------------------------|
+ * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
+ * `-----------------------------------------------------------'
+ */
+
+/* Layer 1: HHKB mode (HHKB Fn)
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |------------------------------------------------------` |
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | | |
+ * |-----------------------------------------------------------|
+ * | || | | | | | | | | || | | |
+ * `-----------------------------------------------------------'
+ */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_JP(
+ 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_JYEN, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, 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_RO, KC_UP, KC_RSFT,
+ MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [1] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
+{
+ return MACRO_NONE;
+}
diff --git a/keyboards/hhkb/jp/keymaps/default/rules.mk b/keyboards/hhkb/jp/keymaps/default/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/default/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/default_mac/keymap.c b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
new file mode 100644
index 0000000000..f3ef3d6af6
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
@@ -0,0 +1,49 @@
+#include QMK_KEYBOARD_H
+
+/* Layer 0: HHKB JP
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ * |------------------------------------------------------` Ent|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ * |-----------------------------------------------------------|
+ * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ * |-----------------------------------------------------------|
+ * |Fn|`|Ctl|Cmd|Opt|Hnk| Spc |Mhk|Cmd|Opt| Fn||Lft|Dwn|Rgh|
+ * `-----------------------------------------------------------'
+ */
+
+/* Layer 1: HHKB mode (HHKB Fn)
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |------------------------------------------------------` |
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | | |
+ * |-----------------------------------------------------------|
+ * | || | | | | | | | | ||Del| | |
+ * `-----------------------------------------------------------'
+ */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_JP(
+ 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_JYEN, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, 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_RO, KC_UP, KC_RSFT,
+ MO(1), KC_GRV, KC_LALT, KC_LGUI, KC_MHEN, KC_SPC, KC_HENK, KC_RGUI, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [1] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, _______)};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
+{
+ return MACRO_NONE;
+}
diff --git a/keyboards/hhkb/jp/keymaps/default_mac/rules.mk b/keyboards/hhkb/jp/keymaps/default_mac/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/default_mac/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/dhertz/config.h b/keyboards/hhkb/jp/keymaps/dhertz/config.h
new file mode 100644
index 0000000000..af2fb9d8a5
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/dhertz/config.h
@@ -0,0 +1 @@
+#define USB_MAX_POWER_CONSUMPTION 100
diff --git a/keyboards/hhkb/jp/keymaps/dhertz/keymap.c b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
new file mode 100644
index 0000000000..951af069b0
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
@@ -0,0 +1,84 @@
+#include QMK_KEYBOARD_H
+#include "keymap.h"
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Del|Bsp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Enter |
+ * |------------------------------------------------------` |
+ * |SrCtl | A| S| D| F| G| H| J| K| L| ;| '| \| |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /| `|Up |Shi|
+ * |-----------------------------------------------------------|
+ * |NCt|| #|Alt|CmT|CmT| LyrSpc |CGv|Iso|Gui|CSL||Rig|Dow|Lef|
+ * `-----------------------------------------------------------'
+ */
+ [0] = LAYOUT_JP(
+ 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_DEL,KC_BSPC,
+ 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,
+ SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS, 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_NUBS, KC_UP, KC_RSFT,
+ NC_CTL, HSH_TLD,KC_LALT,CMD_TAB_CMD,CMD_TAB_CMD, LT(2, KC_SPC) , CMD_GRV_CMD, ISO_COUNTRY_CODE,KC_RGUI, CMD_SFT_L, KC_LEFT,KC_DOWN,KC_RGHT
+ ),
+
+ /* Layer 1: iPad mode (Fixed)
+ * ,-----------------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | | | | | | | |
+ * |------------------------------------------------------` |
+ * |CmdSpc| | | | | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | || ~| |CAD| | |CmH| | | || | | |
+ * `-----------------------------------------------------------'
+ */
+ [1] = LAYOUT_JP(
+ 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,
+ CMD_SPC,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,CMD_ALT_D,KC_TRNS, KC_TRNS ,CMD_H,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS
+ ),
+
+ /* Layer 2: HHKB mode (Space)
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps |DL0|DL1| | | | | |Psc|Slk|Pus|Up | | |
+ * |------------------------------------------------------` |
+ * | |VoD|VoU|Mut| | | |Bsp|Del|CSL|Lef|Rig| | |
+ * |-----------------------------------------------------------|
+ * | | | |CAC| | | | | | |Dow| |PgU| |
+ * |-----------------------------------------------------------|
+ * | || ~| | | | | | | | ||Hom|PgD|End|
+ * `-----------------------------------------------------------'
+ */
+ [2] = LAYOUT_JP(
+ KC_PWR, 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, DF(0), DF(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP,KC_TRNS,
+ KC_TRNS, KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_TRNS,KC_BSPC, KC_DEL,CMD_SFT_L,KC_LEFT,KC_RGHT,KC_TRNS,KC_PENT,
+ KC_TRNS, KC_TRNS,KC_TRNS,CMD_ALT_C,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_DOWN,KC_TRNS,KC_PGUP,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_PGDN, KC_END
+ ),
+};
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
+ switch(keycode) {
+ case CMD_SPC:
+ mod_or_mod_with_macro(record, KC_LGUI, " ");
+ break;
+ case CMD_H:
+ mod_or_mod_with_macro(record, KC_RGUI, "H");
+ break;
+ case CMD_ALT_D:
+ mod_or_mod_with_macro(record, KC_LGUI, SS_LALT("D"));
+ break;
+ default:
+ return true;
+ }
+ return false;
+}
diff --git a/keyboards/hhkb/jp/keymaps/dhertz/keymap.h b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h
new file mode 100644
index 0000000000..dbefc63800
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h
@@ -0,0 +1,7 @@
+#include "dhertz.h"
+
+enum dhertz_keycodes {
+ CMD_SPC = NEW_SAFE_RANGE,
+ CMD_H,
+ CMD_ALT_D,
+};
diff --git a/keyboards/hhkb/jp/keymaps/dhertz/rules.mk b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk
new file mode 100644
index 0000000000..5656057b43
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk
@@ -0,0 +1,2 @@
+OPT_DEFS += -DHHKB_JP
+
diff --git a/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
new file mode 100644
index 0000000000..15dc29773b
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
@@ -0,0 +1,71 @@
+#include QMK_KEYBOARD_H
+
+/* Layer 0: HHKB JP
+* ,-----------------------------------------------------------.
+* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+* |-----------------------------------------------------------|
+* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+* |------------------------------------------------------` Ent|
+* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+* |-----------------------------------------------------------|
+* |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+* |-----------------------------------------------------------|
+* | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
+* `-----------------------------------------------------------'
+*/
+
+/* Layer 1: HHKB mode (HHKB Fn)
+* ,-----------------------------------------------------------.
+* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+* |-----------------------------------------------------------|
+* |Caps |MPrev|MPlay|MNext| | | | |Psc|Slk|Pus|Up | |
+* |------------------------------------------------------` |
+* | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+* |-----------------------------------------------------------|
+* | | | | | | | +| -|End|PgD|Dow| | | |
+* |-----------------------------------------------------------|
+* | || | | | | | | | | || | | |
+* `-----------------------------------------------------------'
+*/
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_JP(
+ 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_GRAVE, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, 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, KC_UP, KC_BSLS,
+ KC_BSPC, KC_ZKHK, KC_LGUI, KC_LALT, MO(1), KC_SPC, KC_BSPC, KC_RSFT, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [1] = LAYOUT_JP(
+ _______, 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_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PSCR, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ return MACRO_NONE;
+};
+
+/*void matrix_scan_user(void) {
+ LEADER_DICTIONARY() {
+ leading = false;
+ leader_end();
+
+ SEQ_ONE_KEY(KC_RSFT) {
+ register_code(KC_S);
+ unregister_code(KC_S);
+ }
+ SEQ_TWO_KEYS(KC_A, KC_S) {
+ register_code(KC_H);
+ unregister_code(KC_H);
+ }
+ SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
+ register_code(KC_LGUI);
+ register_code(KC_S);
+ unregister_code(KC_S);
+ unregister_code(KC_LGUI);
+ }
+ }
+}*/
diff --git a/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk b/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
new file mode 100644
index 0000000000..d35c58b777
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
@@ -0,0 +1,3 @@
+NKRO_ENABLE = yes
+
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
new file mode 100644
index 0000000000..222ad898ef
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
@@ -0,0 +1,49 @@
+# harfqwerty_jp
+
+half-QWERTY is a keyboard layout for one-handed typing on QWERTY keyboard.
+
+* When hold space bar, the keyboard enters mirror mode.
+* To type a space, just tap the space bar.
+
+## BASE
+
+ ,-----------------------------------------------------------.
+ |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ |------------------------------------------------------` Ent|
+ |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ |-----------------------------------------------------------|
+ |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ |-----------------------------------------------------------|
+ | ||Ctl|Alt|Cmd| | Spc | | | | ||Lft|Dwn|Rgh|
+ `-----------------------------------------------------------'
+
+## HHKB mode (HHKB Fn)
+
+ ,-----------------------------------------------------------.
+ |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ |-----------------------------------------------------------|
+ |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ |------------------------------------------------------` |
+ | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+ |-----------------------------------------------------------|
+ | | | | | | | +| -|End|PgD|Dow| | | |
+ |-----------------------------------------------------------|
+ | || | | | | | | | | || | | |
+ `-----------------------------------------------------------'
+
+
+## Mirror mode
+
+ ,-----------------------------------------------------------.
+ | | 0| 9| 8| 7| 6| 5| 4| 3| 2| 1| | | | |
+ |-----------------------------------------------------------|
+ | | P| O| I| U| Y| T| R| E| W| Q| | | |
+ |------------------------------------------------------` |
+ | | ;| L| K| J| H| G| F| D| S| A| | | |
+ |-----------------------------------------------------------|
+ | | .| ,| M| N| B| V| C| X| Z| | | | |
+ |-----------------------------------------------------------|
+ | || | | | | | | | | || | | |
+ `-----------------------------------------------------------'
diff --git a/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
new file mode 100644
index 0000000000..0d4a24c60d
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
@@ -0,0 +1,76 @@
+/* -*- eval: (turn-on-orgtbl); -*-
+ * default HHKB Layout
+ */
+#include QMK_KEYBOARD_H
+
+enum
+{
+ BASE,
+ HHKB,
+ MIRROR,
+};
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ /* BASE Level: Default Layer
+ ,-----------------------------------------------------------.
+ |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ |------------------------------------------------------` Ent|
+ |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ |-----------------------------------------------------------|
+ |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ |-----------------------------------------------------------|
+ | ||Ctl|Alt|Cmd| | Spc | | | | ||Lft|Dwn|Rgh|
+ `-----------------------------------------------------------'
+ */
+ [BASE] = LAYOUT_JP(
+ 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_JYEN, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, 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_RO, KC_UP, KC_RSFT,
+ MO(HHKB), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, LT(MIRROR, KC_SPC), KC_HENK, KC_KANA, KC_RALT, MO(HHKB), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ /* Layer HHKB: HHKB mode (HHKB Fn)
+ ,-----------------------------------------------------------.
+ |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ |-----------------------------------------------------------|
+ |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ |------------------------------------------------------` |
+ | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+ |-----------------------------------------------------------|
+ | | | | | | | +| -|End|PgD|Dow| | | |
+ |-----------------------------------------------------------|
+ | || | | | | | | | | || | | |
+ `-----------------------------------------------------------'
+ */
+
+ [HHKB] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+
+ /* Mirror Level: when hold space bar
+ ,-----------------------------------------------------------.
+ | | 0| 9| 8| 7| 6| 5| 4| 3| 2| 1| | | | |
+ |-----------------------------------------------------------|
+ | | P| O| I| U| Y| T| R| E| W| Q| | | |
+ |------------------------------------------------------` |
+ | | ;| L| K| J| H| G| F| D| S| A| | | |
+ |-----------------------------------------------------------|
+ | | .| ,| M| N| B| V| C| X| Z| | | | |
+ |-----------------------------------------------------------|
+ | || | | | | | | | | || | | |
+ `-----------------------------------------------------------'
+ */
+ [MIRROR] = LAYOUT_JP(
+ _______, KC_0, KC_9, KC_8, KC_7, KC_6, KC_5, KC_4, KC_3, KC_2, KC_1, _______, _______, _______, _______,
+ _______, KC_P, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, _______, _______,
+ _______, KC_SCLN, KC_L, KC_K, KC_J, KC_H, KC_G, KC_F, KC_D, KC_S, KC_A, _______, _______, _______,
+ _______, KC_DOT, KC_COMM, KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, _______, _______)};
+
diff --git a/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
new file mode 100644
index 0000000000..f40df74e87
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
@@ -0,0 +1,55 @@
+#include QMK_KEYBOARD_H
+
+enum
+{
+ ZER,
+ HDN,
+ OSY
+};
+
+#define CTL_ESC CTL_T(KC_ESC)
+#define SFT_BSP SFT_T(KC_BSPC)
+
+#define SCRNS3 LGUI(LCTL(LSFT(KC_3)))
+#define SCRNS4 LGUI(LCTL(LSFT(KC_4)))
+
+/* hhkb jp ~ layout
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ * |------------------------------------------------------` Ent|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ * |-----------------------------------------------------------|
+ * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ * |-----------------------------------------------------------|
+ * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
+ * `-----------------------------------------------------------'
+ */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [ZER] = LAYOUT_JP(
+ 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_INS, KC_BSPC,
+ 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,
+ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_GRV, 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_BSLS, KC_UP, KC_RSFT,
+ MO(HDN), KC_LCTL, KC_LALT, KC_LGUI, MO(HDN), KC_SPC, SFT_BSP, MO(HDN), MO(OSY), KC_NO, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [HDN] = LAYOUT_JP(
+ KC_GRV, 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_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
+ _______, KC_TILD, KC_GRV, KC_BSLS, KC_PIPE, KC_MINS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TILD, KC_GRV, _______, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, _______, KC_ENT, _______, _______, _______, _______, KC_PGUP, _______,
+ _______, _______, _______, _______, _______, KC_UNDS, KC_DEL, _______, _______, _______, KC_HOME, KC_PGDN, KC_END),
+
+ [OSY] = LAYOUT_JP(
+ _______, _______, _______, SCRNS3, SCRNS4, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
+{
+ return MACRO_NONE;
+}
diff --git a/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk b/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/sh_jp/README.md b/keyboards/hhkb/jp/keymaps/sh_jp/README.md
new file mode 100644
index 0000000000..4f82f2f4e9
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/README.md
@@ -0,0 +1,86 @@
+###Keymaps with both Dvorak layout and QWER layout for HHKB JP.
+
+1. The default layout is Dvorak.
+2. Use `Tog` to toggle between Dvorak and QWER
+3. Holding `NewCmd`, the original `LftCmd`, will activate the `NewCmd` layer which means `NewCmd+key` is the same as `Cmd+key` in normal QWER layout.<sup>[1](#cmdTab)</sup>
+ - For example, no matter you are in Dvorak layout or QWER layout, you can use `Cmd+s` to save a currently editing file.
+4. `Symb` makes type symbols easier
+ - for example: `Symb+a` is `!`.
+5. `Spc+key` equals to `Shft+key` while using `Spc` alone will yield a space as usual.
+6. There's an extra `Tab` in the last line.
+
+```
+Layer DVOR:
+,-----------------------------------------------------------.
+|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| |Bsp|
+|-----------------------------------------------------------|
+|Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| |
+|------------------------------------------------------` Ent|
+|Ctrl | A| O| E| U| I| D| H| T| N| S| -| \| |
+|-----------------------------------------------------------|
+|Shft | ;| Q| J| K| X| B| M| W| V| Z| | Up| |
+|-----------------------------------------------------------|
+|FN| `| Alt|NewCmd|Symb| Spc |Symb|Tab|RCmd|Tog|Lft|Dwn|Rgh|
+`-----------------------------------------------------------'
+```
+
+```
+Layer QWER:
+,-----------------------------------------------------------.
+|Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =| |Bsp|
+|-----------------------------------------------------------|
+|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+|------------------------------------------------------` Ent|
+|Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| |
+|-----------------------------------------------------------|
+|Shft | Z| X| C| V| B| N| M| ,| .| /| | Up| |
+|-----------------------------------------------------------|
+|FN| `| Alt|NewCmd|Symb| Spc |Symb|Tab|Cmd|Tog|Lft|Dwn|Rgh|
+`-----------------------------------------------------------'
+```
+
+```
+Layer Symb:
+,-----------------------------------------------------------.
+| | | | | | | | | | | | | | | |
+|-----------------------------------------------------------|
+| | | | [| ]| | | {| }| | | | | |
+|------------------------------------------------------` |
+| | !| @| #| $| %| ^| &| *| (| )| '| \| |
+|-----------------------------------------------------------|
+| | | | | | | | | | | | | | |
+|-----------------------------------------------------------|
+| | | | | | | | | | | | | |
+`-----------------------------------------------------------'
+```
+
+```
+Layer FUNC: HHKB mode (HHKB Fn)
+,-----------------------------------------------------------.
+|Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+|-----------------------------------------------------------|
+|Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+|------------------------------------------------------` |
+| |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+|-----------------------------------------------------------|
+| | | | | | | +| -|End|PgD|Dow| | | |
+|-----------------------------------------------------------|
+| || | | | | | | | | || | | |
+`-----------------------------------------------------------'
+```
+
+```
+Empty Layer:
+,-----------------------------------------------------------.
+| | | | | | | | | | | | | | | |
+|-----------------------------------------------------------|
+| | | | | | | | | | | | | | |
+|------------------------------------------------------` |
+| | | | | | | | | | | | | | |
+|-----------------------------------------------------------|
+| | | | | | | | | | | | | | |
+|-----------------------------------------------------------|
+| | | | | | | | | | | | | |
+`-----------------------------------------------------------'
+```
+<a name="cmdTab">1</a>: `NewCmd + Tab` does not work, you can use `RCmd+Tab` to switch among applications.
diff --git a/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
new file mode 100644
index 0000000000..79515c5a6e
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
@@ -0,0 +1,50 @@
+#include QMK_KEYBOARD_H
+
+enum
+{
+ DVOR,
+ QWER,
+ NEW_CMD,
+ SYMB,
+ FUNC
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [DVOR] = LAYOUT_JP(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_JYEN, KC_BSPC,
+ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL,
+ KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_BSLS, KC_ENT,
+ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RO, KC_UP, KC_RSFT,
+ MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, TG(QWER), KC_LEFT, KC_DOWN, KC_RGHT),
+ [QWER] = LAYOUT_JP(
+ 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_JYEN, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, 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_RO, KC_UP, KC_RSFT,
+ MO(FUNC), KC_ZKHK, KC_LALT, MO(NEW_CMD), MO(SYMB), MT(MOD_LSFT, KC_SPC), MO(SYMB), KC_TAB, KC_RGUI, _______, KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [NEW_CMD] = LAYOUT_JP(
+ _______, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), _______, _______, _______, LGUI(KC_BSPC),
+ _______, LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC),
+ _______, LGUI(KC_A), LGUI(KC_S), LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), _______, _______, _______, _______,
+ LGUI(KC_LSFT), LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), _______, _______, _______,
+ _______, _______, _______, _______, _______, LGUI(KC_SPC), _______, _______, _______, _______, LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RGHT)),
+
+ [SYMB] = LAYOUT_JP(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, LSFT(KC_LBRC), LSFT(KC_RBRC), _______, _______, _______, _______,
+ _______, LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
+
+ [FUNC] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
+{
+ return MACRO_NONE;
+}
diff --git a/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk b/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
new file mode 100644
index 0000000000..a7f700f019
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
@@ -0,0 +1 @@
+OPT_DEFS += -DHHKB_JP
diff --git a/keyboards/hhkb/jp/keymaps/via/config.h b/keyboards/hhkb/jp/keymaps/via/config.h
new file mode 100644
index 0000000000..96c85573df
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/config.h
@@ -0,0 +1,2 @@
+// 3 layers or else it will not fit in EEPROM
+#define DYNAMIC_KEYMAP_LAYER_COUNT 3
diff --git a/keyboards/hhkb/jp/keymaps/via/keymap.c b/keyboards/hhkb/jp/keymaps/via/keymap.c
new file mode 100644
index 0000000000..cb1ba76fb0
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/keymap.c
@@ -0,0 +1,58 @@
+#include QMK_KEYBOARD_H
+
+/* Layer 0: HHKB JP
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| -| =|Yen|Bsp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ * |------------------------------------------------------` Ent|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| |
+ * |-----------------------------------------------------------|
+ * |Shft | Z| X| C| V| B| N| M| ,| .| /| \| Up|Sft|
+ * |-----------------------------------------------------------|
+ * | ||Ctl|Alt|Cmd| | Spc |Bsp| | | ||Lft|Dwn|Rgh|
+ * `-----------------------------------------------------------'
+ */
+
+/* Layer 1: HHKB mode (HHKB Fn)
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |------------------------------------------------------` |
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | | |
+ * |-----------------------------------------------------------|
+ * | || | | | | | | | | || | | |
+ * `-----------------------------------------------------------'
+ */
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_JP(
+ 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_JYEN, KC_BSPC,
+ 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_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, 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_RO, KC_UP, KC_RSFT,
+ MO(1), KC_ZKHK, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
+
+ [1] = LAYOUT_JP(
+ KC_PWR, 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_PSCR, KC_SLCK, KC_PAUS, KC_UP, _______,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_PWR, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT,
+ _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ ),
+ [2] = LAYOUT_JP(
+ 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ )
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t macro_id, uint8_t opt)
+{
+ return MACRO_NONE;
+}
diff --git a/keyboards/hhkb/jp/keymaps/via/rules.mk b/keyboards/hhkb/jp/keymaps/via/rules.mk
new file mode 100644
index 0000000000..1e5b99807c
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/hhkb/jp/matrix.c b/keyboards/hhkb/jp/matrix.c
new file mode 100644
index 0000000000..437356af6d
--- /dev/null
+++ b/keyboards/hhkb/jp/matrix.c
@@ -0,0 +1,212 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "timer.h"
+#include "matrix.h"
+#include "hhkb_avr.h"
+#include <avr/wdt.h>
+#include "suspend.h"
+#include "lufa.h"
+
+
+// matrix power saving
+#define MATRIX_POWER_SAVE 10000
+static uint32_t matrix_last_modified = 0;
+
+// matrix state buffer(1:on, 0:off)
+static matrix_row_t *matrix;
+static matrix_row_t *matrix_prev;
+static matrix_row_t _matrix0[MATRIX_ROWS];
+static matrix_row_t _matrix1[MATRIX_ROWS];
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+#ifdef DEBUG
+ debug_enable = true;
+ debug_keyboard = true;
+#endif
+
+ KEY_INIT();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00;
+ matrix = _matrix0;
+ matrix_prev = _matrix1;
+}
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+}
+
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+uint8_t matrix_scan(void)
+{
+ uint8_t *tmp;
+
+ tmp = matrix_prev;
+ matrix_prev = matrix;
+ matrix = tmp;
+
+ // power on
+ if (!KEY_POWER_STATE()) KEY_POWER_ON();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ KEY_SELECT(row, col);
+ _delay_us(5);
+
+ // Not sure this is needed. This just emulates HHKB controller's behaviour.
+ if (matrix_prev[row] & (1<<col)) {
+ KEY_PREV_ON();
+ }
+ _delay_us(10);
+
+ // NOTE: KEY_STATE is valid only in 20us after KEY_ENABLE.
+ // If V-USB interrupts in this section we could lose 40us or so
+ // and would read invalid value from KEY_STATE.
+ uint8_t last = TIMER_RAW;
+
+ KEY_ENABLE();
+
+ // Wait for KEY_STATE outputs its value.
+ // 1us was ok on one HHKB, but not worked on another.
+ // no wait doesn't work on Teensy++ with pro(1us works)
+ // no wait does work on tmk PCB(8MHz) with pro2
+ // 1us wait does work on both of above
+ // 1us wait doesn't work on tmk(16MHz)
+ // 5us wait does work on tmk(16MHz)
+ // 5us wait does work on tmk(16MHz/2)
+ // 5us wait does work on tmk(8MHz)
+ // 10us wait does work on Teensy++ with pro
+ // 10us wait does work on 328p+iwrap with pro
+ // 10us wait doesn't work on tmk PCB(8MHz) with pro2(very lagged scan)
+ _delay_us(5);
+
+ if (KEY_STATE()) {
+ matrix[row] &= ~(1<<col);
+ } else {
+ matrix[row] |= (1<<col);
+ }
+
+ // Ignore if this code region execution time elapses more than 20us.
+ // MEMO: 20[us] * (TIMER_RAW_FREQ / 1000000)[count per us]
+ // MEMO: then change above using this rule: a/(b/c) = a*1/(b/c) = a*(c/b)
+ if (TIMER_DIFF_RAW(TIMER_RAW, last) > 20/(1000000/TIMER_RAW_FREQ)) {
+ matrix[row] = matrix_prev[row];
+ }
+
+ _delay_us(5);
+ KEY_PREV_OFF();
+ KEY_UNABLE();
+
+ // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE.
+ // This takes 25us or more to make sure KEY_STATE returns to idle state.
+
+ // Looks like JP needs faster scan due to its twice larger matrix
+ // or it can drop keys in fast key typing
+ _delay_us(30);
+ }
+ if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
+ }
+ // power off
+ if (KEY_POWER_STATE() &&
+ (USB_DeviceState == DEVICE_STATE_Suspended ||
+ USB_DeviceState == DEVICE_STATE_Unattached ) &&
+ timer_elapsed32(matrix_last_modified) > MATRIX_POWER_SAVE) {
+ KEY_POWER_OFF();
+ suspend_power_down();
+ }
+
+ matrix_scan_quantum();
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix[i] != matrix_prev[i])
+ return true;
+ }
+ return false;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void) {
+ uint8_t count = 0;
+ for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
+ count += bitpop16(matrix_get_row(r));
+ }
+ return count;
+}
+
+void matrix_power_up(void) {
+ KEY_POWER_ON();
+}
+void matrix_power_down(void) {
+ KEY_POWER_OFF();
+}
diff --git a/keyboards/hhkb/jp/readme.md b/keyboards/hhkb/jp/readme.md
new file mode 100644
index 0000000000..41c1d2214e
--- /dev/null
+++ b/keyboards/hhkb/jp/readme.md
@@ -0,0 +1,14 @@
+HHKB Alternate Controller
+===
+
+An alternative controler for the HHKB designed by hasu.
+
+Keyboard Maintainer: QMK Community
+Hardware Supported: HHKB Alternate Controller
+Hardware Availability: https://geekhack.org/index.php?topic=12047.0
+
+Make example for this keyboard (after setting up your build environment):
+
+ make hhkb/jp:default
+
+See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/hhkb/jp/rules.mk b/keyboards/hhkb/jp/rules.mk
new file mode 100644
index 0000000000..774b444c53
--- /dev/null
+++ b/keyboards/hhkb/jp/rules.mk
@@ -0,0 +1,69 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+# Teensy halfkay
+# Pro Micro caterina
+# Atmel DFU atmel-dfu
+# LUFA DFU lufa-dfu
+# QMK DFU qmk-dfu
+# ATmega32A bootloadHID
+# ATmega328P USBasp
+BOOTLOADER = atmel-dfu
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+CUSTOM_MATRIX = yes # Custom matrix file for the HHKB
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+# MIDI_ENABLE = yes # MIDI controls
+# UNICODE_ENABLE = yes # Unicode
+# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+
+
+# HHKB_RN42_ENABLE = yes # Enable support for hasu's BT alt controller -- code borrowed from tmk source tree.
+
+# Either uncomment the HHKB_RN42_ENABLE line above, or run make enabling the
+# feature. Be sure to clean any existing build before trying to enable rn42
+# support. For example:
+#
+# make hhkb-keymap-clean
+# make hhkb-keymap-dfu HHKB_RN42_ENABLE=yes
+
+# project specific files
+SRC = matrix.c
+
+ifeq ($(strip $(HHKB_RN42_ENABLE)), yes)
+
+OPT_DEFS += -DHHKB_RN42_ENABLE
+
+# Support for the RN42 Bluetooth module. This is the BT module in Hasu's BT
+# HHKB Alt controller.
+RN42_DIR = ../rn42
+
+SRC += serial_uart.c \
+ ../rn42/suart.S \
+ ../rn42/rn42.c \
+ ../rn42/rn42_task.c \
+ ../rn42/battery.c \
+ ../rn42/main.c
+
+VPATH += $(RN42_DIR)
+
+endif
+
+
+# debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
+# debug-on: all
+
+# debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT
+# debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS))
+# debug-off: all