diff --git a/keyboards/hhkb/ansi/ansi.c b/keyboards/hhkb/ansi/ansi.c
new file mode 100644
index 000000000000..cefc4e06904e
--- /dev/null
+++ b/keyboards/hhkb/ansi/ansi.c
@@ -0,0 +1 @@
+#include "ansi.h"
\ No newline at end of file
diff --git a/keyboards/hhkb/ansi/ansi.h b/keyboards/hhkb/ansi/ansi.h
new file mode 100644
index 000000000000..28e8d2fef89b
--- /dev/null
+++ b/keyboards/hhkb/ansi/ansi.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "quantum.h"
+
+#define LAYOUT( \
+ K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \
+ K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \
+ K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \
+ K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \
+ K35, K36, K37, K57, K56) \
+ \
+{ \
+ { K00, K01, K02, K03, K04, K05, K06, K07 }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17 }, \
+ { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \
+ { K30, K31, K32, K33, K34, K35, K36, K37 }, \
+ { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \
+ { K50, K51, K52, K53, K54, K55, K56, K57 }, \
+ { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \
+ { K70, K71, K72, K73, K74, K75, K76, KC_NO } \
+}
+
+#define LAYOUT_60_hhkb LAYOUT
diff --git a/keyboards/hhkb/config.h b/keyboards/hhkb/ansi/config.h
similarity index 94%
rename from keyboards/hhkb/config.h
rename to keyboards/hhkb/ansi/config.h
index fc747a6e9421..689fd556819d 100644
--- a/keyboards/hhkb/config.h
+++ b/keyboards/hhkb/ansi/config.h
@@ -15,25 +15,20 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef CONFIG_H
-#define CONFIG_H
+#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0xCAFE
+#define VENDOR_ID 0x4848 // HH = happy hacking
+#define PRODUCT_ID 0x0001 // ANSI HHKB
#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 */
-#ifdef HHKB_JP
-# define MATRIX_ROWS 16
-#else
-# define MATRIX_ROWS 8
-#endif
+#define MATRIX_ROWS 8
#define MATRIX_COLS 8
#define TAPPING_TERM 200
@@ -107,5 +102,3 @@ along with this program. If not, see .
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
-
-#endif
diff --git a/keyboards/hhkb/ansi/hhkb_avr.h b/keyboards/hhkb/ansi/hhkb_avr.h
new file mode 100644
index 000000000000..f9446deef71a
--- /dev/null
+++ b/keyboards/hhkb/ansi/hhkb_avr.h
@@ -0,0 +1,157 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+
+
+// 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;
+
+ 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);
+
+}
+
+
+#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/ansi/info.json b/keyboards/hhkb/ansi/info.json
new file mode 100644
index 000000000000..a36f1d44c82f
--- /dev/null
+++ b/keyboards/hhkb/ansi/info.json
@@ -0,0 +1,73 @@
+{
+ "keyboard_name": "HHKB",
+ "url": "",
+ "maintainer": "qmk",
+ "width": 15,
+ "height": 5,
+ "layouts": {
+ "LAYOUT": {
+ "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": "~", "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": "Delete", "x": 13.5, "y": 1, "w": 1.5 },
+ { "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": "Return", "x": 12.75, "y": 2, "w": 2.25 },
+ { "label": "Shift", "x": 0, "y": 3, "w": 2.25 },
+ { "label": "Z", "x": 2.25, "y": 3 },
+ { "label": "X", "x": 3.25, "y": 3 },
+ { "label": "C", "x": 4.25, "y": 3 },
+ { "label": "V", "x": 5.25, "y": 3 },
+ { "label": "B", "x": 6.25, "y": 3 },
+ { "label": "N", "x": 7.25, "y": 3 },
+ { "label": "M", "x": 8.25, "y": 3 },
+ { "label": "<", "x": 9.25, "y": 3 },
+ { "label": ">", "x": 10.25, "y": 3 },
+ { "label": "?", "x": 11.25, "y": 3 },
+ { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 },
+ { "label": "Fn", "x": 14, "y": 3 },
+ { "label": "", "x": 1.5, "y": 4 },
+ { "label": "", "x": 2.5, "y": 4, "w": 1.5 },
+ { "x": 4, "y": 4, "w": 6 },
+ { "label": "", "x": 10, "y": 4, "w": 1.5 },
+ { "label": "", "x": 11.5, "y": 4 }
+ ]
+ }
+ }
+}
diff --git a/keyboards/hhkb/keymaps/blakedietz/README.md b/keyboards/hhkb/ansi/keymaps/blakedietz/README.md
similarity index 100%
rename from keyboards/hhkb/keymaps/blakedietz/README.md
rename to keyboards/hhkb/ansi/keymaps/blakedietz/README.md
diff --git a/keyboards/hhkb/keymaps/blakedietz/config.h b/keyboards/hhkb/ansi/keymaps/blakedietz/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/blakedietz/config.h
rename to keyboards/hhkb/ansi/keymaps/blakedietz/config.h
diff --git a/keyboards/hhkb/keymaps/blakedietz/keymap.c b/keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/blakedietz/keymap.c
rename to keyboards/hhkb/ansi/keymaps/blakedietz/keymap.c
diff --git a/keyboards/hhkb/keymaps/blakedietz/rules.mk b/keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/blakedietz/rules.mk
rename to keyboards/hhkb/ansi/keymaps/blakedietz/rules.mk
diff --git a/keyboards/hhkb/keymaps/brett/config.h b/keyboards/hhkb/ansi/keymaps/brett/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/brett/config.h
rename to keyboards/hhkb/ansi/keymaps/brett/config.h
diff --git a/keyboards/hhkb/keymaps/brett/keymap.c b/keyboards/hhkb/ansi/keymaps/brett/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/brett/keymap.c
rename to keyboards/hhkb/ansi/keymaps/brett/keymap.c
diff --git a/keyboards/hhkb/keymaps/brett/readme.md b/keyboards/hhkb/ansi/keymaps/brett/readme.md
similarity index 100%
rename from keyboards/hhkb/keymaps/brett/readme.md
rename to keyboards/hhkb/ansi/keymaps/brett/readme.md
diff --git a/keyboards/hhkb/keymaps/brett/rules.mk b/keyboards/hhkb/ansi/keymaps/brett/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/brett/rules.mk
rename to keyboards/hhkb/ansi/keymaps/brett/rules.mk
diff --git a/keyboards/hhkb/keymaps/cinaeco/README.md b/keyboards/hhkb/ansi/keymaps/cinaeco/README.md
similarity index 100%
rename from keyboards/hhkb/keymaps/cinaeco/README.md
rename to keyboards/hhkb/ansi/keymaps/cinaeco/README.md
diff --git a/keyboards/hhkb/keymaps/cinaeco/config.h b/keyboards/hhkb/ansi/keymaps/cinaeco/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/cinaeco/config.h
rename to keyboards/hhkb/ansi/keymaps/cinaeco/config.h
diff --git a/keyboards/hhkb/keymaps/cinaeco/keymap.c b/keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/cinaeco/keymap.c
rename to keyboards/hhkb/ansi/keymaps/cinaeco/keymap.c
diff --git a/keyboards/hhkb/keymaps/cinaeco/rules.mk b/keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/cinaeco/rules.mk
rename to keyboards/hhkb/ansi/keymaps/cinaeco/rules.mk
diff --git a/keyboards/hhkb/keymaps/dbroqua/keymap.c b/keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/dbroqua/keymap.c
rename to keyboards/hhkb/ansi/keymaps/dbroqua/keymap.c
diff --git a/keyboards/hhkb/keymaps/dbroqua/readme.md b/keyboards/hhkb/ansi/keymaps/dbroqua/readme.md
similarity index 100%
rename from keyboards/hhkb/keymaps/dbroqua/readme.md
rename to keyboards/hhkb/ansi/keymaps/dbroqua/readme.md
diff --git a/keyboards/hhkb/keymaps/default/keymap.c b/keyboards/hhkb/ansi/keymaps/default/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/default/keymap.c
rename to keyboards/hhkb/ansi/keymaps/default/keymap.c
diff --git a/keyboards/hhkb/keymaps/eric/keymap.c b/keyboards/hhkb/ansi/keymaps/eric/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/eric/keymap.c
rename to keyboards/hhkb/ansi/keymaps/eric/keymap.c
diff --git a/keyboards/hhkb/keymaps/dhertz/config.h b/keyboards/hhkb/ansi/keymaps/krusli/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/dhertz/config.h
rename to keyboards/hhkb/ansi/keymaps/krusli/config.h
diff --git a/keyboards/hhkb/keymaps/krusli/keymap.c b/keyboards/hhkb/ansi/keymaps/krusli/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/krusli/keymap.c
rename to keyboards/hhkb/ansi/keymaps/krusli/keymap.c
diff --git a/keyboards/hhkb/keymaps/lxol/keymap.c b/keyboards/hhkb/ansi/keymaps/lxol/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/lxol/keymap.c
rename to keyboards/hhkb/ansi/keymaps/lxol/keymap.c
diff --git a/keyboards/hhkb/keymaps/mjt/config.h b/keyboards/hhkb/ansi/keymaps/mjt/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/mjt/config.h
rename to keyboards/hhkb/ansi/keymaps/mjt/config.h
diff --git a/keyboards/hhkb/keymaps/mjt/keymap.c b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c
similarity index 98%
rename from keyboards/hhkb/keymaps/mjt/keymap.c
rename to keyboards/hhkb/ansi/keymaps/mjt/keymap.c
index e51eb8bf9226..b62676edd985 100644
--- a/keyboards/hhkb/keymaps/mjt/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/mjt/keymap.c
@@ -17,7 +17,6 @@ enum hhkb_keycodes
DYNAMIC_MACRO_RANGE,
};
-#include "dynamic_macro.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -104,7 +103,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
uint16_t macro_kc = (keycode == MO(DYN) ? DYN_REC_STOP : keycode);
- if (!process_record_dynamic_macro(macro_kc, record))
+ if (!process_dynamic_macro(macro_kc, record))
{
return false;
}
diff --git a/keyboards/hhkb/keymaps/mjt/readme.md b/keyboards/hhkb/ansi/keymaps/mjt/readme.md
similarity index 100%
rename from keyboards/hhkb/keymaps/mjt/readme.md
rename to keyboards/hhkb/ansi/keymaps/mjt/readme.md
diff --git a/keyboards/hhkb/ansi/keymaps/mjt/rules.mk b/keyboards/hhkb/ansi/keymaps/mjt/rules.mk
new file mode 100644
index 000000000000..9e6797ed3074
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/mjt/rules.mk
@@ -0,0 +1 @@
+DYNAMIC_MACRO_ENABLE = yes
diff --git a/keyboards/hhkb/keymaps/schaeferdev/README.md b/keyboards/hhkb/ansi/keymaps/schaeferdev/README.md
similarity index 100%
rename from keyboards/hhkb/keymaps/schaeferdev/README.md
rename to keyboards/hhkb/ansi/keymaps/schaeferdev/README.md
diff --git a/keyboards/hhkb/keymaps/schaeferdev/config.h b/keyboards/hhkb/ansi/keymaps/schaeferdev/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/schaeferdev/config.h
rename to keyboards/hhkb/ansi/keymaps/schaeferdev/config.h
diff --git a/keyboards/hhkb/keymaps/schaeferdev/keymap.c b/keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/schaeferdev/keymap.c
rename to keyboards/hhkb/ansi/keymaps/schaeferdev/keymap.c
diff --git a/keyboards/hhkb/keymaps/schaeferdev/rules.mk b/keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/schaeferdev/rules.mk
rename to keyboards/hhkb/ansi/keymaps/schaeferdev/rules.mk
diff --git a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.c b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/action_pseudo_lut.c
rename to keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c
diff --git a/keyboards/hhkb/keymaps/shela/action_pseudo_lut.h b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/action_pseudo_lut.h
rename to keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
diff --git a/keyboards/hhkb/keymaps/shela/config.h b/keyboards/hhkb/ansi/keymaps/shela/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/config.h
rename to keyboards/hhkb/ansi/keymaps/shela/config.h
diff --git a/keyboards/hhkb/keymaps/shela/keymap.c b/keyboards/hhkb/ansi/keymaps/shela/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/keymap.c
rename to keyboards/hhkb/ansi/keymaps/shela/keymap.c
diff --git a/keyboards/hhkb/keymaps/shela/keymap_jis2us.h b/keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/keymap_jis2us.h
rename to keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h
diff --git a/keyboards/hhkb/keymaps/shela/readme.md b/keyboards/hhkb/ansi/keymaps/shela/readme.md
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/readme.md
rename to keyboards/hhkb/ansi/keymaps/shela/readme.md
diff --git a/keyboards/hhkb/keymaps/shela/rules.mk b/keyboards/hhkb/ansi/keymaps/shela/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/shela/rules.mk
rename to keyboards/hhkb/ansi/keymaps/shela/rules.mk
diff --git a/keyboards/hhkb/keymaps/smt/keymap.c b/keyboards/hhkb/ansi/keymaps/smt/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/smt/keymap.c
rename to keyboards/hhkb/ansi/keymaps/smt/keymap.c
diff --git a/keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/tobiasvl_iso/keymap.c
rename to keyboards/hhkb/ansi/keymaps/tobiasvl_iso/keymap.c
diff --git a/keyboards/hhkb/keymaps/tobiasvl_iso/readme.md b/keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md
similarity index 100%
rename from keyboards/hhkb/keymaps/tobiasvl_iso/readme.md
rename to keyboards/hhkb/ansi/keymaps/tobiasvl_iso/readme.md
diff --git a/keyboards/hhkb/keymaps/tominabox1/.gitignore b/keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore
similarity index 100%
rename from keyboards/hhkb/keymaps/tominabox1/.gitignore
rename to keyboards/hhkb/ansi/keymaps/tominabox1/.gitignore
diff --git a/keyboards/hhkb/keymaps/tominabox1/keymap.c b/keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/tominabox1/keymap.c
rename to keyboards/hhkb/ansi/keymaps/tominabox1/keymap.c
diff --git a/keyboards/hhkb/ansi/keymaps/via/keymap.c b/keyboards/hhkb/ansi/keymaps/via/keymap.c
new file mode 100644
index 000000000000..bdbd32898a00
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/via/keymap.c
@@ -0,0 +1,68 @@
+#include QMK_KEYBOARD_H
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ /* BASE Level: Default Layer
+ |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
+ | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
+ |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
+ | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | |
+ |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
+ | Cont | A | S | D | F | G | H | J | K | L | ; | ' | Ent | | |
+ |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
+ | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | |
+ |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---|
+
+ |------+------+-----------------------+------+------|
+ | LAlt | LGUI | ******* Space ******* | RGUI | RAlt |
+ |------+------+-----------------------+------+------|
+ */
+
+ [0] = LAYOUT( // default layer
+ 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
+ ),
+
+ /* 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 | | Backs | |
+ |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
+ | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | |
+ |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
+ | | | | | | | + | - | End | PgD | Dow | | | | |
+ |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----|
+
+ |------+------+----------------------+------+------+
+ | **** | **** | ******************** | **** | **** |
+ |------+------+----------------------+------+------+
+
+ */
+
+ [1] = LAYOUT(
+ 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC,
+ KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ ),
+ [2] = 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
+ ),
+ [3] = 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
+ )
+};
diff --git a/keyboards/hhkb/ansi/keymaps/via/rules.mk b/keyboards/hhkb/ansi/keymaps/via/rules.mk
new file mode 100644
index 000000000000..1e5b99807cb7
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/hhkb/keymaps/xyverz/keymap.c b/keyboards/hhkb/ansi/keymaps/xyverz/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/xyverz/keymap.c
rename to keyboards/hhkb/ansi/keymaps/xyverz/keymap.c
diff --git a/keyboards/hhkb/ansi/matrix.c b/keyboards/hhkb/ansi/matrix.c
new file mode 100644
index 000000000000..f22e69f6b024
--- /dev/null
+++ b/keyboards/hhkb/ansi/matrix.c
@@ -0,0 +1,211 @@
+/*
+Copyright 2011 Jun Wako
+
+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 .
+*/
+
+/*
+ * scan matrix
+ */
+#include
+#include
+#include
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "timer.h"
+#include "matrix.h"
+#include "hhkb_avr.h"
+#include
+#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< 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.
+
+ _delay_us(75);
+
+ }
+ 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<= 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/ansi/readme.md b/keyboards/hhkb/ansi/readme.md
new file mode 100644
index 000000000000..495aa4c3f7b3
--- /dev/null
+++ b/keyboards/hhkb/ansi/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/ansi: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/rules.mk b/keyboards/hhkb/ansi/rules.mk
similarity index 94%
rename from keyboards/hhkb/rules.mk
rename to keyboards/hhkb/ansi/rules.mk
index 68fb51a30cff..a367ef48d144 100644
--- a/keyboards/hhkb/rules.mk
+++ b/keyboards/hhkb/ansi/rules.mk
@@ -47,14 +47,14 @@ 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
+RN42_DIR = ../rn42
SRC += serial_uart.c \
- rn42/suart.S \
- rn42/rn42.c \
- rn42/rn42_task.c \
- rn42/battery.c \
- rn42/main.c
+ ../rn42/suart.S \
+ ../rn42/rn42.c \
+ ../rn42/rn42_task.c \
+ ../rn42/battery.c \
+ ../rn42/main.c
VPATH += $(RN42_DIR)
diff --git a/keyboards/hhkb/hhkb.c b/keyboards/hhkb/hhkb.c
deleted file mode 100644
index a9d35123ffa0..000000000000
--- a/keyboards/hhkb/hhkb.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "hhkb.h"
\ No newline at end of file
diff --git a/keyboards/hhkb/jp/config.h b/keyboards/hhkb/jp/config.h
new file mode 100644
index 000000000000..01dab6d440cd
--- /dev/null
+++ b/keyboards/hhkb/jp/config.h
@@ -0,0 +1,104 @@
+/*
+Copyright 2012 Jun Wako
+
+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"
+
+/* 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<>8); /* baud rate */ \
+ UCSR1B |= (1<
#include
@@ -67,11 +66,11 @@ static inline void KEY_INIT(void)
/* key: input with pull-up */
DDRD &= ~0x80;
PORTD |= 0x80;
-#ifdef HHKB_JP
+
/* row extention for HHKB JP */
DDRC |= (1<<6|1<<7);
PORTC |= (1<<6|1<<7);
-#endif
+
KEY_UNABLE();
KEY_PREV_OFF();
@@ -80,10 +79,10 @@ static inline void KEY_INIT(void)
static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
{
PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
-#ifdef HHKB_JP
+
if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6);
else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7);
-#endif
+
}
@@ -163,5 +162,3 @@ static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
PORTC &= ~0x0F; \
} while (0)
#endif
-
-#endif
diff --git a/keyboards/hhkb/info.json b/keyboards/hhkb/jp/info.json
similarity index 53%
rename from keyboards/hhkb/info.json
rename to keyboards/hhkb/jp/info.json
index 3beaff83da9a..7594987d96c3 100644
--- a/keyboards/hhkb/info.json
+++ b/keyboards/hhkb/jp/info.json
@@ -1,75 +1,10 @@
{
- "keyboard_name": "hhkb",
+ "keyboard_name": "HHKB JP",
"url": "",
"maintainer": "qmk",
"width": 15,
"height": 5,
"layouts": {
- "LAYOUT": {
- "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": "~", "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": "Delete", "x": 13.5, "y": 1, "w": 1.5 },
- { "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": "Return", "x": 12.75, "y": 2, "w": 2.25 },
- { "label": "Shift", "x": 0, "y": 3, "w": 2.25 },
- { "label": "Z", "x": 2.25, "y": 3 },
- { "label": "X", "x": 3.25, "y": 3 },
- { "label": "C", "x": 4.25, "y": 3 },
- { "label": "V", "x": 5.25, "y": 3 },
- { "label": "B", "x": 6.25, "y": 3 },
- { "label": "N", "x": 7.25, "y": 3 },
- { "label": "M", "x": 8.25, "y": 3 },
- { "label": "<", "x": 9.25, "y": 3 },
- { "label": ">", "x": 10.25, "y": 3 },
- { "label": "?", "x": 11.25, "y": 3 },
- { "label": "Shift", "x": 12.25, "y": 3, "w": 1.75 },
- { "label": "Fn", "x": 14, "y": 3 },
- { "label": "", "x": 1.5, "y": 4 },
- { "label": "", "x": 2.5, "y": 4, "w": 1.5 },
- { "x": 4, "y": 4, "w": 6 },
- { "label": "", "x": 10, "y": 4, "w": 1.5 },
- { "label": "", "x": 11.5, "y": 4 }
- ]
- },
-
"LAYOUT_JP": {
"layout": [
{ "label": "Esc", "x": 0, "y": 0 },
diff --git a/keyboards/hhkb/jp/jp.c b/keyboards/hhkb/jp/jp.c
new file mode 100644
index 000000000000..f1f1388c7739
--- /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/hhkb.h b/keyboards/hhkb/jp/jp.h
similarity index 57%
rename from keyboards/hhkb/hhkb.h
rename to keyboards/hhkb/jp/jp.h
index 668f78eecc53..a95796f25f9d 100644
--- a/keyboards/hhkb/hhkb.h
+++ b/keyboards/hhkb/jp/jp.h
@@ -1,28 +1,7 @@
-#ifndef HHKB_H
-#define HHKB_H
+#pragma once
#include "quantum.h"
-#define LAYOUT( \
- K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \
- K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \
- K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \
- K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \
- K35, K36, K37, K57, K56) \
- \
-{ \
- { K00, K01, K02, K03, K04, K05, K06, K07 }, \
- { K10, K11, K12, K13, K14, K15, K16, K17 }, \
- { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \
- { K30, K31, K32, K33, K34, K35, K36, K37 }, \
- { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \
- { K50, K51, K52, K53, K54, K55, K56, K57 }, \
- { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \
- { K70, K71, K72, K73, K74, K75, K76, KC_NO } \
-}
-
-#define LAYOUT_60_hhkb LAYOUT
-
#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, \
@@ -47,6 +26,3 @@
{ KC_NO, KC_NO, KE2, KE3, KE4, KE5, KE6, KC_NO }, \
{ KC_NO, KC_NO, KF2, KF3, KF4, KF5, KF6, KC_NO } \
}
-
-
-#endif
diff --git a/keyboards/hhkb/keymaps/bakingpy/keymap.c b/keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/bakingpy/keymap.c
rename to keyboards/hhkb/jp/keymaps/bakingpy/keymap.c
diff --git a/keyboards/hhkb/keymaps/bakingpy/rules.mk b/keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/bakingpy/rules.mk
rename to keyboards/hhkb/jp/keymaps/bakingpy/rules.mk
diff --git a/keyboards/hhkb/keymaps/jp/keymap.c b/keyboards/hhkb/jp/keymaps/default/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/jp/keymap.c
rename to keyboards/hhkb/jp/keymaps/default/keymap.c
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk b/keyboards/hhkb/jp/keymaps/default/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/halfqwerty_jp/rules.mk
rename to keyboards/hhkb/jp/keymaps/default/rules.mk
diff --git a/keyboards/hhkb/keymaps/jp_mac/keymap.c b/keyboards/hhkb/jp/keymaps/default_mac/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/jp_mac/keymap.c
rename to keyboards/hhkb/jp/keymaps/default_mac/keymap.c
diff --git a/keyboards/hhkb/keymaps/jp/rules.mk b/keyboards/hhkb/jp/keymaps/default_mac/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/jp/rules.mk
rename to keyboards/hhkb/jp/keymaps/default_mac/rules.mk
diff --git a/keyboards/hhkb/keymaps/krusli/config.h b/keyboards/hhkb/jp/keymaps/dhertz/config.h
similarity index 100%
rename from keyboards/hhkb/keymaps/krusli/config.h
rename to keyboards/hhkb/jp/keymaps/dhertz/config.h
diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.c b/keyboards/hhkb/jp/keymaps/dhertz/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/dhertz/keymap.c
rename to keyboards/hhkb/jp/keymaps/dhertz/keymap.c
diff --git a/keyboards/hhkb/keymaps/dhertz/keymap.h b/keyboards/hhkb/jp/keymaps/dhertz/keymap.h
similarity index 100%
rename from keyboards/hhkb/keymaps/dhertz/keymap.h
rename to keyboards/hhkb/jp/keymaps/dhertz/keymap.h
diff --git a/keyboards/hhkb/keymaps/dhertz/rules.mk b/keyboards/hhkb/jp/keymaps/dhertz/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/dhertz/rules.mk
rename to keyboards/hhkb/jp/keymaps/dhertz/rules.mk
diff --git a/keyboards/hhkb/keymaps/enoch_jp/keymap.c b/keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/enoch_jp/keymap.c
rename to keyboards/hhkb/jp/keymaps/enoch_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/enoch_jp/rules.mk b/keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/enoch_jp/rules.mk
rename to keyboards/hhkb/jp/keymaps/enoch_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/README.md b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
similarity index 100%
rename from keyboards/hhkb/keymaps/halfqwerty_jp/README.md
rename to keyboards/hhkb/jp/keymaps/halfqwerty_jp/README.md
diff --git a/keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/halfqwerty_jp/keymap.c
rename to keyboards/hhkb/jp/keymaps/halfqwerty_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/jp_mac/rules.mk b/keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/jp_mac/rules.mk
rename to keyboards/hhkb/jp/keymaps/halfqwerty_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/rdg_jp/keymap.c b/keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/rdg_jp/keymap.c
rename to keyboards/hhkb/jp/keymaps/rdg_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/rdg_jp/rules.mk b/keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/rdg_jp/rules.mk
rename to keyboards/hhkb/jp/keymaps/rdg_jp/rules.mk
diff --git a/keyboards/hhkb/keymaps/sh_jp/README.md b/keyboards/hhkb/jp/keymaps/sh_jp/README.md
similarity index 100%
rename from keyboards/hhkb/keymaps/sh_jp/README.md
rename to keyboards/hhkb/jp/keymaps/sh_jp/README.md
diff --git a/keyboards/hhkb/keymaps/sh_jp/keymap.c b/keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
similarity index 100%
rename from keyboards/hhkb/keymaps/sh_jp/keymap.c
rename to keyboards/hhkb/jp/keymaps/sh_jp/keymap.c
diff --git a/keyboards/hhkb/keymaps/sh_jp/rules.mk b/keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
similarity index 100%
rename from keyboards/hhkb/keymaps/sh_jp/rules.mk
rename to keyboards/hhkb/jp/keymaps/sh_jp/rules.mk
diff --git a/keyboards/hhkb/jp/keymaps/via/config.h b/keyboards/hhkb/jp/keymaps/via/config.h
new file mode 100644
index 000000000000..96c85573df1e
--- /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 000000000000..cb1ba76fb0ef
--- /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 000000000000..1e5b99807cb7
--- /dev/null
+++ b/keyboards/hhkb/jp/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes
diff --git a/keyboards/hhkb/matrix.c b/keyboards/hhkb/jp/matrix.c
similarity index 99%
rename from keyboards/hhkb/matrix.c
rename to keyboards/hhkb/jp/matrix.c
index 666b6f595f17..437356af6d26 100644
--- a/keyboards/hhkb/matrix.c
+++ b/keyboards/hhkb/jp/matrix.c
@@ -140,13 +140,10 @@ uint8_t matrix_scan(void)
// 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.
-#ifdef HHKB_JP
+
// Looks like JP needs faster scan due to its twice larger matrix
// or it can drop keys in fast key typing
_delay_us(30);
-#else
- _delay_us(75);
-#endif
}
if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
}
diff --git a/keyboards/hhkb/readme.md b/keyboards/hhkb/jp/readme.md
similarity index 95%
rename from keyboards/hhkb/readme.md
rename to keyboards/hhkb/jp/readme.md
index 57eb81439106..41c1d2214eaa 100644
--- a/keyboards/hhkb/readme.md
+++ b/keyboards/hhkb/jp/readme.md
@@ -9,6 +9,6 @@ Hardware Availability: https://geekhack.org/index.php?topic=12047.0
Make example for this keyboard (after setting up your build environment):
- make hhkb:default
+ 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 000000000000..774b444c5318
--- /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