summaryrefslogtreecommitdiffstats
path: root/keyboard/hhkb
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/hhkb')
-rw-r--r--keyboard/hhkb/Makefile156
-rw-r--r--keyboard/hhkb/Makefile.jp2
-rw-r--r--keyboard/hhkb/Makefile.pjrc68
-rw-r--r--keyboard/hhkb/Makefile.rn42155
-rw-r--r--keyboard/hhkb/README.md102
-rw-r--r--keyboard/hhkb/config.h71
-rw-r--r--keyboard/hhkb/config_rn42.h112
-rw-r--r--keyboard/hhkb/doc/Bluetooth.txt39
-rw-r--r--keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpgbin0 -> 502118 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB.txt203
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpgbin0 -> 149082 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpgbin0 -> 155342 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpgbin0 -> 148225 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpgbin0 -> 193900 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpgbin0 -> 135100 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpgbin0 -> 171469 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/connector_contact.jpgbin0 -> 192830 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpgbin0 -> 169564 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/probe_contact.jpgbin0 -> 208477 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/teensy_install.jpgbin0 -> 135851 bytes
-rw-r--r--keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpgbin0 -> 154695 bytes
-rw-r--r--keyboard/hhkb/doc/Power.txt48
-rw-r--r--keyboard/hhkb/doc/V-USB.md39
-rw-r--r--keyboard/hhkb/hhkb_avr.h167
-rw-r--r--keyboard/hhkb/keymap_common.c33
-rw-r--r--keyboard/hhkb/keymap_common.h84
-rw-r--r--keyboard/hhkb/keymap_hasu.c282
-rw-r--r--keyboard/hhkb/keymap_hhkb.c62
-rw-r--r--keyboard/hhkb/keymap_jp.c50
-rw-r--r--keyboard/hhkb/keymap_spacefn.c116
-rw-r--r--keyboard/hhkb/led.c33
-rw-r--r--keyboard/hhkb/matrix.c190
-rw-r--r--keyboard/hhkb/not_supported/Makefile.iwrap103
-rw-r--r--keyboard/hhkb/not_supported/Makefile.vusb97
-rw-r--r--keyboard/hhkb/not_supported/config_iwrap.h54
-rw-r--r--keyboard/hhkb/not_supported/config_vusb.h38
-rw-r--r--keyboard/hhkb/not_supported/iwrap.txt32
-rw-r--r--keyboard/hhkb/not_supported/usbconfig.h388
-rw-r--r--keyboard/hhkb/rn42.mk12
-rw-r--r--keyboard/hhkb/rn42/MEMO.txt255
-rw-r--r--keyboard/hhkb/rn42/PowerSave.txt88
-rw-r--r--keyboard/hhkb/rn42/RN42.txt408
-rw-r--r--keyboard/hhkb/rn42/battery.c130
-rw-r--r--keyboard/hhkb/rn42/battery.h35
-rw-r--r--keyboard/hhkb/rn42/main.c111
-rw-r--r--keyboard/hhkb/rn42/rn42.c237
-rw-r--r--keyboard/hhkb/rn42/rn42.h23
-rw-r--r--keyboard/hhkb/rn42/rn42_task.c478
-rw-r--r--keyboard/hhkb/rn42/rn42_task.h10
-rw-r--r--keyboard/hhkb/rn42/suart.S156
-rw-r--r--keyboard/hhkb/rn42/suart.h8
51 files changed, 4675 insertions, 0 deletions
diff --git a/keyboard/hhkb/Makefile b/keyboard/hhkb/Makefile
new file mode 100644
index 0000000000..ea5a65ea29
--- /dev/null
+++ b/keyboard/hhkb/Makefile
@@ -0,0 +1,156 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+# Target file name (without extension).
+TARGET = hhkb_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../..
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap_common.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# MCU name
+# PJRC Teensy++ 2.0
+#MCU = at90usb1286
+# TMK Alt Controller or PJRC Teensy 2.0
+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
+#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096 (TMK Alt Controller)
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+NKRO_ENABLE = yes # USB Nkey Rollover
+#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
+#HHKB_JP = yes # HHKB JP support
+
+
+#
+# Keymap file
+#
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ ifdef HHKB_JP
+ SRC := keymap_jp.c $(SRC)
+ else
+ SRC := keymap_hhkb.c $(SRC)
+ endif
+endif
+
+
+ifneq (, $(or $(findstring keymap_jp.c, $(SRC)), $(findstring yes, $(HHKB_JP))))
+ OPT_DEFS += -DHHKB_JP
+endif
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+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/keyboard/hhkb/Makefile.jp b/keyboard/hhkb/Makefile.jp
new file mode 100644
index 0000000000..e04dbb2424
--- /dev/null
+++ b/keyboard/hhkb/Makefile.jp
@@ -0,0 +1,2 @@
+HHKB_JP = yes
+include Makefile
diff --git a/keyboard/hhkb/Makefile.pjrc b/keyboard/hhkb/Makefile.pjrc
new file mode 100644
index 0000000000..53bb784cf0
--- /dev/null
+++ b/keyboard/hhkb/Makefile.pjrc
@@ -0,0 +1,68 @@
+#
+# Makefile for PJRC Teensy
+#
+
+
+# Target file name (without extension).
+TARGET = hhkb_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../..
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_hasu.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# MCU name, you MUST set this to match the board you are using
+# type "make clean" after changing this, so all files will be rebuilt
+#MCU = at90usb162 # Teensy 1.0
+MCU = atmega32u4 # Teensy 2.0
+#MCU = at90usb646 # Teensy++ 1.0
+#MCU = at90usb1286 # Teensy++ 2.0
+
+
+# Processor frequency.
+# Normally the first thing your program should do is set the clock prescaler,
+# so your program will run at the correct speed. You should also set this
+# variable to same clock speed. The _delay_ms() macro uses this, and many
+# examples use this variable to calculate timings. Do not add a "UL" here.
+F_CPU = 16000000
+
+
+# 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
+NKRO_ENABLE = yes # USB Nkey Rollover
+
+
+
+#---------------- Programming Options --------------------------
+PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/hhkb/Makefile.rn42 b/keyboard/hhkb/Makefile.rn42
new file mode 100644
index 0000000000..66bdba9174
--- /dev/null
+++ b/keyboard/hhkb/Makefile.rn42
@@ -0,0 +1,155 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+
+# Target file name (without extension).
+TARGET = hhkb_rn42
+
+# Directory common source filess exist
+TMK_DIR = ../..
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap_common.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config_rn42.h
+
+
+# MCU name
+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
+#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096 (TMK Alt Controller)
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#NKRO_ENABLE = yes # USB Nkey Rollover
+#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
+#HHKB_JP = yes # HHKB JP support
+
+
+#
+# Keymap file
+#
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ ifdef HHKB_JP
+ SRC := keymap_jp.c $(SRC)
+ else
+ SRC := keymap_hhkb.c $(SRC)
+ endif
+endif
+
+
+ifneq (, $(or $(findstring keymap_jp.c, $(SRC)), $(findstring yes, $(HHKB_JP))))
+ OPT_DEFS += -DHHKB_JP
+endif
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include rn42.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+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/keyboard/hhkb/README.md b/keyboard/hhkb/README.md
new file mode 100644
index 0000000000..fcd72e1941
--- /dev/null
+++ b/keyboard/hhkb/README.md
@@ -0,0 +1,102 @@
+Alternative Controller for HHKB Pro
+===================================
+I wanted to add some features like vi cursor and mouse keys to my [HHKB][HHKB] but its controller is not programmable and firmware source code is not open, of course. This means customizing this keyboard needs to replace original controller with programmable one.
+
+This controller can work with HHKB **Professional**, **Professional** 2, **JP** and **Type-S**.
+
+See [this thread][AltController] in geekhack.org.
+
+[HHKB]: http://www.pfu.fujitsu.com/hhkeyboard/
+[AltController]: http://geekhack.org/index.php?topic=12047.0
+
+
+## Update
+* Bluetooth module RN-42 is supported.(2015/01)
+* V-USB and iWRAP are no longer supported now, but still it'll works with a little fix. See not_supported directory.(2015/01)
+
+
+##Features
+* Customizable keymap
+* More keymap layers(more Fn keys)
+* Mouse keys
+* USB NKRO
+* Bluetooth(RN-42)
+
+See README of [tmk_keyboard] for more.
+
+[tmk_keyboard]: http://github.com/tmk/tmk_keyboard
+
+###Pros
+* No risks: Everything is all reversible
+* No need for PCB trace patching, case cutting or any other destructive mod
+* Can keep original controller intact
+* Can change all HHKB behavior as you like
+
+###Cons
+* Void your warranty
+* Lose USB hub function of Pro2
+
+##DISCLAIMER
+I'm not a professional of electronics nor MCU programming. This may damage your HHKB.
+And my English writing is poor, I'm not sure I can convey my notions accurately.
+
+
+##Documents
+See [doc/HHKB.txt](doc/HHKB.txt) and files under [doc/](doc/) for internal of HHKB and this controller.
+
+
+##Build Firmware & Program
+See [this document](../../doc/build.md) first.
+
+### Configuration
+If your target is **HHKB JP** you need to set `HHKB_JP` build option in `Makefile` or use `Makefile.jp` instead of `Makefile`.
+
+If you use other than **TMK Alt Controller Board** set proper `MCU`, `BOOTLOADER_SIZE` and other build options in `Makefile` and `config.h`. At least PJRC Teensy requires changing `BOOTLOADER_SIZE` to 512.
+
+### Build
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. Just `make` with `KEYMAP` option like:
+
+ $ make -f Makefile.<jp|pjrc|rn42> KEYMAP=(hasu|hhkb|spacefn|<name>)
+
+You can omit `-f` option when you use `Makefile`. `Makefile` is used for **Pro2 and Pro**, `Makefile.jp` fits for **JP** model and `Makefile.rn42` supports Bluetooth module **RN-42**. `Makefile.pjrc` uses **PJRC** as output protocol instead of **LUFA**.
+
+
+### Program
+First, push reset button on board to start bootloader.
+
+This command programs the controller with [dfu-programmer] if the tool is installed and configured properly.
+
+ $ make -f Makefile.<variant> KEYMAP=<name> dfu
+
+Or you can also use [FLIP] command to program. Also the tool should be installed and configured properly. FLIP GUI application is also available.
+
+ $ make -f Makefile.<variant> KEYMAP=<name> flip
+
+Use [Teensy Loader] if your controller is Teensy/Teensy++.
+
+
+##Keymap
+To define your own keymap create file named `keymap_<name>.c` and see [keymap document](../../doc/keymap.md) and existent keymap files.
+
+
+##Hardware
+You have some options for hardware. Development boards with USB AVR family(ATMega32U4, AT90USB1286) like Teensy will work while MegaAVR with [V-USB] library is also cheaper option for DIY.
+
+###1. TMK Alt Controller Board
+Design files are available at [Keyboard Controller Board for HHKB(KiCad project)](https://github.com/tmk/HHKB_controller) and see [Controller Distribution thread](http://geekhack.org/index.php?topic=56494.0) if you get an assembled one.
+
+
+###2. PJRC Teensy
+See [this thread](http://geekhack.org/index.php?topic=57008.0).
+
+
+###3. V-USB version
+See [V-USB controller for HHKB](doc/V-USB.md).
+
+
+[LUFA]: http://www.fourwalledcubicle.com/LUFA.php
+[PJRC]: http://www.pjrc.com/teensy/usb_keyboard.html
+[dfu-programmer]: http://dfu-programmer.sourceforge.net/
+[FLIP]: http://www.atmel.com/tools/FLIP.aspx
+[Teensy Loader]: http://www.pjrc.com/teensy/loader.html
+[V-USB]: http://www.obdev.at/products/vusb/index.html
diff --git a/keyboard/hhkb/config.h b/keyboard/hhkb/config.h
new file mode 100644
index 0000000000..c0acc0a7ed
--- /dev/null
+++ b/keyboard/hhkb/config.h
@@ -0,0 +1,71 @@
+/*
+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/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xCAFE
+#define DEVICE_VER 0x0104
+#define MANUFACTURER t.m.k.
+#define PRODUCT HHKB mod
+#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
+
+
+/* matrix size */
+#ifdef HHKB_JP
+# define MATRIX_ROWS 16
+#else
+# define MATRIX_ROWS 8
+#endif
+#define MATRIX_COLS 8
+
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+
+/* period of tapping(ms) */
+#define TAPPING_TERM 300
+/* tap count needed for toggling a feature */
+#define TAPPING_TOGGLE 5
+/* Oneshot timeout(ms) */
+#define ONESHOT_TIMEOUT 300
+
+/* Boot Magic salt key: Space */
+#define BOOTMAGIC_KEY_SALT KC_SPACE
+
+
+/*
+ * 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/keyboard/hhkb/config_rn42.h b/keyboard/hhkb/config_rn42.h
new file mode 100644
index 0000000000..21e73f1c53
--- /dev/null
+++ b/keyboard/hhkb/config_rn42.h
@@ -0,0 +1,112 @@
+/*
+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/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x4242
+#define DEVICE_VER 0x0104
+#define MANUFACTURER t.m.k.
+#define PRODUCT HHKB mod
+#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
+
+
+/* matrix size */
+#ifdef HHKB_JP
+# define MATRIX_ROWS 16
+#else
+# define MATRIX_ROWS 8
+#endif
+#define MATRIX_COLS 8
+
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+
+/* period of tapping(ms) */
+#define TAPPING_TERM 300
+/* tap count needed for toggling a feature */
+#define TAPPING_TOGGLE 5
+/* Oneshot timeout(ms) */
+#define ONESHOT_TIMEOUT 300
+
+/* Boot Magic salt key: Space */
+#define BOOTMAGIC_KEY_SALT KC_FN6
+
+/* power control of key switch board */
+#define HHKB_POWER_SAVING
+
+/*
+ * Hardware Serial(UART)
+ * Baud rate are calculated with round off(+0.5).
+ */
+#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
+
+
+/* for debug */
+#define SUART_OUT_PORT PORTD
+#define SUART_OUT_BIT 0
+#define SUART_IN_PIN PIND
+#define SUART_IN_BIT 1
+
+
+/*
+ * 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 f