summaryrefslogtreecommitdiffstats
path: root/keyboards/hhkb
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-06-21 22:39:54 -0400
committerGitHub <noreply@github.com>2016-06-21 22:39:54 -0400
commit649b33d7783cf3021928534b7ae127e0a89e8807 (patch)
treec2b5e0cf8ff4aa2918e3b88ab75dbdb071cc0a1d /keyboards/hhkb
parent464c8e274f993d3571fe5ea5e836fe55a3912ffe (diff)
Renames keyboard folder to keyboards, adds couple of tmk's fixes (#432)
* fixes from tmk's repo * rename keyboard to keyboards
Diffstat (limited to 'keyboards/hhkb')
-rw-r--r--keyboards/hhkb/Makefile86
-rw-r--r--keyboards/hhkb/README.md180
-rw-r--r--keyboards/hhkb/config.h71
-rw-r--r--keyboards/hhkb/hhkb.c29
-rw-r--r--keyboards/hhkb/hhkb.h30
-rw-r--r--keyboards/hhkb/hhkb_avr.h167
-rw-r--r--keyboards/hhkb/keymaps/default/compiled.hex1381
-rw-r--r--keyboards/hhkb/keymaps/default/keymap.c78
-rw-r--r--keyboards/hhkb/keymaps/lxol/compiled.hex1421
-rw-r--r--keyboards/hhkb/keymaps/lxol/keymap.c208
-rw-r--r--keyboards/hhkb/matrix.c204
11 files changed, 3855 insertions, 0 deletions
diff --git a/keyboards/hhkb/Makefile b/keyboards/hhkb/Makefile
new file mode 100644
index 0000000000..53eece3969
--- /dev/null
+++ b/keyboards/hhkb/Makefile
@@ -0,0 +1,86 @@
+
+
+# project specific files
+SRC = matrix.c
+
+# MCU name
+#MCU = at90usb1287
+MCU = atmega32u4
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_USB below, as it is sourced by
+# F_USB after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+# This will define a symbol, F_USB, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+#OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+# as per original hasu settings
+OPT_DEFS += -DBOOTLOADER_SIZE=512
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= yes # Console for debug(+400)
+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
+
+
+
+ifndef QUANTUM_DIR
+ include ../../Makefile
+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
diff --git a/keyboards/hhkb/README.md b/keyboards/hhkb/README.md
new file mode 100644
index 0000000000..2bfec7aa54
--- /dev/null
+++ b/keyboards/hhkb/README.md
@@ -0,0 +1,180 @@
+hhkb_qmk keyboard firmware
+======================
+
+## Quantum MK Firmware
+
+You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you.
+
+ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+ MIDI_ENABLE = yes # MIDI controls
+ # UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not //
+ BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
+
+## Quick aliases to common actions
+
+Your keymap can include shortcuts to common operations (called "function actions" in tmk).
+
+### Switching and toggling layers
+
+`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack.
+
+`LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped. Like `MO()`, this only works upwards in the layer stack (`layer` must be higher than the current layer).
+
+`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
+
+### Fun with modifier keys
+
+* `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias
+* `RSFT(kc)` - applies right Shift to *kc*
+* `LCTL(kc)` - applies left Control to *kc*
+* `RCTL(kc)` - applies right Control to *kc*
+* `LALT(kc)` - applies left Alt to *kc*
+* `RALT(kc)` - applies right Alt to *kc*
+* `LGUI(kc)` - applies left GUI (command/win) to *kc*
+* `RGUI(kc)` - applies right GUI (command/win) to *kc*
+
+You can also chain these, like this:
+
+ LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress.
+
+The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names are also available and documented in `/quantum/keymap_common.h`.
+
+ KC_TILD ~
+ KC_EXLM !
+ KC_AT @
+ KC_HASH #
+ KC_DLR $
+ KC_PERC %
+ KC_CIRC ^
+ KC_AMPR &
+ KC_ASTR *
+ KC_LPRN (
+ KC_RPRN )
+ KC_UNDS _
+ KC_PLUS +
+ KC_LCBR {
+ KC_RCBR }
+ KC_PIPE |
+ KC_COLN :
+
+`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down.
+
+These are the values you can use for the `mod` in `MT()` (right-hand modifiers are not available):
+
+ * MOD_LCTL
+ * MOD_LSFT
+ * MOD_LALT
+ * MOD_LGUI
+
+These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped.
+
+We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact:
+
+ * `CTL_T(kc)` - is LCTL when held and *kc* when tapped
+ * `SFT_T(kc)` - is LSFT when held and *kc* when tapped
+ * `ALT_T(kc)` - is LALT when held and *kc* when tapped
+ * `GUI_T(kc)` - is LGUI when held and *kc* when tapped
+ * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)
+
+### Temporarily setting the default layer
+
+`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
+
+### Remember: These are just aliases
+
+These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/keymap.md#2-action).
+
+Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
+
+## Macro shortcuts: Send a whole string when pressing just one key
+
+Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c).
+
+```c
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
+{
+ switch(id) {
+ case 0: // this would trigger when you hit a key mapped as M(0)
+ if (record->event.pressed) {
+ return MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ); // this sends the string 'hello' when the macro executes
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+```
+A macro can include the following commands:
+
+* I() change interval of stroke in milliseconds.
+* D() press key.
+* U() release key.
+* T() type key(press and release).
+* W() wait (milliseconds).
+* END end mark.
+
+So above you can see the stroke interval changed to 255ms between each keystroke, then a bunch of keys being typed, waits a while, then the macro ends.
+
+Note: Using macros to have your keyboard send passwords for you is a bad idea.
+
+### Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc)
+
+Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
+
+ #include "keymap_<layout>.h"
+
+Where <layout> is "colemak" or "dvorak". After including this line, you will get access to:
+
+ * `CM_*` for all of the Colemak-equivalent characters
+ * `DV_*` for all of the Dvorak-equivalent characters
+
+These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features.
+
+To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`.
+
+## Additional language support
+
+In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `รน` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support).
+
+## Unicode support
+
+You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile.
+
+## Other firmware shortcut keycodes
+
+* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`)
+* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things
+* `BL_ON` - turns the backlight on
+* `BL_OFF` - turns the backlight off
+* `BL_<n>` - sets the backlight to level *n*
+* `BL_INC` - increments the backlight level by one
+* `BL_DEC` - decrements the backlight level by one
+* `BL_TOGG` - toggles the backlight
+* `BL_STEP` - steps through the backlight levels
+
+Enable the backlight from the Makefile.
+
+## MIDI functionalty
+
+This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
+
+## Bluetooth functionality
+
+This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
+
+## Building
+
+Download or clone the whole firmware and navigate to the keyboards/planck folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use `make dfu` to program your PCB once you hit the reset button.
+
+Depending on which keymap you would like to use, you will have to compile slightly differently.
+
+### Default
+To build with the default keymap, simply run `make`.
+
+### Other Keymaps
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a file in the keymaps folder named `<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
+
+To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
+```
+$ make KEYMAP=[default|jack|<name>]
+```
+Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.
diff --git a/keyboards/hhkb/config.h b/keyboards/hhkb/config.h
new file mode 100644
index 0000000000..ee66e44571
--- /dev/null
+++ b/keyboards/hhkb/config.h
@@ -0,0 +1,71 @@
+/*
+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/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xCAFE
+#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 8
+#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
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/*
+ * 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
+
+#endif
diff --git a/keyboards/hhkb/hhkb.c b/keyboards/hhkb/hhkb.c
new file mode 100644
index 0000000000..6897026c6c
--- /dev/null
+++ b/keyboards/hhkb/hhkb.c
@@ -0,0 +1,29 @@
+#include "hhkb.h"
+
+__attribute__ ((weak))
+void matrix_init_user(void) {
+ // leave these blank
+};
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+ // leave these blank
+};
+
+void matrix_init_kb(void) {
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
+
+ if (matrix_init_user) {
+ (*matrix_init_user)();
+ }
+};
+
+void matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+
+ if (matrix_scan_user) {
+ (*matrix_scan_user)();
+ }
+};
diff --git a/keyboards/hhkb/hhkb.h b/keyboards/hhkb/hhkb.h
new file mode 100644
index 0000000000..093d7aeabc
--- /dev/null
+++ b/keyboards/hhkb/hhkb.h
@@ -0,0 +1,30 @@
+#ifndef HHKB_H
+#define HHKB_H
+
+#include "matrix.h"
+#include "keymap.h"
+//#include "backlight.h"
+#include <stddef.h>
+
+#define KEYMAP( \
+ 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 } \
+}
+
+void matrix_init_user(void);
+void matrix_scan_user(void);
+
+#endif
diff --git a/keyboards/hhkb/hhkb_avr.h b/keyboards/hhkb/hhkb_avr.h
new file mode 100644
index 0000000000..7ea6322c73
--- /dev/null
+++ b/keyboards/hhkb/hhkb_avr.h
@@ -0,0 +1,167 @@
+#ifndef HHKB_AVR_H
+#define HHKB_AVR_H
+
+#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;
+#ifdef HHKB_JP
+ /* row extention for HHKB JP */
+ DDRC |= (1<<6|1<<7);
+ PORTC |= (1<<6|1<<7);
+#endif
+ 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);
+#ifdef HHKB_JP
+ if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6);
+ else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7);
+#endif
+}
+
+
+#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
+
+#endif
diff --git a/keyboards/hhkb/keymaps/default/compiled.hex b/keyboards/hhkb/keymaps/default/compiled.hex
new file mode 100644
index 0000000000..b3af695270
--- /dev/null
+++ b/keyboards/hhkb/keymaps/default/compiled.hex
@@ -0,0 +1,1381 @@
+:100000000C9452060C9496060C9496060C94960644
+:100010000C9496060C9496060C9496060C949606F0
+:100020000C9496060C9496060C945A110C942C126F
+:100030000C941C1F0C9496060C9496060C94960631
+:100040000C9496060C9496060C9496060C949606C0
+:100050000C9496060C94BC1F0C9496060C94960671
+:100060000C9496060C9496060C9496060C949606A0
+:100070000C9496060C9496060C9496060C94960690
+:100080000C9496060C9496060C9496060C94960680
+:100090000C9496060C9496060C9496060C94960670
+:1000A0000C9496060C9496060C9496069912BB1224
+:1000B000A913BB12A91300132313A91378138B13CD
+:1000C0006516651694169416D316F316231823187E
+:1000D000FE162318AE17AE171418231823181D1870
+:1000E000BB17BB17BB17BB17BB17BB17BB17BB1780
+:1000F000BB17BB17BB17BB17BB17BB17BB17BB1770
+:10010000CB17D917E017E717F117253032583A20E7
+:10011000253038620A000A722F63203031323334BE
+:100120003536370A001F0014001A00160004001D9F
+:10013000001B000600200021001500080007000930
+:100140000019000500220023001C0017000A000B04
+:1001500000110000001E0029002B00E000E100E279
+:1001600000E3002C002400250018000C000E000DF8
+:100170000010000000310035002A0028000152E57F
+:1001800000E600E700260027001200130033000FEE
+:1001900000360000002D002E0030002F0034003803
+:1001A00000370000003B0001000100A900AA000187
+:1001B00000010001003C003D0001000100A8000119
+:1001C00000010001003E003F000100010001005558
+:1001D00000570000003A00A50039000100010001AD
+:1001E000000100010040004100010046004A0054A7
+:1001F000005600000049004C002A00580001000190
+:100200000001000100420043004700480050004B3D
+:10021000004D00000044004500010052004F005115
+:10022000004E0000000A44454255473A20656E6181
+:10023000626C65642E0A005B735D004B6579626FCA
+:100240006172642073746172742E0A005B575D00E2
+:100250005B535D005B525D005B445D005B435D0092
+:100260001203480048004B00420020006D006F0060
+:10027000640000000C0371002E006D002E006B0066
+:1002800000000403090409027400040100A0FA0933
+:100290000400000103010100092111010001223FB6
+:1002A000000705810308000A090401000103010297
+:1002B00000092111010001224D00070582030800F9
+:1002C0000A090402000103000000092111010001D4
+:1002D0002236000705830308000A0904030002030D
+:1002E00000000009211101000122200007058403FC
+:1002F0002000010705040320000112011001000085
+:100300000008EDFEFECA0401010200010631FF09EA
+:1003100074A1010975150025FF9520750881020952
+:1003200076150025FF952075089102C0050109800A
+:10033000A101850216010026B7001A01002AB700A4
+:10034000751095018100C0050C0901A101850316F6
+:100350000100269C021A01002A9C02751095018159
+:1003600000C005010902A1010901A1000509190147
+:100370002905150025019505750181029501750373
+:1003800081010501093009311581257F9502750824
+:10039000810609381581257F950175088106050CB0
+:1003A0000A38021581257F950175088106C0C005B0
+:1003B000010906A101050719E029E71500250195A6
+:1003C0000875018102950175088101050819012947
+:1003D00005950575019102950175039101050719B0
+:1003E0000029FF150025FF950675088100C00A0049
+:1003F0002530325820006B6579626F6172645F72DC
+:1004000065706F72743A20004B6579626F61726437
+:10041000204C4544732073746174653A2025780A32
+:1004200000646F6E652E0A00626F6F676D616769A9
+:1004300063207363616E3A202E2E2E2000290A005D
+:100440002575002F002575005D280025640020001B
+:10045000256400200025640020002564007C002520
+:10046000303258006D6F7573656B6579205B62740F
+:100470006E7C782079207620685D287265702F6107
+:10048000636C293A205B006D6B5F776865656C5F14
+:1004900074696D655F746F5F6D6178203D202564C0
+:1004A0000A006D6B5F776865656C5F6D61785F737F
+:1004B00070656564203D2025640A006D6B5F74697A
+:1004C0006D655F746F5F6D6178203D2025640A0063
+:1004D0006D6B5F6D61785F7370656564203D20258D
+:1004E000640A006D6B5F696E74657276616C203DA5
+:1004F0002025640A006D6B5F64656C6179203D2086
+:1005000025640A006D6B5F776865656C5F74696D63
+:10051000655F746F5F6D6178203D2025640A006D12
+:100520006B5F776865656C5F6D61785F737065653B
+:1005300064203D2025640A006D6B5F74696D655F02
+:10054000746F5F6D6178203D2025640A006D6B5FDC
+:100550006D61785F7370656564203D2025640A00D5
+:100560006D6B5F696E74657276616C203D202564E9
+:100570000A006D6B5F64656C6179203D2025640A1B
+:10058000000A00257500363A20776865656C5F744F
+:10059000696D655F746F5F6D61783A20000A0025B0
+:1005A0007500353A20776865656C5F6D61785F73BB
+:1005B000706565643A20000A00257500343A20749D
+:1005C000696D655F746F5F6D61783A20000A002580
+:1005D0007500333A206D61785F73706565643A2009
+:1005E000000A00257500323A20696E7465727661E2
+:1005F0006C286D73293A20000A00257500313A20D5
+:1006000064656C6179282A31306D73293A20000ABB
+:10061000092D2056616C756573202D0A004D3E0032
+:100620004D25643E20003F0073657420646566615B
+:10063000756C740A00433E2000776865726520641B
+:10064000656C74613A20637572736F723D25642C1A
+:1006500020776865656C3D25640A5365652068747C
+:1006600074703A2F2F656E2E77696B6970656469B7
+:10067000612E6F72672F77696B692F4D6F75736588
+:100680005F6B6579730A000A092D204D6F757365DC
+:100690006B6579202D0A4553432F713A09717569AD
+:1006A000740A313A0964656C6179282A31306D73B6
+:1006B000290A323A09696E74657276616C286D7325
+:1006C000290A333A096D61785F73706565640A348D
+:1006D0003A0974696D655F746F5F6D61780A353AC8
+:1006E00009776865656C5F6D61785F7370656564D7
+:1006F0000A363A09776865656C5F74696D655F7481
+:100700006F5F6D61780A0A703A097072696E7420C1
+:1007100076616C7565730A643A0973657420646563
+:100720006661756C74730A75703A092B310A646FCF
+:10073000776E3A092D310A706775703A092B31309E
+:100740000A7067646F776E3A092D31300A0A737048
+:10075000656564203D2064656C7461202A206D61AC
+:10076000785F7370656564202A2028726570656102
+:1007700074202F2074696D655F746F5F6D617829D7
+:100780000A003F004D3E2000433E20004C25640AF5
+:100790000074696D65725F636F756E743A20253001
+:1007A000346C580A006B6579626F6172645F6964CA
+:1007B0006C653A2025580A006B6579626F61726436
+:1007C0005F70726F746F636F6C3A2025580A00680F
+:1007D0006F73745F6B6579626F6172645F6C65647F
+:1007E0007328293A2025580A000A092D20537461DC
+:1007F000747573202D0A004743433A20342E392E56
+:1008000032204156522D4C4942433A20312E382E47
+:1008100031204156525F415243483A206176723549
+:100820000A004F5054494F4E533A204C55464120F0
+:10083000424F4F544D41474943204D4F5553454B2F
+:1008400045592045585452414B455920434F4E532A
+:100850004F4C4520434F4D4D414E44203531320AD7
+:10086000004255494C443A20313637313865662DBF
+:100870006469727479202832333A33393A32382035
+:100880004A756E2020392032303136290A00564907
+:10089000443A2030784645454428712E6D2E6B2908
+:1008A000205049443A203078434146452848484B37
+:1008B00042206D6F6429205645523A2030783031FD
+:1008C00030340A00444553433A20712E6D2E6B207C
+:1008D0006B6579626F617264206669726D776172AF
+:1008E0006520666F722048484B420A000A092D2095
+:1008F00056657273696F6E202D0A000A092D204318
+:100900006F6E736F6C65202D0A4553432F713A0942
+:10091000717569740A6D3A096D6F7573656B6579E8
+:100920000A000A092D204D61676963202D0A443AA7
+:10093000094465627567204D65737361676520546E
+:100940006F67676C650A583A094D6174726978205F
+:100950004465627567204D6F646520546F67676CEE
+:1009600065202D2053686F77206B657970726573F1
+:1009700073657320696E206D617472697820677287
+:1009800069640A4B3A094B6579626F61726420446D
+:100990006562756720546F67676C65202D2053680A
+:1009A0006F77206B65797072657373207265706FF5
+:1009B00072740A4D3A094465627567204D6F75730C
+:1009C0006520546F67676C650A563A0956657273FD
+:1009D000696F6E0A533A095374617475730A433A26
+:1009E00009416374697661746520436F6E736F6C3F
+:1009F00065204D6F64650A46312D4631303A095302
+:100A0000776974636820746F204C61796572203057
+:100A10002D392028463130203D204C30290A302DF8
+:100A2000393A0953776974636820746F204C61798F
+:100A3000657220302D390A4553433A09537769745A
+:100A4000636820746F204C617965722030202861C2
+:100A50006C7465726E617465206B65792031290A4A
+:100A600047524156453A0953776974636820746F59
+:100A7000204C6179657220302028616C7465726E3B
+:100A8000617465206B65792032290A5041555345C0
+:100A90003A094A756D7020746F20426F6F746C6FE5
+:100AA0006164657220285265736574290A453A09A4
+:100AB0005072696E7420454550524F4D20536574F5
+:100AC00074696E67730A000A002575002E6E6B72DA
+:100AD0006F3A20000A002575002E737761705F62FF
+:100AE00061636B736C6173685F6261636B73706188
+:100AF00063653A20000A002575002E737761705FE8
+:100B000067726176655F6573633A20000A00257538
+:100B1000002E6E6F5F6775693A20000A0025750028
+:100B20002E737761705F72616C745F726775693A7A
+:100B300020000A002575002E737761705F6C616C70
+:100B4000745F6C6775693A20000A002575002E6392
+:100B50006170736C6F636B5F746F5F636F6E7472E1
+:100B60006F6C3A20000A002575002E737761705F64
+:100B7000636F6E74726F6C5F636170736C6F636BC5
+:100B80003A20000A0025303258006B65796D61709B
+:100B90005F636F6E6669672E7261773A20000A00A4
+:100BA0002575002E6D6F7573653A20000A00257556
+:100BB000002E6B6579626F6172643A20000A00252D
+:100BC00075002E6D61747269783A20000A002575EF
+:100BD000002E656E61626C653A20000A0025303295
+:100BE000580064656275675F636F6E6669672E7231
+:100BF00061773A20000A0025750064656661756CAE
+:100C0000745F6C617965723A20003F000A6D6F7500
+:100C100073653A206F66660A000A6D6F7573653AF0
+:100C2000206F6E0A000A6B6579626F6172643A2008
+:100C30006F66660A000A6B6579626F6172643A20BA
+:100C40006F6E0A000A6D61747269783A206F666689
+:100C50000A000A6D61747269783A206F6E0A000AA0
+:100C600064656275673A206F66660A000A646562A9
+:100C700075673A206F6E0A000A0A4A756D70696ED0
+:100C80006720746F20626F6F746C6F616465722E81
+:100C90002E2E2000433E20006565636F6E666967F7
+:100CA0003A0A000011241FBECFEFDAE0DEBFCDBF4D
+:100CB00004B603FE24C08091E0019091E101A0916F
+:100CC000E201B091E3018730904BA740B04BB9F4FB
+:100CD0001092E0011092E1011092E2011092E30102
+:100CE00014BE84B7877F84BF88E10FB6F8948093E1
+:100CF0006000109260000FBEE0E0FFE3099511E094
+:100D0000A0E0B1E0ECEFF5E502C005900D92A23352
+:100D1000B107D9F711E0A2E3B1E001C01D92A03EF6
+:100D2000B107E1F70E94940E0C94FC2A0C94000089
+:100D3000FF93EF93E0913201F0913301309709F086
+:100D40000995EF91FF910895FC018591803011F094
+:100D5000EFDFFBCF0895FF27E0E230E247FF0CC052
+:100D6000419597FF09C0EDE260957095809590954B
+:100D7000611D711D811D911D27FF02C0219530E36A
+:100D800050E2AA27660F771F881F991FAA1FA41772
+:100D900010F0A41B63955A95A9F7AA3008F0A95F33
+:100DA000A05DAF93F395611571058105910541F73C
+:100DB000ED3211F4EF93F395F21718F43F93F39596
+:100DC000FBCF8F91B5DFFA95E1F70895E991F9919D
+:100DD0008591803021F0853219F0AADFF9CF08958E
+:100DE00020E0E89455915532C1F3503311F46894E2
+:100DF00055915A3348F4505390F3220F022E220F8C
+:100E0000220F200D250FF4CF0EF421958991999191
+:100E1000533619F3533729F1533559F1BC0188275B
+:100E20009927E8945C3621F48991999168945591B9
+:100E3000543639F446EF7EF077FF0DC08FEF9FEF09
+:100E40000AC055374AE039F0583540E121F05236B2
+:100E500042E009F00895FF93EF937DDFEF91FF915A
+:100E6000B7CFFF93EF93FC0181918030B9F360DF3E
+:100E7000FBCFFF93EF9368DFF1CFDF93CF93CDB735
+:100E8000DEB72596A3DFCF91DF9108958FEF84B968
+:100E900080E485B957985F9A2E9A2F98ECE3F1E099
+:100EA00088E08E0F11928E13FDCFE4E3F1E088E02D
+:100EB0008E0F11928E13FDCF8CE391E0909347013A
+:100EC0008093460184E391E090934501809344012F
+:100ED0000895EF92FF920F931F93CF93DF9380912A
+:100EE0004401909145012091460130914701309392
+:100EF0004501209344019093470180934601C0E04F
+:100F0000D0E0EE24E394F12C0FEF10E020E030E08D
+:100F100085B1807C8C2BA90193E0440F551F9A95D5
+:100F2000E1F7842B85B98AE18A95F1F700C0E09159
+:100F30004401F0914501EC0FFD1F808190E0022EED
+:100F400002C0959587950A94E2F780FD2F9A95E364
+:100F50009A95F1F70000E6B52E988AE18A95F1F7A7
+:100F600000C04091460150914701DA01AC0FBD1F0E
+:100F70004F9B0AC0C701022E01C0880F0A94EAF7EE
+:100F800080959C91892308C06C91C701022E01C0F5
+:100F9000880F0A94EAF7862B8C9386B56E2F70E043
+:100FA0008E1728F086B590E0861B970B06C0E6B535
+:100FB000C801861B970B8E0F911D069758F0E09184
+:100FC0004401F0914501E