summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--README.md182
-rw-r--r--converter/adb_usb/Makefile137
-rw-r--r--converter/adb_usb/Makefile.pjrc69
-rw-r--r--converter/adb_usb/README.md96
-rw-r--r--converter/adb_usb/config.h63
-rw-r--r--converter/adb_usb/keymap_ansi.c16
-rw-r--r--converter/adb_usb/keymap_common.c30
-rw-r--r--converter/adb_usb/keymap_common.h212
-rw-r--r--converter/adb_usb/keymap_hasu.c58
-rw-r--r--converter/adb_usb/keymap_iso.c16
-rw-r--r--converter/adb_usb/led.c27
-rw-r--r--converter/adb_usb/matrix.c235
-rw-r--r--converter/ascii_usb/Makefile82
-rw-r--r--converter/ascii_usb/README38
-rw-r--r--converter/ascii_usb/config.h70
-rw-r--r--converter/ascii_usb/keymap.c42
-rw-r--r--converter/ascii_usb/led.c25
-rw-r--r--converter/ascii_usb/matrix.c195
-rw-r--r--converter/ibm4704_usb/Makefile93
-rw-r--r--converter/ibm4704_usb/README.md62
-rw-r--r--converter/ibm4704_usb/config.h74
-rw-r--r--converter/ibm4704_usb/ibm4704.txt181
-rw-r--r--converter/ibm4704_usb/keymap_common.c30
-rw-r--r--converter/ibm4704_usb/keymap_common.h73
-rw-r--r--converter/ibm4704_usb/keymap_hasu.c85
-rw-r--r--converter/ibm4704_usb/keymap_plain.c38
-rw-r--r--converter/ibm4704_usb/led.c24
-rw-r--r--converter/ibm4704_usb/matrix.c170
-rw-r--r--converter/m0110_usb/Makefile96
-rw-r--r--converter/m0110_usb/Makefile.pjrc73
-rw-r--r--converter/m0110_usb/Makefile.teensy98
-rw-r--r--converter/m0110_usb/README.md82
-rw-r--r--converter/m0110_usb/config.h62
-rw-r--r--converter/m0110_usb/keymap_common.c37
-rw-r--r--converter/m0110_usb/keymap_common.h143
-rw-r--r--converter/m0110_usb/keymap_default.c85
-rw-r--r--converter/m0110_usb/keymap_for_editor.c118
-rw-r--r--converter/m0110_usb/keymap_hasu.c87
-rw-r--r--converter/m0110_usb/keymap_intl.c85
-rw-r--r--converter/m0110_usb/keymap_plain.c64
-rw-r--r--converter/m0110_usb/keymap_spacefn.c71
-rw-r--r--converter/m0110_usb/led.c32
-rw-r--r--converter/m0110_usb/matrix.c142
-rw-r--r--converter/news_usb/Makefile.pjrc74
-rw-r--r--converter/news_usb/config_pjrc.h62
-rw-r--r--converter/news_usb/keymap.c125
-rw-r--r--converter/news_usb/led.c26
-rw-r--r--converter/news_usb/matrix.c142
-rw-r--r--converter/next_usb/Makefile87
-rw-r--r--converter/next_usb/Makefile.pjrc63
-rw-r--r--converter/next_usb/README45
-rw-r--r--converter/next_usb/config.h188
-rw-r--r--converter/next_usb/keymap.c177
-rw-r--r--converter/next_usb/led.c55
-rw-r--r--converter/next_usb/matrix.c269
-rw-r--r--converter/next_usb/next_timings.jpgbin0 -> 407936 bytes
-rw-r--r--converter/pc98_usb/Makefile83
-rw-r--r--converter/pc98_usb/README67
-rw-r--r--converter/pc98_usb/config.h123
-rw-r--r--converter/pc98_usb/keymap.c208
-rw-r--r--converter/pc98_usb/led.c33
-rw-r--r--converter/pc98_usb/matrix.c211
-rw-r--r--converter/ps2_usb/Makefile105
-rw-r--r--converter/ps2_usb/Makefile.mbed46
-rw-r--r--converter/ps2_usb/Makefile.pjrc75
-rw-r--r--converter/ps2_usb/Makefile.tmk_rev198
-rw-r--r--converter/ps2_usb/Makefile.tmk_rev298
-rw-r--r--converter/ps2_usb/Makefile.vusb107
-rw-r--r--converter/ps2_usb/README.md84
-rw-r--r--converter/ps2_usb/config.h173
-rw-r--r--converter/ps2_usb/config_mbed.h60
-rw-r--r--converter/ps2_usb/config_tmk_rev1.h147
-rw-r--r--converter/ps2_usb/config_tmk_rev2.h85
-rw-r--r--converter/ps2_usb/keymap_common.c31
-rw-r--r--converter/ps2_usb/keymap_common.h173
-rw-r--r--converter/ps2_usb/keymap_jis.c34
-rw-r--r--converter/ps2_usb/keymap_plain.c32
-rw-r--r--converter/ps2_usb/keymap_spacefn.c61
-rw-r--r--converter/ps2_usb/led.c33
-rw-r--r--converter/ps2_usb/main.cpp46
-rw-r--r--converter/ps2_usb/matrix.c486
-rw-r--r--converter/ps2_usb/usbconfig.h377
-rw-r--r--converter/serialmouse_usb/Makefile106
-rw-r--r--converter/serialmouse_usb/README.md11
-rw-r--r--converter/serialmouse_usb/config.h119
-rw-r--r--converter/serialmouse_usb/keymap.c33
-rw-r--r--converter/serialmouse_usb/keymap_common.c30
-rw-r--r--converter/serialmouse_usb/keymap_common.h174
-rw-r--r--converter/serialmouse_usb/led.c24
-rw-r--r--converter/serialmouse_usb/matrix.c83
-rw-r--r--converter/sun_usb/Makefile85
-rw-r--r--converter/sun_usb/README99
-rw-r--r--converter/sun_usb/command_extra.c61
-rw-r--r--converter/sun_usb/config.h89
-rw-r--r--converter/sun_usb/keymap.c192
-rw-r--r--converter/sun_usb/led.c33
-rw-r--r--converter/sun_usb/matrix.c162
-rw-r--r--converter/terminal_bluefruit/Makefile99
-rw-r--r--converter/terminal_bluefruit/README37
-rw-r--r--converter/terminal_bluefruit/config.h112
-rw-r--r--converter/terminal_bluefruit/keymap.c227
-rw-r--r--converter/terminal_bluefruit/led.c35
-rw-r--r--converter/terminal_bluefruit/matrix.c262
-rw-r--r--converter/terminal_usb/Makefile98
-rw-r--r--converter/terminal_usb/README37
-rw-r--r--converter/terminal_usb/config.h138
-rw-r--r--converter/terminal_usb/keymap.c156
-rw-r--r--converter/terminal_usb/led.c33
-rw-r--r--converter/terminal_usb/matrix.c262
-rw-r--r--converter/usb_usb/Makefile136
-rw-r--r--converter/usb_usb/README74
-rw-r--r--converter/usb_usb/config.h39
-rw-r--r--converter/usb_usb/keymap.c137
-rw-r--r--converter/usb_usb/keymap_common.c31
-rw-r--r--converter/usb_usb/keymap_common.h77
-rw-r--r--converter/usb_usb/keymap_hasu.c158
-rw-r--r--converter/usb_usb/keymap_spacefn.c61
-rw-r--r--converter/usb_usb/led.c24
-rw-r--r--converter/usb_usb/main.cpp120
-rw-r--r--converter/usb_usb/matrix.c133
-rw-r--r--converter/x68k_usb/Makefile101
-rw-r--r--converter/x68k_usb/README151
-rw-r--r--converter/x68k_usb/config_pjrc.h67
-rw-r--r--converter/x68k_usb/keymap.c150
-rw-r--r--converter/x68k_usb/led.c43
-rw-r--r--converter/x68k_usb/matrix.c142
-rw-r--r--keyboard/IIgs/Makefile95
-rw-r--r--keyboard/IIgs/README45
-rw-r--r--keyboard/IIgs/config.h63
-rw-r--r--keyboard/IIgs/doc/PIN_BYPASS.jpgbin0 -> 329437 bytes
-rw-r--r--keyboard/IIgs/doc/Teensy++_Mod.jpgbin0 -> 74137 bytes
-rwxr-xr-xkeyboard/IIgs/hid_listen.macbin0 -> 13524 bytes
-rw-r--r--keyboard/IIgs/keymap.c142
-rw-r--r--keyboard/IIgs/led.c24
-rw-r--r--keyboard/IIgs/matrix.c363
-rw-r--r--keyboard/alps64/Makefile134
-rw-r--r--keyboard/alps64/config.h70
-rw-r--r--keyboard/alps64/keymap_common.c30
-rw-r--r--keyboard/alps64/keymap_common.h70
-rw-r--r--keyboard/alps64/keymap_hasu.c151
-rw-r--r--keyboard/alps64/keymap_plain.c12
-rw-r--r--keyboard/alps64/led.c34
-rw-r--r--keyboard/alps64/matrix.c190
-rw-r--r--keyboard/gh60/Makefile135
-rw-r--r--keyboard/gh60/Makefile.pjrc116
-rw-r--r--keyboard/gh60/README.md141
-rw-r--r--keyboard/gh60/config.h70
-rw-r--r--keyboard/gh60/keymap_common.c30
-rw-r--r--keyboard/gh60/keymap_common.h84
-rw-r--r--keyboard/gh60/keymap_hasu.c145
-rw-r--r--keyboard/gh60/keymap_hhkb.c52
-rw-r--r--keyboard/gh60/keymap_plain.c11
-rw-r--r--keyboard/gh60/keymap_poker.c104
-rw-r--r--keyboard/gh60/keymap_poker_bit.c50
-rw-r--r--keyboard/gh60/keymap_poker_set.c82
-rw-r--r--keyboard/gh60/keymap_spacefn.c55
-rw-r--r--keyboard/gh60/led.c34
-rw-r--r--keyboard/gh60/matrix.c211
-rw-r--r--keyboard/ghost_squid/Makefile.lufa117
-rw-r--r--keyboard/ghost_squid/README.md20
-rw-r--r--keyboard/ghost_squid/config.h43
-rw-r--r--keyboard/ghost_squid/keymap.c102
-rw-r--r--keyboard/ghost_squid/keymap_ansi.h23
-rw-r--r--keyboard/ghost_squid/led.c60
-rw-r--r--keyboard/ghost_squid/matrix.c237
-rw-r--r--keyboard/hbkb/Makefile.lufa120
-rw-r--r--keyboard/hbkb/config.h49
-rw-r--r--keyboard/hbkb/keymap.c231
-rw-r--r--keyboard/hbkb/led.c24
-rw-r--r--keyboard/hbkb/matrix.c206
-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.h (renamed from protocol/iwrap/suart.h)0
-rw-r--r--keyboard/hid_liber/Makefile.lufa138
-rw-r--r--keyboard/hid_liber/Makefile.pjrc111
-rw-r--r--keyboard/hid_liber/README.md17
-rw-r--r--keyboard/hid_liber/config.h49
-rw-r--r--keyboard/hid_liber/keymap.c125
-rw-r--r--keyboard/hid_liber/keymap_alaricljs.h61
-rw-r--r--keyboard/hid_liber/keymap_ansi.h32
-rw-r--r--keyboard/hid_liber/keymap_custom.h64
-rw-r--r--keyboard/hid_liber/keymap_iso.h32
-rw-r--r--keyboard/hid_liber/led.c34
-rw-r--r--keyboard/hid_liber/matrix.c231
-rw-r--r--keyboard/infinity/Makefile42
-rw-r--r--keyboard/infinity/README81
-rw-r--r--keyboard/infinity/config.h43
-rw-r--r--keyboard/infinity/keymap.c48
-rw-r--r--keyboard/infinity/keymap_common.c30
-rw-r--r--keyboard/infinity/keymap_common.h80
-rw-r--r--keyboard/infinity/led.c25
-rw-r--r--keyboard/infinity/main.cpp44
-rw-r--r--keyboard/infinity/matrix.c107
-rw-r--r--keyboard/infinity/mbed-infinity.mk47
-rw-r--r--keyboard/infinity/mbed-infinity/README83
-rw-r--r--keyboard/infinity/mbed-infinity/USBHAL_KL25Z.cpp557
-rw-r--r--keyboard/infinity/mbed-infinity/cmsis_nvic.c55
-rw-r--r--keyboard/infinity/mbed-infinity/infinity.ld156
-rw-r--r--keyboard/infinity/mbed-infinity/startup_MK20D5.s259
-rw-r--r--keyboard/infinity/mbed-infinity/system_MK20D5.c299
-rw-r--r--keyboard/infinity/tool/README103
-rw-r--r--keyboard/infinity/tool/k20dx32_flash.cfg139
-rw-r--r--keyboard/infinity/tool/openocd.cfg13
-rw-r--r--keyboard/kitten_paw/Makefile.lufa117
-rw-r--r--keyboard/kitten_paw/README.md20
-rw-r--r--keyboard/kitten_paw/config.h43
-rw-r--r--keyboard/kitten_paw/keymap.c102
-rw-r--r--keyboard/kitten_paw/keymap_ansi.h23
-rw-r--r--keyboard/kitten_paw/led.c60
-rw-r--r--keyboard/kitten_paw/matrix.c239
-rw-r--r--keyboard/kmac/Makefile.lufa130
-rw-r--r--keyboard/kmac/Makefile.pjrc101
-rw-r--r--keyboard/kmac/README.md110
-rw-r--r--keyboard/kmac/backlight.c58
-rw-r--r--keyboard/kmac/config.h50
-rw-r--r--keyboard/kmac/keymap.c97
-rw-r--r--keyboard/kmac/keymap_winkey.h24
-rw-r--r--keyboard/kmac/keymap_winkeyless.h24
-rw-r--r--keyboard/kmac/led.c54
-rw-r--r--keyboard/kmac/matrix.c283
-rw-r--r--keyboard/lightpad/Makefile.lufa117
-rw-r--r--keyboard/lightpad/README.md24
-rw-r--r--keyboard/lightpad/backlight.c129
-rw-r--r--keyboard/lightpad/backlight.h39
-rw-r--r--keyboard/lightpad/config.h46
-rw-r--r--keyboard/lightpad/keymap.c73
-rw-r--r--keyboard/lightpad/keymap_lightpad.h29
-rw-r--r--keyboard/lightpad/led.c24
-rw-r--r--keyboard/lightpad/matrix.c205
-rw-r--r--keyboard/lightsaber/Makefile.lufa126
-rw-r--r--keyboard/lightsaber/Makefile.pjrc94
-rw-r--r--keyboard/lightsaber/README.md26
-rw-r--r--keyboard/lightsaber/backlight.c86
-rw-r--r--keyboard/lightsaber/backlight.h9
-rw-r--r--keyboard/lightsaber/config.h46
-rw-r--r--keyboard/lightsaber/keymap.c77
-rw-r--r--keyboard/lightsaber/keymap_winkey.h29
-rw-r--r--keyboard/lightsaber/led.c54
-rw-r--r--keyboard/lightsaber/matrix.c292
-rw-r--r--keyboard/macway/Makefile.lufa121
-rw-r--r--keyboard/macway/Makefile.pjrc97
-rw-r--r--keyboard/macway/config.h63
-rw-r--r--keyboard/macway/doc/back.jpgbin0 -> 122135 bytes
-rw-r--r--keyboard/macway/doc/case.jpgbin0 -> 146003 bytes
-rw-r--r--keyboard/macway/doc/keys.jpgbin0 -> 116365 bytes
-rw-r--r--keyboard/macway/doc/side.jpgbin0 -> 109755 bytes
-rw-r--r--keyboard/macway/doc/switch.jpgbin0 -> 115526 bytes
-rw-r--r--keyboard/macway/doc/teensy.jpgbin0 -> 165814 bytes
-rw-r--r--keyboard/macway/doc/wiring.jpgbin0 -> 165569 bytes
-rw-r--r--keyboard/macway/doc/withHHKB.jpgbin0 -> 152832 bytes
-rw-r--r--keyboard/macway/doc/withThinkPad.jpgbin0 -> 118993 bytes
-rw-r--r--keyboard/macway/keymap.c195
-rw-r--r--keyboard/macway/led.c24
-rw-r--r--keyboard/macway/matrix.c217
-rw-r--r--keyboard/mbed_onekey/Makefile33
-rw-r--r--keyboard/mbed_onekey/config.h7
-rw-r--r--keyboard/mbed_onekey/main.cpp33
-rw-r--r--keyboard/nerd/Makefile126
-rw-r--r--keyboard/nerd/README.md52
-rw-r--r--keyboard/nerd/backlight.c81
-rw-r--r--keyboard/nerd/backlight.h40
-rw-r--r--keyboard/nerd/config.h49
-rw-r--r--keyboard/nerd/keymap_60_ansi150.c30
-rw-r--r--keyboard/nerd/keymap_80_ansi150.c33
-rw-r--r--keyboard/nerd/keymap_common.c29
-rw-r--r--keyboard/nerd/keymap_common.h89
-rw-r--r--keyboard/nerd/matrix.c221
-rw-r--r--keyboard/onekey/Makefile132
-rw-r--r--keyboard/onekey/Makefile.pjrc103
-rw-r--r--keyboard/onekey/README.md5
-rw-r--r--keyboard/onekey/config.h156
-rw-r--r--keyboard/onekey/keymap.c66
-rw-r--r--keyboard/onekey/led.c25
-rw-r--r--keyboard/onekey/matrix.c176
-rw-r--r--keyboard/phantom/Makefile.lufa137
-rw-r--r--keyboard/phantom/Makefile.pjrc108
-rw-r--r--keyboard/phantom/README.md248
-rw-r--r--keyboard/phantom/config.h51
-rw-r--r--keyboard/phantom/keymap.c151
-rw-r--r--keyboard/phantom/keymap_7bit.h42
-rw-r--r--keyboard/phantom/keymap_ansi.h22
-rw-r--r--keyboard/phantom/keymap_ansi_150.h22
-rw-r--r--keyboard/phantom/keymap_iso.h22
-rw-r--r--keyboard/phantom/keymap_iso_150.h22
-rw-r--r--keyboard/phantom/led.c49
-rw-r--r--keyboard/phantom/matrix.c274
-rw-r--r--tmk_core/.gitignore13
-rw-r--r--tmk_core/.gitmodules6
-rw-r--r--tmk_core/README.md146
-rw-r--r--tmk_core/common.mk (renamed from common.mk)0
-rw-r--r--tmk_core/common/action.c (renamed from common/action.c)0
-rw-r--r--tmk_core/common/action.h (renamed from common/action.h)0
-rw-r--r--tmk_core/common/action_code.h (renamed from common/action_code.h)0
-rw-r--r--tmk_core/common/action_layer.c (renamed from common/action_layer.c)0
-rw-r--r--tmk_core/common/action_layer.h (renamed from common/action_layer.h)0
-rw-r--r--tmk_core/common/action_macro.c (renamed from common/action_macro.c)0
-rw-r--r--tmk_core/common/action_macro.h (renamed from common/action_macro.h)0
-rw-r--r--tmk_core/common/action_tapping.c (renamed from common/action_tapping.c)0
-rw-r--r--tmk_core/common/action_tapping.h (renamed from common/action_tapping.h)0
-rw-r--r--tmk_core/common/action_util.c (renamed from common/action_util.c)0
-rw-r--r--tmk_core/common/action_util.h (renamed from common/action_util.h)0
-rw-r--r--tmk_core/common/avr/bootloader.c (renamed from common/avr/bootloader.c)0
-rw-r--r--tmk_core/common/avr/eeconfig.c (renamed from common/avr/eeconfig.c)0
-rw-r--r--tmk_core/common/avr/suspend.c (renamed from common/avr/suspend.c)0
-rw-r--r--tmk_core/common/avr/suspend_avr.h (renamed from common/avr/suspend_avr.h)0
-rw-r--r--tmk_core/common/avr/timer.c (renamed from common/avr/timer.c)0
-rw-r--r--tmk_core/common/avr/timer_avr.h (renamed from common/avr/timer_avr.h)0
-rw-r--r--tmk_core/common/avr/xprintf.S (renamed from common/avr/xprintf.S)0
-rw-r--r--tmk_core/common/avr/xprintf.h (renamed from common/avr/xprintf.h)0
-rw-r--r--tmk_core/common/backlight.c (renamed from common/backlight.c)0
-rw-r--r--tmk_core/common/backlight.h (renamed from common/backlight.h)0
-rw-r--r--tmk_core/common/bootloader.h (renamed from common/bootloader.h)0
-rw-r--r--tmk_core/common/bootmagic.c (renamed from common/bootmagic.c)0
-rw-r--r--tmk_core/common/bootmagic.h (renamed from common/bootmagic.h)0
-rw-r--r--tmk_core/common/command.c (renamed from common/command.c)0
-rw-r--r--tmk_core/common/command.h (renamed from common/command.h)0
-rw-r--r--tmk_core/common/debug.c (renamed from common/debug.c)0
-rw-r--r--tmk_core/common/debug.h (renamed from common/debug.h)0
-rw-r--r--tmk_core/common/eeconfig.h (renamed from common/eeconfig.h)0
-rw-r--r--tmk_core/common/host.c (renamed from common/host.c)0
-rw-r--r--tmk_core/common/host.h (renamed from common/host.h)0
-rw-r--r--tmk_core/common/host_driver.h (renamed from common/host_driver.h)0
-rw-r--r--tmk_core/common/keyboard.c (renamed from common/keyboard.c)0
-rw-r--r--tmk_core/common/keyboard.h (renamed from common/keyboard.h)0
-rw-r--r--tmk_core/common/keycode.h (renamed from common/keycode.h)0
-rw-r--r--tmk_core/common/keymap.c (renamed from common/keymap.c)0
-rw-r--r--tmk_core/common/keymap.h (renamed from common/keymap.h)0
-rw-r--r--tmk_core/common/led.h (renamed from common/led.h)0
-rw-r--r--tmk_core/common/matrix.h (renamed from common/matrix.h)0
-rw-r--r--tmk_core/common/mbed/bootloader.c (renamed from common/mbed/bootloader.c)0
-rw-r--r--tmk_core/common/mbed/suspend.c (renamed from common/mbed/suspend.c)0
-rw-r--r--tmk_core/common/mbed/timer.c (renamed from common/mbed/timer.c)0
-rw-r--r--tmk_core/common/mbed/xprintf.cpp (renamed from common/mbed/xprintf.cpp)0
-rw-r--r--tmk_core/common/mbed/xprintf.h (renamed from common/mbed/xprintf.h)0
-rw-r--r--tmk_core/common/mousekey.c (renamed from common/mousekey.c)0
-rw-r--r--tmk_core/common/mousekey.h (renamed from common/mousekey.h)0
-rw-r--r--tmk_core/common/nodebug.h (renamed from common/nodebug.h)0
-rw-r--r--tmk_core/common/print.c (renamed from common/print.c)0
-rw-r--r--tmk_core/common/print.h (renamed from common/print.h)0
-rw-r--r--tmk_core/common/progmem.h (renamed from common/progmem.h)0
-rw-r--r--tmk_core/common/report.h (renamed from common/report.h)0
-rw-r--r--tmk_core/common/sendchar.h (renamed from common/sendchar.h)0
-rw-r--r--tmk_core/common/sendchar_null.c (renamed from common/sendchar_null.c)0
-rw-r--r--tmk_core/common/sendchar_uart.c (renamed from common/sendchar_uart.c)0
-rw-r--r--tmk_core/common/sleep_led.c (renamed from common/sleep_led.c)0
-rw-r--r--tmk_core/common/sleep_led.h (renamed from common/sleep_led.h)0
-rw-r--r--tmk_core/common/suspend.h (renamed from common/suspend.h)0
-rw-r--r--tmk_core/common/timer.h (renamed from common/timer.h)0
-rw-r--r--tmk_core/common/uart.c (renamed from common/uart.c)0
-rw-r--r--tmk_core/common/uart.h (renamed from common/uart.h)0
-rw-r--r--tmk_core/common/util.c (renamed from common/util.c)0
-rw-r--r--tmk_core/common/util.h (renamed from common/util.h)0
-rw-r--r--tmk_core/common/wait.h (renamed from common/wait.h)0
-rw-r--r--tmk_core/doc/COPYING.GPLv2339
-rw-r--r--tmk_core/doc/COPYING.GPLv3674
-rw-r--r--tmk_core/doc/FUSE.txt40
-rw-r--r--tmk_core/doc/POWER.txt62
-rw-r--r--tmk_core/doc/USB_NKRO.txt160
-rw-r--r--tmk_core/doc/build.md186
-rw-r--r--tmk_core/doc/keycode.txt261
-rw-r--r--tmk_core/doc/keymap.md593
-rw-r--r--tmk_core/doc/other_projects.md62
-rw-r--r--tmk_core/ldscript_keymap_avr5.x (renamed from ldscript_keymap_avr5.x)0
-rw-r--r--tmk_core/protocol.mk (renamed from protocol.mk)0
-rw-r--r--tmk_core/protocol/adb.c (renamed from protocol/adb.c)0
-rw-r--r--tmk_core/protocol/adb.h (renamed from protocol/adb.h)0
-rw-r--r--tmk_core/protocol/bluefruit.mk (renamed from protocol/bluefruit.mk)0
-rw-r--r--tmk_core/protocol/bluefruit/bluefruit.c (renamed from protocol/bluefruit/bluefruit.c)0
-rw-r--r--tmk_core/protocol/bluefruit/bluefruit.h (renamed from protocol/bluefruit/bluefruit.h)0
-rw-r--r--tmk_core/protocol/bluefruit/main.c (renamed from protocol/bluefruit/main.c)0
-rw-r--r--tmk_core/protocol/ibm4704.c (renamed from protocol/ibm4704.c)0
-rw-r--r--tmk_core/protocol/ibm4704.h (renamed from protocol/ibm4704.h)0
-rw-r--r--tmk_core/protocol/iwrap.mk (renamed from protocol/iwrap.mk)0
-rw-r--r--tmk_core/protocol/iwrap/iWRAP4.txt (renamed from protocol/iwrap/iWRAP4.txt)0
-rw-r--r--tmk_core/protocol/iwrap/iWRAP5.txt (renamed from protocol/iwrap/iWRAP5.txt)0
-rw-r--r--tmk_core/protocol/iwrap/iwrap.c (renamed from protocol/iwrap/iwrap.c)0
-rw-r--r--tmk_core/protocol/iwrap/iwrap.h (renamed from protocol/iwrap/iwrap.h)0
-rw-r--r--tmk_core/protocol/iwrap/main.c (renamed from protocol/iwrap/main.c)0
-rw-r--r--tmk_core/protocol/iwrap/mux_exit.rb (renamed from protocol/iwrap/mux_exit.rb)0
-rw-r--r--tmk_core/protocol/iwrap/suart.S (renamed from protocol/iwrap/suart.S)0
-rw-r--r--tmk_core/protocol/iwrap/suart.h8
-rw-r--r--tmk_core/protocol/iwrap/wd.h (renamed from protocol/iwrap/wd.h)0
-rw-r--r--tmk_core/protocol/lufa.mk (renamed from protocol/lufa.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c (renamed from protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile (renamed from protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk (renamed from protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template (renamed from protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Common.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/Common.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h (renamed from protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf (renamed from protocol/lufa/LUFA-120730/LUFA/Doxygen.conf)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png)bin98201 -> 98201 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png)bin100532 -> 100532 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png)bin32987 -> 32987 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png)bin161824 -> 161824 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png)bin43666 -> 43666 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png)bin28918 -> 28918 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png)bin23561 -> 23561 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg)bin28410 -> 28410 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png)bin10296 -> 10296 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png)bin3729 -> 3729 bytes
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt (renamed from protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h (renamed from protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/License.txt (renamed from protocol/lufa/LUFA-120730/LUFA/License.txt)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h (renamed from protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/Version.h (renamed from protocol/lufa/LUFA-120730/LUFA/Version.h)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/LUFA/makefile (renamed from protocol/lufa/LUFA-120730/LUFA/makefile)0
-rw-r--r--tmk_core/protocol/lufa/LUFA-120730/README.txt (renamed from protocol/lufa/LUFA-120730/README.txt)0
m---------tmk_core/protocol/lufa/LUFA-git (renamed from protocol/lufa/LUFA-git)0
-rw-r--r--tmk_core/protocol/lufa/descriptor.c (renamed from protocol/lufa/descriptor.c)0
-rw-r--r--tmk_core/protocol/lufa/descriptor.h (renamed from protocol/lufa/descriptor.h)0
-rw-r--r--tmk_core/protocol/lufa/lufa.c (renamed from protocol/lufa/lufa.c)0
-rw-r--r--tmk_core/protocol/lufa/lufa.h (renamed from protocol/lufa/lufa.h)0
-rw-r--r--tmk_core/protocol/m0110.c (renamed from protocol/m0110.c)0
-rw-r--r--tmk_core/protocol/m0110.h (renamed from protocol/m0110.h)0
-rw-r--r--tmk_core/protocol/mbed/HIDKeyboard.cpp (renamed from protocol/mbed/HIDKeyboard.cpp)0
-rw-r--r--tmk_core/protocol/mbed/HIDKeyboard.h (renamed from protocol/mbed/HIDKeyboard.h)0
-rw-r--r--tmk_core/protocol/mbed/mbed_driver.cpp (renamed from protocol/mbed/mbed_driver.cpp)0
-rw-r--r--tmk_core/protocol/mbed/mbed_driver.h (renamed from protocol/mbed/mbed_driver.h)0
-rw-r--r--tmk_core/protocol/news.c (renamed from protocol/news.c)0
-rw-r--r--tmk_core/protocol/news.h (renamed from protocol/news.h)0
-rw-r--r--tmk_core/protocol/next_kbd.c (renamed from protocol/next_kbd.c)0
-rw-r--r--tmk_core/protocol/next_kbd.h (renamed from protocol/next_kbd.h)0
-rw-r--r--tmk_core/protocol/pjrc.mk (renamed from protocol/pjrc.mk)0
-rw-r--r--tmk_core/protocol/pjrc/MEMO.txt (renamed from protocol/pjrc/MEMO.txt)0
-rw-r--r--tmk_core/protocol/pjrc/main.c (renamed from protocol/pjrc/main.c)0
-rw-r--r--tmk_core/protocol/pjrc/pjrc.c (renamed from protocol/pjrc/pjrc.c)0
-rw-r--r--tmk_core/protocol/pjrc/pjrc.h (renamed from protocol/pjrc/pjrc.h)0
-rw-r--r--tmk_core/protocol/pjrc/usb.c (renamed from protocol/pjrc/usb.c)0
-rw-r--r--tmk_core/protocol/pjrc/usb.h (renamed from protocol/pjrc/usb.h)0
-rw-r--r--tmk_core/protocol/pjrc/usb_debug.c (renamed from protocol/pjrc/usb_debug.c)0
-rw-r--r--tmk_core/protocol/pjrc/usb_debug.h (renamed from protocol/pjrc/usb_debug.h)0
-rw-r--r--tmk_core/protocol/pjrc/usb_extra.c (renamed from protocol/pjrc/usb_extra.c)0
-rw-r--r--tmk_core/protocol/pjrc/usb_extra.h (renamed from protocol/pjrc/usb_extra.h)0
-rw-r--r--tmk_core/protocol/pjrc/usb_keyboard.c (renamed from protocol/pjrc/usb_keyboard.c)0
-rw-r--r--tmk_core/protocol/pjrc/usb_keyboard.h (renamed from protocol/pjrc/usb_keyboard.h)0
-rw-r--r--tmk_core/protocol/pjrc/usb_mouse.c (renamed from protocol/pjrc/usb_mouse.c)0
-rw-r--r--tmk_core/protocol/pjrc/usb_mouse.h (renamed from protocol/pjrc/usb_mouse.h)0
-rw-r--r--tmk_core/protocol/ps2.h (renamed from protocol/ps2.h)0
-rw-r--r--tmk_core/protocol/ps2_busywait.c (renamed from protocol/ps2_busywait.c)0
-rw-r--r--tmk_core/protocol/ps2_interrupt.c (renamed from protocol/ps2_interrupt.c)0
-rw-r--r--tmk_core/protocol/ps2_io.h (renamed from protocol/ps2_io.h)0
-rw-r--r--tmk_core/protocol/ps2_io_avr.c (renamed from protocol/ps2_io_avr.c)0
-rw-r--r--tmk_core/protocol/ps2_io_mbed.c (renamed from protocol/ps2_io_mbed.c)0
-rw-r--r--tmk_core/protocol/ps2_mouse.c (renamed from protocol/ps2_mouse.c)0
-rw-r--r--tmk_core/protocol/ps2_mouse.h (renamed from protocol/ps2_mouse.h)0
-rw-r--r--tmk_core/protocol/ps2_usart.c (renamed from protocol/ps2_usart.c)0
-rw-r--r--tmk_core/protocol/serial.h (renamed from protocol/serial.h)0
-rw-r--r--tmk_core/protocol/serial_mouse.h (renamed from protocol/serial_mouse.h)0
-rw-r--r--tmk_core/protocol/serial_mouse_microsoft.c (renamed from protocol/serial_mouse_microsoft.c)0
-rw-r--r--tmk_core/protocol/serial_mouse_mousesystems.c (renamed from protocol/serial_mouse_mousesystems.c)0
-rw-r--r--tmk_core/protocol/serial_soft.c (renamed from protocol/serial_soft.c)0
-rw-r--r--tmk_core/protocol/serial_uart.c (renamed from protocol/serial_uart.c)0
-rw-r--r--tmk_core/protocol/usb_hid.mk (renamed from protocol/usb_hid.mk)0
-rw-r--r--tmk_core/protocol/usb_hid/README (renamed from protocol/usb_hid/README)0
m---------tmk_core/protocol/usb_hid/USB_Host_Shield_2.0 (renamed from protocol/usb_hid/USB_Host_Shield_2.0)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c (renamed from protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h (renamed from protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h (renamed from protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h (renamed from protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h)0
-rw-r--r--tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h (renamed from protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h)0
-rw-r--r--tmk_core/protocol/usb_hid/leonardo_led.h (renamed from protocol/usb_hid/leonardo_led.h)0
-rw-r--r--tmk_core/protocol/usb_hid/override_Serial.cpp (renamed from protocol/usb_hid/override_Serial.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/override_wiring.c (renamed from protocol/usb_hid/override_wiring.c)0
-rw-r--r--tmk_core/protocol/usb_hid/parser.cpp (renamed from protocol/usb_hid/parser.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/parser.h (renamed from protocol/usb_hid/parser.h)0
-rw-r--r--tmk_core/protocol/usb_hid/test/Makefile (renamed from protocol/usb_hid/test/Makefile)0
-rw-r--r--tmk_core/protocol/usb_hid/test/config.h (renamed from protocol/usb_hid/test/config.h)0
-rw-r--r--tmk_core/protocol/usb_hid/test/test.cpp (renamed from protocol/usb_hid/test/test.cpp)0
-rw-r--r--tmk_core/protocol/usb_hid/usb_hid.h (renamed from protocol/usb_hid/usb_hid.h)0
-rw-r--r--tmk_core/protocol/vusb.mk (renamed from protocol/vusb.mk)0
-rw-r--r--tmk_core/protocol/vusb/main.c (renamed from protocol/vusb/main.c)0
-rw-r--r--tmk_core/protocol/vusb/sendchar_usart.c (renamed from protocol/vusb/sendchar_usart.c)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/Changelog.txt (renamed from protocol/vusb/usbdrv/Changelog.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt (renamed from protocol/vusb/usbdrv/CommercialLicense.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/License.txt (renamed from protocol/vusb/usbdrv/License.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/Readme.txt (renamed from protocol/vusb/usbdrv/Readme.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt (renamed from protocol/vusb/usbdrv/USB-ID-FAQ.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt (renamed from protocol/vusb/usbdrv/USB-IDs-for-free.txt)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/asmcommon.inc (renamed from protocol/vusb/usbdrv/asmcommon.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/oddebug.c (renamed from protocol/vusb/usbdrv/oddebug.c)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/oddebug.h (renamed from protocol/vusb/usbdrv/oddebug.h)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h (renamed from protocol/vusb/usbdrv/usbconfig-prototype.h)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrv.c (renamed from protocol/vusb/usbdrv/usbdrv.c)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrv.h (renamed from protocol/vusb/usbdrv/usbdrv.h)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm.S (renamed from protocol/vusb/usbdrv/usbdrvasm.S)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm (renamed from protocol/vusb/usbdrv/usbdrvasm.asm)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc (renamed from protocol/vusb/usbdrv/usbdrvasm12.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc (renamed from protocol/vusb/usbdrv/usbdrvasm128.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc (renamed from protocol/vusb/usbdrv/usbdrvasm15.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc (renamed from protocol/vusb/usbdrv/usbdrvasm16.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc (renamed from protocol/vusb/usbdrv/usbdrvasm165.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc (renamed from protocol/vusb/usbdrv/usbdrvasm18-crc.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc (renamed from protocol/vusb/usbdrv/usbdrvasm20.inc)0
-rw-r--r--tmk_core/protocol/vusb/usbdrv/usbportability.h (renamed from protocol/vusb/usbdrv/usbportability.h)0
-rw-r--r--tmk_core/protocol/vusb/vusb.c (renamed from protocol/vusb/vusb.c)0
-rw-r--r--tmk_core/protocol/vusb/vusb.h (renamed from protocol/vusb/vusb.h)0
-rw-r--r--tmk_core/rules.mk (renamed from rules.mk)0
-rw-r--r--tmk_core/tool/mbed/common.mk (renamed from tool/mbed/common.mk)0
-rw-r--r--tmk_core/tool/mbed/gcc.mk (renamed from tool/mbed/gcc.mk)0
-rw-r--r--tmk_core/tool/mbed/lpc-vector-checksum.c (renamed from tool/mbed/lpc-vector-checksum.c)0
-rw-r--r--tmk_core/tool/mbed/lpc11u35_501.mk (renamed from tool/mbed/lpc11u35_501.mk)0
-rw-r--r--tmk_core/tool/mbed/mbed.mk (renamed from tool/mbed/mbed.mk)0
868 files changed, 33220 insertions, 22 deletions
diff --git a/.gitmodules b/.gitmodules
index e21f449613..e69de29bb2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +0,0 @@
-[submodule "protocol/lufa/LUFA-git"]
- path = protocol/lufa/LUFA-git
- url = https://github.com/abcminiuser/lufa.git
-[submodule "protocol/usb_hid/USB_Host_Shield_2.0"]
- path = protocol/usb_hid/USB_Host_Shield_2.0
- url = https://github.com/felis/USB_Host_Shield_2.0.git
diff --git a/README.md b/README.md
index 6b6714a6a2..dd03e1403d 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-TMK Keyboard Firmware Core Library
-==================================
-This is a keyboard firmware library with some useful features for Atmel AVR and Cortex-M.
+TMK Keyboard Firmware Collection
+================================
+This is a keyboard firmware with some useful features for Atmel AVR controller.
-Source code is available here: <https://github.com/tmk/tmk_keyboard/tree/core>
+Source code is available here: <http://github.com/tmk/tmk_keyboard>
Features
@@ -26,18 +26,69 @@ These features can be used in your keyboard.
* Backlight - Control backlight levels
-
-Updates
--------
-2015/04/22 separated with TMK Keyboard Firmware Collection
-
-
-
-TMK Keyboard Firmware Collection
---------------------------------
-Complete firmwares for various keyboards and protocol converters.
-
-<https://github.com/tmk/tmk_keyboard>
+Projects
+--------
+You can find some keyboard specific projects under `converter` and `keyboard` directory.
+
+### converter
+* [ps2_usb](converter/ps2_usb/) - [PS/2 keyboard to USB][GH_ps2]
+* [adb_usb](converter/adb_usb/) - [ADB keyboard to USB][GH_adb]
+* [m0110_usb](converter/m0110_usb) - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
+* [terminal_usb](converter/terminal_usb/) - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
+* [news_usb](converter/news_usb/) - [Sony NEWS keyboard to USB][GH_news]
+* [x68k_usb](converter/x68k_usb/) - [Sharp X68000 keyboard to USB][GH_x68k]
+* [sun_usb](converter/sun_usb/) - [Sun] to USB(type4, 5 and 3?)
+* [pc98_usb](converter/pc98_usb/) - [PC98] to USB
+* [usb_usb](converter/usb_usb/) - USB to USB(experimental)
+* [ascii_usb](converter/ascii_usb/) - ASCII(Serial console terminal) to USB
+* [ibm4704_usb](converter/ibm4704_usb) - [IBM 4704 keyboard Converter][GH_ibm4704]
+
+### keyboard
+* [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] **my main board**
+* [gh60](keyboard/gh60/) - [GH60] DIY 60% keyboard [prototype][GH60_proto] **my second board**
+* [hbkb](keyboard/hbkb/) - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
+* [hid_liber](keyboard/hid_liber/) - [HID liberation][HID_liber] controller (by alaricljs)
+* [phantom](keyboard/phantom/) - [Phantom] keyboard (by Tranquilite)
+* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung)
+* [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired]
+* [KMAC](keyboard/kmac/) - Korean custom keyboard
+* [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard
+* [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity]
+* [NerD](keyboard/nerd/) - Korean custom keyboard
+* [KittenPaw](keyboard/kitten_paw) - Custom Majestouch controller
+* [Lightpad](keyboard/lightpad) - Korean custom keypad
+* [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt]
+
+### Extenal projects using tmk_keyboard
+* [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org]
+* [mcdox][mcdox_tmk] - [mcdox][mcdox]
+
+
+[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
+[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
+[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
+[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
+[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
+[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
+[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
+[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
+[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
+[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
+[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
+[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
+[Phantom]: http://geekhack.org/index.php?topic=26742
+[GH60]: http://geekhack.org/index.php?topic=34959
+[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
+[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
+[Sun]: http://en.wikipedia.org/wiki/Sun-3
+[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
+[Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit
+[ghost_squid]: http://deskthority.net/wiki/Costar_replacement_controllers#The_Ghost_Squid
+[cmxt]: http://gaming.coolermaster.com/en/products/keyboards/quickfirext/
+[ergodox_org]: http://ergodox.org/
+[cub-uanic]: https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox
+[mcdox]: https://github.com/DavidMcEwan/mcdox
+[mcdox_tmk]: https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox
@@ -54,6 +105,97 @@ See [doc/build.md](doc/build.md).
+Change your keymap
+------------------
+See [doc/keymap.md](doc/keymap.md).
+
+
+
+Magic Commands
+--------------
+To see help press `Magic` + `H`.
+
+ `Magic` key bind may be `LShift` + `RShift` in many project, but `Power` key on ADB converter. `Magic` keybind can be vary on each project, check `config.h` in project directory.
+
+Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed.
+
+ ----- Command Help -----
+ c: enter console mode
+ d: toggle debug enable
+ x: toggle matrix debug
+ k: toggle keyboard debug
+ m: toggle mouse debug
+ v: print device version & info
+ t: print timer count
+ s: print status
+ e: print eeprom config
+ n: toggle NKRO
+ 0/F10: switch to Layer0
+ 1/F1: switch to Layer1
+ 2/F2: switch to Layer2
+ 3/F3: switch to Layer3
+ 4/F4: switch to Layer4
+ PScr: power down/remote wake-up
+ Caps: Lock Keyboard(Child Proof)
+ Paus: jump to bootloader
+
+**TBD**
+
+### Boot Magic Configuration - Virtual DIP Switch
+Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
+Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles.
+
+To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [common/bootmagic.h](common/bootmagic.h).
+
+#### General
+- Skip reading EEPROM to start with default configuration(`ESC`)
+- Clear configuration stored in EEPROM to reset configuration(`Backspace`)
+
+#### Bootloader
+- Kick up Bootloader(`B`)
+
+#### Debug
+- Debug enable(`D`)
+- Debug matrix enable(`D`+`X`)
+- Debug keyboard enable(`D`+`K`)
+- Debug mouse enable(`D`+`M`)
+
+#### Keymap
+- Swap Control and CapsLock(`Left Control`)
+- Change CapsLock to Control(`Caps Lock`)
+- Swap LeftAlt and Gui(`Left Alt`)
+- Swap RightAlt and Gui(`Right Alt`)
+- Disable Gui(`Left Gui`)
+- Swap Grave and Escape(`Grave`)
+- Swap BackSlash and BackSpace(`Back Slash`)
+- Enable NKRO on boot(`N`)
+
+#### Default Layer
+- Set Default Layer to 0(`0`)
+- Set Default Layer to 1(`1`)
+- Set Default Layer to 2(`2`)
+- Set Default Layer to 3(`3`)
+- Set Default Layer to 4(`4`)
+- Set Default Layer to 5(`5`)
+- Set Default Layer to 6(`6`)
+- Set Default Layer to 7(`7`)
+
+#### Caution
+Unintentional use of this feature will cause user confusion.
+
+TODO: Magic key combination to avoid unintentional press during plug in
+
+**TBD**
+
+
+Mechanical Locking support
+--------------------------
+This feature makes it possible for you to use mechanical switch for `CapsLock`, `NumLock` or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LNUM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Resync option tries to keep lock switch state consistent with keyboard LED state.
+
+ #define LOCKING_SUPPORT_ENABLE
+ #define LOCKING_RESYNC_ENABLE
+
+
Start Your Own Project
-----------------------
**TBD**
@@ -103,6 +245,8 @@ Files and Directories
### Top
* common/ - common codes
* protocol/ - keyboard protocol support
+* keyboard/ - keyboard projects
+* converter/ - protocol converter projects
* doc/ - documents
* common.mk - Makefile for common
* protocol.mk - Makefile for protocol
@@ -144,3 +288,9 @@ Files and Directories
Coding Style
-------------
- Doesn't use Tab to indent, use 4-spaces instead.
+
+
+
+Other Keyboard Firmware Projects
+------------------
+You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](doc/other_projects.md).
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
new file mode 100644
index 0000000000..a16873dc03
--- /dev/null
+++ b/converter/adb_usb/Makefile
@@ -0,0 +1,137 @@
+#----------------------------------------------------------------------------
+# 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 = adb_usb_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c \
+ adb.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_ansi.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# 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
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/adb_usb/Makefile.pjrc b/converter/adb_usb/Makefile.pjrc
new file mode 100644
index 0000000000..b54ea142c5
--- /dev/null
+++ b/converter/adb_usb/Makefile.pjrc
@@ -0,0 +1,69 @@
+# Target file name (without extension).
+TARGET = adb_usb_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c \
+ adb.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_ansi.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
+
+
+# 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
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
new file mode 100644
index 0000000000..21ad318c1d
--- /dev/null
+++ b/converter/adb_usb/README.md
@@ -0,0 +1,96 @@
+ADB to USB keyboard converter
+=============================
+This firmware converts ADB keyboard protocol to USB.
+You can use PJRC Teensy for this converter, though, other USB AVR(ATMega32U4, AT90USB64/128 or etc) should work.
+But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U2.
+
+Discuss: http://geekhack.org/showwiki.php?title=Island:14290
+
+
+Wiring
+------
+0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
+ This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable.
+ The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.
+1. Define following macros for ADB connection in config.h if you use other than port PD0.
+ ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
+2. make
+3. program Teensy
+
+
+Build
+-----
+Just make
+
+ $ make clean
+ $ make
+
+If your keyboard is ISO layout
+
+ $ make KEYMAP=iso
+
+
+LOCKING CAPSLOCK
+----------------
+Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
+
+Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
+http://www.youtube.com/watch?v=9wqnt2mGJ2Y
+
+
+Keymap
+------
+You can change a keymap by editing code of keymap.c like following.
+This is a keymap for AEK, however, also used for other keyboards.
+How to define the keymap is probably obvious. You can find key symbols in keycode.h.
+If you want to define some keymaps than just one, see hhkb/keymap.c and
+macway/keymap.c as examples. Keymap(layer) switching may needs a bit of
+effort at this time.
+
+ /* Default Layer: plain keymap
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
+ * `---' `---------------' `---------------' `---------------' `-----------' `---'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
+ * |-----------------------------------------------------------| `-----------' |---------------|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Alt |Gui | Space |Gui |Alt |Ctrl | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, PWR,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
+ LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+
+Magic command
+-------------
+To get help press `h` holding Magic key. Magic key is `Power key`.
+
+
+Notes
+-----
+Not-extended ADB keyboards have no discrimination between right modifier and left one,
+you will always see left control even if you press right control key.
+Apple Extended Keyboard and Apple Extended Keyboard II can discriminate both side
+modifiers except for GUI key(Windows/Command).
+
+And most ADB keyboard has no diodes in its matrix so they are not NKRO,
+though ADB protocol itself supports it. See protocol/adb.c for more info.
+
+If keyboard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
+keymap you will suffer from swapped keys problem.
+
+https://github.com/tmk/tmk_keyboard/issues/35
+
+EOF
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
new file mode 100644
index 0000000000..5ce5c22159
--- /dev/null
+++ b/converter/adb_usb/config.h
@@ -0,0 +1,63 @@
+/*
+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 0x0ADB
+#define DEVICE_VER 0x0101
+#define MANUFACTURER t.m.k.
+#define PRODUCT ADB keyboard converter
+#define DESCRIPTION convert ADB keyboard to USB
+
+/* matrix size */
+#define MATRIX_ROWS 16 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+#define MATRIX_ROW(code) ((code)>>3&0x0F)
+#define MATRIX_COL(code) ((code)&0x07)
+
+
+/* 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
+
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+/* ADB port setting */
+#define ADB_PORT PORTD
+#define ADB_PIN PIND
+#define ADB_DDR DDRD
+#define ADB_DATA_BIT 0
+//#define ADB_PSW_BIT 1 // optional
+
+/* key combination for command */
+#ifndef __ASSEMBLER__
+#include "adb.h"
+#include "matrix.h"
+#define IS_COMMAND() ( \
+ matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
+)
+#endif
+
+#endif
diff --git a/converter/adb_usb/keymap_ansi.c b/converter/adb_usb/keymap_ansi.c
new file mode 100644
index 0000000000..0d0bae99b5
--- /dev/null
+++ b/converter/adb_usb/keymap_ansi.c
@@ -0,0 +1,16 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ KEYMAP_EXT_ANSI(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
+ LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/adb_usb/keymap_common.c b/converter/adb_usb/keymap_common.c
new file mode 100644
index 0000000000..55a13793cb
--- /dev/null
+++ b/converter/adb_usb/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2011,2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h
new file mode 100644
index 0000000000..bdca38e129
--- /dev/null
+++ b/converter/adb_usb/keymap_common.h
@@ -0,0 +1,212 @@
+/*
+Copyright 2011,2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* M0115 Apple Extended Keyboard ANSI
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
+ * `---' `---------------' `---------------' `---------------' `-----------' `---'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
+ * |-----------------------------------------------------------| `-----------' |---------------|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+#define KEYMAP_EXT_ANSI( \
+ K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
+ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
+ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
+ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
+ K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
+ K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_NUBS, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
+ { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
+ { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
+ { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
+ { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
+}
+
+/* M0115 Apple Extended Keyboard ISO
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
+ * `---' `---------------' `---------------' `---------------' `-----------' `---'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Retur| |Del|End|PgD| | 7| 8| 9| -|
+ * |------------------------------------------------------` | `-----------' |---------------|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+#define KEYMAP_EXT_ISO( \
+ K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
+ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
+ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \
+ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, K56,K57,K58,K45, \
+ K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
+ K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
+ { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
+ { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
+ { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
+ { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
+}
+
+
+
+
+/* M0116 Apple Standard Keyboard ANSI
+* +-------+
+* | power |
+* +-------+
+* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
+* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
+* +---------------------------------------------------------+ +---+---+---+---+
+* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + |
+* +-----------------------------------------------------+ | +---+---+---+---+
+* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
+* +---------------------------------------------------------+ +---+---+---+---+
+* | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | |
+* +---------------------------------------------------------+ +-------+---|ent|
+* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | |
+* +---------------------------------------------------------+ +-------+---+---+
+*/
+#define KEYMAP_M0116_ANSI( \
+ K7F, \
+ K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
+ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \
+ K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K4E, \
+ K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K53,K54,K55, \
+ K39,K3A,K37,K32, K31, K2A,K3B,K3C,K3D,K3E, K52, K41,K4C \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
+ { KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \
+ { KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO , KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \
+}
+
+#endif
+
+
+/*
+ADB ANSI/ISO Keymapping Note
+============================
+ANSI
+,----------- ----------.
+| *a| 1| 2 =|Backspa|
+|----------- ----------|
+|Tab | Q| | ]| *c|
+|----------- ----------|
+|CapsLo| A| '|Return |
+|----------- ----------|
+|Shift | Shift |
+`----------- ----------'
+
+ISO
+,----------- ----------.
+| *a| 1| 2 =|Backspa|
+|----------- ----------|
+|Tab | Q| | ]|Retur|
+|----------- -----` |
+|CapsLo| A| '| *c| |
+|----------- ----------|
+|Shif| *b| Shift |
+`----------- ----------'
+
+ADB Keyboard scan code:
+ ADB scan code USB usage
+ ------------- ---------
+Key ANSI ISO ANSI ISO
+---------------------------------------------
+*a 0x32 0x0A 0x35 0x35
+*b ---- 0x32 ---- 0x64
+*c 0x2A 0x2A 0x31 0x31(or 0x32)
+
+
+TMK ADB-USB mapping:
+ADB USB(ANSI) USB(ISO)
+---------------------------------
+0x32 0x35 0x64
+0x0A ---- 0x35
+0x2A 0x31 0x31(or 0x32)
+
+Note that mappings of ADB code 0x32 are diffrent between ANSI and ISO keyboard.
+https://github.com/tmk/tmk_keyboard/issues/35
+ */
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
new file mode 100644
index 0000000000..f2e59b3e91
--- /dev/null
+++ b/converter/adb_usb/keymap_hasu.c
@@ -0,0 +1,58 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Default Layer: plain keymap
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
+ * `---' `---------------' `---------------' `---------------' `-----------' `---'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Fn0| |Del|End|PgD| | 7| 8| 9| -|
+ * |-----------------------------------------------------------| `-----------' |---------------|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP_EXT_ANSI(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN0, DEL, END, PGDN, P7, P8, P9, PMNS,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Default Layer: plain keymap
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
+ * |` | |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
+ * `---' `---------------' `---------------' `---------------' `-----------' `---'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U|PrS|ScL|Pau|Up |Ins| Fn0| |Del|End|PgD| |MwD|McU|MwU|MwD|
+ * |-----------------------------------------------------------| `-----------' |---------------|
+ * |CapsLo|VoD|VoU|Mut| F| G| H| J|Hom|PgU|Lef|Rig|Return | |McL|McD|McR|MwU|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M|End|PgD|Dow|Shift | |PgU| |MwL|McD|MwR| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Hom|PgD|End| | Mb1|Mb2| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP_EXT_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3,
+ TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN0, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D,
+ CAPS,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U,
+ LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS),
+};
diff --git a/converter/adb_usb/keymap_iso.c b/converter/adb_usb/keymap_iso.c
new file mode 100644
index 0000000000..451d3d2c35
--- /dev/null
+++ b/converter/adb_usb/keymap_iso.c
@@ -0,0 +1,16 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ KEYMAP_EXT_ISO(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS,
+ LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS,
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/adb_usb/led.c b/converter/adb_usb/led.c
new file mode 100644
index 0000000000..3ee64a8e7d
--- /dev/null
+++ b/converter/adb_usb/led.c
@@ -0,0 +1,27 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <util/delay.h>
+#include "adb.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ adb_host_kbd_led(~usb_led);
+}
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
new file mode 100644
index 0000000000..405391865f
--- /dev/null
+++ b/converter/adb_usb/matrix.c
@@ -0,0 +1,235 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "adb.h"
+#include "matrix.h"
+
+
+#if (MATRIX_COLS > 16)
+# error "MATRIX_COLS must not exceed 16"
+#endif
+#if (MATRIX_ROWS > 255)
+# error "MATRIX_ROWS must not exceed 255"
+#endif
+
+
+static bool is_modified = false;
+
+// matrix state buffer(1:on, 0:off)
+#if (MATRIX_COLS <= 8)
+static uint8_t matrix[MATRIX_ROWS];
+#else
+static uint16_t matrix[MATRIX_ROWS];
+#endif
+
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+static void register_key(uint8_t key);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ adb_host_init();
+ // wait for keyboard to boot up and receive command
+ _delay_ms(1000);
+ // Enable keyboard left/right modifier distinction
+ // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11)
+ // upper byte: reserved bits 0000, device address 0010
+ // lower byte: device handler 00000011
+ adb_host_listen(0x2B,0x02,0x03);
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ debug_enable = true;
+ //debug_matrix = true;
+ //debug_keyboard = true;
+ //debug_mouse = true;
+ print("debug enabled.\n");
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ /* extra_key is volatile and more convoluted than necessary because gcc refused
+ to generate valid code otherwise. Making extra_key uint8_t and constructing codes
+ here via codes = extra_key<<8 | 0xFF; would consistently fail to even LOAD
+ extra_key from memory, and leave garbage in the high byte of codes. I tried
+ dozens of code variations and it kept generating broken assembly output. So
+ beware if attempting to make extra_key code more logical and efficient. */
+ static volatile uint16_t extra_key = 0xFFFF;
+ uint16_t codes;
+ uint8_t key0, key1;
+
+ is_modified = false;
+
+ codes = extra_key;
+ extra_key = 0xFFFF;
+
+ if ( codes == 0xFFFF )
+ {
+ _delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
+ codes = adb_host_kbd_recv();
+ }
+ key0 = codes>>8;
+ key1 = codes&0xFF;
+
+ if (debug_matrix && codes) {
+ print("adb_host_kbd_recv: "); phex16(codes); print("\n");
+ }
+
+ if (codes == 0) { // no keys
+ return 0;
+ } else if (codes == 0x7F7F) { // power key press
+ register_key(0x7F);
+ } else if (codes == 0xFFFF) { // power key release
+ register_key(0xFF);
+ } else if (key0 == 0xFF) { // error
+ xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes);
+ return key1;
+ } else {
+ register_key(key0);
+ if (key1 != 0xFF) // key1 is 0xFF when no second key.
+ extra_key = key1<<8 | 0xFF; // process in a separate call
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+#ifdef MATRIX_HAS_GHOST
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_has_ghost_in_row(i))
+ return true;
+ }
+#endif
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+#if (MATRIX_COLS <= 8)
+uint8_t matrix_get_row(uint8_t row)
+#else
+uint16_t matrix_get_row(uint8_t row)
+#endif
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ if (!debug_matrix) return;
+#if (MATRIX_COLS <= 8)
+ print("r/c 01234567\n");
+#else
+ print("r/c 0123456789ABCDEF\n");
+#endif
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+#if (MATRIX_COLS <= 8)
+ pbin_reverse(matrix_get_row(row));
+#else
+ pbin_reverse16(matrix_get_row(row));
+#endif
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+#if (MATRIX_COLS <= 8)
+ count += bitpop(matrix[i]);
+#else
+ count += bitpop16(matrix[i]);
+#endif
+ }
+ return count;
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]) == matrix[row])
+ return true;
+ }
+ return false;
+}
+#endif
+
+inline
+static void register_key(uint8_t key)
+{
+ uint8_t col, row;
+ col = key&0x07;
+ row = (key>>3)&0x0F;
+ if (key&0x80) {
+ matrix[row] &= ~(1<<col);
+ } else {
+ matrix[row] |= (1<<col);
+ }
+ is_modified = true;
+}
diff --git a/converter/ascii_usb/Makefile b/converter/ascii_usb/Makefile
new file mode 100644
index 0000000000..6d977afc05
--- /dev/null
+++ b/converter/ascii_usb/Makefile
@@ -0,0 +1,82 @@
+# Target file name (without extension).
+TARGET = ascii_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ protocol/serial_uart.c
+
+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
+
+
+#
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+#MOUSEKEY_ENABLE = yes # Mouse keys
+#EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ascii_usb/README b/converter/ascii_usb/README
new file mode 100644
index 0000000000..02fa064ed4
--- /dev/null
+++ b/converter/ascii_usb/README
@@ -0,0 +1,38 @@
+ASCII to USB keyboard protocol converter
+========================================
+This converts serial console terminal into USB keyboard, tested with TRS-80 model 100 TELCOM application.
+Target MCU is ATMega32u4 but other USB capable AVR will also work.
+
+
+Hardware
+--------
+Connect RX, TX and GND to UART pin of AVR. Note that you may need line driver/level shifter like MAX232 to interface high voltage of RS-232C.
+
+
+
+Build Firmware
+--------------
+Configure UART setting and Just use 'make'
+
+ $ cd ascii_usb
+ $ make
+
+Then, load the binary to MCU with your favorite programmer.
+
+
+
+Limitation
+----------
+- This cannot see key up event, you cannot hold a key.
+- Alt, Gui(Win/Mac) modifier key are not available.
+
+
+
+TRS-80 model 100
+----------------
+Use TELCOM program with setting: 19200bps/8bit/odd parity/1stop bit
+To set this configuration push Stat(F3) and input '9801D,10'. Then push Term(F4) to connect.
+
+
+
+
diff --git a/converter/ascii_usb/config.h b/converter/ascii_usb/config.h
new file mode 100644
index 0000000000..0908997a53
--- /dev/null
+++ b/converter/ascii_usb/config.h
@@ -0,0 +1,70 @@
+/*
+Copyright 2014 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 0x5C01
+#define DEVICE_VER 0x0100
+#define MANUFACTURER t.m.k.
+#define PRODUCT ASCII keyboard converter
+#define DESCRIPTION converts Serial Console Terminal into USB keyboard
+
+
+/* matrix size */
+#define MATRIX_ROWS 16
+#define MATRIX_COLS 16
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ host_get_first_key() == KC_BRK \
+)
+
+
+/*
+ * Serial(USART) configuration
+ * asynchronous, positive logic, 19200baud, bit order: LSB first
+ * 1-start bit, 8-data bit, odd parity, 1-stop bit
+ */
+#ifdef __AVR_ATmega32U4__
+ #define SERIAL_UART_BAUD 19200
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_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 |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
+ sei(); \
+ } while(0)
+#else
+ #error "USART configuration is needed."
+#endif
+
+/* 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/converter/ascii_usb/keymap.c b/converter/ascii_usb/keymap.c
new file mode 100644
index 0000000000..a0c61ce8de
--- /dev/null
+++ b/converter/ascii_usb/keymap.c
@@ -0,0 +1,42 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "action_util.h"
+#include "util.h"
+#include "print.h"
+#include "keymap.h"
+
+
+// Keymap is not used. See matrix.c.
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return KC_NO;
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t) { .code = ACTION_NO };
+}
diff --git a/converter/ascii_usb/led.c b/converter/ascii_usb/led.c
new file mode 100644
index 0000000000..d1c39bc653
--- /dev/null
+++ b/converter/ascii_usb/led.c
@@ -0,0 +1,25 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "serial.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/converter/ascii_usb/matrix.c b/converter/ascii_usb/matrix.c
new file mode 100644
index 0000000000..e1ea8e0ab8
--- /dev/null
+++ b/converter/ascii_usb/matrix.c
@@ -0,0 +1,195 @@
+/*
+Copyright 2014 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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "matrix.h"
+#include "debug.h"
+#include "action_util.h"
+#include "protocol/serial.h"
+
+
+/*
+ * Not use Matrix.
+ *
+ * ROW: 16(4bits)
+ * COL: 16(4bits)
+ *
+ * 8bit wide
+ * +---------+
+ * 0|00 ... 0F|
+ * 1|08 ... 1F|
+ * :| ... |
+ * :| ... |
+ * E|E0 ... EF|
+ * F|F0 ... FF|
+ * +---------+
+ */
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_matrix = true;
+ serial_init();
+
+ debug("init\n");
+ return;
+}
+
+static void type_key(uint16_t keycode)
+{
+ if (keycode == 0) return;
+
+ uint8_t mods = keycode>>8;
+ uint8_t key = keycode&0xFF;
+ if (mods) {
+ add_mods(mods);
+ send_keyboard_report();
+ }
+
+ add_key(key);
+ send_keyboard_report();
+
+ del_key(key);
+ send_keyboard_report();
+
+ if (mods) {
+ del_mods(mods);
+ send_keyboard_report();
+ }
+}
+static uint16_t code2key(uint8_t code)
+{
+ // ASCII to key combination in US laout
+ switch (code) {
+ case 0x01 ... 0x08: // Ctrl-[a-z]
+ return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
+ case 0x09: return KC_TAB; // TAB(Ctrl-i)
+ case 0x0A ... 0x0C: // Ctrl-[a-z]
+ return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
+ case 0x0D: return KC_ENTER; // Enter(Ctrl-m)
+ case 0x0E ... 0x1A: // Ctrl-[a-z]
+ return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
+ case 0x1B: return KC_ESC;
+ case 0x1C: return KC_RIGHT;
+ case 0x1D: return KC_LEFT;
+ case 0x1E: return KC_UP;
+ case 0x1F: return KC_DOWN;
+ case 0x20: return KC_SPACE;
+ case 0x21: return MOD_BIT(KC_LSHIFT)<<8 | KC_1; // !
+ case 0x22: return MOD_BIT(KC_LSHIFT)<<8 | KC_QUOTE; // "
+ case 0x23: return MOD_BIT(KC_LSHIFT)<<8 | KC_3; // #
+ case 0x24: return MOD_BIT(KC_LSHIFT)<<8 | KC_4; // $
+ case 0x25: return MOD_BIT(KC_LSHIFT)<<8 | KC_5; // %
+ case 0x26: return MOD_BIT(KC_LSHIFT)<<8 | KC_7; // &
+ case 0x27: return KC_QUOTE; // '
+ case 0x28: return MOD_BIT(KC_LSHIFT)<<8 | KC_9; // (
+ case 0x29: return MOD_BIT(KC_LSHIFT)<<8 | KC_0; // )
+ case 0x2A: return MOD_BIT(KC_LSHIFT)<<8 | KC_8; // *
+ case 0x2B: return MOD_BIT(KC_LSHIFT)<<8 | KC_EQUAL; // +
+ case 0x2C: return KC_COMMA; // ,
+ case 0x2D: return KC_MINUS; // -
+ case 0x2E: return KC_DOT; // .
+ case 0x2F: return KC_SLASH; // /
+ case 0x30: return KC_0;
+ case 0x31 ... 0x39: // 1-9
+ return KC_1 + (code-0x31);
+ case 0x3A: return MOD_BIT(KC_LSHIFT)<<8 | KC_SCLN; // :
+ case 0x3B: return KC_SCLN; // ;
+ case 0x3C: return MOD_BIT(KC_LSHIFT)<<8 | KC_COMMA; // <
+ case 0x3D: return KC_EQUAL; // =
+ case 0x3E: return MOD_BIT(KC_LSHIFT)<<8 | KC_DOT; // >
+ case 0x3F: return MOD_BIT(KC_LSHIFT)<<8 | KC_SLASH; // ?
+ case 0x40: return MOD_BIT(KC_LSHIFT)<<8 | KC_2; // @
+ case 0x41 ... 0x5A: // A-Z
+ return MOD_BIT(KC_LSHIFT)<<8 | (KC_A + (code-0x41));
+ case 0x5B: return KC_LBRACKET; // [
+ case 0x5C: return KC_BSLASH; //
+ case 0x5D: return KC_RBRACKET; // ]
+ case 0x5E: return MOD_BIT(KC_LSHIFT)<<8 | KC_6; // ^
+ case 0x5F: return MOD_BIT(KC_LSHIFT)<<8 | KC_MINUS; // _
+ case 0x61 ... 0x7A: // a-z
+ return KC_A + (code-0x61);
+ case 0x7B: return MOD_BIT(KC_LSHIFT)<<8 | KC_LBRACKET; // {
+ case 0x7C: return MOD_BIT(KC_LSHIFT)<<8 | KC_BSLASH; // |
+ case 0x7D: return MOD_BIT(KC_LSHIFT)<<8 | KC_RBRACKET; // }
+ case 0x7E: return MOD_BIT(KC_LSHIFT)<<8 | KC_GRAVE; // }
+ case 0x7F: return KC_DELETE; //
+ }
+ return 0;
+}
+
+uint8_t matrix_scan(void)
+{
+ uint16_t code = serial_recv2();
+ if (code == -1) {
+ return 0;
+ }
+
+ print_hex8(code); print(" ");
+
+ // echo back
+ serial_send(code);
+ type_key(code2key(code));
+
+
+ return code;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return false;
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return 0;
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
diff --git a/converter/ibm4704_usb/Makefile b/converter/ibm4704_usb/Makefile
new file mode 100644
index 0000000000..b5c97d2d31
--- /dev/null
+++ b/converter/ibm4704_usb/Makefile
@@ -0,0 +1,93 @@
+# Target file name (without extension).
+TARGET = ibm4704_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c \
+ protocol/ibm4704.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# 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
+
+
+# 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
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md
new file mode 100644
index 0000000000..a3af4ab31d
--- /dev/null
+++ b/converter/ibm4704_usb/README.md
@@ -0,0 +1,62 @@
+IBM 4704 to USB keyboard converter
+==================================
+This firmware converts IBM 4704 keyboard protocol to USB HID.
+
+Keyboard initialization process takes a few seconds at start up. During that you will hear buzzer from the keyboard. **You need to plug USB cable after hooking up your keyboard to the converter.**
+
+
+Supported Keyboard
+------------------
+### IBM capacitive switch models:
+- 6019273 Model 100 50-key (grid layout) http://kishy.dyndns.org/?p=977
+- 6019284 Model 200 62-key Alpha(60% layout) http://kishy.dyndns.org/?p=894
+- 6019303 Model 300 77-key Expanded Alpha http://kbtalking.cool3c.com/article/23272
+- 6020218 Model 400 107-key Full key http://kishy.dyndns.org/?p=980
+
+### Alps switch(vintage Green) models:
+
+- 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
+- 6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
+- 6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
+- 6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
+
+
+Connector
+---------
+Keyboard Plug from front:
+
+ DSUB-9
+ -------------
+ \ N 2 3 4 5 /
+ \ N N N N /
+ ---------
+ 2 GND
+ 3 VCC 5V
+ 4 DATA
+ 5 CLOCK
+ N No connection/No pin.
+
+
+Connection
+----------
+In case of using ATMega32U4(Teensy2.0):
+
+1. Supply power with VCC and GND.
+2. Connect CLOCK to PD1 and DATA to PD0. You can change pin with config.h.
+3. Optionally you may need pull-up register. 1KOhm probably work.
+
+
+Build Firmware
+--------------
+Just run `make`:
+
+ $ make
+
+To select keymap:
+
+ $ make KEYMAP=[plain|...]
+
+
+Keymap
+------
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files.
diff --git a/converter/ibm4704_usb/config.h b/converter/ibm4704_usb/config.h
new file mode 100644
index 0000000000..4f82f49ad3
--- /dev/null
+++ b/converter/ibm4704_usb/config.h
@@ -0,0 +1,74 @@
+/*
+Copyright 2014 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 <avr/interrupt.h>
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x4707
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT IBM 4704 keyboard converter
+#define DESCRIPTION convert IBM 4704 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 16 // keycode bit3-6
+#define MATRIX_COLS 8 // keycode bit0-2
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+
+/*
+ * Busywait
+ */
+#define IBM4704_CLOCK_PORT PORTD
+#define IBM4704_CLOCK_PIN PIND
+#define IBM4704_CLOCK_DDR DDRD
+#define IBM4704_CLOCK_BIT 1
+#define IBM4704_DATA_PORT PORTD
+#define IBM4704_DATA_PIN PIND
+#define IBM4704_DATA_DDR DDRD
+#define IBM4704_DATA_BIT 0
+
+/*
+ * Pin interrupt
+ */
+#ifdef IBM4704_USE_INT
+#define IBM4704_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define IBM4704_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define IBM4704_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define IBM4704_INT_VECT INT1_vect
+#endif
+
+
+#endif
diff --git a/converter/ibm4704_usb/ibm4704.txt b/converter/ibm4704_usb/ibm4704.txt
new file mode 100644
index 0000000000..877d8fdb9a
--- /dev/null
+++ b/converter/ibm4704_usb/ibm4704.txt
@@ -0,0 +1,181 @@
+IBM 4704 Keyboard
+=================
+IBM capacitive switch models:
+ 6019273 Model 100 50-key (grid layout) http://kishy.dyndns.org/?p=977
+ 6019284 Model 200 62-key Alpha(60% layout) http://kishy.dyndns.org/?p=894
+ 6019303 Model 300 77-key Expanded Alpha http://kbtalking.cool3c.com/article/23272
+ 6020218 Model 400 107-key Full key http://kishy.dyndns.org/?p=980
+
+Alps switch(vintage Green) models:
+ 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
+ 6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
+ 6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
+ 6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
+
+Resourse
+--------
+The IBM 4704: lots of pictures and info
+http://kishy.dyndns.org/?p=648#more-648
+
+Brochure:
+http://ed-thelen.org/comp-hist/IBM-ProdAnn/4700.pdf
+
+
+
+IBM 4704 Keyboard Protocol
+==========================
+On powering up keyboard sends keyboard ID; A3h for 6019284(62-key), for example.
+After that the keyboard enters FC command mode and waits for parameter data from host
+so that it doesn't send any scancode until you send 'FF'(End of FC command mode).
+
+ Keyboard ID
+ -------------------------------
+ Model 100 50-key A2h
+ Model 200 62-key A3h
+ Model 300 77-key A4h
+ Model 400 107-key ??
+ Japanese/Chinese 102-key A6h
+
+
+Connector
+---------
+ Keyboard Plug from front
+
+ DSUB-9
+ -------------
+ \ N 2 3 4 5 /
+ \ N N N N /
+ ---------
+ 2 GND
+ 3 VCC 5V
+ 4 DATA
+ 5 CLOCK
+ N No connection/No pin.
+
+
+Keyboard to Host
+----------------
+Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
+
+ ____ __ __ __ __ __ __ __ __ __ ________
+ Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
+ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
+ Data ____/ X____X____X____X____X____X____X____X____X____X________
+ Start 0 1 2 3 4 5 6 7 P Stop
+
+Start bit: can be long as 300-350us.
+Inhibit: Pull Data line down to inhibit keyboard to send.
+Timing: Host reads bit while Clock is hi.
+Stop bit: Keyboard pulls down Data line to lo after 9th clock.
+
+
+Host to Keyboard
+----------------
+Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
+
+ ____ __ __ __ __ __ __ __ __ __ ________
+ Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
+ ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
+ Data ____|__/ X____X____X____X____X____X____X____X____X____X \___
+ | Start 0 1 2 3 4 5 6 7 P Stop
+ Request by host
+
+Start bit: can be long as 300-350us.
+Request: Host pulls Clock line down to request to send a command.
+Timing: After Request keyboard pull up Data and down Clock line to low for start bit.
+ After request host release Clock line once Data line becomes hi.
+ Host wirtes a bit while Clock is hi and Keyboard reads while low.
+Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keybaord pull down the line to lo.
+
+
+Scancodes
+---------
+Keyboard doesn't send Break code for all keys except for Alt by default.
+
+ 6019284 62-key:
+ ,-----------------------------------------------------------.
+ | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| ¢| \| PD2|
+ |-----------------------------------------------------------|
+ |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| {}| PD3|
+ |-----------------------------------------------------------|
+ |Shif| <>| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
+ |-----------------------------------------------------------|
+ |Reset|blk|Alt | Space |Alt |blk|Enter|
+ `-----------------------------------------------------------'
+ +----------+---------------------+----------+----------+
+ |` 00|PD1 04|Caps 20|LShift 30|Reset 31|
+ |1 18|q 05|a 21|<> 3E|Rblank 41|
+ |2 19|w 06|s 22|z 32|Alt 3F|
+ |3 1A|e 13|d 23|x 33|Space 40|
+ |4 10|r 14|f 24|c 34|Alt 3F|
+ |5 11|t 15|g 25|v 35|Lblank 42|
+ |6 12|y 16|h 26|b 36|Enter 2F|
+ |7 08|u 17|j 27|n 37| |
+ |8 09|i 01|k 28|m 38| |
+ |9 0A|o 02|l 29|, 39| |
+ |0 0F|p 03|; 2A|. 3A| |
+ |- 1F|¢ 1B|' 2B|/ 3B| |
+ |= 0D|\ 1C|{} 2C|??? 3C| |
+ |??? 0C|PD2 1D|PD3 2D|RShift 3D| |
+ |BS 0E| | | | |
+ +----------+---------------------+----------+----------+
+ Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled.
+
+NOTE: When break code is enabled the key sends scancode with setting 7th bit on press
+and without it on release. That is, '`' sends 80h on press and 00h on release.
+
+
+Keyboard command
+----------------
+Keyboard accepts these commands from host.
+
+ Description Entry point
+ -----------------------------------------------------------
+ FF Soft Reset 0008h
+ FE Resend 00e8h
+ FD Buzzer(emits a short beep) 00edh
+ FC Set Key Flag 00f6h
+ FB Soft Reset 0008h
+ FA Reset 0000h
+
+
+Keyboard response
+-----------------
+Keyobard sends these bytes to host.
+
+ Description Entry point
+ -----------------------------------------------------------
+ FE Overflow(key event/receive data) 00c5h, 0346h
+ Memory test error 0224h
+ FD Command out of bound 00d8h
+ Key out of bound
+ 7E Read/Parity error in receive from host 00bch
+
+
+Set Key Flag command(FC)
+------------------------
+After 'Power on Reset' firmware enters this command mode and waits for data from host,
+so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'.
+
+Data sent from host:
+
+ bit: 7 6 ... 0
+ en | |
+ | `-----`--- scan code
+ `------------- enable bit(0: enable repeat, 1: enable break)
+
+ 00-77 Enable repeat(78-7F: invalid scancode)
+ 80-F7 Enable break(F8-FF: invalid scancode)
+ FE Resend(011ah) no need to use
+ FF End(0114h) exits FC command mode.
+
+Response from keyboard:
+ FD Out of bound - Invalid scancode
+
+Examples:
+ To enable break code of all keys.
+
+ FC 80 81 ... F7 FF
+
diff --git a/converter/ibm4704_usb/keymap_common.c b/converter/ibm4704_usb/keymap_common.c
new file mode 100644
index 0000000000..55a13793cb
--- /dev/null
+++ b/converter/ibm4704_usb/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2011,2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/ibm4704_usb/keymap_common.h b/converter/ibm4704_usb/keymap_common.h
new file mode 100644
index 0000000000..c55a817205
--- /dev/null
+++ b/converter/ibm4704_usb/keymap_common.h
@@ -0,0 +1,73 @@
+/*
+Copyright 2011,2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+// 32*8(256) byte array which converts PS/2 code into USB code
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* Original keys */
+#define KEYMAP( \
+ K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \
+ K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \
+ K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \
+ K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \
+ K31,K41,K3F, K40, K42,K2F \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+}
+
+#endif
+
+/*
+ { K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \
+ { K50, K51, K52, K53, K54, K55, K56, K57 }, \
+ { K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, \
+ { K60, K61, K62, K63, K64, K65, K66, K67 }, \
+ { K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \
+ { K70, K71, K72, K73, K74, K75, K76, K77 }, \
+ { K78, K79, K7A, K7B, K7C, K7D, K7E, K7F }, \
+*/
diff --git a/converter/ibm4704_usb/keymap_hasu.c b/converter/ibm4704_usb/keymap_hasu.c
new file mode 100644
index 0000000000..7545b0923d
--- /dev/null
+++ b/converter/ibm4704_usb/keymap_hasu.c
@@ -0,0 +1,85 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|xxx|Ret |
+ * |-----------------------------------------------------------|
+ * |Shif|xxx| Z| X| C| V| B| N| M| ,| ,| /|xxx|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \
+ LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, FN2, NO, FN0, \
+ LCTL,LGUI,LALT, FN3, RGUI,RCTL \
+ ),
+
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL \
+ ),
+
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \
+ LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, RSFT,\
+ LCTL,LGUI,LALT, BTN1, RGUI,RCTL \
+ ),
+
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,NO, RSFT, \
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL \
+ ),
+
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, NO, \
+ LCTL,LGUI,LALT, TRNS, RGUI,RCTL \
+ ),
+};
+
+enum macro_id {
+ ALT_TAB,
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN),
+ [2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH),
+ [3] = ACTION_LAYER_TAP_KEY(4, KC_SPC),
+ [4] = ACTION_MACRO(ALT_TAB),
+};
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ keyevent_t event = record->event;
+
+ switch (id) {
+ case ALT_TAB:
+ return (event.pressed ?
+ MACRO( D(LALT), D(TAB), END ) :
+ MACRO( U(TAB), END ));
+ }
+ return MACRO_NONE;
+}
diff --git a/converter/ibm4704_usb/keymap_plain.c b/converter/ibm4704_usb/keymap_plain.c
new file mode 100644
index 0000000000..a121634ef7
--- /dev/null
+++ b/converter/ibm4704_usb/keymap_plain.c
@@ -0,0 +1,38 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| #|Ret |
+ * |-----------------------------------------------------------|
+ * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui|Alt | Space |Alt* |Gui|Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS,ENT, \
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, FN0, \
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL \
+ ),
+
+ /* 1: HHKB */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, INS, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \
+ LCTL,LGUI,LALT, SPC, RGUI,RCTL \
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/converter/ibm4704_usb/led.c b/converter/ibm4704_usb/led.c
new file mode 100644
index 0000000000..f76545f0ba
--- /dev/null
+++ b/converter/ibm4704_usb/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/converter/ibm4704_usb/matrix.c b/converter/ibm4704_usb/matrix.c
new file mode 100644
index 0000000000..0bfda2b158
--- /dev/null
+++ b/converter/ibm4704_usb/matrix.c
@@ -0,0 +1,170 @@
+/*
+Copyright 2014 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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "action.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "ibm4704.h"
+#include "matrix.h"
+
+
+static void matrix_make(uint8_t code);
+static void matrix_break(uint8_t code);
+static void matrix_clear(void);
+
+
+/*
+ * Matrix Array usage:
+ * IBM 4704 scan codes are assigned into 128(16x8)-cell matrix.
+ *
+ * 8bit wide
+ * +---------+
+ * 0| |
+ * :| XX | 00-7F
+ * f| |
+ * +---------+
+ *
+ * Exceptions:
+ */
+static uint8_t matrix[MATRIX_ROWS];
+
+// scan code bits 7654 3210
+// R:row/C:column -RRR RCCC
+#define ROW(code) ((code>>3)&0x0f)
+#define COL(code) (code&0x07)
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+static void enable_break(void)
+{
+ uint8_t ret;
+ print("Enable break: ");
+ // valid scancode: 00-77h
+ for (uint8_t code = 0; code < 0x78; code++) {
+ while (ibm4704_send(0x80|code) != 0) {
+ print("z");
+ _delay_us(500);
+ }
+ _delay_us(2000);
+ ret = ibm4704_recv();
+ if (ret != 0xff) {
+ xprintf("c%02X:r%02X ", code, ret);
+ }
+ _delay_us(1000);
+ }
+ _delay_us(1000);
+ while (ibm4704_send(0xFF) != 0) { _delay_us(500); } // End
+ print("End\n");
+}
+
+void matrix_init(void)
+{
+ uint8_t ret;
+ debug_enable = true;
+
+ ibm4704_init();
+ matrix_clear();
+
+ // read keyboard id
+ while ((ret = ibm4704_recv()) == 0xFF) {
+ ibm4704_send(0xFE);
+ _delay_us(100);
+ }
+
+ _delay_ms(2000); // wait for starting up debug console
+ print("IBM 4704 converter\n");
+ xprintf("Keyboard ID: %02X\n", ret);
+ enable_break();
+}
+
+/*
+ * IBM 4704 Scan Code
+ */
+uint8_t matrix_scan(void)
+{
+ uint8_t code = ibm4704_recv();
+ if (code==0xFF) {
+ // Not receivd
+ return 0;
+ } else if ((code&0x78)==0x78) {
+ // 0xFF-F8 and 0x7F-78 is not scancode
+ xprintf("Error: %0X\n", code);
+ matrix_clear();
+ return 0;
+ } else if (code&0x80) {
+ matrix_make(code);
+ } else {
+ matrix_break(code);
+ }
+ return 1;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
+ }
+}
+
+
+
+inline
+static void matrix_make(uint8_t code)
+{
+ matrix[ROW(code)] |= 1<<COL(code);
+}
+
+inline
+static void matrix_break(uint8_t code)
+{
+ matrix[ROW(code)] &= ~(1<<COL(code));
+}
+
+inline
+static void matrix_clear(void)
+{
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+}
diff --git a/converter/m0110_usb/Makefile b/converter/m0110_usb/Makefile
new file mode 100644
index 0000000000..e836456326
--- /dev/null
+++ b/converter/m0110_usb/Makefile
@@ -0,0 +1,96 @@
+# Target file name (without extension).
+TARGET = m0110_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = matrix.c \
+ led.c \
+ keymap_common.c \
+ m0110.c
+
+# To use own keymap file run make like: make keymap=hasu
+ifdef KEYMAP
+ SRC += keymap_$(KEYMAP).c
+else
+ SRC += keymap_default.c
+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 = atmega32u2 # TMK converter rev2
+#MCU = atmega32u4 # TMK converter rev1
+
+
+# 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
+
+
+#
+# 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
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
+
+
+
+#---------------- 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/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/Makefile.pjrc b/converter/m0110_usb/Makefile.pjrc
new file mode 100644
index 0000000000..e82564218e
--- /dev/null
+++ b/converter/m0110_usb/Makefile.pjrc
@@ -0,0 +1,73 @@
+# Target file name (without extension).
+TARGET = m0110_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = matrix.c \
+ led.c \
+ m0110.c
+
+# To use own keymap file run make like: make keymap=hasu
+ifdef keymap
+ SRC += keymap_$(keymap).c
+else
+ SRC += keymap.c
+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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+
+#---------------- 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)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/Makefile.teensy b/converter/m0110_usb/Makefile.teensy
new file mode 100644
index 0000000000..394b660508
--- /dev/null
+++ b/converter/m0110_usb/Makefile.teensy
@@ -0,0 +1,98 @@
+# Target file name (without extension).
+TARGET = m0110_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = matrix.c \
+ led.c \
+ keymap_common.c \
+ m0110.c
+
+# To use own keymap file run make like: make keymap=hasu
+ifdef KEYMAP
+ SRC += keymap_$(KEYMAP).c
+else
+ SRC += keymap_default.c
+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
+
+
+#
+# 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
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
+
+
+
+#---------------- 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/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md
new file mode 100644
index 0000000000..c1ecb53b0b
--- /dev/null
+++ b/converter/m0110_usb/README.md
@@ -0,0 +1,82 @@
+M0110/M0110A to USB keyboard converter
+======================================
+This firmware converts the protocol of Apple Macintosh keyboard **M0110**, **M0110A** and **M0120** into USB. Target of this project is USB AVR controller like **ATmega32U2** and **ATmega32U4**. Using this converter you can revive these retro keyboards with modern computer.
+
+Read README of top directory too.
+
+Pictures of **M0110 + M0120** and **M0110A**.
+
+![M0110+M0120](http://i.imgur.com/dyvXb2Tm.jpg)
+![M0110A](http://i.imgur.com/HuHOEoHm.jpg)
+
+
+- M0110A support was contributed by [skagon@github](https://github.com/skagon).
+- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys.
+
+
+
+Update
+------
+- 2013/08: Change port for signals `PF` to `PD`
+- 2013/09: Change port again, it uses inversely `PD0` for data and `PD1` for clock line now.
+- 2014/06: Change keymaps
+- 2015/03: Add support for "International"(ISO) keyboard(keymap_intl.c)
+
+
+
+Building Hardware
+-----------------
+You need [TMK converter] or AVR dev board like PJRC [Teensy]. Port of the MCU `PD1` is assigned to `CLOCK` line and `PD0` to `DATA` by default, you can change pin configuration with editing `config.h`.
+
+[![M0110 Converter](http://i.imgur.com/4G2ZOegm.jpg)](http://i.imgur.com/4G2ZOeg.jpg)
+
+### 4P4C phone handset cable
+Note that original cable used with Mac is **straight** while phone handset cable is **crossover**.
+
+<http://en.wikipedia.org/wiki/Modular_connector#4P4C>
+
+Close-up picture of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
+[![4P4C cable](http://i.imgur.com/3S9P1mYm.jpg?1)](http://i.imgur.com/3S9P1mY.jpg?1)
+
+[Teensy]: http://www.pjrc.com/teensy/
+[TMK converter]: https://github.com/tmk/keyboard_converter
+
+
+### Socket Pinout
+- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml>
+
+![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png)
+
+
+### Pull-up Resistor
+You may need pull-up resistors on signal lines(`CLOCK`, `DATA`) in particular when you have long or coiled cable. **1k-10k Ohm** will be OK for this purpose. In that case the converter may not read signal from keyboard correctly without pull-up resistors.
+
+
+
+Building Firmware
+-----------------
+To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to change compile options and pin configuration. Also `KEYMAP` option can be used to select keymap.
+
+ $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
+ $ cd m0110_usb
+ $ make -f Makefile clean
+ $ make -f Makefile [KEYMAP={default|plain|intl|spacefn|hasu}]
+
+Use `Makefile.teensy` instead for Teensy.
+
+
+
+Keymap
+------
+To create your own keymap copy existent keymap file to `keymap_name.c` and edit it. You can build it like this.
+
+ $ make -f Makefile clean
+ $ make -f Makefile KEYMAP=name
+
+
+
+Debug
+-----
+You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see debug output. The converter has some functions for debug, press `<Magic>+H` simultaneously to get help.
+
+- Magic combo: `Shift+Option+⌘` or `Shift+Option+Ctrl`(`Shift+Alt+Gui` or `Shift+Alt+Control`)
diff --git a/converter/m0110_usb/config.h b/converter/m0110_usb/config.h
new file mode 100644
index 0000000000..801bc4ebfa
--- /dev/null
+++ b/converter/m0110_usb/config.h
@@ -0,0 +1,62 @@
+/*
+Copyright 2011,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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x0110
+#define DEVICE_VER 0x0101
+#define MANUFACTURER t.m.k.
+#define PRODUCT M0110 keyboard converter
+#define DESCRIPTION convert M0110 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 14
+#define MATRIX_COLS 8
+
+
+/* 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
+
+
+/* magic key */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \
+)
+
+/* boot magic key */
+#define BOOTMAGIC_KEY_SALT KC_FN0
+#define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_LCAP
+
+
+/* ports */
+#define M0110_CLOCK_PORT PORTD
+#define M0110_CLOCK_PIN PIND
+#define M0110_CLOCK_DDR DDRD
+#define M0110_CLOCK_BIT 1
+#define M0110_DATA_PORT PORTD
+#define M0110_DATA_PIN PIND
+#define M0110_DATA_DDR DDRD
+#define M0110_DATA_BIT 0
+
+#endif
diff --git a/converter/m0110_usb/keymap_common.c b/converter/m0110_usb/keymap_common.c
new file mode 100644
index 0000000000..4ac2d71783
--- /dev/null
+++ b/converter/m0110_usb/keymap_common.c
@@ -0,0 +1,37 @@
+/*
+Copyright 2011,2012,2014 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/>.
+*/
+#include <stdint.h>
+#include <avr/pgmspace.h>
+#include "action.h"
+#include "keycode.h"
+#include "keymap.h"
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn index to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ return action;
+}
diff --git a/converter/m0110_usb/keymap_common.h b/converter/m0110_usb/keymap_common.h
new file mode 100644
index 0000000000..8bde7473dd
--- /dev/null
+++ b/converter/m0110_usb/keymap_common.h
@@ -0,0 +1,143 @@
+/*
+Copyright 2011,2012,2014 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/>.
+*/
+#include <stdint.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/*
+ * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset
+ * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist
+ * on the M0110A, but since it generates a unique scan code which is not used for some other key in
+ * the M0110A, they are totally interchangeable. In fact, the M0110A is functionally (almost)
+ * identical to the combination of the M0110 along with the M0120 keypad. The only difference
+ * (which is causing some problems as you will read below) is that the M0110+M0120 don't have
+ * dedicated arrow keys, while the M0110A does. However, the M0120 did have arrow keys, which
+ * doubled as the [comma], [/], [*] and [+] keys, when used with the [Shift] key. The M0110A has
+ * substituted the [comma] key with the [=] key, however its scancode is the same.
+ *
+ * Physical layout:
+ * M0110A
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------' |-----------|Ent|
+ * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ *
+ * M0110 M0120
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
+ * |---------------------------------------------------------| |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Ent |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ * With Shift keys on M0120 work as curosor.(-:Left *:Right /:Up ,:Down)
+ *
+ * NOTE: \ is located differently.
+ * NOTE: Enter on M0110 is different from Enter on keypad(M0120 and M0110A).
+ * NOTE: Left Shift and right Shift are logically same key.
+ * NOTE: Left Option and right Option are logically same key.
+ */
+
+/* Keymap definition Macro
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Opt |Mac | Space |Ent| \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ * NOTE: Ent between Space and \ means Enter on M0110.
+ */
+#define KEYMAP( \
+ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
+ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K4E, \
+ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K66, \
+ K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K4D, K53,K54,K55,K4C, \
+ K3A,K37, K31, K34,K2A,K46,K42,K48, K52, K41 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_NO, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
+ { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
+}
+
+/* International keyboard
+ * ,---------------------------------------------------------.
+ * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33|
+ * |---------------------------------------------------------|
+ * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A|
+ * |------------------------------------------------------, |
+ * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| |
+ * |---------------------------------------------------------|
+ * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38|
+ * `---------------------------------------------------------'
+ * | 3A| 37| 34 | 31| 3A|
+ * `------------------------------------------------'
+ */
+#define KEYMAP_INTL( \
+ K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
+ K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K59,K5B,K5C,K4E, \
+ K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24, K56,K57,K58,K66, \
+ K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K4D, K53,K54,K55,K4C, \
+ K3A,K37, K34, K31, K46,K42,K48, K52, K41 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_NO, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
+ { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
+}
diff --git a/converter/m0110_usb/keymap_default.c b/converter/m0110_usb/keymap_default.c
new file mode 100644
index 0000000000..b0b8ee220a
--- /dev/null
+++ b/converter/m0110_usb/keymap_default.c
@@ -0,0 +1,85 @@
+/*
+Copyright 2011,2012,2015 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+ /* Default:
+ * M0110 M0120
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
+ * |---------------------------------------------------------| |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Fn |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ * M0110A
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [0] = KEYMAP(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
+ LALT,LGUI, SPC, FN0, BSLS,LEFT,RGHT,DOWN, P0, PDOT
+ ),
+ /* Cursor Layer
+ * ,---------------------------------------------------------. ,---------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |INS| | 7| 8| 9| /|
+ * |---------------------------------------------------------| |---------------|
+ * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Fn |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ */
+ [1] = KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, P7, P8, P9, PMNS,
+ LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
+ LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
+ LALT,LGUI, SPC, FN0, INS, HOME,END, PGDN, P0, PDOT
+ ),
+};
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t fn_actions[] PROGMEM = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/converter/m0110_usb/keymap_for_editor.c b/converter/m0110_usb/keymap_for_editor.c
new file mode 100644
index 0000000000..d20f298f87
--- /dev/null
+++ b/converter/m0110_usb/keymap_for_editor.c
@@ -0,0 +1,118 @@
+/*
+Copyright 2014 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+#ifdef KEYMAP_SECTION_ENABLE
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+#endif
+ /* Default:
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter | | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Ctl |Gui | Space |Alt| \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [0] = KEYMAP(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, CLR, EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
+ LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, FN15, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
+ LCTL,LGUI, FN16, LALT,FN31,LEFT,RGHT,DOWN, P0, PDOT
+ ),
+ /* Cursor Layer(WASD, IJKL)
+ * ,---------------------------------------------------------. ,---------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Enter | | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift |End| |PgD| | | | |End|PgD|Dow|Shif|PgU| | 1| 2| 3| |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Ctl |Gui | Space |Alt | \|Hom|End|PgD| | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [3] = KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
+ LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN15, P4, P5, P6, PPLS,
+ LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
+ LCTL,LGUI, FN16, LALT,FN31,HOME,END, PGDN, P0, PDOT
+ ),
+ [4] = KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
+ LCAP,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, FN15, P4, P5, P6, PPLS,
+ LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
+ LCTL,LGUI, FN16, LALT,FN31,HOME,END, PGDN, P0, PDOT
+ ),
+ [7] = {},
+};
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_LAYER_MOMENTARY(2),
+ [2] = ACTION_LAYER_MOMENTARY(3),
+ [3] = ACTION_LAYER_MOMENTARY(4),
+ [4] = ACTION_LAYER_MOMENTARY(5),
+ [5] = ACTION_LAYER_MOMENTARY(6),
+ [6] = ACTION_LAYER_MOMENTARY(7),
+ [7] = ACTION_LAYER_TOGGLE(1),
+ [8] = ACTION_LAYER_TOGGLE(2),
+ [9] = ACTION_LAYER_TOGGLE(3),
+ [10] = ACTION_LAYER_TAP_TOGGLE(1),
+ [11] = ACTION_LAYER_TAP_TOGGLE(2),
+ [12] = ACTION_LAYER_TAP_TOGGLE(3),
+ [13] = ACTION_LAYER_TAP_KEY(1, KC_F),
+ [14] = ACTION_LAYER_TAP_KEY(2, KC_J),
+ [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER),
+ [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
+ [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
+ [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
+ [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
+ [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
+ [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
+ [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
+ [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
+ [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
+ [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
+ [26] = ACTION_MODS_ONESHOT(MOD_LCTL),
+ [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
+ [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
+ [29] = ACTION_MODS_ONESHOT(MOD_LSFT),
+ [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE),
+ [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH),
+};
diff --git a/converter/m0110_usb/keymap_hasu.c b/converter/m0110_usb/keymap_hasu.c
new file mode 100644
index 0000000000..11f1a4f394
--- /dev/null
+++ b/converter/m0110_usb/keymap_hasu.c
@@ -0,0 +1,87 @@
+/*
+Copyright 2014 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Default:
+ * M0110
+ * ,---------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs|
+ * |---------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |---------------------------------------------------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| Fn| '|Return|
+ * |---------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| Fn|Shift |
+ * `---------------------------------------------------------'
+ * |Fn |alt | Fn |Gui |Fn |
+ * `-----------------------------------------------'
+ */
+ [0] = KEYMAP(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, UP, P1, P2, P3, PENT,
+ FN0, LALT, FN2, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
+ ),
+ // IJKL cursor
+ [1] = KEYMAP(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, HOME,LEFT,DOWN,RGHT,END, NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, PGUP, P1, P2, P3, PENT,
+ TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
+ ),
+ // HJKL cursor
+ [2] = KEYMAP(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, PGUP, P1, P2, P3, PENT,
+ TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
+ ),
+ // Mousekey
+ [3] = KEYMAP(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
+ NO, LALT, TRNS, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
+ ),
+ // Mousekey
+ [4] = KEYMAP(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
+ NO, LALT, BTN1, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
+ ),
+};
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t fn_actions[] PROGMEM = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_LAYER_TAP_KEY(2, KC_SLASH),
+ [2] = ACTION_LAYER_TAP_KEY(3, KC_SPACE),
+ [3] = ACTION_LAYER_TAP_KEY(4, KC_SCOLON),
+};
diff --git a/converter/m0110_usb/keymap_intl.c b/converter/m0110_usb/keymap_intl.c
new file mode 100644
index 0000000000..80b029305f
--- /dev/null
+++ b/converter/m0110_usb/keymap_intl.c
@@ -0,0 +1,85 @@
+/*
+Copyright 2015 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+ /* International keyboard
+ * M0110 M0120
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Ret| | 7| 8| 9| /|
+ * |------------------------------------------------------, | |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Fn |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ * M0110A(not existent?)
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Ret| | 7| 8| 9| -|
+ * |------------------------------------------------------, | |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------| |-----------|Ent|
+ * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [0] = KEYMAP_INTL(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, P7, P8, P9, PMNS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, P4, P5, P6, PPLS,
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
+ LALT,LGUI, SPC, FN0, LEFT,RGHT,DOWN, P0, PDOT
+ ),
+ /* Cursor Layer
+ * ,---------------------------------------------------------. ,---------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |Ret| | 7| 8| 9| /|
+ * |------------------------------------------------------, | |---------------|
+ * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Ins| | | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shif| <|End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Fn |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ */
+ [1] = KEYMAP_INTL(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, ENT, P7, P8, P9, PMNS,
+ LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT,INS, P4, P5, P6, PPLS,
+ LSFT,NO, END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
+ LALT,LGUI, SPC, FN0, HOME,END, PGDN, P0, PDOT
+ ),
+};
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t fn_actions[] PROGMEM = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/converter/m0110_usb/keymap_plain.c b/converter/m0110_usb/keymap_plain.c
new file mode 100644
index 0000000000..d1507fcaa9
--- /dev/null
+++ b/converter/m0110_usb/keymap_plain.c
@@ -0,0 +1,64 @@
+/*
+Copyright 2014 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Default:
+ * M0110 M0120
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
+ * |---------------------------------------------------------| |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Mac |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ * M0110A
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Nlk| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------' |-----------|Ent|
+ * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [0] = KEYMAP(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,PEQL,PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
+ LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
+ LALT,LGUI, SPC, RGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
+ ),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t fn_actions[] PROGMEM = {
+};
+
+
diff --git a/converter/m0110_usb/keymap_spacefn.c b/converter/m0110_usb/keymap_spacefn.c
new file mode 100644
index 0000000000..5017861a34
--- /dev/null
+++ b/converter/m0110_usb/keymap_spacefn.c
@@ -0,0 +1,71 @@
+/*
+Copyright 2014 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/>.
+*/
+#include <stdint.h>
+#include "keycode.h"
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Default:
+ * M0110 M0120
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
+ * |---------------------------------------------------------| |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
+ * `---------------------------------------------------------' |-----------|Ent|
+ * |Opt|Mac | Space |Mac |Opt| | 0| .| |
+ * `-----------------------------------------------' `---------------'
+ * M0110A
+ * ,---------------------------------------------------------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Nlk| =| /| *|
+ * |---------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
+ * |-----------------------------------------------------' | |---------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
+ * |---------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
+ * |---------------------------------------------------------' |-----------|Ent|
+ * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
+ * `---------------------------------------------------------' `---------------'
+ */
+ [0] = KEYMAP(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,PEQL,PSLS,PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
+ LALT,LGUI, FN0, RGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
+ ),
+ [1] = KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, P7, P8, P9, PMNS,
+ LCTL,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, PGUP, P1, P2, P3, PENT,
+ TRNS,TRNS, TRNS, TRNS,INS, HOME,END, PGDN, P0, PDOT
+ ),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t fn_actions[] PROGMEM = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+};
diff --git a/converter/m0110_usb/led.c b/converter/m0110_usb/led.c
new file mode 100644
index 0000000000..3822a131b8
--- /dev/null
+++ b/converter/m0110_usb/led.c
@@ -0,0 +1,32 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <avr/io.h>
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ DDRD |= (1<<6);
+ PORTD |= (1<<6);
+ } else {
+ DDRD |= (1<<6);
+ PORTD &= ~(1<<6);
+ }
+}
diff --git a/converter/m0110_usb/matrix.c b/converter/m0110_usb/matrix.c
new file mode 100644
index 0000000000..2189c0b56f
--- /dev/null
+++ b/converter/m0110_usb/matrix.c
@@ -0,0 +1,142 @@
+/*
+Copyright 2011,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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "host.h"
+#include "led.h"
+#include "m0110.h"
+#include "matrix.h"
+
+
+#define CAPS 0x39
+#define CAPS_BREAK (CAPS | 0x80)
+#define ROW(key) ((key)>>3&0x0F)
+#define COL(key) ((key)&0x07)
+
+
+static bool is_modified = false;
+
+// matrix state buffer(1:on, 0:off)
+static uint8_t *matrix;
+static uint8_t _matrix0[MATRIX_ROWS];
+
+static void register_key(uint8_t key);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ m0110_init();
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
+ matrix = _matrix0;
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ uint8_t key;
+
+ is_modified = false;
+ key = m0110_recv_key();
+
+ if (key == M0110_NULL) {
+ return 0;
+ } else if (key == M0110_ERROR) {
+ return 0;
+ } else {
+ is_modified = true;
+ register_key(key);
+ }
+
+ if (debug_enable) {
+ print("["); phex(key); print("]\n");
+ }
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
+
+inline
+static void register_key(uint8_t key)
+{
+ if (key&0x80) {
+ matrix[ROW(key)] &= ~(1<<COL(key));
+ } else {
+ matrix[ROW(key)] |= (1<<COL(key));
+ }
+}
diff --git a/converter/news_usb/Makefile.pjrc b/converter/news_usb/Makefile.pjrc
new file mode 100644
index 0000000000..80cadcc730
--- /dev/null
+++ b/converter/news_usb/Makefile.pjrc
@@ -0,0 +1,74 @@
+#
+# Makefile for PJRC Teensy
+#
+
+
+# Target file name (without extension).
+TARGET = news_usb_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ news.c
+
+CONFIG_H = config_pjrc.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
+
+
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+
+
+
+#---------------- 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)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/news_usb/config_pjrc.h b/converter/news_usb/config_pjrc.h
new file mode 100644
index 0000000000..adce014c9e
--- /dev/null
+++ b/converter/news_usb/config_pjrc.h
@@ -0,0 +1,62 @@
+/*
+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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x5021
+#define MANUFACTURER t.m.k.
+#define PRODUCT SONY NEWS keyboard converter
+#define DESCRIPTION converts SONY NEWS protocol into USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 16 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+/* Asynchronous USART
+ * 8-data bit, non parity, 1-stop bit, no flow control
+ */
+#ifdef __AVR_ATmega32U4__
+# define NEWS_KBD_RX_VECT USART1_RX_vect
+# define NEWS_KBD_RX_DATA UDR1
+# define NEWS_KBD_RX_BAUD 9600
+# define NEWS_KBD_RX_UBBR ((F_CPU/(16UL*NEWS_KBD_RX_BAUD))-1)
+# define NEWS_KBD_RX_INIT() do { \
+ UBRR1L = (uint8_t) NEWS_KBD_RX_UBBR; \
+ UBRR1H = (uint8_t) (NEWS_KBD_RX_UBBR>>8); \
+ UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); \
+ } while(0)
+#else
+# error "USART configuration is needed."
+#endif
+
+#endif
diff --git a/converter/news_usb/keymap.c b/converter/news_usb/keymap.c
new file mode 100644
index 0000000000..058f2914bd
--- /dev/null
+++ b/converter/news_usb/keymap.c
@@ -0,0 +1,125 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+// Following macros help you to define a keymap with the form of actual keyboard layout.
+
+/* SONY NEWS NWP-5461 */
+#define KEYMAP( \
+ K7A, K01,K02,K03,K04,K05, K06,K07,K08,K09,K0A, K68,K69, K64,K65,K52, \
+ K0B,K0C,K0D,K0E,K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19, K6A, K4B,K4C,K4D,K4E, \
+ K1A,K1B,K1C,K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27, K6B, K4F,K50,K51,K56, \
+ K28,K29,K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34, K35, K6C, K53,K54,K55,K5A, \
+ K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K6D, K57,K59,K58, \
+ K43,K44,K45, K46, K47, K48,K49,K4A, K6E, K66,K5B,K5C,K5D \
+) { \
+ { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
+ { KC_NO, KC_NO, KC_##K7A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
+}
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 0, // Fn1
+ 0, // Fn2
+ 0, // Fn3
+ 0, // Fn4
+ 0, // Fn5
+ 0, // Fn6
+ 0 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_NO, // Fn2
+ KC_NO, // Fn3
+ KC_NO, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,------------------------, ,------------------------. ,---------.
+ * |Pow| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| ,-----------.
+ * `---' `------------------------' `------------------------' `---------' | *| /| +|
+ * ,-------------------------------------------------------------. ,---. ,---------------|
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS | |Hlp| | 7| 8| 9| -|
+ * |-------------------------------------------------------------| |---| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Del| | |Ins| | 4| 5| 6| ,|
+ * |---------------------------------------------------------' | |---| |---------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `|Return| |Clr| | 1| 2| 3| |
+ * |-------------------------------------------------------------| |---| |-----------|Ent|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /| |Shift | |PgU| | 0| .| Up| |
+ * |-------------------------------------------------------------| |---| |---------------|
+ * |Alt |Gui |Alt | Space | |Gui|App|Ctrl | |PgD| |Tab|Lef|Dow|Rig|
+ * `-------------------------------------------------------------' `---' `---------------'
+ */
+ KEYMAP(
+ PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PAST,PSLS,PPLS,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HELP, P7, P8, P9, PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,DEL, INS, P4, P5, P6, PCMM,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, CLR, P1, P2, P3, PENT,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, PGUP, P0, PDOT,UP,
+ LALT,CAPS,LALT, SPC, ERAS, RALT,RGUI,RCTL, PGDN, TAB, LEFT,DOWN,RGHT
+ ),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/converter/news_usb/led.c b/converter/news_usb/led.c
new file mode 100644
index 0000000000..51e601318a
--- /dev/null
+++ b/converter/news_usb/led.c
@@ -0,0 +1,26 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "news.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ // not supported now
+}
diff --git a/converter/news_usb/matrix.c b/converter/news_usb/matrix.c
new file mode 100644
index 0000000000..f0d5b58633
--- /dev/null
+++ b/converter/news_usb/matrix.c
@@ -0,0 +1,142 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "news.h"
+#include "matrix.h"
+#include "debug.h"
+
+
+/*
+ * Matrix Array usage:
+ *
+ * ROW: 16
+ * COL:8
+ *
+ * 8bit wide
+ * +---------+
+ * 0|00 ... 07|
+ * 1|08 ... 0F|
+ * :| ... |
+ * :| ... |
+ * E|70 ... 77|
+ * F|78 ... 7F|
+ * +---------+
+ *
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) ((code>>3)&0xF)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ news_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ is_modified = false;
+
+ uint8_t code;
+ code = news_recv();
+ if (code == 0) {
+ return 0;
+ }
+
+ phex(code); print(" ");
+ if (code&0x80) {
+ // break code
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+ } else {
+ // make code
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= (1<<COL(code));
+ is_modified = true;
+ }
+ }
+ return code;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
diff --git a/converter/next_usb/Makefile b/converter/next_usb/Makefile
new file mode 100644
index 0000000000..fe19e98ccb
--- /dev/null
+++ b/converter/next_usb/Makefile
@@ -0,0 +1,87 @@
+# Target file name (without extension).
+TARGET = next_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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
+#MCU = atmega32u2 # TMK converter
+
+
+# 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
+
+
+#
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+SRC += next_kbd.c
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/next_usb/Makefile.pjrc b/converter/next_usb/Makefile.pjrc
new file mode 100644
index 0000000000..5813c9d6d2
--- /dev/null
+++ b/converter/next_usb/Makefile.pjrc
@@ -0,0 +1,63 @@
+# Target file name (without extension).
+TARGET = next_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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
+
+
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+SRC += next_kbd.c
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/next_usb/README b/converter/next_usb/README
new file mode 100644
index 0000000000..07ac89de30
--- /dev/null
+++ b/converter/next_usb/README
@@ -0,0 +1,45 @@
+NeXT non-ADB Keyboard Converter
+-------------------------------
+
+Cable connector inside keyboard case:
++-----+
+|Black|\
+|Green|-\
+|Yello|--\-------- to computer via Mini-Din 5a Connector
+|Orang|--/--------
+|Red |-/
+|Brown|/
++-----+
+
+Black - Ground to outer metal part of Mini Din 5a connector (not used)
+Green - Ground
+Yellow - Power button signal
+Orange - Keyboard Out
+Red - Keyboard In
+Brown - Vcc
+
+ATmega32u4 connections (pinout provided for Arduino Pro Micro):
+
+Keyboard out (orange) : PD0 (pin 3)
+Keyboard in (red) : PD1 (pin 2)
+Power Button (yellow) : PD4 (pin 4)
+Ground (black) : GND
+Vcc (brown) : VCC
+
+See attached next_timings.jpg file for a detailed illustration of NeXT keyboard protocol timings.
+
+Power button signal line is normally high when the keyboard is powered/initialized. It is pulled to ground when pressed. The converter automatically translates this to a "normal" keypress with code 0x5A. This connection is technically optional, the only side effect of not making this connection is the power key will do nothing.
+
+Converter is based heavily on Ladyada's original "USB NeXT Keyboard with Arduino Micro" tutorial (http://learn.adafruit.com/usb-next-keyboard-with-arduino-micro/overview). If you build this converter, show Adafruit some love and do it using an Arduino Micro (http://www.adafruit.com/products/1315) or their ATmega 32u4 Breakout Board (http://www.adafruit.com/products/296). Arduino Micro should work fine using the Arduino Pro Micro configuration above, same pins numbers and everything.
+
+TODO:
+-----
+
+I believe it might be possible to run the keyboard off of 3V; during testing I observed that the keyboard could sometimes function even without Vcc connected as long as the ground connection was good and the Keyboard In line was connected. If that works it should be easy to do a Bluetooth conversion and run the keyboard right off of a LiPo battery without a boost circuit
+
+Utilize second LED as status indicator for good initialization; also try to make hot plugging much more robust.
+
+Figure a better use for the Power button. Too easy to hit it by mistake to use for Suspend or Power Off - maybe move cap to different part of the board and consider that
+
+Figure out a better use for the lock LEDs. Right now they just light up when you press shift. Lame. Maybe implement proper Caps/Num/Scroll Locks
+
diff --git a/converter/next_usb/config.h b/converter/next_usb/config.h
new file mode 100644
index 0000000000..cd80b5af1b
--- /dev/null
+++ b/converter/next_usb/config.h
@@ -0,0 +1,188 @@
+/*
+NeXT non-ADB Keyboard USB Converter
+
+Copyright 2013, Benjamin Gould (bgould@github.com)
+
+Based on:
+TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
+Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
+
+Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
+Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
+Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
+
+This software is licensed with a Modified BSD License.
+All of this is supposed to be Free Software, Open Source, DFSG-free,
+GPL-compatible, and OK to use in both free and proprietary applications.
+Additions and corrections to this file are welcome.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+* Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#define VENDOR_ID 0xBCBC
+#define PRODUCT_ID 0xBCBC
+#define DEVICE_VER 0x0500
+#define MANUFACTURER t.m.k.
+#define PRODUCT NeXT Keyboard to USB converter
+#define DESCRIPTION USB converter for NeXT non-ADB Keyboard
+
+/* matrix size */
+#define MATRIX_ROWS 12 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+//#define DEBUG_ON_INIT 1
+
+//#define TEENSY_CONFIG 1
+#define PRO_MICRO_CONFIG 1
+//#define TMK_CONFIG 1
+
+// comment out if you don't want the keyboard's LEDs to flash upon initialization
+#define NEXT_KBD_INIT_FLASH_LEDS
+
+//============= Start of Arduino Pro Micro Configuration ==============
+#ifdef PRO_MICRO_CONFIG
+
+// this is the debugging LED that flashes when a key is being pressed
+// comment out in order to disable debugging LED
+#define NEXT_KBD_LED1_PORT PORTD
+#define NEXT_KBD_LED1_PIN PIND
+#define NEXT_KBD_LED1_DDR DDRD
+#define NEXT_KBD_LED1_BIT 5
+
+#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
+#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
+
+// reserved for future use
+#define NEXT_KBD_LED2_PORT PORTB
+#define NEXT_KBD_LED2_PIN PINB
+#define NEXT_KBD_LED2_DDR DDRB
+#define NEXT_KBD_LED2_BIT 6
+
+#define NEXT_KBD_LED2_ON NEXT_KBD_LED2_PORT &= ~(1<<NEXT_KBD_LED2_BIT);
+#define NEXT_KBD_LED2_OFF NEXT_KBD_LED2_PORT |= (1<<NEXT_KBD_LED2_BIT);
+
+// corresponds to the Keyboard In wire on the NeXT connector
+// (red wire in NeXT connector) - pin 2 on the Pro Micro
+#define NEXT_KBD_OUT_PORT PORTD
+#define NEXT_KBD_OUT_PIN PIND
+#define NEXT_KBD_OUT_DDR DDRD
+#define NEXT_KBD_OUT_BIT 1
+
+// corresponds to the Keyboard Out wire on the NeXT connector
+// (orange wire in NeXT connector) - pin 3 on the Pro Micro
+#define NEXT_KBD_IN_PORT PORTD
+#define NEXT_KBD_IN_PIN PIND
+#define NEXT_KBD_IN_DDR DDRD
+#define NEXT_KBD_IN_BIT 0
+
+// this pin is an input for the power key on the NeXT keyboard
+// as the keyboard is powered on this should be normally high;
+// if it is pulled low it means the power button is being preseed
+// (yellow wire in NeXT connector) - pin 4 on the Pro Micro
+#define NEXT_KBD_PWR_PORT PORTD
+#define NEXT_KBD_PWR_PIN PIND
+#define NEXT_KBD_PWR_DDR DDRD
+#define NEXT_KBD_PWR_BIT 4
+
+#endif
+//============== End of Arduino Pro Micro Configuration ===============
+
+
+//================ Start of Teensy 2.0 Configuration =================
+#ifdef TEENSY_CONFIG
+
+// this is the debugging LED that flashes when a key is being pressed
+// comment out in order to disable debugging LED
+#define NEXT_KBD_LED_PORT PORTD
+#define NEXT_KBD_LED_PIN PIND
+#define NEXT_KBD_LED_DDR DDRD
+#define NEXT_KBD_LED_BIT 6
+
+#define NEXT_KBD_LED_ON NEXT_KBD_LED_PORT |= (1<<NEXT_KBD_LED_BIT);
+#define NEXT_KBD_LED_OFF NEXT_KBD_LED_PORT &= ~(1<<NEXT_KBD_LED_BIT);
+
+// corresponds to the Keyboard In wire on the NeXT connector
+// (red wire in NeXT connector)
+#define NEXT_KBD_OUT_PORT PORTB
+#define NEXT_KBD_OUT_PIN PINB
+#define NEXT_KBD_OUT_DDR DDRB
+#define NEXT_KBD_OUT_BIT 1
+
+// corresponds to the Keyboard Out wire on the NeXT connector
+// (orange wire in NeXT connector)
+#define NEXT_KBD_IN_PORT PORTB
+#define NEXT_KBD_IN_PIN PINB
+#define NEXT_KBD_IN_DDR DDRB
+#define NEXT_KBD_IN_BIT 0
+
+#endif
+//================= End of Teensy 2.0 Configuration ==================
+
+
+//================ Start of TMK converter Configuration =================
+#ifdef TMK_CONFIG
+
+// this is the debugging LED that flashes when a key is being pressed
+// comment out in order to disable debugging LED
+#define NEXT_KBD_LED1_PORT PORTD
+#define NEXT_KBD_LED1_PIN PIND
+#define NEXT_KBD_LED1_DDR DDRD
+#define NEXT_KBD_LED1_BIT 6
+
+#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
+#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
+
+// corresponds to the Keyboard In wire on the NeXT connector
+#define NEXT_KBD_OUT_PORT PORTD
+#define NEXT_KBD_OUT_PIN PIND
+#define NEXT_KBD_OUT_DDR DDRD
+#define NEXT_KBD_OUT_BIT 1
+
+// corresponds to the Keyboard Out wire on the NeXT connector
+#define NEXT_KBD_IN_PORT PORTD
+#define NEXT_KBD_IN_PIN PIND
+#define NEXT_KBD_IN_DDR DDRD
+#define NEXT_KBD_IN_BIT 0
+
+// this pin is an input for the power key on the NeXT keyboard
+// as the keyboard is powered on this should be normally high;
+// if it is pulled low it means the power button is being preseed
+#define NEXT_KBD_PWR_PORT PORTD
+#define NEXT_KBD_PWR_PIN PIND
+#define NEXT_KBD_PWR_DDR DDRD
+#define NEXT_KBD_PWR_BIT 4
+
+#endif
+//================= End of TMK converter Configuration ==================
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))|| \
+ (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
+)
diff --git a/converter/next_usb/keymap.c b/converter/next_usb/keymap.c
new file mode 100644
index 0000000000..3a51075483
--- /dev/null
+++ b/converter/next_usb/keymap.c
@@ -0,0 +1,177 @@
+/*
+NeXT non-ADB Keyboard USB Converter
+
+Copyright 2013, Benjamin Gould (bgould@github.com)
+
+Based on:
+---------
+* TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
+* Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/) \
+ released under BSD license \
+ https://github.com/adafruit/USB-NeXT-Keyboard
+
+Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
+Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
+Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
+
+This software is licensed with a Modified BSD License.
+All of this is supposed to be Free Software, Open Source, DFSG-free,
+GPL-compatible, and OK to use in both free and proprietary applications.
+Additions and corrections to this file are welcome.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+* Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+#include "keycode.h"
+
+// 32*8(256) byte array which converts PS/2 code into USB code
+static const uint16_t PROGMEM fn_actions[] = {
+ ACTION_LAYER_MOMENTARY(1), // FN0 - left command key
+ ACTION_LAYER_MOMENTARY(1), // FN1 - right command key
+ ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash
+ ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN3 - number pad equals & pipe
+ ACTION_MODS_KEY(MOD_LCTL, KC_Z), // FN4 - cmd+undo on layer 1
+ ACTION_MODS_KEY(MOD_LCTL, KC_X), // FN5 - cmd+cut on layer 1
+ ACTION_MODS_KEY(MOD_LCTL, KC_C), // FN6 - cmd+copy on layer 1
+ ACTION_MODS_KEY(MOD_LCTL, KC_V), // FN7 - cmd+paste on layer 1
+};
+
+/* This is the physical layout that I am starting with:
+ * Note: there is some strangeness on the number pad;
+ * the equal sign shifts to pipe and forward slash shifts to backslash
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |VUp|Pwr|BrU| |` | =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |VDn| |BrD| | 7| 8| 9| -|
+ * |------------------------------------------------------ | `---' `---' |-----------|---|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Alt |Cmd | Space |Cmd |Alt | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ *
+ * Keymap array:
+ * 8 bytes
+ * +---------+
+ * 0| |
+ * :| | 0x00-0x87
+ * ;| |
+ * 11| |
+ * +---------+
+ */
+#define KEYMAP( \
+ K49,K4A,K4B,K4C,K4D,K50,K4F,K4E,K1E,K1F,K20,K1D,K1C,K1B, K1A,K58,K19, K26,K27,K28,K25, \
+ K41,K42,K43,K44,K45,K48,K47,K46,K06,K07,K08,K05,K04,K03, K02, K01, K21,K22,K23,K24, \
+ K57,K39,K3A,K3B,K3C,K3D,K40,K3F,K3E,K2D,K2C,K2B, K2A, K12,K18,K13,K15, \
+ K56, K31,K32,K33,K34,K35,K37,K36,K2E,K2F,K30, K55, K16, K11,K17,K14, \
+ K52,K54, K38, K53,K51, K09,K0F,K10, K0B, K0C,K0D \
+) { \
+ { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K10, KC_##K0B, KC_##K0C, KC_##K0D, KC_NO, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_NO, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
+}
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ /* Layer 0: default
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |Ins|Ref|Hom| |` | =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del| |End| | 7| 8| 9| -|
+ * |-----------------------------------------------------' | `---' `---' |-----------|---|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Fn0 |Alt | Space |LGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, WREF,HOME, GRV, FN3, FN2, PAST,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,NO, DEL, END, P7, P8, P9, PMNS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ FN0, LALT, SPC, LGUI,FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
+
+ ),
+
+ /* Layer 1: extra keys
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * |Grv| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| BS | |VUp|VMu|PgU| |` | =| /| *|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab |Pau| W| E| R| T| Y| U| I| O|PSc| \| ]| | |VDn| |PgD| | 7| 8| 9| -|
+ * |-----------------------------------------------------' | `---' `---' |-----------|---|
+ * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift |UND|CUT|COP|PST| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Fn0 |Alt | Space |RGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, VOLU,MUTE,PGUP, TRNS,TRNS,TRNS,TRNS,
+ TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, MS_L,MS_D,MS_R,WH_D,
+ TRNS, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,
+ TRNS,RALT, TRNS, RGUI,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS
+
+ )
+};
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/next_usb/led.c b/converter/next_usb/led.c
new file mode 100644
index 0000000000..24db15e16a
--- /dev/null
+++ b/converter/next_usb/led.c
@@ -0,0 +1,55 @@
+/*
+NeXT non-ADB Keyboard USB Converter
+
+Copyright 2013, Benjamin Gould (bgould@github.com)
+
+Based on:
+TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
+Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
+
+Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
+Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
+Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
+
+This software is licensed with a Modified BSD License.
+All of this is supposed to be Free Software, Open Source, DFSG-free,
+GPL-compatible, and OK to use in both free and proprietary applications.
+Additions and corrections to this file are welcome.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+* Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+
+}
diff --git a/converter/next_usb/matrix.c b/converter/next_usb/matrix.c
new file mode 100644
index 0000000000..fd6eb9d64f
--- /dev/null
+++ b/converter/next_usb/matrix.c
@@ -0,0 +1,269 @@
+/*
+NeXT non-ADB Keyboard USB Converter
+
+Copyright 2013, Benjamin Gould (bgould@github.com)
+
+Based on:
+TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
+Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
+
+Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
+Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
+Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
+
+This software is licensed with a Modified BSD License.
+All of this is supposed to be Free Software, Open Source, DFSG-free,
+GPL-compatible, and OK to use in both free and proprietary applications.
+Additions and corrections to this file are welcome.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+* Neither the name of the copyright holders nor the names of
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "serial.h"
+#include "matrix.h"
+#include "debug.h"
+#include "matrix.h"
+#include "next_kbd.h"
+
+static void matrix_make(uint8_t code);
+static void matrix_break(uint8_t code);
+
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) ((code>>3)&0xF)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+/* number of matrix rows */
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+/* number of matrix columns */
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+#ifndef NEXT_KBD_LED1_ON
+#define NEXT_KBD_LED1_ON
+#endif
+
+#ifndef NEXT_KBD_LED1_OFF
+#define NEXT_KBD_LED1_OFF
+#endif
+
+#define NEXT_KBD_PWR_READ (NEXT_KBD_PWR_PIN&(1<<NEXT_KBD_PWR_BIT))
+
+static bool power_state = false;
+
+/* intialize matrix for scanning. should be called once. */
+void matrix_init(void)
+{
+#ifdef DEBUG_ON_INIT
+ debug_enable = true;
+#endif
+
+ // I've found that the matrix likes a little while for things to
+ // settle down before it gets started. Not sure why :)
+ _delay_ms(250);
+
+ dprintf("[ Intializing NeXT keyboard ]\n");
+ NEXT_KBD_LED1_DDR |= (1<<NEXT_KBD_LED1_BIT); // LED pin to output
+ NEXT_KBD_LED1_ON;
+
+ NEXT_KBD_PWR_DDR &= ~(1<<NEXT_KBD_PWR_BIT); // Power Button pin to input
+ NEXT_KBD_PWR_PIN |= (1<<NEXT_KBD_PWR_BIT); // KBD_PWR pull up
+
+ power_state = NEXT_KBD_PWR_READ ? false : true;
+ dprintf("Initial power button state: %b\n", power_state);
+
+ next_kbd_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+#ifdef NEXT_KBD_INIT_FLASH_LEDS
+ dprintf("flashing LEDs:");
+ // flash the LEDs after initialization
+ bool leds_on = true;
+ for (uint8_t i = 0; i <= 6; i++)
+ {
+ leds_on = leds_on ? false : true;
+ dprintf(" %b", leds_on);
+ next_kbd_set_leds(leds_on, leds_on);
+ _delay_ms(250);
+ }
+ dprintf("\n");
+#endif
+
+ dprintf("[ NeXT keyboard initialized ]\n");
+
+ return;
+}
+
+#define NEXT_KBD_KEYCODE(response) (uint8_t)((response&0xFF)>>1)
+#define NEXT_KBD_PRESSED_KEYCODE(response) (uint8_t)(((response)&0xF00)==0x400)
+#define NEXT_KBD_PRESSED(response, mask) (uint8_t)(((response)&mask)>0)
+#define NEXT_KBD_PRESSED_CONTROL(response) NEXT_KBD_PRESSED(response,0x01000)
+#define NEXT_KBD_PRESSED_SHIFT_LEFT(response) NEXT_KBD_PRESSED(response,0x02000)
+#define NEXT_KBD_PRESSED_SHIFT_RGHT(response) NEXT_KBD_PRESSED(response,0x04000)
+#define NEXT_KBD_PRESSED_CMD_LEFT(response) NEXT_KBD_PRESSED(response,0x08000)
+#define NEXT_KBD_PRESSED_CMD_RGHT(response) NEXT_KBD_PRESSED(response,0x10000)
+#define NEXT_KBD_PRESSED_ALT_LEFT(response) NEXT_KBD_PRESSED(response,0x20000)
+#define NEXT_KBD_PRESSED_ALT_RGHT(response) NEXT_KBD_PRESSED(response,0x40000)
+#define NEXT_KBD_MAKE_OR_BREAK(key, code) \
+ do { \
+ if (NEXT_KBD_PRESSED_##key(resp) > 0) \
+ matrix_make(code); \
+ else \
+ matrix_break(code); \
+ } while (0);
+
+#define NEXT_KBD_PWR_KEYCODE 0x58
+
+/* scan all key states on matrix */
+uint8_t matrix_scan(void)
+{
+ _delay_ms(20);
+
+ //next_kbd_set_leds(false, false);
+ NEXT_KBD_LED1_OFF;
+
+ is_modified = false;
+
+ if (!NEXT_KBD_PWR_READ) {
+ matrix_make(NEXT_KBD_PWR_KEYCODE);
+ power_state = 1;
+ if (is_modified)
+ {
+ dprintf("Power state 1\n");
+
+ }
+ } else {
+ matrix_break(NEXT_KBD_PWR_KEYCODE);
+ power_state = 0;
+ if (is_modified)
+ {
+ dprintf("Power state 0\n");
+
+ }
+ }
+
+ uint32_t resp = (next_kbd_recv());
+
+ if (resp == NEXT_KBD_KMBUS_IDLE)
+ {
+ return 0;
+ }
+
+ NEXT_KBD_LED1_ON;
+
+ next_kbd_set_leds(
+ NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false,
+ NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
+ );
+
+ dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
+ resp, \
+ NEXT_KBD_KEYCODE(resp), \
+ NEXT_KBD_PRESSED_KEYCODE(resp), \
+ NEXT_KBD_PRESSED_CONTROL(resp), \
+ NEXT_KBD_PRESSED_SHIFT_LEFT(resp), \
+ NEXT_KBD_PRESSED_SHIFT_RGHT(resp), \
+ NEXT_KBD_PRESSED_CMD_LEFT(resp), \
+ NEXT_KBD_PRESSED_CMD_RGHT(resp), \
+ NEXT_KBD_PRESSED_ALT_LEFT(resp), \
+ NEXT_KBD_PRESSED_ALT_RGHT(resp) \
+ );
+
+ // Modifier keys don't return keycode; have to check the upper bits
+ NEXT_KBD_MAKE_OR_BREAK(ALT_RGHT, 0x51);
+ NEXT_KBD_MAKE_OR_BREAK(ALT_LEFT, 0x52);
+ NEXT_KBD_MAKE_OR_BREAK(CMD_RGHT, 0x53);
+ NEXT_KBD_MAKE_OR_BREAK(CMD_LEFT, 0x54);
+ NEXT_KBD_MAKE_OR_BREAK(SHIFT_RGHT, 0x55);
+ NEXT_KBD_MAKE_OR_BREAK(SHIFT_LEFT, 0x56);
+ NEXT_KBD_MAKE_OR_BREAK(CONTROL, 0x57);
+ NEXT_KBD_MAKE_OR_BREAK(KEYCODE, NEXT_KBD_KEYCODE(resp));
+
+ return 1;
+}
+
+/* whether modified from previous scan. used after matrix_scan. */
+bool matrix_is_modified()
+{
+ return is_modified;
+}
+
+/* whether a switch is on */
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+/* matrix state on row */
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+/* print matrix for debug */
+void matrix_print(void)
+{
+}
+
+inline
+static void matrix_make(uint8_t code)
+{
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= 1<<COL(code);
+ is_modified = true;
+ }
+}
+
+inline
+static void matrix_break(uint8_t code)
+{
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+}
diff --git a/converter/next_usb/next_timings.jpg b/converter/next_usb/next_timings.jpg
new file mode 100644
index 0000000000..c9e429fe11
--- /dev/null
+++ b/converter/next_usb/next_timings.jpg
Binary files differ
diff --git a/converter/pc98_usb/Makefile b/converter/pc98_usb/Makefile
new file mode 100644
index 0000000000..9892276d7f
--- /dev/null
+++ b/converter/pc98_usb/Makefile
@@ -0,0 +1,83 @@
+# Target file name (without extension).
+TARGET = pc98_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ protocol/serial_uart.c
+# protocol/serial_soft.c
+
+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
+
+
+#
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/pc98_usb/README b/converter/pc98_usb/README
new file mode 100644
index 0000000000..c9bdf3d846
--- /dev/null
+++ b/converter/pc98_usb/README
@@ -0,0 +1,67 @@
+PC98 to USB keyboard protocol converter
+=======================================
+Target MCU is ATMega32u4 but other USB capable AVR will also work.
+
+
+Connector
+---------
+
+ 8Pin mini DIN
+ ___ ___
+ / |_| \
+ / 8 7 6 \
+ | 5 4 3 |
+ \_ 2 1 _/
+ \_____/
+ (receptacle)
+
+
+Wiring: You can change this with editing config.h.
+
+ Pin mini DIN MCU
+ ----------------------------------
+ 1 ~RST(TXD) PD3
+ 2 GND GND
+ 3 ~RDY PD4
+ 4 RXD PD2
+ 5 ~RTY PD5
+ 6 NC
+ 7 NC
+ 8 5V VCC
+
+
+
+
+Protocol
+--------
+Signal: Asynchronous, Positive logic, 19200baud, Least bit first
+Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
+
+
+
+Build Firmware
+--------------
+Just use 'make'
+
+ $ cd pc98_usb
+ $ make
+
+Then, load the binary to MCU with your favorite programmer.
+
+
+
+Other PC98 converter projects and resource
+------------------------------------------
+PC98 to USB
+http://davy.nyacom.net/kbd98usb/
+
+PC98 to PS/2
+http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
+http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
+
+PC98 keyboard commands
+http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
+
+
+Inhibit repeating key:
+0x9C, 0x70
diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h
new file mode 100644
index 0000000000..b8d676e4cf
--- /dev/null
+++ b/converter/pc98_usb/config.h
@@ -0,0 +1,123 @@
+/*
+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
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x9898
+#define DEVICE_VER 0x0100
+#define MANUFACTURER t.m.k.
+#define PRODUCT PC98 keyboard converter
+#define DESCRIPTION converts PC98 keyboard protocol into USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 16
+#define MATRIX_COLS 8
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ host_get_first_key() == KC_CANCEL \
+)
+
+
+/* PC98 Reset Port shared with TXD */
+#define PC98_RST_DDR DDRD
+#define PC98_RST_PORT PORTD
+#define PC98_RST_BIT 3
+/* PC98 Ready Port */
+#define PC98_RDY_DDR DDRD
+#define PC98_RDY_PORT PORTD
+#define PC98_RDY_BIT 4
+/* PC98 Retry Port */
+#define PC98_RTY_DDR DDRD
+#define PC98_RTY_PORT PORTD
+#define PC98_RTY_BIT 5
+
+/*
+ * PC98 Serial(USART) configuration
+ * asynchronous, positive logic, 19200baud, bit order: LSB first
+ * 1-start bit, 8-data bit, odd parity, 1-stop bit
+ */
+/*
+ * Software Serial
+ */
+#define SERIAL_SOFT_BAUD 19200
+#define SERIAL_SOFT_PARITY_ODD
+#define SERIAL_SOFT_BIT_ORDER_LSB
+#define SERIAL_SOFT_LOGIC_POSITIVE
+/* RXD Port */
+#define SERIAL_SOFT_RXD_DDR DDRD
+#define SERIAL_SOFT_RXD_PORT PORTD
+#define SERIAL_SOFT_RXD_PIN PIND
+#define SERIAL_SOFT_RXD_BIT 2
+#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
+/* RXD Interupt */
+#define SERIAL_SOFT_RXD_VECT INT2_vect
+#define SERIAL_SOFT_RXD_INIT() do { \
+ /* pin configuration: input with pull-up */ \
+ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
+ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
+ /* enable interrupt: INT2(falling edge) */ \
+ EICRA |= ((1<<ISC21)|(0<<ISC20)); \
+ EIMSK |= (1<<INT2); \
+ sei(); \
+} while (0)
+#define SERIAL_SOFT_RXD_INT_ENTER()
+#define SERIAL_SOFT_RXD_INT_EXIT() do { \
+ /* clear interrupt flag */ \
+ EIFR = (1<<INTF2); \
+} while (0)
+/* TXD Port */
+#define SERIAL_SOFT_TXD_DDR DDRD
+#define SERIAL_SOFT_TXD_PORT PORTD
+#define SERIAL_SOFT_TXD_PIN PIND
+#define SERIAL_SOFT_TXD_BIT 3
+#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_INIT() do { \
+ /* pin configuration: output */ \
+ SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
+ /* idle */ \
+ SERIAL_SOFT_TXD_ON(); \
+} while (0)
+
+
+/*
+ * Hardware Serial(UART)
+ */
+#ifdef __AVR_ATmega32U4__
+ #define SERIAL_UART_BAUD 19200
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_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 |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
+ sei(); \
+ } while(0)
+#else
+ #error "USART configuration is needed."
+#endif
+
+
+#endif
diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c
new file mode 100644
index 0000000000..8922ea7bab
--- /dev/null
+++ b/converter/pc98_usb/keymap.c
@@ -0,0 +1,208 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+/* PC-9801-98-S02 Raku Raku keyboard(Luckyboard) Normal Mode
+ ,---------------------------------------------------------------.
+ | 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
+ `---------------------------------------------------------------'
+ ,---------------------------------------------------------------.
+ | 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
+ |---------------------------------------------------------------|
+ | 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
+ |---------------------------------------------------------'. |
+ | 74| 20| 21| 22| 23| 24| 3B | 3C | 25| 26| 27| 28| 29| |
+ |---------------------------------------------------------------|
+ | 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
+ `---------------------------------------------------------------'
+ | 73| 51| 5B| 59| 34| 5A| 35| xx|
+ `-----------------------------------------------'
+ xx: 74 35 F4 B5
+*/
+#define KEYMAP( \
+ K60, K61, K62, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K36, K37, K3F, K3E, \
+ K00, K01, K02, K03, K04, K05, K58, K71, K06, K07, K08, K09, K0A, K0E, \
+ K0F, K10, K11, K12, K13, K14, K3A, K15, K16, K17, K18, K19, K1C, \
+ K74, K20, K21, K22, K23, K24, K3B, K3C, K25, K26, K27, K28, K29, \
+ K70,K2A, K2B, K2C, K2D, K2E, K38, K3D, K39, K2F, K30, K31, K32, K33, \
+ K73, K51, K5B, K59, K34, K5A, K35 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_NO, KC_NO, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_NO, KC_NO, KC_##K1C, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_NO, KC_##K73, KC_##K74, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
+}
+
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /*
+ ,---------------------------------------------------------------.
+ | 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
+ `---------------------------------------------------------------'
+ ,---------------------------------------------------------------.
+ | 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
+ |---------------------------------------------------------------|
+ | 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
+ |---------------------------------------------------------------|
+ | 74| 20| 21| 22| 23| 24| MINS| EQL| 25| 26| 27| 28| 29| |
+ |---------------------------------------------------------------|
+ | 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
+ `---------------------------------------------------------------'
+ | 73| 51| 5B| 59| 34| 5A| 35| xx|
+ `-----------------------------------------------'
+ */
+ KEYMAP(
+ CANCEL,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, FN6,
+ ESC, 1, 2, 3, 4, 5, FN4, FN5, 6, 7, 8, 9, 0, BSPC,
+ TAB, Q, W, E, R, T, UP, Y, U, I, O, P, ENT,
+ LCTL, A, S, D, F, G, MINS, EQL, H, J, K, L, FN2,
+ LSFT, Z, X, C, V, B, GRV, BSLS, QUOT, N, M,COMM, DOT, FN1,
+ LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
+ ),
+ KEYMAP(
+ PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
+ GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
+ TAB, Q, W, E, R, T, UP, HOME,PGDN,PGUP, END, P, ENT,
+ LCTL, A, S, D, F, G, MINS, EQL, LEFT,DOWN, UP,RGHT,SCLN,
+ LSFT, Z, X, C, V, B, INS, DOWN, DEL,HOME,PGDN,PGUP, END,TRNS,
+ LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
+ ),
+ KEYMAP(
+ PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
+ GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
+ TAB, Q, W, E, R, T, UP, WH_L,WH_D,WH_U,WH_R, P, ENT,
+ LCTL, A, S, D, F, G, MINS, EQL, MS_L,MS_D,MS_U,MS_R,TRNS,
+ LSFT, Z, X, C, V, B, INS, DOWN, BTN3,BTN2,BTN1,BTN4,BTN5,TRNS,
+ LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
+ ),
+};
+static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
+
+/*
+ * Macro definition
+ */
+enum macro_id {
+ LBRACKET,
+ RBRACKET,
+ DUMMY,
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ keyevent_t event = record->event;
+ //uint8_t tap_count = record->tap_count;
+
+ switch (id) {
+ case LBRACKET:
+ return (event.pressed ?
+ MACRO( T(LBRC), END ) :
+ MACRO( T(LBRC), END ) );
+ case RBRACKET:
+ return (event.pressed ?
+ MACRO( T(RBRC), END ) :
+ MACRO( T(RBRC), END ) );
+ }
+ return MACRO_NONE;
+}
+
+/*
+ * Action function
+ */
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+/*
+ keyevent_t event = record->event;
+ uint8_t tap_count = record->tap_count;
+ switch (id) {
+ case 0xFF:
+ action_macro_play(get_macro(opt, event.pressed));
+ break;
+ }
+*/
+}
+
+
+/*
+ * Fn actions
+ */
+static const uint16_t PROGMEM fn_actions[] = {
+ ACTION_LAYER_TAP_TOGGLE(0), // FN0
+ ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1
+ ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2
+ ACTION_LAYER_MOMENTARY(2), // FN3
+ ACTION_MACRO(LBRACKET), // FN4
+ ACTION_MACRO(RBRACKET), // FN5
+ ACTION_MACRO(DUMMY), // FN6
+};
+
+
+
+
+
+
+/*
+ * No need to edit.
+ */
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/converter/pc98_usb/led.c b/converter/pc98_usb/led.c
new file mode 100644
index 0000000000..48c3f1c2b2
--- /dev/null
+++ b/converter/pc98_usb/led.c
@@ -0,0 +1,33 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "serial.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ uint8_t sun_led = 0;
+ if (usb_led & (1<<USB_LED_NUM_LOCK)) sun_led |= (1<<0);
+ if (usb_led & (1<<USB_LED_COMPOSE)) sun_led |= (1<<1);
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
+
+ serial_send(0x0E);
+ serial_send(sun_led);
+}
diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c
new file mode 100644
index 0000000000..8833e0a851
--- /dev/null
+++ b/converter/pc98_usb/matrix.c
@@ -0,0 +1,211 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "matrix.h"
+#include "debug.h"
+#include "protocol/serial.h"
+
+
+/*
+ * Matrix Array usage:
+ *
+ * ROW: 16(4bits)
+ * COL: 8(3bits)
+ *
+ * 8bit wide
+ * +---------+
+ * 0|00 ... 07|
+ * 1|08 ... 0F|
+ * :| ... |
+ * :| ... |
+ * E|70 ... 77|
+ * F|78 ... 7F|
+ * +---------+
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) ((code>>3)&0xF)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+static void pc98_inhibit_repeat(void)
+{
+ uint8_t code;
+
+ while (serial_recv()) ;
+RETRY:
+ PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ _delay_ms(500);
+ serial_send(0x9C);
+
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+ _delay_ms(100);
+ while (!(code = serial_recv())) ;
+ print("PC98: send 9C: "); print_hex8(code); print("\n");
+ if (code != 0xFA) goto RETRY;
+
+
+
+ PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ _delay_ms(100);
+ serial_send(0x70);
+
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+ _delay_ms(100);
+ //code = serial_recv();
+ while (!(code = serial_recv())) ;
+ print("PC98: send 70: "); print_hex8(code); print("\n");
+ if (code != 0xFA) goto RETRY;
+}
+
+void matrix_init(void)
+{
+ PC98_RST_DDR |= (1<<PC98_RST_BIT);
+ PC98_RDY_DDR |= (1<<PC98_RDY_BIT);
+ PC98_RTY_DDR |= (1<<PC98_RTY_BIT);
+ PC98_RST_PORT |= (1<<PC98_RST_BIT);
+ PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ PC98_RTY_PORT |= (1<<PC98_RTY_BIT);
+
+
+ serial_init();
+
+ // PC98 reset
+/*
+ PC98_RST_PORT &= ~(1<<PC98_RST_BIT);
+ _delay_us(15);
+ PC98_RST_PORT |= (1<<PC98_RST_BIT);
+ _delay_us(13);
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+*/
+
+ _delay_ms(500);
+ pc98_inhibit_repeat();
+
+
+ // PC98 ready
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ debug("init\n");
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ is_modified = false;
+
+ uint16_t code;
+ PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ _delay_us(30);
+ code = serial_recv2();
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+ if (code == -1) return 0;
+
+if (code == 0x60) {
+ pc98_inhibit_repeat();
+
+/*
+ PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
+ _delay_ms(100);
+ serial_send(0x96);
+ PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
+*/
+
+ return 0;
+}
+
+ print_hex8(code); print(" ");
+
+ if (code&0x80) {
+ // break code
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+ } else {
+ // make code
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= (1<<COL(code));
+ is_modified = true;
+ }
+ }
+ return code;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile
new file mode 100644
index 0000000000..edcbddfdfa
--- /dev/null
+++ b/converter/ps2_usb/Makefile
@@ -0,0 +1,105 @@
+#
+# Makefile for Teensy
+#
+# Target file name (without extension).
+TARGET = ps2_usb_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# 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=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
+NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# PS/2 Options
+#
+PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.mbed b/converter/ps2_usb/Makefile.mbed
new file mode 100644
index 0000000000..eeb5ad9d5e
--- /dev/null
+++ b/converter/ps2_usb/Makefile.mbed
@@ -0,0 +1,46 @@
+PROJECT = ps2_usb
+
+TMK_DIR = ../../tmk_core
+MBED_DIR = $(TMK_DIR)/mbed-sdk
+
+#VPATH += $(MBED_DIR):$(TMK_DIR)
+vpath %.s .:$(MBED_DIR):$(TMK_DIR)
+vpath %.c .:$(MBED_DIR):$(TMK_DIR)
+vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
+
+OBJDIR = ./build
+
+OBJECTS = \
+ $(OBJDIR)/protocol/ps2_busywait.o \
+ $(OBJDIR)/protocol/ps2_io_mbed.o \
+ $(OBJDIR)/./keymap_common.o \
+ $(OBJDIR)/./matrix.o \
+ $(OBJDIR)/./led.o \
+ $(OBJDIR)/./main.o
+
+ifdef KEYMAP
+ OBJECTS := $(OBJDIR)/keymap_$(KEYMAP).o $(OBJECTS)
+else
+ OBJECTS := $(OBJDIR)/keymap_plain.o $(OBJECTS)
+endif
+
+CONFIG_H = config_mbed.h
+
+SYS_OBJECTS =
+
+INCLUDE_PATHS = -I.
+
+LIBRARY_PATHS =
+LIBRARIES =
+
+# Build Options
+# Comment out to disable
+#BOOTMAGIC_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+
+
+#include $(TMK_DIR)/tool/mbed/mk20d50m.mk
+include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk
+include $(TMK_DIR)/tool/mbed/mbed.mk
+include $(TMK_DIR)/tool/mbed/common.mk
+include $(TMK_DIR)/tool/mbed/gcc.mk
diff --git a/converter/ps2_usb/Makefile.pjrc b/converter/ps2_usb/Makefile.pjrc
new file mode 100644
index 0000000000..64319aca88
--- /dev/null
+++ b/converter/ps2_usb/Makefile.pjrc
@@ -0,0 +1,75 @@
+# Target file name (without extension).
+TARGET = ps2_usb_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# 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_plain.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
+
+
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = yes # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+NKRO_ENABLE = yes # USB Nkey Rollover
+
+
+# PS/2 Options
+#
+#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.tmk_rev1 b/converter/ps2_usb/Makefile.tmk_rev1
new file mode 100644
index 0000000000..6aaef49969
--- /dev/null
+++ b/converter/ps2_usb/Makefile.tmk_rev1
@@ -0,0 +1,98 @@
+#
+# Makefile for TMK keyboard converter rev2
+# https://github.com/tmk/keyboard_converter#pcb-rev1
+#
+# Target file name (without extension).
+TARGET = ps2_usb_tmk_rev1
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config_tmk_rev1.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)
+
+
+# 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
+
+
+# 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
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# PS/2 Options
+#
+PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.tmk_rev2 b/converter/ps2_usb/Makefile.tmk_rev2
new file mode 100644
index 0000000000..5049a22703
--- /dev/null
+++ b/converter/ps2_usb/Makefile.tmk_rev2
@@ -0,0 +1,98 @@
+#
+# Makefile for TMK keyboard converter rev2
+# https://github.com/tmk/keyboard_converter#pcb-rev2
+#
+# Target file name (without extension).
+TARGET = ps2_usb_tmk_rev2
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config_tmk_rev2.h
+
+
+# MCU name
+MCU = atmega32u2
+
+# 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)
+
+
+# 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
+
+
+# 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
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# PS/2 Options
+#
+PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb
new file mode 100644
index 0000000000..8af5c5b083
--- /dev/null
+++ b/converter/ps2_usb/Makefile.vusb
@@ -0,0 +1,107 @@
+# Target file name (without extension).
+TARGET = ps2_usb_vusb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# 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_plain.c $(SRC)
+endif
+
+# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
+SRC += protocol/ps2_usart.c
+OPT_DEFS += -DPS2_USE_USART
+
+CONFIG_H = config.h
+
+
+# V-USB debug level: To use ps2_usart.c level must be 0
+# ps2_usart.c requires USART to receive PS/2 signal.
+OPT_DEFS += -DDEBUG_LEVEL=0
+
+
+# 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
+MCU = atmega168
+
+
+# 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 = 20000000
+
+
+# Build Options
+# comment out to disable the options.
+#
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+#NKRO_ENABLE = yes # USB Nkey Rollover
+NO_UART = yes # UART is unavailable
+
+
+
+#---------------- Programming Options --------------------------
+AVRDUDE = avrdude
+# Type: avrdude -c ? to get a full listing.
+AVRDUDE_PROGRAMMER = usbasp
+AVRDUDE_PORT =
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBasp 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=2048
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/README.md b/converter/ps2_usb/README.md
new file mode 100644
index 0000000000..8a535949d8
--- /dev/null
+++ b/converter/ps2_usb/README.md
@@ -0,0 +1,84 @@
+PS/2 to USB keyboard converter
+==============================
+This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set 2.)
+
+
+Connect Wires
+-------------
+In case of Teensy2.0(ATMega32U4):
+
+1. Connect **Vcc** and **GND**.
+2. Connect **Clock** and **Data** line.
+ - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible)
+ - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`.
+ - **USART**: **Clock** is on `PD5` and **Data** on `PD2`.
+3. Optionally you need pull-up resistor. 1K-10K Ohm is OK.
+
+To change pin configuration edit config.h.
+
+
+Build Firmware
+--------------
+For **PJRC Teensy** just run `make`:
+
+ $ make clean
+ $ make
+
+To select keymap:
+
+ $ make clean
+ $ make KEYMAP=[plain|jis|spacefn|...]
+
+After that you will find HEX file `ps2_usb_lufa.hex` in current directory.
+
+
+- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`.
+
+- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`.
+
+
+Keymap
+------
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in README.md of top directory) and existent keymap files.
+
+
+PS/2 signal handling implementations
+------------------------------------
+Following three methods can be used to implement PS/2 signal handling.
+
+### Simple and stupid busy-wait(ps2_busywait.c)
+ This is expected to implemented with portable C code for reference.
+### Interrupt driven(ps2_interrupt.c)
+ Uses pin interrupt to detect falling edge of clock line.
+### USART hardware module(ps2_usart.c)
+ Uses AVR USART engine to receive PS/2 signal.
+
+To select method edit Makefile.
+
+
+V-USB Support
+-------------
+With V-USB you can use this converter on ATmega(168/328) but it doesn't support NKRO at this time.
+
+Circuit:
+
+ +---+ +---------------+
+ USB GND | | ATmega168 |
+ === C3 | |
+ 5V <-------+--------+---|Vcc,AVCC | PS/2
+ R1 | | ====
+ D- <----+--+-----R2-----|INT1 RXD|------->DATA
+ D+ <----|---+----R3-----|INT0 XCK|------->CLOCK
+ Z1 Z2 | | ->5V
+ GND<----+---+--+--+-----|GND | ->GND
+ | | | |
+ | C2-+--|XTAL1 |
+ | X1 | |
+ +--C3-+--|XTAL2 |
+ +---------------+
+ R1: 1.5K Ohm
+ R2,R3: 68 Ohm
+ Z1,Z2: Zenner 3.6V
+ C1,C2: 22pF
+ C3: 0.1uF
+ X1: Crystal 20MHz(16MHz/12MHz)
diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h
new file mode 100644
index 0000000000..c9bab1b072
--- /dev/null
+++ b/converter/ps2_usb/config.h
@@ -0,0 +1,173 @@
+/*
+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 <avr/interrupt.h>
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6512
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2 keyboard converter
+#define DESCRIPTION convert PS/2 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 32 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+//#define NO_SUSPEND_POWER_DOWN
+
+
+/*
+ * PS/2 Busywait
+ */
+#ifdef PS2_USE_BUSYWAIT
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+#endif
+
+/*
+ * PS/2 Pin interrupt
+ */
+#ifdef PS2_USE_INT
+/* uses INT1 for clock line(ATMega32U4) */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+#define PS2_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define PS2_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define PS2_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define PS2_INT_VECT INT1_vect
+#endif
+
+/*
+ * PS/2 USART
+ */
+#ifdef PS2_USE_USART
+#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
+/* XCK for clock line and RXD for data line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR1C = ((1 << UMSEL10) | \
+ (3 << UPM10) | \
+ (0 << USBS1) | \
+ (3 << UCSZ10) | \
+ (0 << UCPOL1)); \
+ UCSR1A = 0; \
+ UBRR1H = 0; \
+ UBRR1L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR1B = ((1 << RXCIE1) | \
+ (1 << RXEN1)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR1B = (1 << RXEN1); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR1C = 0; \
+ UCSR1B &= ~((1 << RXEN1) | \
+ (1 << TXEN1)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
+#define PS2_USART_RX_DATA UDR1
+#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
+#define PS2_USART_RX_VECT USART1_RX_vect
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
+/* XCK for clock line and RXD for data line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 4
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR0C = ((1 << UMSEL00) | \
+ (3 << UPM00) | \
+ (0 << USBS0) | \
+ (3 << UCSZ00) | \
+ (0 << UCPOL0)); \
+ UCSR0A = 0; \
+ UBRR0H = 0; \
+ UBRR0L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR0B = ((1 << RXCIE0) | \
+ (1 << RXEN0)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR0B = (1 << RXEN0); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR0C = 0; \
+ UCSR0B &= ~((1 << RXEN0) | \
+ (1 << TXEN0)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
+#define PS2_USART_RX_DATA UDR0
+#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
+#define PS2_USART_RX_VECT USART_RX_vect
+#endif
+#endif
+
+#endif
diff --git a/converter/ps2_usb/config_mbed.h b/converter/ps2_usb/config_mbed.h
new file mode 100644
index 0000000000..5819763e65
--- /dev/null
+++ b/converter/ps2_usb/config_mbed.h
@@ -0,0 +1,60 @@
+/*
+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_MBED_H
+#define CONFIG_MBED_H
+
+
+#if 0
+// duplicated name against mbed USBDeivce
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6512
+#endif
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2 keyboard converter
+#define DESCRIPTION convert PS/2 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 32 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+/*
+ * PS/2 Busywait
+ */
+#ifdef PS2_USE_BUSYWAIT
+# define PS2_CLOCK_PORT PORTD
+# define PS2_CLOCK_PIN PIND
+# define PS2_CLOCK_DDR DDRD
+# define PS2_CLOCK_BIT 5
+# define PS2_DATA_PORT PORTD
+# define PS2_DATA_PIN PIND
+# define PS2_DATA_DDR DDRD
+# define PS2_DATA_BIT 2
+#endif
+
+
+#endif
diff --git a/converter/ps2_usb/config_tmk_rev1.h b/converter/ps2_usb/config_tmk_rev1.h
new file mode 100644
index 0000000000..75dc97df38
--- /dev/null
+++ b/converter/ps2_usb/config_tmk_rev1.h
@@ -0,0 +1,147 @@
+/*
+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 <avr/interrupt.h>
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6512
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2 keyboard converter
+#define DESCRIPTION convert PS/2 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 32 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+//#define NO_SUSPEND_POWER_DOWN
+
+
+/*
+ * PS/2 Busywait
+ */
+#ifdef PS2_USE_BUSYWAIT
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+#endif
+
+/*
+ * PS/2 USART
+ */
+#ifdef PS2_USE_USART
+#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
+/* XCK for clock line and RXD for data line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR1C = ((1 << UMSEL10) | \
+ (3 << UPM10) | \
+ (0 << USBS1) | \
+ (3 << UCSZ10) | \
+ (0 << UCPOL1)); \
+ UCSR1A = 0; \
+ UBRR1H = 0; \
+ UBRR1L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR1B = ((1 << RXCIE1) | \
+ (1 << RXEN1)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR1B = (1 << RXEN1); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR1C = 0; \
+ UCSR1B &= ~((1 << RXEN1) | \
+ (1 << TXEN1)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
+#define PS2_USART_RX_DATA UDR1
+#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
+#define PS2_USART_RX_VECT USART1_RX_vect
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
+/* XCK for clock line and RXD for data line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 4
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR0C = ((1 << UMSEL00) | \
+ (3 << UPM00) | \
+ (0 << USBS0) | \
+ (3 << UCSZ00) | \
+ (0 << UCPOL0)); \
+ UCSR0A = 0; \
+ UBRR0H = 0; \
+ UBRR0L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR0B = ((1 << RXCIE0) | \
+ (1 << RXEN0)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR0B = (1 << RXEN0); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR0C = 0; \
+ UCSR0B &= ~((1 << RXEN0) | \
+ (1 << TXEN0)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
+#define PS2_USART_RX_DATA UDR0
+#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
+#define PS2_USART_RX_VECT USART_RX_vect
+#endif
+#endif
+
+#endif
diff --git a/converter/ps2_usb/config_tmk_rev2.h b/converter/ps2_usb/config_tmk_rev2.h
new file mode 100644
index 0000000000..2e91838e28
--- /dev/null
+++ b/converter/ps2_usb/config_tmk_rev2.h
@@ -0,0 +1,85 @@
+/*
+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 <avr/interrupt.h>
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6512
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2 keyboard converter
+#define DESCRIPTION convert PS/2 keyboard to USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 32 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+//#define NO_SUSPEND_POWER_DOWN
+
+
+/*
+ * PS/2 Busywait
+ */
+#ifdef PS2_USE_BUSYWAIT
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+#endif
+
+/*
+ * PS/2 Pin interrupt
+ */
+#ifdef PS2_USE_INT
+/* uses INT1 for clock line(ATMega32U4) */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+#define PS2_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define PS2_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define PS2_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define PS2_INT_VECT INT1_vect
+#endif
+
+#endif
diff --git a/converter/ps2_usb/keymap_common.c b/converter/ps2_usb/keymap_common.c
new file mode 100644
index 0000000000..e344fb4167
--- /dev/null
+++ b/converter/ps2_usb/keymap_common.c
@@ -0,0 +1,31 @@
+/*
+Copyright 2011,2012,2013 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/>.
+*/
+#include "keymap_common.h"
+#include "progmem.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/ps2_usb/keymap_common.h b/converter/ps2_usb/keymap_common.h
new file mode 100644
index 0000000000..d783e01ded
--- /dev/null
+++ b/converter/ps2_usb/keymap_common.h
@@ -0,0 +1,173 @@
+/*
+Copyright 2011,2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+// 32*8(256) byte array which converts PS/2 code into USB code
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* All keys */
+#define KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ K61, /* for European ISO */ \
+ K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
+ K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
+ KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
+ KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
+ KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
+ KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
+ K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
+ KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
+) { \
+ { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
+ { KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
+ { KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
+ { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
+ { KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K83, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
+ { KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
+ { KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
+ { KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
+ { KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
+ { KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
+ { KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
+ { KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
+ { KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
+}
+
+/* US layout */
+#define KEYMAP( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ NUBS, \
+ RO, KANA, JYEN, HENK, MHEN, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+/* ISO layout */
+#define KEYMAP_ISO( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
+ K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ K61, \
+ RO, KANA, JYEN, HENK, MHEN, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+/* JIS layout */
+#define KEYMAP_JIS( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ NUBS, \
+ K51, K13, K6A, K64, K67, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+#endif
diff --git a/converter/ps2_usb/keymap_jis.c b/converter/ps2_usb/keymap_jis.c
new file mode 100644
index 0000000000..02585150fb
--- /dev/null
+++ b/converter/ps2_usb/keymap_jis.c
@@ -0,0 +1,34 @@
+/*
+ * JIS layout Japanese keyboard
+ */
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: JIS LAYOUT
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| JY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | |Del|End|PgD| | 7| 8| 9| |
+ * |------------------------------------------------------` | `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| :| \| | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt |MHEN| Space |HENK|KANA|Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP_JIS(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, MHEN,SPC, HENK,KANA, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/ps2_usb/keymap_plain.c b/converter/ps2_usb/keymap_plain.c
new file mode 100644
index 0000000000..51b2fddb5b
--- /dev/null
+++ b/converter/ps2_usb/keymap_plain.c
@@ -0,0 +1,32 @@
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/ps2_usb/keymap_spacefn.c b/converter/ps2_usb/keymap_spacefn.c
new file mode 100644
index 0000000000..bffd2bc606
--- /dev/null
+++ b/converter/ps2_usb/keymap_spacefn.c
@@ -0,0 +1,61 @@
+/*
+ * SpaceFN layout
+ * http://geekhack.org/index.php?topic=51069.0
+ */
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 1: SpaceFN
+ * ,-----------------------------------------------------------.
+ * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ * |-----------------------------------------------------------|
+ * | | | | | | |PgU|Lef|Dow|Rig| | | |
+ * |-----------------------------------------------------------|
+ * | | | | | |Spc|PgD|` |~ | |Men| |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+};
+
diff --git a/converter/ps2_usb/led.c b/converter/ps2_usb/led.c
new file mode 100644
index 0000000000..e448e84ec7
--- /dev/null
+++ b/converter/ps2_usb/led.c
@@ -0,0 +1,33 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "ps2.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ uint8_t ps2_led = 0;
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ ps2_led |= (1<<PS2_LED_NUM_LOCK);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ ps2_led |= (1<<PS2_LED_CAPS_LOCK);
+ ps2_host_set_led(ps2_led);
+}
diff --git a/converter/ps2_usb/main.cpp b/converter/ps2_usb/main.cpp
new file mode 100644
index 0000000000..860af149a0
--- /dev/null
+++ b/converter/ps2_usb/main.cpp
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "debug.h"
+#include "timer.h"
+#include "action.h"
+#include "keycode.h"
+#include "host.h"
+#include "host_driver.h"
+#include "mbed_driver.h"
+
+
+// Button and LEDs of LPC11U35 board
+DigitalIn isp(P0_1); // ISP button
+DigitalOut led_red(P0_20);
+DigitalOut led_green(P0_21);
+
+
+int main(void) {
+ isp.mode(PullUp);
+ led_red = 1;
+ led_green = 0;
+
+ timer_init();
+ host_set_driver(&mbed_driver);
+ keyboard_init();
+
+ //debug_enable = true;
+ xprintf("mbed_onekey ver.eee:\r\n");
+
+
+ bool last_isp = isp;
+ while (1) {
+ keyboard_task();
+
+ //led_green = !led_green;
+ if (last_isp == isp) continue;
+ last_isp = isp;
+ if (last_isp == 0) {
+ led_red = 0; // on
+ dprintf("timer: %i\r\n", timer_read());
+ //register_code(KC_A);
+ } else {
+ led_red = 1; // off
+ //unregister_code(KC_A);
+ }
+ }
+}
diff --git a/converter/ps2_usb/matrix.c b/converter/ps2_usb/matrix.c
new file mode 100644
index 0000000000..45cf2a4a90
--- /dev/null
+++ b/converter/ps2_usb/matrix.c
@@ -0,0 +1,486 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "action.h"
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "ps2.h"
+#include "matrix.h"
+
+
+static void matrix_make(uint8_t code);
+static void matrix_break(uint8_t code);
+static void matrix_clear(void);
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+
+
+/*
+ * Matrix Array usage:
+ * 'Scan Code Set 2' is assigned into 256(32x8)cell matrix.
+ * Hmm, it is very sparse and not efficient :(
+ *
+ * Notes:
+ * Both 'Hanguel/English'(F1) and 'Hanja'(F2) collide with 'Delete'(E0 71) and 'Down'(E0 72).
+ * These two Korean keys need exceptional handling and are not supported for now. Sorry.
+ *
+ * 8bit wide
+ * +---------+
+ * 0| |
+ * :| XX | 00-7F for normal codes(without E0-prefix)
+ * f|_________|
+ * 10| |
+ * :| E0 YY | 80-FF for E0-prefixed codes
+ * 1f| | (<YY>|0x80) is used as matrix position.
+ * +---------+
+ *
+ * Exceptions:
+ * 0x83: F7(0x83) This is a normal code but beyond 0x7F.
+ * 0xFC: PrintScreen
+ * 0xFE: Pause
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) (code>>3)
+#define COL(code) (code&0x07)
+
+// matrix positions for exceptional keys
+#define F7 (0x83)
+#define PRINT_SCREEN (0xFC)
+#define PAUSE (0xFE)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ ps2_host_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+/*
+ * PS/2 Scan Code Set 2: Exceptional Handling
+ *
+ * There are several keys to be handled exceptionally.
+ * The scan code for these keys are varied or prefix/postfix'd
+ * depending on modifier key state.
+ *
+ * Keyboard Scan Code Specification:
+ * http://www.microsoft.com/whdc/archive/scancode.mspx
+ * http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc
+ *
+ *
+ * 1) Insert, Delete, Home, End, PageUp, PageDown, Up, Down, Right, Left
+ * a) when Num Lock is off
+ * modifiers | make | break
+ * ----------+---------------------------+----------------------
+ * Ohter | <make> | <break>
+ * LShift | E0 F0 12 <make> | <break> E0 12
+ * RShift | E0 F0 59 <make> | <break> E0 59
+ * L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
+ *
+ * b) when Num Lock is on
+ * modifiers | make | break
+ * ----------+---------------------------+----------------------
+ * Other | E0 12 <make> | <break> E0 F0 12
+ * Shift'd | <make> | <break>
+ *
+ * Handling: These prefix/postfix codes are ignored.
+ *
+ *
+ * 2) Keypad /
+ * modifiers | make | break
+ * ----------+---------------------------+----------------------
+ * Ohter | <make> | <break>
+ * LShift | E0 F0 12 <make> | <break> E0 12
+ * RShift | E0 F0 59 <make> | <break> E0 59
+ * L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
+ *
+ * Handling: These prefix/postfix codes are ignored.
+ *
+ *
+ * 3) PrintScreen
+ * modifiers | make | break
+ * ----------+--------------+-----------------------------------
+ * Other | E0 12 E0 7C | E0 F0 7C E0 F0 12
+ * Shift'd | E0 7C | E0 F0 7C
+ * Control'd | E0 7C | E0 F0 7C
+ * Alt'd | 84 | F0 84
+ *
+ * Handling: These prefix/postfix codes are ignored, and both scan codes
+ * 'E0 7C' and 84 are seen as PrintScreen.
+ *
+ * 4) Pause
+ * modifiers | make(no break code)
+ * ----------+--------------------------------------------------
+ * Other | E1 14 77 E1 F0 14 F0 77
+ * Control'd | E0 7E E0 F0 7E
+ *
+ * Handling: Both code sequences are treated as a whole.
+ * And we need a ad hoc 'pseudo break code' hack to get the key off
+ * because it has no break code.
+ *
+ */
+uint8_t matrix_scan(void)
+{
+
+ // scan code reading states
+ static enum {
+ INIT,
+ F0,
+ E0,
+ E0_F0,
+ // Pause
+ E1,
+ E1_14,
+ E1_14_77,
+ E1_14_77_E1,
+ E1_14_77_E1_F0,
+ E1_14_77_E1_F0_14,
+ E1_14_77_E1_F0_14_F0,
+ // Control'd Pause
+ E0_7E,
+ E0_7E_E0,
+ E0_7E_E0_F0,
+ } state = INIT;
+
+
+ is_modified = false;
+
+ // 'pseudo break code' hack
+ if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) {
+ matrix_break(PAUSE);
+ }
+
+ uint8_t code = ps2_host_recv();
+ if (code) xprintf("%i\r\n", code);
+ if (!ps2_error) {
+ switch (state) {
+ case INIT:
+ switch (code) {
+ case 0xE0:
+ state = E0;
+ break;
+ case 0xF0:
+ state = F0;
+ break;
+ case 0xE1:
+ state = E1;
+ break;
+ case 0x83: // F7
+ matrix_make(F7);
+ state = INIT;
+ break;
+ case 0x84: // Alt'd PrintScreen
+ matrix_make(PRINT_SCREEN);
+ state = INIT;
+ break;
+ case 0x00: // Overrun [3]p.25
+ matrix_clear();
+ clear_keyboard();
+ print("Overrun\n");
+ state = INIT;
+ break;
+ default: // normal key make
+ if (code < 0x80) {
+ matrix_make(code);
+ } else {
+ matrix_clear();
+ clear_keyboard();
+ xprintf("unexpected scan code at INIT: %02X\n", code);
+ }
+ state = INIT;
+ }
+ break;
+ case E0: // E0-Prefixed
+ switch (code) {
+ case 0x12: // to be ignored
+ case 0x59: // to be ignored
+ state = INIT;
+ break;
+ case 0x7E: // Control'd Pause
+ state = E0_7E;
+ break;
+ case 0xF0:
+ state = E0_F0;
+ break;
+ default:
+ if (code < 0x80) {
+ matrix_make(code|0x80);
+ } else {
+ matrix_clear();
+ clear_keyboard();
+ xprintf("unexpected scan code at E0: %02X\n", code);
+ }
+ state = INIT;
+ }
+ break;
+ case F0: // Break code
+ switch (code) {
+ case 0x83: // F7
+ matrix_break(F7);
+ state = INIT;
+ break;
+ case 0x84: // Alt'd PrintScreen
+ matrix_break(PRINT_SCREEN);
+ state = INIT;
+ break;
+ case 0xF0:
+ matrix_clear();
+ clear_keyboard();
+ xprintf("unexpected scan code at F0: F0(clear and cont.)\n");
+ break;
+ default:
+ if (code < 0x80) {
+ matrix_break(code);
+ } else {
+ matrix_clear();
+ clear_keyboard();
+ xprintf("unexpected scan code at F0: %02X\n", code);
+ }
+ state = INIT;
+ }
+ break;
+ case E0_F0: // Break code of E0-prefixed
+ switch (code) {
+ case 0x12: // to be ignored
+ case 0x59: // to be ignored
+ state = INIT;
+ break;
+ default:
+ if (code < 0x80) {
+ matrix_break(code|0x80);
+ } else {
+ matrix_clear();
+ clear_keyboard();
+ xprintf("unexpected scan code at E0_F0: %02X\n", code);
+ }
+ state = INIT;
+ }
+ break;
+ // following are states of Pause
+ case E1:
+ switch (code) {
+ case 0x14:
+ state = E1_14;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14:
+ switch (code) {
+ case 0x77:
+ state = E1_14_77;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14_77:
+ switch (code) {
+ case 0xE1:
+ state = E1_14_77_E1;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14_77_E1:
+ switch (code) {
+ case 0xF0:
+ state = E1_14_77_E1_F0;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14_77_E1_F0:
+ switch (code) {
+ case 0x14:
+ state = E1_14_77_E1_F0_14;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14_77_E1_F0_14:
+ switch (code) {
+ case 0xF0:
+ state = E1_14_77_E1_F0_14_F0;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ case E1_14_77_E1_F0_14_F0:
+ switch (code) {
+ case 0x77:
+ matrix_make(PAUSE);
+ state = INIT;
+ break;
+ default:
+ state = INIT;
+ }
+ break;
+ // Following are states of Control'd Pause
+ case E0_7E:
+ if (code == 0xE0)
+ state = E0_7E_E0;
+ else
+ state = INIT;
+ break;
+ case E0_7E_E0:
+ if (code == 0xF0)
+ state = E0_7E_E0_F0;
+ else
+ state = INIT;
+ break;
+ case E0_7E_E0_F0:
+ if (code == 0x7E)
+ matrix_make(PAUSE);
+ state = INIT;
+ break;
+ default:
+ state = INIT;
+ }
+ }
+
+ // TODO: request RESEND when error occurs?
+/*
+ if (PS2_IS_FAILED(ps2_error)) {
+ uint8_t ret = ps2_host_send(PS2_RESEND);
+ xprintf("Resend: %02X\n", ret);
+ }
+*/
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+#ifdef MATRIX_HAS_GHOST
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_has_ghost_in_row(i))
+ return true;
+ }
+#endif
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]) == matrix[row])
+ return true;
+ }
+ return false;
+}
+#endif
+
+
+inline
+static void matrix_make(uint8_t code)
+{
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= 1<<COL(code);
+ is_modified = true;
+ }
+}
+
+inline
+static void matrix_break(uint8_t code)
+{
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+}
+
+inline
+static void matrix_clear(void)
+{
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+}
diff --git a/converter/ps2_usb/usbconfig.h b/converter/ps2_usb/usbconfig.h
new file mode 100644
index 0000000000..d0ca4c717e
--- /dev/null
+++ b/converter/ps2_usb/usbconfig.h
@@ -0,0 +1,377 @@
+/* Name: usbconfig.h
+ * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
+ * Author: Christian Starkjohann
+ * Creation Date: 2005-04-01
+ * Tabsize: 4
+ * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
+ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
+ * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
+ */
+
+#ifndef __usbconfig_h_included__
+#define __usbconfig_h_included__
+
+
+/*
+General Description:
+This file is an example configuration (with inline documentation) for the USB
+driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
+also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
+wire the lines to any other port, as long as D+ is also wired to INT0 (or any
+other hardware interrupt, as long as it is the highest level interrupt, see
+section at the end of this file).
+*/
+
+/* ---------------------------- Hardware Config ---------------------------- */
+
+#define USB_CFG_IOPORTNAME D
+/* This is the port where the USB bus is connected. When you configure it to
+ * "B", the registers PORTB, PINB and DDRB will be used.
+ */
+#define USB_CFG_DMINUS_BIT 3
+/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
+ * This may be any bit in the port.
+ */
+#define USB_CFG_DPLUS_BIT 2
+/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
+ * This may be any bit in the port. Please note that D+ must also be connected
+ * to interrupt pin INT0! [You can also use other interrupts, see section
+ * "Optional MCU Description" below, or you can connect D- to the interrupt, as
+ * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
+ * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
+ * markers every millisecond.]
+ */
+#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
+/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
+ * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
+ * require no crystal, they tolerate +/- 1% deviation from the nominal
+ * frequency. All other rates require a precision of 2000 ppm and thus a
+ * crystal!
+ * Since F_CPU should be defined to your actual clock rate anyway, you should
+ * not need to modify this setting.
+ */
+#define USB_CFG_CHECK_CRC 0
+/* Define this to 1 if you want that the driver checks integrity of incoming
+ * data packets (CRC checks). CRC checks cost quite a bit of code size and are
+ * currently only available for 18 MHz crystal clock. You must choose
+ * USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
+ */
+
+/* ----------------------- Optional Hardware Config ------------------------ */
+
+/* #define USB_CFG_PULLUP_IOPORTNAME D */
+/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
+ * V+, you can connect and disconnect the device from firmware by calling
+ * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
+ * This constant defines the port on which the pullup resistor is connected.
+ */
+/* #define USB_CFG_PULLUP_BIT 4 */
+/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
+ * above) where the 1.5k pullup resistor is connected. See description
+ * above for details.
+ */
+
+/* --------------------------- Functional Range ---------------------------- */
+
+#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
+/* Define this to 1 if you want to compile a version with two endpoints: The
+ * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
+ * number).
+ */
+#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
+/* Define this to 1 if you want to compile a version with three endpoints: The
+ * default control endpoint 0, an interrupt-in endpoint 3 (or the number
+ * configured below) and a catch-all default interrupt-in endpoint as above.
+ * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
+ */
+#define USB_CFG_EP3_NUMBER 3
+/* If the so-called endpoint 3 is used, it can now be configured to any other
+ * endpoint number (except 0) with this macro. Default if undefined is 3.
+ */
+/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
+/* The above macro defines the startup condition for data toggling on the
+ * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
+ * Since the token is toggled BEFORE sending any data, the first packet is
+ * sent with the oposite value of this configuration!
+ */
+#define USB_CFG_IMPLEMENT_HALT 0
+/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
+ * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
+ * it is required by the standard. We have made it a config option because it
+ * bloats the code considerably.
+ */
+#define USB_CFG_SUPPRESS_INTR_CODE 0
+/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
+ * want to send any data over them. If this macro is defined to 1, functions
+ * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
+ * you need the interrupt-in endpoints in order to comply to an interface
+ * (e.g. HID), but never want to send any data. This option saves a couple
+ * of bytes in flash memory and the transmit buffers in RAM.
+ */
+#define USB_CFG_INTR_POLL_INTERVAL 10
+/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
+ * interval. The value is in milliseconds and must not be less than 10 ms for
+ * low speed devices.
+ */
+#define USB_CFG_IS_SELF_POWERED 0
+/* Define this to 1 if the device has its own power supply. Set it to 0 if the
+ * device is powered from the USB bus.
+ */
+#define USB_CFG_MAX_BUS_POWER 100
+/* Set this variable to the maximum USB bus power consumption of your device.
+ * The value is in milliamperes. [It will be divided by two since USB
+ * communicates power requirements in units of 2 mA.]
+ */
+#define USB_CFG_IMPLEMENT_FN_WRITE 1
+/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
+ * transfers. Set it to 0 if you don't need it and want to save a couple of
+ * bytes.
+ */
+#define USB_CFG_IMPLEMENT_FN_READ 0
+/* Set this to 1 if you need to send control replies which are generated
+ * "on the fly" when usbFunctionRead() is called. If you only want to send
+ * data from a static buffer, set it to 0 and return the data from
+ * usbFunctionSetup(). This saves a couple of bytes.
+ */
+#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
+/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
+ * You must implement the function usbFunctionWriteOut() which receives all
+ * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
+ * can be found in 'usbRxToken'.
+ */
+#define USB_CFG_HAVE_FLOWCONTROL 0
+/* Define this to 1 if you want flowcontrol over USB data. See the definition
+ * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
+ * usbdrv.h.
+ */
+#define USB_CFG_DRIVER_FLASH_PAGE 0
+/* If the device has more than 64 kBytes of flash, define this to the 64 k page
+ * where the driver's constants (descriptors) are located. Or in other words:
+ * Define this to 1 for boot loaders on the ATMega128.
+ */
+#define USB_CFG_LONG_TRANSFERS 0
+/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
+ * in a single control-in or control-out transfer. Note that the capability
+ * for long transfers increases the driver size.
+ */
+/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
+/* This macro is a hook if you want to do unconventional things. If it is
+ * defined, it's inserted at the beginning of received message processing.
+ * If you eat the received message and don't want default processing to
+ * proceed, do a return after doing your things. One possible application
+ * (besides debugging) is to flash a status LED on each packet.
+ */
+/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
+/* This macro is a hook if you need to know when an USB RESET occurs. It has
+ * one parameter which distinguishes between the start of RESET state and its
+ * end.
+ */
+/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
+/* This macro (if defined) is executed when a USB SET_ADDRESS request was
+ * received.
+ */
+#define USB_COUNT_SOF 0
+/* define this macro to 1 if you need the global variable "usbSofCount" which
+ * counts SOF packets. This feature requires that the hardware interrupt is
+ * connected to D- instead of D+.
+ */
+/* #ifdef __ASSEMBLER__
+ * macro myAssemblerMacro
+ * in YL, TCNT0
+ * sts timer0Snapshot, YL
+ * endm
+ * #endif
+ * #define USB_SOF_HOOK myAssemblerMacro
+ * This macro (if defined) is executed in the assembler module when a
+ * Start Of Frame condition is detected. It is recommended to define it to
+ * the name of an assembler macro which is defined here as well so that more
+ * than one assembler instruction can be used. The macro may use the register
+ * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
+ * immediately after an SOF pulse may be lost and must be retried by the host.
+ * What can you do with this hook? Since the SOF signal occurs exactly every
+ * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
+ * designs running on the internal RC oscillator.
+ * Please note that Start Of Frame detection works only if D- is wired to the
+ * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
+ */
+#define USB_CFG_CHECK_DATA_TOGGLING 0
+/* define this macro to 1 if you want to filter out duplicate data packets
+ * sent by the host. Duplicates occur only as a consequence of communication
+ * errors, when the host does not receive an ACK. Please note that you need to
+ * implement the filtering yourself in usbFunctionWriteOut() and
+ * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
+ * for each control- and out-endpoint to check for duplicate packets.
+ */
+#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
+/* define this macro to 1 if you want the function usbMeasureFrameLength()
+ * compiled in. This function can be used to calibrate the AVR's RC oscillator.
+ */
+#define USB_USE_FAST_CRC 0
+/* The assembler module has two implementations for the CRC algorithm. One is
+ * faster, the other is smaller. This CRC routine is only used for transmitted
+ * messages where timing is not critical. The faster routine needs 31 cycles
+ * per byte while the smaller one needs 61 to 69 cycles. The faster routine
+ * may be worth the 32 bytes bigger code size if you transmit lots of data and
+ * run the AVR close to its limit.
+ */
+
+/* -------------------------- Device Description --------------------------- */
+
+#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
+/* USB vendor ID for the device, low byte first. If you have registered your
+ * own Vendor ID, define it here. Otherwise you may use one of obdev's free
+ * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
+ * *** IMPORTANT NOTE ***
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
+ * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
+ * the implications!
+ */
+#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
+/* This is the ID of the product, low byte first. It is interpreted in the
+ * scope of the vendor ID. If you have registered your own VID with usb.org
+ * or if you have licensed a PID from somebody else, define it here. Otherwise
+ * you may use one of obdev's free shared VID/PID pairs. See the file
+ * USB-IDs-for-free.txt for details!
+ * *** IMPORTANT NOTE ***
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
+ * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
+ * the implications!
+ */
+#define USB_CFG_DEVICE_VERSION 0x00, 0x01
+/* Version number of the device: Minor number first, then major number.
+ */
+#define USB_CFG_VENDOR_NAME 't', '.', 'm', '.', 'k', '.'
+#define USB_CFG_VENDOR_NAME_LEN 6
+/* These two values define the vendor name returned by the USB device. The name
+ * must be given as a list of characters under single quotes. The characters
+ * are interpreted as Unicode (UTF-16) entities.
+ * If you don't want a vendor name string, undefine these macros.
+ * ALWAYS define a vendor name containing your Internet domain name if you use
+ * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
+ * details.
+ */
+#define USB_CFG_DEVICE_NAME 'P', 'S', '/', '2', ' ', 'k', 'e', 'y', 'b', 'o', 'a', 'r', 'd', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 't', 'e', 'r'
+#define USB_CFG_DEVICE_NAME_LEN 23
+/* Same as above for the device name. If you don't want a device name, undefine
+ * the macros. See the file USB-IDs-for-free.txt before you assign a name if
+ * you use a shared VID/PID.
+ */
+/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
+/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
+/* Same as above for the serial number. If you don't want a serial number,
+ * undefine the macros.
+ * It may be useful to provide the serial number through other means than at
+ * compile time. See the section about descriptor properties below for how
+ * to fine tune control over USB descriptors such as the string descriptor
+ * for the serial number.
+ */
+#define USB_CFG_DEVICE_CLASS 0
+#define USB_CFG_DEVICE_SUBCLASS 0
+/* See USB specification if you want to conform to an existing device class.
+ * Class 0xff is "vendor specific".
+ */
+#define USB_CFG_INTERFACE_CLASS 3 /* HID */
+#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
+#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
+/* See USB specification if you want to conform to an existing device class or
+ * protocol. The following classes must be set at interface level:
+ * HID class is 3, no subclass and protocol required (but may be useful!)
+ * CDC class is 2, use subclass 2 and protocol 1 for ACM
+ */
+#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
+/* Define this to the length of the HID report descriptor, if you implement
+ * an HID device. Otherwise don't define it or define it to 0.
+ * If you use this define, you must add a PROGMEM character array named
+ * "usbHidReportDescriptor" to your code which contains the report descriptor.
+ * Don't forget to keep the array and this define in sync!
+ */
+
+/* #define USB_PUBLIC static */
+/* Use the define above if you #include usbdrv.c instead of linking against it.
+ * This technique saves a couple of bytes in flash memory.
+ */
+
+/* ------------------- Fine Control over USB Descriptors ------------------- */
+/* If you don't want to use the driver's default USB descriptors, you can
+ * provide our own. These can be provided as (1) fixed length static data in
+ * flash memory, (2) fixed length static data in RAM or (3) dynamically at
+ * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
+ * information about this function.
+ * Descriptor handling is configured through the descriptor's properties. If
+ * no properties are defined or if they are 0, the default descriptor is used.
+ * Possible properties are:
+ * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
+ * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
+ * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
+ * you want RAM pointers.
+ * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
+ * in static memory is in RAM, not in flash memory.
+ * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
+ * the driver must know the descriptor's length. The descriptor itself is
+ * found at the address of a well known identifier (see below).
+ * List of static descriptor names (must be declared PROGMEM if in flash):
+ * char usbDescriptorDevice[];
+ * char usbDescriptorConfiguration[];
+ * char usbDescriptorHidReport[];
+ * char usbDescriptorString0[];
+ * int usbDescriptorStringVendor[];
+ * int usbDescriptorStringDevice[];
+ * int usbDescriptorStringSerialNumber[];
+ * Other descriptors can't be provided statically, they must be provided
+ * dynamically at runtime.
+ *
+ * Descriptor properties are or-ed or added together, e.g.:
+ * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
+ *
+ * The following descriptors are defined:
+ * USB_CFG_DESCR_PROPS_DEVICE
+ * USB_CFG_DESCR_PROPS_CONFIGURATION
+ * USB_CFG_DESCR_PROPS_STRINGS
+ * USB_CFG_DESCR_PROPS_STRING_0
+ * USB_CFG_DESCR_PROPS_STRING_VENDOR
+ * USB_CFG_DESCR_PROPS_STRING_PRODUCT
+ * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
+ * USB_CFG_DESCR_PROPS_HID
+ * USB_CFG_DESCR_PROPS_HID_REPORT
+ * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
+ *
+ * Note about string descriptors: String descriptors are not just strings, they
+ * are Unicode strings prefixed with a 2 byte header. Example:
+ * int serialNumberDescriptor[] = {
+ * USB_STRING_DESCRIPTOR_HEADER(6),
+ * 'S', 'e', 'r', 'i', 'a', 'l'
+ * };
+ */
+
+#define USB_CFG_DESCR_PROPS_DEVICE 0
+#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
+//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
+#define USB_CFG_DESCR_PROPS_STRINGS 0
+#define USB_CFG_DESCR_PROPS_STRING_0 0
+#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
+#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
+#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
+//#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
+#define USB_CFG_DESCR_PROPS_HID 0
+#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
+//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
+#define USB_CFG_DESCR_PROPS_UNKNOWN 0
+
+/* ----------------------- Optional MCU Description ------------------------ */
+
+/* The following configurations have working defaults in usbdrv.h. You
+ * usually don't need to set them explicitly. Only if you want to run
+ * the driver on a device which is not yet supported or with a compiler
+ * which is not fully supported (such as IAR C) or if you use a differnt
+ * interrupt than INT0, you may have to define some of these.
+ */
+/* #define USB_INTR_CFG MCUCR */
+/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
+/* #define USB_INTR_CFG_CLR 0 */
+/* #define USB_INTR_ENABLE GIMSK */
+/* #define USB_INTR_ENABLE_BIT INT0 */
+/* #define USB_INTR_PENDING GIFR */
+/* #define USB_INTR_PENDING_BIT INTF0 */
+/* #define USB_INTR_VECTOR INT0_vect */
+
+#endif /* __usbconfig_h_included__ */
diff --git a/converter/serialmouse_usb/Makefile b/converter/serialmouse_usb/Makefile
new file mode 100644
index 0000000000..34f550b314
--- /dev/null
+++ b/converter/serialmouse_usb/Makefile
@@ -0,0 +1,106 @@
+#
+# Makefile for Teensy
+#
+# Target file name (without extension).
+TARGET = serialmouse_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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=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
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Serial Mouse Options
+# You can choose a mouse protocol and the implementation of
+# the underlying serial connection.
+#
+SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice
+#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice
+#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection
+SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation
+
+# Optional serial mouse driver features
+# Support scrolling while holding the middle mouse button
+# (currently only supported for Mousesystems mice):
+#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/serialmouse_usb/README.md b/converter/serialmouse_usb/README.md
new file mode 100644
index 0000000000..ef8a006716
--- /dev/null
+++ b/converter/serialmouse_usb/README.md
@@ -0,0 +1,11 @@
+Serial mouse converter
+======================
+See https://github.com/tmk/tmk_keyboard/pull/131
+
+
+Supported protocols
+-------------------
+### Microsoft
+Not tested.
+
+### Mousesystems
diff --git a/converter/serialmouse_usb/config.h b/converter/serialmouse_usb/config.h
new file mode 100644
index 0000000000..b257d997cf
--- /dev/null
+++ b/converter/serialmouse_usb/config.h
@@ -0,0 +1,119 @@
+/*
+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 <avr/interrupt.h>
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x2222
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT serial mouse converter
+#define DESCRIPTION convert serial mouse into USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 0
+#define MATRIX_COLS 0
+
+
+/* key combination for command */
+#define IS_COMMAND() false
+
+
+
+#ifdef SERIAL_MOUSE_MICROSOFT
+ /*
+ * Serial(USART) configuration (for Microsoft serial mice)
+ * asynchronous, positive logic, 1200baud, bit order: LSB first
+ * 1-start bit, 7-data bit, no parity, 1-stop bit
+ */
+ #define SERIAL_UART_BAUD 1200
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
+ UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
+ UCSR1C = (1<<UCSZ11) | (0<<UCSZ10); /* no parity, 1 stop bit, 7-bit characters */ \
+ sei(); \
+ } while(0)
+
+ // for Microsoft mouse protocol
+ /* Serial(USART) configuration
+ * asynchronous, negative logic, 1200baud, no flow control
+ * 1-start bit, 7-data bit, non parity, 1-stop bit
+ */
+ #define SERIAL_SOFT_BAUD 1200
+ #define SERIAL_SOFT_DATA_7BIT
+ #define SERIAL_SOFT_PARITY_NONE
+ #define SERIAL_SOFT_BIT_ORDER_LSB
+ #define SERIAL_SOFT_LOGIC_NEGATIVE
+ /* RXD Port */
+ #define SERIAL_SOFT_RXD_DDR DDRD
+ #define SERIAL_SOFT_RXD_PORT PORTD
+ #define SERIAL_SOFT_RXD_PIN PIND
+ #define SERIAL_SOFT_RXD_BIT 2
+ #define SERIAL_SOFT_RXD_VECT INT2_vect
+ /* RXD Interupt */
+ #define SERIAL_SOFT_RXD_INIT() do { \
+ /* pin configuration: input with pull-up */ \
+ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
+ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
+ /* enable interrupt: INT2(rising edge) */ \
+ EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+ EIMSK |= (1<<INT2); \
+ sei(); \
+ } while (0)
+ #define SERIAL_SOFT_RXD_INT_ENTER()
+ #define SERIAL_SOFT_RXD_INT_EXIT() do { \
+ /* clear interrupt flag */ \
+ EIFR = (1<<INTF2); \
+ } while (0)
+ #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
+ /* TXD Port */
+ #define SERIAL_SOFT_TXD_HI()
+ #define SERIAL_SOFT_TXD_LO()
+ #define SERIAL_SOFT_TXD_INIT()
+#elif defined(SERIAL_MOUSE_MOUSESYSTEMS)
+ /*
+ * Serial(USART) configuration (for Mousesystems serial mice)
+ * asynchronous, positive logic, 1200baud, bit order: LSB first
+ * 1-start bit, 8-data bit, no parity, 1-stop bit
+ */
+ #define SERIAL_UART_BAUD 1200
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
+ UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
+ UCSR1C = (1<<UCSZ11) | (1<<UCSZ10); /* no parity, 1 stop bit, 8-bit characters */ \
+ sei(); \
+ } while(0)
+#endif
+
+
+
+
+#endif
diff --git a/converter/serialmouse_usb/keymap.c b/converter/serialmouse_usb/keymap.c
new file mode 100644
index 0000000000..cb78b4d195
--- /dev/null
+++ b/converter/serialmouse_usb/keymap.c
@@ -0,0 +1,33 @@
+/*
+Copyright 2011,2012,2013 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/>.
+*/
+#include <stdint.h>
+#include <stdbool.h>
+#include "keymap.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return KC_NO;
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){};
+}
+
diff --git a/converter/serialmouse_usb/keymap_common.c b/converter/serialmouse_usb/keymap_common.c
new file mode 100644
index 0000000000..55a13793cb
--- /dev/null
+++ b/converter/serialmouse_usb/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2011,2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/serialmouse_usb/keymap_common.h b/converter/serialmouse_usb/keymap_common.h
new file mode 100644
index 0000000000..216a8dc020
--- /dev/null
+++ b/converter/serialmouse_usb/keymap_common.h
@@ -0,0 +1,174 @@
+/*
+Copyright 2011,2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+// 32*8(256) byte array which converts PS/2 code into USB code
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* All keys */
+#define KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ K61, /* for European ISO */ \
+ K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
+ K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
+ KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
+ KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
+ KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
+ KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
+ K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
+ KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
+) { \
+ { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
+ { KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
+ { KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
+ { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
+ { KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K83, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
+ { KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
+ { KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
+ { KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
+ { KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
+ { KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
+ { KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
+ { KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
+ { KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
+}
+
+/* US layout */
+#define KEYMAP( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ NUBS, \
+ RO, KANA, JYEN, HENK, MHEN, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+/* ISO layout */
+#define KEYMAP_ISO( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
+ K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ K61, \
+ RO, KANA, JYEN, HENK, MHEN, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+/* JIS layout */
+#define KEYMAP_JIS( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
+) \
+KEYMAP_ALL( \
+ K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
+ K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
+ K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
+ K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
+ K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
+ K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
+ \
+ NUBS, \
+ K51, K13, K6A, K64, K67, \
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
+ SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
+ AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
+ MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
+ MAIL, CALCULATOR, MY_COMPUTER, \
+ WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
+ WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
+)
+
+#endif
diff --git a/converter/serialmouse_usb/led.c b/converter/serialmouse_usb/led.c
new file mode 100644
index 0000000000..f76545f0ba
--- /dev/null
+++ b/converter/serialmouse_usb/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/converter/serialmouse_usb/matrix.c b/converter/serialmouse_usb/matrix.c
new file mode 100644
index 0000000000..0e0d87f80e
--- /dev/null
+++ b/converter/serialmouse_usb/matrix.c
@@ -0,0 +1,83 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "action.h"
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "matrix.h"
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ debug_mouse=true;
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ return 0;
+}
+
+bool matrix_is_modified(void)
+{
+ return false;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return false;
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return 0;
+}
+
+void matrix_print(void)
+{
+}
+
+uint8_t matrix_key_count(void)
+{
+ return 0;
+}
diff --git a/converter/sun_usb/Makefile b/converter/sun_usb/Makefile
new file mode 100644
index 0000000000..f046bfdd36
--- /dev/null
+++ b/converter/sun_usb/Makefile
@@ -0,0 +1,85 @@
+# Target file name (without extension).
+TARGET = sun_usb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ command_extra.c \
+ protocol/serial_soft.c
+
+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
+MCU = atmega32u2
+
+
+# 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
+
+
+#
+# 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
+
+
+# Build Options
+# *Comment out* to disable the options.
+#
+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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/sun_usb/README b/converter/sun_usb/README
new file mode 100644
index 0000000000..276f6bfff8
--- /dev/null
+++ b/converter/sun_usb/README
@@ -0,0 +1,99 @@
+Sun to USB keyboard protocol converter
+======================================
+Target MCU is ATMega32u4 but other USB capable AVR will also work.
+Supported keyboards: Sun Type 5 Keyboard, CTCSP SHORT TYPE KEYBOARD(CKUB)
+
+CTCSP SHORT TYPE KEYBOARD: http://imgur.com/a/QIv6p
+
+
+
+
+Connector
+---------
+ 8Pin mini DIN
+ ___ ___
+ / |_| \
+ / 8 7 6 \
+ | 5 4 3 |
+ \_ 2 1 _/
+ \_____/
+ (receptacle)
+
+ Wiring:
+ Pin mini DIN MCU
+ ----------------------------------
+ 1 GND GND
+ 2 GND GND
+ 3 5V
+ 4 RX/TX(Mouse)
+ 5 RX PD3
+ 6 TX PD2
+ 7 GND GND
+ 8 5V VCC
+
+
+Protocol
+--------
+Signal: Asynchronous, Negative logic, 1200baud, No Flow control
+Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
+
+ AVR USART engine expects positive logic while Sun keyboard signal is negative.
+ To use AVR UART engine you need external inverter in front of RX and TX pin.
+ Otherwise you can software serial routine to communicate the keyboard.
+
+This converter uses software method, you doesn't need any inverter part.
+
+
+Commands From System To Keyboard
+ 0x01 Reset
+ Keyboard responds with following byte sequence:
+ Success: 0xFF 0x04 0x7F
+ Fail: 0x7E 0x01 0x7F
+ 0x02 Bell On
+ 0x03 Bell Off
+ 0x0A Click On
+ 0x0B Click Off
+ 0x0E LED
+ followed by LED status byte:
+ bit: 3 2 1 0
+ LED: CapsLk ScrLk Compose NumLk
+ 0x0F Layout
+ Keyboard responds with 'Layout Response' 0xFE 0xXX
+
+Commands From Keyboard To System
+ 0x7F Idle
+ means no keys pressed.
+ 0xFE Layout Response
+ 0xFF Reset Response(followed by 0x04)
+
+Reference
+ http://kentie.net/article/sunkbd/page2.htm
+ http://kentie.net/article/sunkbd/KBD.pdf
+
+
+Build Firmware
+--------------
+Just use 'make'
+ $ cd sun_usb
+ $ make
+Then, load the binary to MCU with your favorite programmer.
+
+
+Sun commands
+------------
+You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
+https://github.com/tmk/tmk_keyboard#magic-commands
+
+Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
+
+```
+----- Sun converter Help -----
+Up: Bell On
+Down: Bell Off
+Left: Click On
+Right: Click Off
+PgUp: LED all On
+PgDown: LED all On
+Insert: Layout
+Delete: Reset
+```
diff --git a/converter/sun_usb/command_extra.c b/converter/sun_usb/command_extra.c
new file mode 100644
index 0000000000..aba3fe6da3
--- /dev/null
+++ b/converter/sun_usb/command_extra.c
@@ -0,0 +1,61 @@
+#include "stdbool.h"
+#include "stdint.h"
+#include "keycode.h"
+#include "serial.h"
+#include "print.h"
+#include "command.h"
+
+bool command_extra(uint8_t code)
+{
+ switch (code) {
+ case KC_H:
+ case KC_SLASH: /* ? */
+ print("\n\n----- Sun converter Help -----\n");
+ print("Up: Bell On\n");
+ print("Down: Bell Off\n");
+ print("Left: Click On\n");
+ print("Right: Click Off\n");
+ print("PgUp: LED all On\n");
+ print("PgDown: LED all On\n");
+ print("Insert: Layout\n");
+ print("Delete: Reset\n");
+ return false;
+ case KC_DEL:
+ print("Reset\n");
+ serial_send(0x01);
+ break;
+ case KC_UP:
+ print("Bell On\n");
+ serial_send(0x02);
+ break;
+ case KC_DOWN:
+ print("Bell Off\n");
+ serial_send(0x03);
+ break;
+ case KC_LEFT:
+ print("Click On\n");
+ serial_send(0x0A);
+ break;
+ case KC_RIGHT:
+ print("Click Off\n");
+ serial_send(0x0B);
+ break;
+ case KC_PGUP:
+ print("LED all on\n");
+ serial_send(0x0E);
+ serial_send(0xFF);
+ break;
+ case KC_PGDOWN:
+ print("LED all off\n");
+ serial_send(0x0E);
+ serial_send(0x00);
+ break;
+ case KC_INSERT:
+ print("layout\n");
+ serial_send(0x0F);
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h
new file mode 100644
index 0000000000..cfd39cd513
--- /dev/null
+++ b/converter/sun_usb/config.h
@@ -0,0 +1,89 @@
+/*
+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
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x3333
+#define DEVICE_VER 0x0100
+#define MANUFACTURER t.m.k.
+#define PRODUCT Sun keyboard converter
+#define DESCRIPTION converts Sun keyboard protocol into USB
+
+/* matrix size */
+#define MATRIX_ROWS 16
+#define MATRIX_COLS 8
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+/* Serial(USART) configuration
+ * asynchronous, negative logic, 1200baud, no flow control
+ * 1-start bit, 8-data bit, non parity, 1-stop bit
+ */
+#define SERIAL_SOFT_BAUD 1200
+#define SERIAL_SOFT_PARITY_NONE
+#define SERIAL_SOFT_BIT_ORDER_LSB
+#define SERIAL_SOFT_LOGIC_NEGATIVE
+/* RXD Port */
+#define SERIAL_SOFT_RXD_ENABLE
+#define SERIAL_SOFT_RXD_DDR DDRD
+#define SERIAL_SOFT_RXD_PORT PORTD
+#define SERIAL_SOFT_RXD_PIN PIND
+#define SERIAL_SOFT_RXD_BIT 2
+#define SERIAL_SOFT_RXD_VECT INT2_vect
+/* RXD Interupt */
+#define SERIAL_SOFT_RXD_INIT() do { \
+ /* pin configuration: input with pull-up */ \
+ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
+ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
+ /* enable interrupt: INT2(rising edge) */ \
+ EICRA |= ((1<<ISC21)|(1<<ISC20)); \
+ EIMSK |= (1<<INT2); \
+ sei(); \
+} while (0)
+#define SERIAL_SOFT_RXD_INT_ENTER()
+#define SERIAL_SOFT_RXD_INT_EXIT() do { \
+ /* clear interrupt flag */ \
+ EIFR = (1<<INTF2); \
+} while (0)
+#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
+/* TXD Port */
+#define SERIAL_SOFT_TXD_ENABLE
+#define SERIAL_SOFT_TXD_DDR DDRD
+#define SERIAL_SOFT_TXD_PORT PORTD
+#define SERIAL_SOFT_TXD_PIN PIND
+#define SERIAL_SOFT_TXD_BIT 3
+#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
+#define SERIAL_SOFT_TXD_INIT() do { \
+ /* pin configuration: output */ \
+ SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
+ /* idle */ \
+ SERIAL_SOFT_TXD_ON(); \
+} while (0)
+
+#endif
diff --git a/converter/sun_usb/keymap.c b/converter/sun_usb/keymap.c
new file mode 100644
index 0000000000..3d724a5201
--- /dev/null
+++ b/converter/sun_usb/keymap.c
@@ -0,0 +1,192 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+/* Sun type 5 keyboard
+,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------.
+| 76 | | | | 05| 06| 08| 0A| | 0C| 0E| 10| 11| | 12| 07| 09| 0B| | 16| 17| 15| | 2D| 02| 04| 30|
+`-------' `---' `---------------' `---------------' `---------------' `-----------' `---------------'
+,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
+| 01| 03| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2C| 34| 60| | 62| 2E| 2F| 47|
+|-------| |-----------------------------------------------------------| |------------ |---------------|
+| 19| 1A| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 2B | | 42| 4A| 7B| | 44| 45| 46| |
+|-------| |-----------------------------------------------------------| `-----------' |-----------| 7D|
+| 31| 33| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D| |
+|-------| |-----------------------------------------------------------| ,---. |-----------|---|
+| 48| 49| | 63 | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E | | 14| | 70| 71| 72| |
+|-------| |-----------------------------------------------------------| .-----------. |-----------| 5A|
+| 5F| 61| | 77 | 13| 78 |*73 | 79 |*74 |*75| 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| |
+`-------' `-----------------------------------------------------------' `-----------' `---------------'
+*/
+#define KEYMAP( \
+ K76, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \
+ K01,K03, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C,K34,K60, K62,K2E,K2F,K47, \
+ K19,K1A, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42,K4A,K7B, K44,K45,K46,K7D, \
+ K31,K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \
+ K48,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, K70,K71,K72,K5A, \
+ K5F,K61, K77,K13, K78, K73, K79, K74, K75, K7A, K43, K0D, K18,K1B,K1C, K5E, K32 \
+) { \
+ { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO, }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_NO, KC_##K7D, KC_NO, KC_NO } \
+}
+
+/* CTCSP SHORT TYPE KEYBOARD */
+#define SHORT_TYPE( \
+ K01, K05,K06,K08,K0A,K0C,K0E, K61,K49,K33, K30, K2C,K34,K60, \
+ K10,K11,K12,K07,K09,K0B, K42,K4A,K7B, \
+ K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, \
+ K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, \
+ K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, \
+ K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K0D,K14,K6E, \
+ K77,K13, K78, K79, K7A,K43,K62,K18,K1B,K1C \
+) KEYMAP( \
+ HELP, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,K30, \
+ K01, AGAIN, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C, K34, K60, K62, PSLS,PAST,PMNS, \
+ MENU, UNDO, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42, K4A, K7B, P7, P8, P9, PPLS, \
+ SELECT, K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, P4, P5, P6, \
+ EXECUTE,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, P1, P2, P3, PENT, \
+ FIND, K61, K77,K13, K78, HENK, K79, MHEN, KANA, K7A,K43,K0D, K18, K1B, K1C, P0, PDOT \
+)
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 2, // Fn0
+ 3, // Fn1
+ 4, // Fn2
+ 0, // Fn3
+ 0, // Fn4
+ 0, // Fn5
+ 0, // Fn6
+ 0 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_SCLN, // Fn1
+ KC_SLSH, // Fn2
+ KC_NO, // Fn3
+ KC_NO, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/*
+ KEYMAP(
+ HELP, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,PWR,
+ STOP, AGAIN, ESC,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ MENU, UNDO, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC, DEL, END, PGDN, P7, P8, P9, PPLS,
+ SELECT, COPY, LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6,
+ EXECUTE,PASTE, LSFT, Z, X, C, V, B, N, M, COMM,DOT,SLSH, RSFT, UP, P1, P2, P3, PENT,
+ FIND, CUT, CAPS, LALT, LGUI,HENK, SPC, MHEN,KANA,RGUI,APP, RALT, LEFT,DOWN,RGHT, P0, PDOT
+ ),
+*/
+ // 0: default
+ SHORT_TYPE(
+ STOP, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
+ F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
+ LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT,
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RALT,UP, RSFT,
+ CAPS,LALT,LGUI, SPC, RGUI,APP, NLCK,LEFT,DOWN,RGHT
+ ),
+ // 1: with layer keys
+ SHORT_TYPE(
+ ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
+ F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
+ LCTL, A, S, D, F, G, H, J, K, L, FN1, QUOT, ENT,
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,UP, FN0,
+ CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, LEFT,DOWN,RGHT
+ ),
+ // 2: HHKB
+ SHORT_TYPE(
+ ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
+ F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
+ CAPS, NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC,
+ LCTL, VOLD,VOLU,MUTE,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT,
+ LSFT, Z, X, C, V, B, NO, NO, END, PGDN,DOWN, RSFT,PGUP,FN0,
+ CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, HOME,PGDN,END
+ ),
+ // 3: Mousekey
+ SHORT_TYPE(
+ ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
+ F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
+ CAPS, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC,
+ LCTL, NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN1, NO, ENT,
+ LSFT, NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT,UP, NO,
+ CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
+ ),
+ // 4: Cursor
+ SHORT_TYPE(
+ ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
+ F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
+ CAPS, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC,
+ LCTL, NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT,
+ LSFT, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,UP, NO,
+ CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
+ ),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/converter/sun_usb/led.c b/converter/sun_usb/led.c
new file mode 100644
index 0000000000..48c3f1c2b2
--- /dev/null
+++ b/converter/sun_usb/led.c
@@ -0,0 +1,33 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "serial.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ uint8_t sun_led = 0;
+ if (usb_led & (1<<USB_LED_NUM_LOCK)) sun_led |= (1<<0);
+ if (usb_led & (1<<USB_LED_COMPOSE)) sun_led |= (1<<1);
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
+
+ serial_send(0x0E);
+ serial_send(sun_led);
+}
diff --git a/converter/sun_usb/matrix.c b/converter/sun_usb/matrix.c
new file mode 100644
index 0000000000..f333f542bd
--- /dev/null
+++ b/converter/sun_usb/matrix.c
@@ -0,0 +1,162 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "matrix.h"
+#include "debug.h"
+#include "protocol/serial.h"
+
+
+/*
+ * Matrix Array usage:
+ *
+ * ROW: 16(4bits)
+ * COL: 8(3bits)
+ *
+ * 8bit wide
+ * +---------+
+ * 0|00 ... 07|
+ * 1|08 ... 0F|
+ * :| ... |
+ * :| ... |
+ * E|70 ... 77|
+ * F|78 ... 7F|
+ * +---------+
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) ((code>>3)&0xF)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ DDRD |= (1<<6);
+ PORTD |= (1<<6);
+ //debug_enable = true;
+
+ serial_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ is_modified = false;
+
+ uint8_t code;
+ code = serial_recv();
+ if (!code) return 0;
+
+ debug_hex(code); debug(" ");
+
+ switch (code) {
+ case 0xFF: // reset success
+ case 0xFE: // layout
+ case 0x7E: // reset fail
+ if (code == 0xFF) print("reset: 0xFF ");
+ if (code == 0x7E) print("reset fail: 0x7E ");
+ if (code == 0xFE) print("layout: 0xFE ");
+ // response byte
+ _delay_ms(500);
+ if (code = serial_recv()) print_hex8(code);
+ print("\n");
+ // FALL THROUGH
+ case 0x7F:
+ // all keys up
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+ return 0;
+ }
+
+ if (code&0x80) {
+ // break code
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+ } else {
+ // make code
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= (1<<COL(code));
+ is_modified = true;
+ }
+ }
+ return code;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
diff --git a/converter/terminal_bluefruit/Makefile b/converter/terminal_bluefruit/Makefile
new file mode 100644
index 0000000000..dec9233ec9
--- /dev/null
+++ b/converter/terminal_bluefruit/Makefile
@@ -0,0 +1,99 @@
+# Target file name (without extension).
+TARGET = terminal_bluefruit
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+BLUEFRUIT_TRACE_SERIAL=true
+
+# 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
+
+
+#
+# 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
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+#
+# PS/2 protocol implementations
+# USART is recommended if it is available, others are for reference purpose.
+# INT implementation will drop simultaneous key strokes.
+#
+#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+#---------------- 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.mk
+include $(TMK_DIR)/protocol/bluefruit.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/terminal_bluefruit/README b/converter/terminal_bluefruit/README
new file mode 100644
index 0000000000..6ff1bc92f3
--- /dev/null
+++ b/converter/terminal_bluefruit/README
@@ -0,0 +1,37 @@
+Keyboard converter for IBM terminal keyboard
+============================================
+It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
+I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).
+
+Source code: https://github.com/tmk/tmk_keyboard
+Article: http://geekhack.org/index.php?topic=27272.0
+
+
+CONNECTION
+----------
+Keyboard ATMega32U4
+----------------------
+Data: PD2
+Clock: PD5
+
+And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.
+
+
+BUILD
+-----
+$ git clone https://github.com/tmk/tmk_keyboard.git
+$ cd converter/terminal_usb
+$ make
+
+
+RESOURCE
+--------
+Soarer's Converter: http://geekhack.org/index.php?topic=17458.0
+102keys(1392595): http://geekhack.org/index.php?topic=10737.0
+122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html
+KbdBabel: http://www.kbdbabel.org/
+RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
+DIN Connector: http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
+WinAVR: http://winavr.sourceforge.net/
+
+EOF
diff --git a/converter/terminal_bluefruit/config.h b/converter/terminal_bluefruit/config.h
new file mode 100644
index 0000000000..8bf139d35f
--- /dev/null
+++ b/converter/terminal_bluefruit/config.h
@@ -0,0 +1,112 @@
+/*
+Converter for 70% IBM Terminal Keyboard
+Author: Benjamin Gould, 2013
+Based on code 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 0x6535
+#define DEVICE_VER 0x0100
+#define MANUFACTURER t.m.k.
+#define PRODUCT 70% IBM Terminal Keyboard Converter w/ Bluetooth
+#define DESCRIPTION USB converter for IBM Terminal Keyboard w/ Bluetooth
+
+
+/* matrix size */
+#define MATRIX_ROWS 17 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* legacy keymap support */
+// #define USE_LEGACY_KEYMAP
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
+ (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
+)
+
+/* USART configuration
+ * asynchronous, 9600baud, 8-data bit, non parity, 1-stop bit, no flow control
+ */
+#ifdef __AVR_ATmega32U4__
+ #define SERIAL_UART_BAUD 9600
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
+ UCSR1B = (1<<TXEN1); /* TX: enable */ \
+ UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
+ (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
+ sei(); \
+ } while(0)
+#else
+# error "USART configuration is needed."
+#endif
+
+/*
+ * PS/2 Interrupt configuration
+ */
+#ifdef PS2_USE_INT
+/* uses INT1 for clock line(ATMega32U4) */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+
+#define PS2_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define PS2_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define PS2_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define PS2_INT_VECT INT1_vect
+#endif
+
+
+/*
+ * PS/2 Busywait configuration
+ */
+#ifdef PS2_USE_BUSYWAIT
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+#endif
+
+#endif
diff --git a/converter/terminal_bluefruit/keymap.c b/converter/terminal_bluefruit/keymap.c
new file mode 100644
index 0000000000..8acd8cfb33
--- /dev/null
+++ b/converter/terminal_bluefruit/keymap.c
@@ -0,0 +1,227 @@
+/*
+Converter for 70% IBM Terminal Keyboard
+Author: Benjamin Gould, 2013
+Based on code 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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+/*
+ * IBM Terminal keyboard 6110345(122keys)/1392595(102keys)
+ * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M
+ * http://www.seasip.info/VintagePC/ibm_1391406.html
+ *
+ * Keymap array:
+ * 8 bytes
+ * +---------+
+ * 0| |
+ * :| | 0x00-0x87
+ * ;| |
+ * 17| |
+ * +---------+
+ */
+#define KEYMAP( \
+ K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \
+ K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \
+ \
+ K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
+ K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \
+ K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \
+ K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \
+ K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \
+) { \
+ { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \
+}
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|BS | |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #|Retu| | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `----' `---------------------------------------' `----' `-----------' `---------------'
+ */
+/*
+ KEYMAP(
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
+ F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
+
+ PSCR,ESC, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS,
+ PAUS,INT5, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, UP, P4, P5, P6, PCMM,
+ APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
+ RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO
+ ),
+*/
+ /*
+ KEYMAP(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS
+ ),
+ */
+ // pseudo ANSI
+
+ KEYMAP(
+ FN0, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,
+ PSCR,PAUS,PGUP,PGDN,HOME,END, INS, DEL, LEFT,DOWN,UP, RGHT,
+
+ NO, NO, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSPC, NO, NO, NO, NO, NO, NO, NO,
+ NO, NO, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, NO, NO, NO, NO, NO, NO, NO,
+ NO, NO, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, BSLS,ENT, NO, NO, NO, NO, NO,
+ NO, NO, LSFT,FN1 ,Z, X, C, V, B, N, M, COMM,DOT, SLSH, FN1, RSFT, NO, NO, NO, NO, NO, NO, NO,
+ NO, NO, LCTL, LALT, SPC, LGUI, APP, NO, NO, NO, NO, NO
+ ),
+
+ // Momentary Function Layer
+ KEYMAP(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,MUTE,VOLD,VOLU,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+
+ TRNS,TRNS, TRNS,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,UP ,END, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MS_L,MS_D,MS_U,MS_R,LEFT,DOWN, RGHT,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,PGDN,TRNS, TRNS,RSFT, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, BTN2, TRNS, BTN1, RALT, RCTL, TRNS, TRNS,TRNS,TRNS,TRNS
+ ),
+
+ // Mouse Layer
+ KEYMAP(
+ FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS,NO, NO, MS_U,NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, BTN2,BTN1,MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,NO, NO, NO, ENT, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS,TRNS,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, RSFT, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS, TRNS, BTN1, BTN2, TRNS, NO, NO, NO, NO, NO
+ ),
+
+ // vi Layer
+ KEYMAP(
+ FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS,HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS,TRNS,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, RSFT, NO, NO, NO, NO, NO, NO, NO,
+ TRNS,TRNS, TRNS, TRNS, SPC, RALT, RCTL, NO, NO, NO, NO, NO
+ ),
+
+ // num lock layer
+ KEYMAP(
+ FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS
+ ),
+
+};
+
+
+static const uint16_t fn_actions[] PROGMEM = {
+ [0] = ACTION_DEFAULT_LAYER_SET(0),
+ [1] = ACTION_LAYER_MOMENTARY(1),
+ [2] = ACTION_LAYER_MOMENTARY(2), //ACTION_LAYER_ON(2, ON_RELEASE),
+ [3] = KC_NO, //ACTION_LAYER_ON(3, ON_RELEASE),
+ [4] = KC_NO, //ACTION_LAYER_ON(4, ON_RELEASE),
+ [5] = KC_NO,
+ [6] = KC_NO,
+ [7] = KC_NO,
+};
+
+/*
+enum macro_id {
+ MS_UL,
+ MS_UR,
+ MS_DL,
+ MS_DR,
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ keyevent_t event = record->event;
+
+ switch (id) {
+ case MS_UL:
+ return (event.pressed ? MACRO( D(MS_L), D(MS_U), END ) : MACRO( U(MS_L), U(MS_U), END ) );
+ case MS_UR:
+ return (event.pressed ? MACRO( D(MS_R), D(MS_U), END ) : MACRO( U(MS_L), U(MS_U), END ) );
+ case MS_DL:
+ return (event.pressed ? MACRO( D(MS_L), D(MS_D), END ) : MACRO( U(MS_L), U(MS_U), END ) );
+ case MS_DR:
+ return (event.pressed ? MACRO( D(MS_R), D(MS_D), END ) : MACRO( U(MS_L), U(MS_U), END ) );
+ }
+ return MACRO_NONE;
+}
+*/
+
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ return action;
+}
diff --git a/converter/terminal_bluefruit/led.c b/converter/terminal_bluefruit/led.c
new file mode 100644
index 0000000000..e5bf41d4ab
--- /dev/null
+++ b/converter/terminal_bluefruit/led.c
@@ -0,0 +1,35 @@
+/*
+Converter for 70% IBM Terminal Keyboard
+Author: Benjamin Gould, 2013
+Based on code 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/>.
+*/
+
+#include "stdint.h"
+#include "ps2.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ uint8_t ps2_led = 0;
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ ps2_led |= (1<<PS2_LED_NUM_LOCK);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ ps2_led |= (1<<PS2_LED_CAPS_LOCK);
+ ps2_host_set_led(ps2_led);
+}
diff --git a/converter/terminal_bluefruit/matrix.c b/converter/terminal_bluefruit/matrix.c
new file mode 100644
index 0000000000..36901536f1
--- /dev/null
+++ b/converter/terminal_bluefruit/matrix.c
@@ -0,0 +1,262 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "ps2.h"
+#include "matrix.h"
+
+
+static void matrix_make(uint8_t code);
+static void matrix_break(uint8_t code);
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+
+
+/*
+ * Matrix Array usage:
+ * 'Scan Code Set 3' is assigned into 17x8 cell matrix.
+ *
+ * 8bit wide
+ * +---------+
+ * 0| |
+ * :| | 0x00-0x87
+ * ;| |
+ * 17| |
+ * +---------+
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) (code>>3)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ //debug_matrix = true;
+ //debug_keyboard = true;
+ //debug_mouse = false;
+
+ ps2_host_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+
+ // scan code reading states
+ static enum {
+ RESET,
+ RESET_RESPONSE,
+ KBD_ID0,
+ KBD_ID1,
+ CONFIG,
+ READY,
+ F0,
+ } state = RESET;
+
+ is_modified = false;
+
+ uint8_t code;
+ if ((code = ps2_host_recv())) {
+ debug("r"); debug_hex(code); debug(" ");
+ }
+
+ switch (state) {
+ case RESET:
+ debug("wFF ");
+ if (ps2_host_send(0xFF) == 0xFA) {
+ debug("[ack]\nRESET_RESPONSE: ");
+ state = RESET_RESPONSE;
+ }
+ break;
+ case RESET_RESPONSE:
+ if (code == 0xAA) {
+ debug("[ok]\nKBD_ID: ");
+ state = KBD_ID0;
+ } else if (code) {
+ debug("err\nRESET: ");
+ state = RESET;
+ }
+ break;
+ // after reset receive keyboad ID(2 bytes)
+ case KBD_ID0:
+ if (code) {
+ state = KBD_ID1;
+ }
+ break;
+ case KBD_ID1:
+ if (code) {
+ debug("\nCONFIG: ");
+ state = CONFIG;
+ }
+ break;
+ case CONFIG:
+ debug("wF8 ");
+ if (ps2_host_send(0xF8) == 0xFA) {
+ debug("[ack]\nREADY\n");
+ state = READY;
+ }
+ break;
+ case READY:
+ switch (code) {
+ case 0x00:
+ break;
+ case 0xF0:
+ state = F0;
+ debug(" ");
+ break;
+ default: // normal key make
+ if (code < 0x88) {
+ matrix_make(code);
+ } else {
+ debug("unexpected scan code at READY: "); debug_hex(code); debug("\n");
+ }
+ state = READY;
+ debug("\n");
+ }
+ break;
+ case F0: // Break code
+ switch (code) {
+ case 0x00:
+ break;
+ default:
+ if (code < 0x88) {
+ matrix_break(code);
+ } else {
+ debug("unexpected scan code at F0: "); debug_hex(code); debug("\n");
+ }
+ state = READY;
+ debug("\n");
+ }
+ break;
+ }
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+#ifdef MATRIX_HAS_GHOST
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_has_ghost_in_row(i))
+ return true;
+ }
+#endif
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]) == matrix[row])
+ return true;
+ }
+ return false;
+}
+#endif
+
+
+inline
+static void matrix_make(uint8_t code)
+{
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= 1<<COL(code);
+ is_modified = true;
+ }
+}
+
+inline
+static void matrix_break(uint8_t code)
+{
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+}
diff --git a/converter/terminal_usb/Makefile b/converter/terminal_usb/Makefile
new file mode 100644
index 0000000000..42184521d2
--- /dev/null
+++ b/converter/terminal_usb/Makefile
@@ -0,0 +1,98 @@
+# Target file name (without extension).
+TARGET = terminal_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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
+
+
+#
+# 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
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+#
+# PS/2 protocol implementations
+# USART is recommended if it is available, others are for reference purpose.
+# INT implementation will drop simultaneous key strokes.
+#
+PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+
+
+#---------------- 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/lufa.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/terminal_usb/README b/converter/terminal_usb/README
new file mode 100644
index 0000000000..6ff1bc92f3
--- /dev/null
+++ b/converter/terminal_usb/README
@@ -0,0 +1,37 @@
+Keyboard converter for IBM terminal keyboard
+============================================
+It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
+I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).
+
+Source code: https://github.com/tmk/tmk_keyboard
+Article: http://geekhack.org/index.php?topic=27272.0
+
+
+CONNECTION
+----------
+Keyboard ATMega32U4
+----------------------
+Data: PD2
+Clock: PD5
+
+And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.
+
+
+BUILD
+-----
+$ git clone https://github.com/tmk/tmk_keyboard.git
+$ cd converter/terminal_usb
+$ make
+
+
+RESOURCE
+--------
+Soarer's Converter: http://geekhack.org/index.php?topic=17458.0
+102keys(1392595): http://geekhack.org/index.php?topic=10737.0
+122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html
+KbdBabel: http://www.kbdbabel.org/
+RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
+DIN Connector: http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
+WinAVR: http://winavr.sourceforge.net/
+
+EOF
diff --git a/converter/terminal_usb/config.h b/converter/terminal_usb/config.h
new file mode 100644
index 0000000000..ea5ce62caa
--- /dev/null
+++ b/converter/terminal_usb/config.h
@@ -0,0 +1,138 @@
+/*
+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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6535
+#define DEVICE_VER 0x0100
+#define MANUFACTURER t.m.k.
+#define PRODUCT PS/2(Set3)-USB Keyboard converter(IBM 122keys)
+#define DESCRIPTION USB converter for IBM Terminal Keyboard 122keys
+
+
+/* matrix size */
+#define MATRIX_ROWS 17 // keycode bit: 3-0
+#define MATRIX_COLS 8 // keycode bit: 6-4
+
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
+ (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
+)
+
+
+/*
+ * PS/2 USART configuration for ATMega32U4
+ */
+#ifdef PS2_USE_USART
+/* XCK for clock line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+/* RXD for data line */
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR1C = ((1 << UMSEL10) | \
+ (3 << UPM10) | \
+ (0 << USBS1) | \
+ (3 << UCSZ10) | \
+ (0 << UCPOL1)); \
+ UCSR1A = 0; \
+ UBRR1H = 0; \
+ UBRR1L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR1B = ((1 << RXCIE1) | \
+ (1 << RXEN1)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR1B = (1 << RXEN1); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR1C = 0; \
+ UCSR1B &= ~((1 << RXEN1) | \
+ (1 << TXEN1)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
+#define PS2_USART_RX_DATA UDR1
+#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
+#define PS2_USART_RX_VECT USART1_RX_vect
+#endif
+
+
+/*
+ * PS/2 Interrupt configuration
+ */
+#ifdef PS2_USE_INT
+/* uses INT1 for clock line(ATMega32U4) */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+
+#define PS2_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define PS2_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define PS2_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define PS2_INT_VECT INT1_vect
+#endif
+
+
+/*
+ * PS/2 Busywait configuration
+ */
+#ifdef PS2_USE_BUSYWAIT
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 0
+#endif
+
+#endif
diff --git a/converter/terminal_usb/keymap.c b/converter/terminal_usb/keymap.c
new file mode 100644
index 0000000000..73009cb47e
--- /dev/null
+++ b/converter/terminal_usb/keymap.c
@@ -0,0 +1,156 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+/*
+ * IBM Terminal keyboard 6110345(122keys)/1392595(102keys)
+ * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M
+ * http://www.seasip.info/VintagePC/ibm_1391406.html
+ *
+ * Keymap array:
+ * 8 bytes
+ * +---------+
+ * 0| |
+ * :| | 0x00-0x87
+ * ;| |
+ * 17| |
+ * +---------+
+ */
+#define KEYMAP( \
+ K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \
+ K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \
+ \
+ K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
+ K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \
+ K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \
+ K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \
+ K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \
+) { \
+ { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \
+}
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 0, // Fn1
+ 0, // Fn2
+ 0, // Fn3
+ 0, // Fn4
+ 0, // Fn5
+ 0, // Fn6
+ 0 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_NO, // Fn2
+ KC_NO, // Fn3
+ KC_NO, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|BS | |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #|Retu| | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `----' `---------------------------------------' `----' `-----------' `---------------'
+ */
+/*
+ KEYMAP(
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
+ F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
+
+ PSCR,ESC, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS,
+ PAUS,INT5, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, UP, P4, P5, P6, PCMM,
+ APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
+ RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO
+ ),
+*/
+ // pseudo ANSI
+ KEYMAP(
+ F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
+ F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
+
+ PSCR,ESC, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, NO, DEL, END, PGDN, P7, P8, P9, PPLS,
+ PAUS,INT5, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, BSLS,ENT, UP, P4, P5, P6, PCMM,
+ APP, INT6, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
+ RGUI,LGUI, LCTL, LALT, SPC, LGUI, GRV, DOWN, NO, P0, PDOT,NO
+ ),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/converter/terminal_usb/led.c b/converter/terminal_usb/led.c
new file mode 100644
index 0000000000..e448e84ec7
--- /dev/null
+++ b/converter/terminal_usb/led.c
@@ -0,0 +1,33 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "ps2.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ uint8_t ps2_led = 0;
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ ps2_led |= (1<<PS2_LED_NUM_LOCK);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ ps2_led |= (1<<PS2_LED_CAPS_LOCK);
+ ps2_host_set_led(ps2_led);
+}
diff --git a/converter/terminal_usb/matrix.c b/converter/terminal_usb/matrix.c
new file mode 100644
index 0000000000..36901536f1
--- /dev/null
+++ b/converter/terminal_usb/matrix.c
@@ -0,0 +1,262 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "debug.h"
+#include "ps2.h"
+#include "matrix.h"
+
+
+static void matrix_make(uint8_t code);
+static void matrix_break(uint8_t code);
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+
+
+/*
+ * Matrix Array usage:
+ * 'Scan Code Set 3' is assigned into 17x8 cell matrix.
+ *
+ * 8bit wide
+ * +---------+
+ * 0| |
+ * :| | 0x00-0x87
+ * ;| |
+ * 17| |
+ * +---------+
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) (code>>3)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ //debug_matrix = true;
+ //debug_keyboard = true;
+ //debug_mouse = false;
+
+ ps2_host_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+
+ // scan code reading states
+ static enum {
+ RESET,
+ RESET_RESPONSE,
+ KBD_ID0,
+ KBD_ID1,
+ CONFIG,
+ READY,
+ F0,
+ } state = RESET;
+
+ is_modified = false;
+
+ uint8_t code;
+ if ((code = ps2_host_recv())) {
+ debug("r"); debug_hex(code); debug(" ");
+ }
+
+ switch (state) {
+ case RESET:
+ debug("wFF ");
+ if (ps2_host_send(0xFF) == 0xFA) {
+ debug("[ack]\nRESET_RESPONSE: ");
+ state = RESET_RESPONSE;
+ }
+ break;
+ case RESET_RESPONSE:
+ if (code == 0xAA) {
+ debug("[ok]\nKBD_ID: ");
+ state = KBD_ID0;
+ } else if (code) {
+ debug("err\nRESET: ");
+ state = RESET;
+ }
+ break;
+ // after reset receive keyboad ID(2 bytes)
+ case KBD_ID0:
+ if (code) {
+ state = KBD_ID1;
+ }
+ break;
+ case KBD_ID1:
+ if (code) {
+ debug("\nCONFIG: ");
+ state = CONFIG;
+ }
+ break;
+ case CONFIG:
+ debug("wF8 ");
+ if (ps2_host_send(0xF8) == 0xFA) {
+ debug("[ack]\nREADY\n");
+ state = READY;
+ }
+ break;
+ case READY:
+ switch (code) {
+ case 0x00:
+ break;
+ case 0xF0:
+ state = F0;
+ debug(" ");
+ break;
+ default: // normal key make
+ if (code < 0x88) {
+ matrix_make(code);
+ } else {
+ debug("unexpected scan code at READY: "); debug_hex(code); debug("\n");
+ }
+ state = READY;
+ debug("\n");
+ }
+ break;
+ case F0: // Break code
+ switch (code) {
+ case 0x00:
+ break;
+ default:
+ if (code < 0x88) {
+ matrix_break(code);
+ } else {
+ debug("unexpected scan code at F0: "); debug_hex(code); debug("\n");
+ }
+ state = READY;
+ debug("\n");
+ }
+ break;
+ }
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+#ifdef MATRIX_HAS_GHOST
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_has_ghost_in_row(i))
+ return true;
+ }
+#endif
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]) == matrix[row])
+ return true;
+ }
+ return false;
+}
+#endif
+
+
+inline
+static void matrix_make(uint8_t code)
+{
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= 1<<COL(code);
+ is_modified = true;
+ }
+}
+
+inline
+static void matrix_break(uint8_t code)
+{
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+}
diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile
new file mode 100644
index 0000000000..51c9271820
--- /dev/null
+++ b/converter/usb_usb/Makefile
@@ -0,0 +1,136 @@
+#----------------------------------------------------------------------------
+# 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 = usb_usb
+
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# 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
+
+
+
+# Build Options
+# comment out to disable the options.
+#
+MOUSEKEY_ENABLE = yes # Mouse keys
+EXTRAKEY_ENABLE = yes # Media control and System control
+CONSOLE_ENABLE = yes # Console for debug
+#NKRO_ENABLE = yes # USB Nkey Rollover
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+
+SRC = \
+ keymap_common.c \
+ matrix.c \
+ led.c \
+ main.cpp
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+
+# program Leonardo
+PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV)
+
+
+
+include $(TMK_DIR)/protocol/usb_hid.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/usb_usb/README b/converter/usb_usb/README
new file mode 100644
index 0000000000..30d5deb1e5
--- /dev/null
+++ b/converter/usb_usb/README
@@ -0,0 +1,74 @@
+USB to USB keyboard protocol converter
+======================================
+
+Hardware requirement
+--------------------
+Arduino Leonardo
+ http://arduino.cc/en/Main/ArduinoBoardLeonardo
+
+Circuit@Home USB Host Shield 2.0
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/
+
+Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be the easiest way, you won't need even soldering iron.
+Arduino's Shield will also work well but I think Sparkfun's needs to be modified.
+
+ http://arduino.cc/en/Main/ArduinoUSBHostShield
+ https://www.sparkfun.com/products/9947
+
+Also Pro Micro 3.3V(not Mini) or Teensy with mini host shield will work with some fixes on signal/power routing.
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
+ https://www.sparkfun.com/products/12587
+ https://www.pjrc.com/teensy/td_libs_USBHostShield.html
+
+
+
+Build firmware
+--------------
+ $ git clone git://github.com/tmk/tmk_keyboard.git
+ $ cd tmk_keyboard
+ $ git submodule init
+ $ git submodule update
+ $ cd converter/usb_usb
+ $ make
+
+Program converter. Push reset button on Leonardo before run this command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.
+
+ $ DEV=COM17 make program
+ or
+ $ avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:usb_usb.hex -PCOM17
+
+
+
+Limitation
+----------
+Only supports 'HID Boot protocol'.
+Not support keyboard LED yet.
+
+Note that the converter can host only USB "boot protocol" keyboard(6KRO) and not NKRO, it is possible to support NKRO keyboard but you will need to write HID report parser for that. Every NKRO keyboard can have different HID report and it is difficult to support all kind of NKRO keyboards in the market.
+
+
+
+Update
+------
+2014/12/11 Added Hub support(confirmed with HHKB pro2)
+
+
+
+Resource
+--------
+USB Host Sheild 2.0
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino
+ https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
+USB Host Sheild 2.0 source
+ https://github.com/felis/USB_Host_Shield_2.0
+Arduino USB Host Shield(with bootst converter)
+ http://arduino.cc/en/Main/ArduinoUSBHostShield
+Arduino source
+ https://github.com/arduino/Arduino/hardware/arduino/{cores,variants}
+Initial release of TMK USB-USB converter
+ https://geekhack.org/index.php?topic=33057.msg653549#msg653549
+ http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html#p74854
+Arduino-based hardware keyboard remapper - Colemak forum
+ http://forum.colemak.com/viewtopic.php?id=1561
+Teensy + Host Shield
+ http://www.pjrc.com/teensy/td_libs_USBHostShield.html
diff --git a/converter/usb_usb/config.h b/converter/usb_usb/config.h
new file mode 100644
index 0000000000..c992456763
--- /dev/null
+++ b/converter/usb_usb/config.h
@@ -0,0 +1,39 @@
+/*
+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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x005B
+#define DEVICE_VER 0x0814
+#define MANUFACTURER t.m.k.
+#define PRODUCT USB to USB keyboard converter
+
+
+#define DESCRIPTION Product from t.m.k. keyboard firmware project
+
+
+/* matrix size */
+#define MATRIX_ROWS 32
+#define MATRIX_COLS 8
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+#endif
diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c
new file mode 100644
index 0000000000..c14a8aa553
--- /dev/null
+++ b/converter/usb_usb/keymap.c
@@ -0,0 +1,137 @@
+/*
+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/>.
+*/
+
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 1: plain Qwerty without layer switching
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 2: Colemak http://colemak.com
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
+ * `----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 3: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa|
+ * |-----------------------------------------------------------|
+ * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \|
+ * |-----------------------------------------------------------|
+ * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, P4, P5, P6, PPLS,
+ LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 4: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
+ * ,-----------------------------------------------------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+};
diff --git a/converter/usb_usb/keymap_common.c b/converter/usb_usb/keymap_common.c
new file mode 100644
index 0000000000..8ab5ba923e
--- /dev/null
+++ b/converter/usb_usb/keymap_common.c
@@ -0,0 +1,31 @@
+/*
+Copyright 2014 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/>.
+*/
+#include "keymap_common.h"
+#include "progmem.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h
new file mode 100644
index 0000000000..435d83fdc7
--- /dev/null
+++ b/converter/usb_usb/keymap_common.h
@@ -0,0 +1,77 @@
+/*
+Copyright 2014 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+#define KEYMAP( \
+ K29,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \
+ K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \
+ K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K31, K4C,K4D,K4E, K5F,K60,K61, \
+ K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K28, K5C,K5D,K5E,K57, \
+ KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B, \
+ KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58 \
+) { \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, /* 00-07 */ \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, /* 08-0F */ \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, /* 10-17 */ \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, /* 18-1F */ \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, /* 20-27 */ \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \
+ { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, /* 30-37 */ \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, /* 38-3F */ \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, /* 40-47 */ \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, /* 48-4F */ \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, /* 50-57 */ \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, /* 58-5F */ \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_NO, KC_##K65, KC_NO, KC_NO }, /* 60-67 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 68-6F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 70-77 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 78-7F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 80-87 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 90-97 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A0-A7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B0-B7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C0-C7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D0-D7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \
+ { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, /* E0-E7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F0-F7 */ \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \
+}
+
+#endif
diff --git a/converter/usb_usb/keymap_hasu.c b/converter/usb_usb/keymap_hasu.c
new file mode 100644
index 0000000000..de19e23076
--- /dev/null
+++ b/converter/usb_usb/keymap_hasu.c
@@ -0,0 +1,158 @@
+#include "keymap_common.h"
+
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+ /* Layer 0: 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|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Fn6 |
+ * |-----------------------------------------------------------|
+ * |Fn7 | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1|
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Fn4 |Fn5 |Gui|
+ * `-------------------------------------------'
+ */
+ [0] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, FN6, P4, P5, P6, PPLS,
+ FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, FN4, RALT,FN5, FN5, FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 1: HHKB mode[HHKB Fn]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [1] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 2: Vi mode[Slash]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [2] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 3: Mouse mode(IJKL)[Semicolon]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
+ */
+ [3] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, BTN1, RALT,TRNS,TRNS,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* Layer 5: Mouse mode(IJKL)[Space]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
+ */
+ [4] = \
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, TRNS, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+
+/*
+ * Macro definition
+ */
+enum macro_id {
+ ALT_TAB,
+};
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch (id) {
+ case ALT_TAB:
+ return (record->event.pressed ?
+ MACRO( D(LALT), D(TAB), END ) :
+ MACRO( U(TAB), END ));
+ }
+ return MACRO_NONE;
+}
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
+ [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
+ [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
+ [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
+ [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
+ [5] = ACTION_LAYER_MOMENTARY(3), // Mousekey layer
+ [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
+ [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
+ [8] = ACTION_MACRO(ALT_TAB), // Application switching
+};
diff --git a/converter/usb_usb/keymap_spacefn.c b/converter/usb_usb/keymap_spacefn.c
new file mode 100644
index 0000000000..bffd2bc606
--- /dev/null
+++ b/converter/usb_usb/keymap_spacefn.c
@@ -0,0 +1,61 @@
+/*
+ * SpaceFN layout
+ * http://geekhack.org/index.php?topic=51069.0
+ */
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: default
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
+ * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------. ,---------------.
+ * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
+ * |-----------------------------------------------------------| |-----------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
+ * |-----------------------------------------------------------| `-----------' |-----------| +|
+ * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
+ * |-----------------------------------------------------------| ,---. |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
+ * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
+ * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
+ * `-----------------------------------------------------------' `-----------' `---------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
+ LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+
+ /* 1: SpaceFN
+ * ,-----------------------------------------------------------.
+ * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ * |-----------------------------------------------------------|
+ * | | | | | | |PgU|Lef|Dow|Rig| | | |
+ * |-----------------------------------------------------------|
+ * | | | | | |Spc|PgD|` |~ | |Men| |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
+ ),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+};
+
diff --git a/converter/usb_usb/led.c b/converter/usb_usb/led.c
new file mode 100644
index 0000000000..fc0eeb0ff7
--- /dev/null
+++ b/converter/usb_usb/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp
new file mode 100644
index 0000000000..30fd3348a3
--- /dev/null
+++ b/converter/usb_usb/main.cpp
@@ -0,0 +1,120 @@
+#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/power.h>
+#include <util/delay.h>
+
+// USB HID host
+#include "Usb.h"
+#include "hid.h"
+#include "hidboot.h"
+#include "parser.h"
+#include "usbhub.h"
+
+// LUFA
+#include "lufa.h"
+
+#include "timer.h"
+#include "sendchar.h"
+#include "debug.h"
+#include "keyboard.h"
+
+#include "leonardo_led.h"
+
+
+static USB usb_host;
+static HIDBoot<HID_PROTOCOL_KEYBOARD> kbd(&usb_host);
+static KBDReportParser kbd_parser;
+static USBHub hub1(&usb_host); // one hub is enough for HHKB pro2
+/* may be needed for other device with more hub
+static USBHub hub2(&usb_host);
+static USBHub hub3(&usb_host);
+static USBHub hub4(&usb_host);
+static USBHub hub5(&usb_host);
+static USBHub hub6(&usb_host);
+static USBHub hub7(&usb_host);
+*/
+
+static void LUFA_setup(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ // Leonardo needs. Without this USB device is not recognized.
+ USB_Disable();
+
+ USB_Init();
+
+ // for Console_Task
+ USB_Device_EnableSOFEvents();
+ print_set_sendchar(sendchar);
+}
+
+static void HID_setup()
+{
+ if (usb_host.Init() == -1) {
+ debug("HID init: failed\n");
+ LED_TX_OFF;
+ }
+
+ _delay_ms(200);
+
+ kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser);
+}
+
+int main(void)
+{
+ // LED for debug
+ LED_TX_INIT;
+ LED_TX_ON;
+
+ debug_enable = true;
+/*
+ debug_matrix = true;
+ debug_keyboard = true;
+ debug_mouse = true;
+*/
+
+ host_set_driver(&lufa_driver);
+ keyboard_init();
+
+ LUFA_setup();
+ sei();
+
+uint8_t ret;
+ // wait for startup of sendchar routine
+ while (USB_DeviceState != DEVICE_STATE_Configured) ;
+ if (debug_enable) {
+ _delay_ms(1000);
+ }
+
+ debug("init: start\n");
+ HID_setup();
+
+ debug("init: done\n");
+
+uint16_t timer;
+// to see loop pulse with oscillo scope
+DDRF = (1<<7);
+ for (;;) {
+PORTF ^= (1<<7);
+ keyboard_task();
+
+timer = timer_read();
+ usb_host.Task();
+timer = timer_elapsed(timer);
+if (timer > 100) {
+ debug("host.Task: "); debug_hex16(timer); debug("\n");
+}
+
+#if !defined(INTERRUPT_CONTROL_ENDPOINT)
+ // LUFA Task for control request
+ USB_USBTask();
+#endif
+ }
+
+ return 0;
+}
diff --git a/converter/usb_usb/matrix.c b/converter/usb_usb/matrix.c
new file mode 100644
index 0000000000..83d5ab6c83
--- /dev/null
+++ b/converter/usb_usb/matrix.c
@@ -0,0 +1,133 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "usb_hid.h"
+#include "keycode.h"
+#include "util.h"
+#include "print.h"
+#include "debug.h"
+#include "matrix.h"
+
+/* KEY CODE to Matrix
+ *
+ * HID keycode(1 byte):
+ * Higher 5 bits indicates ROW and lower 3 bits COL.
+ *
+ * 7 6 5 4 3 2 1 0
+ * +---------------+
+ * | ROW | COL |
+ * +---------------+
+ *
+ * Matrix space(32 * 8):
+ * 01234567
+ * 0 +--------+
+ * : | |
+ * : | |
+ * 31 +--------+
+ */
+#define ROW_MASK 0xF8
+#define COL_MASK 0x07
+#define CODE(row, col) (((row) << 3) | (col))
+#define ROW(code) (((code) & ROW_MASK) >> 3)
+#define COL(code) ((code) & COL_MASK)
+#define ROW_BITS(code) (1 << COL(code))
+
+
+uint8_t matrix_rows(void) { return MATRIX_ROWS; }
+uint8_t matrix_cols(void) { return MATRIX_COLS; }
+void matrix_init(void) {}
+bool matrix_has_ghost(void) { return false; }
+
+static bool matrix_is_mod =false;
+
+uint8_t matrix_scan(void) {
+ static uint16_t last_time_stamp = 0;
+
+ if (last_time_stamp != usb_hid_time_stamp) {
+ last_time_stamp = usb_hid_time_stamp;
+ matrix_is_mod = true;
+ } else {
+ matrix_is_mod = false;
+ }
+ return 1;
+}
+
+bool matrix_is_modified(void) {
+
+ return matrix_is_mod;
+}
+
+bool matrix_is_on(uint8_t row, uint8_t col) {
+ uint8_t code = CODE(row, col);
+
+ if (IS_MOD(code)) {
+ if (usb_hid_keyboard_report.mods & ROW_BITS(code)) {
+ return true;
+ }
+ }
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
+ if (usb_hid_keyboard_report.keys[i] == code) {
+ return true;
+ }
+ }
+ return false;
+}
+
+uint8_t matrix_get_row(uint8_t row) {
+ uint8_t row_bits = 0;
+
+ if (IS_MOD(CODE(row, 0)) && usb_hid_keyboard_report.mods) {
+ row_bits |= usb_hid_keyboard_report.mods;
+ }
+
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
+ if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
+ if (row == ROW(usb_hid_keyboard_report.keys[i])) {
+ row_bits |= ROW_BITS(usb_hid_keyboard_report.keys[i]);
+ }
+ }
+ }
+ return row_bits;
+}
+
+uint8_t matrix_key_count(void) {
+ uint8_t count = 0;
+
+ count += bitpop(usb_hid_keyboard_report.mods);
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
+ if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
+ count++;
+ }
+ }
+ return count;
+}
+
+void matrix_print(void) {
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile
new file mode 100644
index 0000000000..60e9a57467
--- /dev/null
+++ b/converter/x68k_usb/Makefile
@@ -0,0 +1,101 @@
+#
+# Makefile for PJRC Teensy
+#
+
+
+# Target file name (without extension).
+TARGET = x68k_usb_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ protocol/serial_uart.c
+
+CONFIG_H = config_pjrc.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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+
+#---------------- Programming Options --------------------------
+AVRDUDE = avrdude
+# Type: avrdude -c ? to get a full listing.
+AVRDUDE_PROGRAMMER = avr109
+AVRDUDE_PORT = /dev/ttyACM0
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+#AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+#PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/converter/x68k_usb/README b/converter/x68k_usb/README
new file mode 100644
index 0000000000..516fcd249f
--- /dev/null
+++ b/converter/x68k_usb/README
@@ -0,0 +1,151 @@
+X68000 to USB keyboard protocol converter
+=========================================
+SHARP X68000 is a hobby computer released in Japan.(1987-93)
+http://en.wikipedia.org/wiki/Sharp_X68000
+
+X68000 keyboard has ALPS linear switches.
+- DSETK0016CE01 green linear
+- DSETK0022CE02 yellow linear
+- DSETK0023CE03 yellow linear
+
+
+Hardware
+--------
+Target MCU is ATMega32u4 but other USB capable AVR will also work.
+You can use PJRC Teensy as development board.
+ http://www.pjrc.com/teensy/
+
+Wiring:
+ Mini-DIN Teensy
+ -----------------------------------------------------
+ pin1 +5V VCC
+ pin2 MOUSE -
+ pin3 RXD PD2(RXD)
+ pin4 TXD PD3(TXD) NOTE: Not supported yet.
+ pin5 READY -
+ pin6 REMOTE -
+ pin7 GND GND
+
+
+Firmware
+--------
+Build:
+ $ cd x68k_usb
+ $ make
+
+And load the binary to MCU with your favorite programmer.
+If you use Teensy you can load with PJRC Teensy Loader tool.
+ http://www.pjrc.com/teensy/loader.html
+
+
+* * * * * * * * * * * * * * * * * *
+
+
+X68000 Keyboard Protocol
+========================
+http://kyoutan.jpn.org/uts/pc/pic/x68key/
+
+
+Connector
+---------
+Mini DIN 7pin(female connector on computer side)
+ 7 6 5
+ o o o
+ 4 o = o 3
+ o o
+ 2 1
+
+ Mini-DIN
+ -------------
+ pin1 +5V
+ pin2 MOUSE
+ pin3 RXD
+ pin4 TXD
+ pin5 READY
+ pin6 REMOTE
+ pin7 GND
+
+
+Signaling
+---------
+- TXD,RXD
+ Asynchronous, 2400baud, 1-startbit(L), 8-databit, 1-stopbit(H)
+
+- READY
+ ready/not ready(1/0)
+
+
+Data from keyboard
+------------------
+bit 7 make/break flag(0/1)
+bit 6-0 following scan code
+
+
+Data from computer
+------------------
+- LED control ON/OFF(0/1)
+ bit 7 1(fixed)
+ bit 6 全角
+ bit 5 ひらがな
+ bit 4 INS
+ bit 3 CAPS
+ bit 2 コード入力
+ bit 1 ローマ字
+ bit 0 かな
+
+- Repeat delay
+ bit 7 0(fixed)
+ bit 6 1(fixed)
+ bit 5 1(fixed)
+ bit 4 0(fixed)
+ bit 3-0 delay
+ REPEAT_DELAY = 200+delay*100 ms
+ default: 500ms
+
+- Repeat time
+ bit 7 0(fixed)
+ bit 6 1(fixed)
+ bit 5 1(fixed)
+ bit 4 1(fixed)
+ bit 3-0 time
+ REPEAT_TIME = 30+time^2*5 ms
+ default: 110ms
+
+
+Scan Codes
+----------
+,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
+| 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
+`---' `---' `-------------------' `-------------------' `-----------' `---------------'
+,-----------------------------------------------------------. ,-----------. ,---------------.
+| 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
+|-----------------------------------------------------------| |------------ |---------------|
+| 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
+|------------------------------------------------------. 1D | `---=====---' |---------------|
+| 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
+|-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
+| 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
+`-----------------------------------------------------------| .---=====---. |-----------| 4E|
+ | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
+ `---------------------------------------------' `-----------' `---------------'
+
+
+
+LED Special Functions
+---------------------
+http://homepage2.nifty.com/m_kamada/docs/unlistedx68k.htm#keyboard
+
+1. Random Illumination
+ Plug in with pressing F1, F2 and F3.
+
+2. Sequential Illumination
+ Plug in with pressing 記号入力(52), 登録(53) and HELP.
+
+3. Scan code Display
+ Plug in with pressing かな(5A), ローマ字(5B) and コード入力(5C).
+ You can see its scan code on LEDs by pressing a key.
+ +---------------------------------------------------+
+ |bit|6 |5 |4 |3 |2 |1 |0 |
+ |---+----+--------+---+----+----------+--------+----|
+ |LED|全角|ひらがな|INS|CAPS|コード入力|ローマ字|かな|
+ +---------------------------------------------------+
diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h
new file mode 100644
index 0000000000..c49b4a73e1
--- /dev/null
+++ b/converter/x68k_usb/config_pjrc.h
@@ -0,0 +1,67 @@
+/*
+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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6800
+#define MANUFACTURER t.m.k.
+#define PRODUCT SHARP X68000 keyboard converter
+#define DESCRIPTION converts SHARP X68000 keyboard protocol into USB
+
+
+/* matrix size */
+#define MATRIX_ROWS 16
+#define MATRIX_COLS 8
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \
+)
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+/* USART configuration
+ * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control
+ */
+#ifdef __AVR_ATmega32U4__
+ #define SERIAL_UART_BAUD 2400
+ #define SERIAL_UART_DATA UDR1
+ #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
+ #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 = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
+ UCSR1B = (1<<RXCIE1) | (1<<RXEN1) | /* RX: interrupt, RX: enable */ \
+ (1<<TXEN1); /* TX: enable */ \
+ UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
+ (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
+ sei(); \
+ } while(0)
+#else
+# error "USART configuration is needed."
+#endif
+
+#endif
diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c
new file mode 100644
index 0000000000..5e09f55d20
--- /dev/null
+++ b/converter/x68k_usb/keymap.c
@@ -0,0 +1,150 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "util.h"
+#include "keymap.h"
+
+
+
+
+// Following macros help you to define a keymap with the form of actual keyboard layout.
+
+/* X68000 Keyboard Scan codes
+ ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
+ | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
+ `---' `---' `-------------------' `-------------------' `-----------' `---------------'
+ ,-----------------------------------------------------------. ,-----------. ,---------------.
+ | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
+ |-----------------------------------------------------------| |------------ |---------------|
+ | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
+ |------------------------------------------------------. 1D | `---=====---' |---------------|
+ | 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
+ |-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
+ | 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
+ `-----------------------------------------------------------| .---=====---. |-----------| 4E|
+ | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
+ `---------------------------------------------' `-----------' `---------------'
+*/
+#define KEYMAP( \
+ K61,K62, K63,K64,K65,K66,K67, K68,K69,K6A,K6B,K6C, K5A,K5B,K5C, K5D,K52,K53,K54, \
+ K01,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K0E,K0F, K36,K5E,K37, K3F,K40,K41,K42, \
+ K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B,K1C, K1D, K38,K39,K3A, K43,K44,K45,K46, \
+ K71,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29, K3C, K47,K48,K49,K4A, \
+ K70,K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34, K3B,K3E,K3D, K4B,K4C,K4D,K4E, \
+ K5F,K55,K56, K35, K57,K58,K59,K60, K72, K73, K4F,K50,K51 \
+) { \
+ { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_NO, KC_NO, KC_NO, KC_NO, }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
+}
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 0, // Fn1
+ 0, // Fn2
+ 0, // Fn3
+ 0, // Fn4
+ 0, // Fn5
+ 0, // Fn6
+ 0 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_NO, // Fn2
+ KC_NO, // Fn3
+ KC_NO, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* X68000 Keyboard Scan codes
+ ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
+ | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
+ `---' `---' `-------------------' `-------------------' `-----------' `---------------'
+ ,-----------------------------------------------------------. ,-----------. ,---------------.
+ | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
+ |-----------------------------------------------------------| |------------ |---------------|
+ | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
+ |------------------------------------------------------. 1D | `---=====---' |---------------|
+ | 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
+ |-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
+ | 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
+ `-----------------------------------------------------------| .---=====---. |-----------| 4E|
+ | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
+ `---------------------------------------------' `-----------' `---------------'
+*/
+ /* ANSI */
+ KEYMAP(
+ F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,F18, UP, P4, P5, P6, PEQL,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,GRV, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
+ F19, LGUI,LALT, SPC, RALT,RGUI,RCTL,APP, F14, F15, P0, PCMM,PDOT
+ ),
+ /* JIS */
+ KEYMAP(
+ F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, UP, P4, P5, P6, PEQL,
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
+ LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT
+ ),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/converter/x68k_usb/led.c b/converter/x68k_usb/led.c
new file mode 100644
index 0000000000..ccc38699c7
--- /dev/null
+++ b/converter/x68k_usb/led.c
@@ -0,0 +1,43 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "serial.h"
+#include "led.h"
+#include "debug.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ /* X68000 LED bits 0: on, 1: off
+ * bit 7 1(fixed)
+ * bit 6 全角
+ * bit 5 ひらがな
+ * bit 4 INS
+ * bit 3 CAPS
+ * bit 2 コード入力
+ * bit 1 ローマ字
+ * bit 0 かな
+ */
+ uint8_t led = 0xFF;
+ if (usb_led&(1<<USB_LED_NUM_LOCK)) led &= ~(1<<2);
+ if (usb_led&(1<<USB_LED_CAPS_LOCK)) led &= ~(1<<3);
+ if (usb_led&(1<<USB_LED_SCROLL_LOCK)) led &= ~(1<<1);
+ if (usb_led&(1<<USB_LED_COMPOSE)) led &= ~(1<<4);
+ if (usb_led&(1<<USB_LED_KANA)) led &= ~(1<<0);
+ serial_send(led);
+}
diff --git a/converter/x68k_usb/matrix.c b/converter/x68k_usb/matrix.c
new file mode 100644
index 0000000000..2d5a1e1169
--- /dev/null
+++ b/converter/x68k_usb/matrix.c
@@ -0,0 +1,142 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "util.h"
+#include "serial.h"
+#include "matrix.h"
+#include "debug.h"
+
+
+/*
+ * Matrix Array usage:
+ *
+ * ROW: 16(4bits)
+ * COL: 8(3bits)
+ *
+ * 8bit wide
+ * +---------+
+ * 0|00 ... 07|
+ * 1|08 ... 0F|
+ * :| ... |
+ * :| ... |
+ * E|70 ... 77|
+ * F|78 ... 7F|
+ * +---------+
+ *
+ */
+static uint8_t matrix[MATRIX_ROWS];
+#define ROW(code) ((code>>3)&0xF)
+#define COL(code) (code&0x07)
+
+static bool is_modified = false;
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ serial_init();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
+
+ return;
+}
+
+uint8_t matrix_scan(void)
+{
+ is_modified = false;
+
+ uint16_t code;
+ code = serial_recv2();
+ if (code == -1) {
+ return 0;
+ }
+
+ dprintf("%02X\n", code);
+ if (code&0x80) {
+ // break code
+ if (matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] &= ~(1<<COL(code));
+ is_modified = true;
+ }
+ } else {
+ // make code
+ if (!matrix_is_on(ROW(code), COL(code))) {
+ matrix[ROW(code)] |= (1<<COL(code));
+ is_modified = true;
+ }
+ }
+ return code;
+}
+
+bool matrix_is_modified(void)
+{
+ return is_modified;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+uint8_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop(matrix[i]);
+ }
+ return count;
+}
diff --git a/keyboard/IIgs/Makefile b/keyboard/IIgs/Makefile
new file mode 100644
index 0000000000..3bf380e64b
--- /dev/null
+++ b/keyboard/IIgs/Makefile
@@ -0,0 +1,95 @@
+#----------------------------------------------------------------------------
+# 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 = IIgs_Standard
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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.
+#
+MOUSEKEY_ENABLE = no # Mouse keys
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+EXTRAKEY_ENABLE = yes # Audio control and System control
+#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/IIgs/README b/keyboard/IIgs/README
new file mode 100644
index 0000000000..820d771102
--- /dev/null
+++ b/keyboard/IIgs/README
@@ -0,0 +1,45 @@
+Replaceable USB Controller for Apple IIgs/Standard(M0116)
+JeffreySung(nattyman@gmail.com)
+
+===============================
+
+Feature
+-------
+- Replaceable keyboard controller for Apple IIgs(A9M0330)/Standard(M0116)
+- Teensy++ 2.0 required
+- Some signal bypass required
+- ADB keyboard doesn't use matrix for modifier keys. With virtual row for modifier keys,
+ these keys are merged into key matrix using virtual row.
+
+History
+=======
+- 2012.09.17 First Release
+- 2012.09.17 CapsLock support
+- 2012.09.19 Power button added
+Build
+=====
+0. Just Type "Make" and return.
+
+Hardware
+========
+PJRC Teensy
+-----------
+0. The following ports should not be connected to board.
+ From top view of Teensy++, from GND and counter clock wise.
+ -7,26(in keyboard PCB, these pins are VDD,GND)
+ -30,31(in Teensy++, these pins are Ref,GND respectively)
+ -5,6(D2,D3 for bluetooth in future)
+1. Bypass #31 pin(from board) to E4(Teensy)
+2. Bypass #30 pin(from board) to F2(Teensy)
+3. Bypass #6 pin(from board) to A0(Teensy)
+4. Refer to documentation directory
+
+To Do
+=====
+0. When DEBOUNCE defined, there is a errors.
+1. Layer Change by toggling Clear Key
+2. Eject Key add. (following files should be modified.)
+ common/keycode.h
+ common/keyboard.c
+3. Use bluetooth
+EOF
diff --git a/keyboard/IIgs/config.h b/keyboard/IIgs/config.h
new file mode 100644
index 0000000000..bc8bf75f94
--- /dev/null
+++ b/keyboard/IIgs/config.h
@@ -0,0 +1,63 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+/* for Apple
+#define VENDOR_ID 0x05AC
+#define PRODUCT_ID 0xBEE0
+*/
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xBEE0
+#define DEVICE_VER 0x0202
+#define MANUFACTURER t.m.k.
+#define PRODUCT Apple Desktop Bus Keyboard
+
+
+/* message strings */
+#define DESCRIPTION Apple M0116/A9M0660 keyboard firmware
+
+
+/* matrix size */
+#define MATRIX_ROWS 11 // last row is virtual for modifier
+#define MATRIX_COLS 8
+/* define if matrix has ghost */
+#define MATRIX_HAS_GHOST
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+
+/* layer switching */
+#define LAYER_SWITCH_DELAY 100
+#define LAYER_SEND_FN_TERM 300
+
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
+#endif
diff --git a/keyboard/IIgs/doc/PIN_BYPASS.jpg b/keyboard/IIgs/doc/PIN_BYPASS.jpg
new file mode 100644
index 0000000000..2998f0c3f8
--- /dev/null
+++ b/keyboard/IIgs/doc/PIN_BYPASS.jpg
Binary files differ
diff --git a/keyboard/IIgs/doc/Teensy++_Mod.jpg b/keyboard/IIgs/doc/Teensy++_Mod.jpg
new file mode 100644
index 0000000000..146c1ab93c
--- /dev/null
+++ b/keyboard/IIgs/doc/Teensy++_Mod.jpg
Binary files differ
diff --git a/keyboard/IIgs/hid_listen.mac b/keyboard/IIgs/hid_listen.mac
new file mode 100755
index 0000000000..8758fdf886
--- /dev/null
+++ b/keyboard/IIgs/hid_listen.mac
Binary files differ
diff --git a/keyboard/IIgs/keymap.c b/keyboard/IIgs/keymap.c
new file mode 100644
index 0000000000..cd33e223ac
--- /dev/null
+++ b/keyboard/IIgs/keymap.c
@@ -0,0 +1,142 @@
+/*
+Copyright 2012 Jeffrey Sung <nattyman@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/>.
+*/
+
+/*
+ * Keymap for Apple IIgs/Standard Keyboard
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( R10C5, \
+ R3C7, R3C6, R3C5, R3C4, R3C3, R3C2, R3C1, R8C1, R8C0, R3C0, R0C0, R0C1, R0C2, R0C3, R4C4, R4C5, R4C6, R4C7, \
+ R9C7, R9C6, R9C5, R9C4, R9C3, R9C2, R9C1, R9C0, R1C0, R1C1, R1C2, R1C3, R1C4, R2C4, R2C5, R2C6, R2C3, \
+ R10C0,R7C7, R7C6, R7C5, R7C4, R7C3, R7C2, R7C1, R7C0, R0C4, R1C6, R1C7, R1C5, R2C0, R2C1, R2C2, R2C7, \
+ R10C1,R6C7, R6C6, R6C5, R6C4, R6C3, R6C2, R6C1, R6C0, R0C5, R0C6, R4C0, R4C1, R4C2, \
+ R10C4,R10C2,R10C3,R5C4, R5C7, R5C5, R5C6, R5C0, R5C2, R0C7, R5C1, R5C3, R4C3 \
+) { \
+ { R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7 }, \
+ { R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7 }, \
+ { R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7 }, \
+ { R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7 }, \
+ { R4C0, R4C1, R4C2, R4C3, R4C4, R4C5, R4C6, R4C7 }, \
+ { R5C0, R5C1, R5C2, R5C3, R5C4, R5C5, R5C6, R5C7 }, \
+ { R6C0, R6C1, R6C2, R6C3, R6C4, R6C5, R6C6, R6C7 }, \
+ { R7C0, R7C1, R7C2, R7C3, R7C4, R7C5, R7C6, R7C7 }, \
+ { R8C0, R8C1, KC_NO, KC_NO, KC_NO,KC_NO, KC_NO, KC_NO }, \
+ { R9C0, R9C1, R9C2, R9C3, R9C4, R9C5, R9C6, R9C7 }, \
+ { R10C0,R10C1, R10C2, R10C3, R10C4,R10C5, KC_NO, KC_NO} \
+}
+
+#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 1, // Fn1
+ 2, // Fn2
+ 3, // Fn3
+ 4, // Fn4
+ 0, // Fn5
+ 3, // Fn6
+ 3 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_SLSH, // Fn2
+ KC_SCLN, // Fn3
+ KC_SPC, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------. ,---------------,
+ * | POWER | | |
+ * |-----------------------------------------------------------| |---------------|
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |FN0| = | / | * |
+ * |-----------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7 | 8 | 9 | + |
+ * |-----------------------------------------------------' | |---------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return | | 4 | 5 | 6 | - |
+ * |-----------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| / |Shift | | 1 | 2 | 3 | E |
+ * |-----------------------------------------------------------| |-----------| N |
+ * |CAPS|Alt |Gui |` |SPC |BSLS |LFT|RGT|DN|UP| | 0 | . | T |
+ * `-----------------------------------------------------------' |---------------'
+ */
+ KEYMAP( KC_PWR,
+ 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_BSPC, KC_FN1, KC_PEQL, KC_PSLS, KC_PAST, \
+ 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_P7, KC_P8, KC_P9, KC_PPLS, \
+ 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_P4, KC_P5, KC_P6, KC_PMNS, \
+ KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_P1, KC_P2, KC_P3, \
+ KC_CAPS,KC_LALT,KC_LGUI,KC_GRV, KC_SPC, KC_BSLS,KC_LEFT,KC_RGHT,KC_DOWN,KC_UP, KC_P0, KC_PDOT, KC_PENT),
+
+
+ /* Layer 1: Tenkey use Layer
+ * ,-----------------------------------------------------------. ,---------------,
+ * | POWER | | |
+ * |-----------------------------------------------------------| |---------------|
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |NLK| = | / | * |
+ * |-----------------------------------------------------------| |---------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |INS| 8 |PGU|V+ |
+ * |-----------------------------------------------------' | |---------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return | |DEL|UP |PGD|V- |
+ * |-----------------------------------------------------------| |---------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| / |Shift | |LFT|DN |RGT| E |
+ * |-----------------------------------------------------------| |-----------| N |
+ * |CAPS|Alt |Gui |` |SPC |BSLS |LFT|RGT|DN|UP| | 0 | . | T |
+ * `-----------------------------------------------------------' `---------------'
+ */
+ KEYMAP( KC_PWR, \
+ 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_BSPC, KC_FN1, KC_PEQL, KC_PSLS, KC_MUTE, \
+ 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_INS, KC_P8, KC_PGUP, KC_VOLU, \
+ 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_DEL, KC_UP, KC_PGDN, KC_VOLD, \
+ KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_LEFT, KC_DOWN, KC_RIGHT, \
+ KC_CAPS,KC_LALT,KC_LGUI,KC_GRV, KC_SPC, KC_BSLS,KC_LEFT,KC_RGHT,KC_DOWN,KC_UP, KC_P0, KC_PDOT, KC_PENT),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return KEYCODE(layer, row, col);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/keyboard/IIgs/led.c b/keyboard/IIgs/led.c
new file mode 100644
index 0000000000..f76545f0ba
--- /dev/null
+++ b/keyboard/IIgs/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/keyboard/IIgs/matrix.c b/keyboard/IIgs/matrix.c
new file mode 100644
index 0000000000..6ca55b7ea2
--- /dev/null
+++ b/keyboard/IIgs/matrix.c
@@ -0,0 +1,363 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "led.h"
+
+
+#if (MATRIX_COLS > 16)
+# error "MATRIX_COLS must not exceed 16"
+#endif
+#if (MATRIX_ROWS > 255)
+# error "MATRIX_ROWS must not exceed 255"
+#endif
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+// matrix state buffer(1:on, 0:off)
+#if (MATRIX_COLS <= 8)
+static uint8_t *matrix;
+static uint8_t *matrix_prev;
+static uint8_t _matrix0[MATRIX_ROWS];
+static uint8_t _matrix1[MATRIX_ROWS];
+#else
+static uint16_t *matrix;
+static uint16_t *matrix_prev;
+static uint16_t _matrix0[MATRIX_ROWS];
+static uint16_t _matrix1[MATRIX_ROWS];
+#endif
+
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+static uint8_t read_col(uint8_t row);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // initialize row and col
+ unselect_rows();
+ // Input with pull-up(DDR:0, PORT:1)
+ // Column C1 ~ C7 (PortC0-6)
+ // Column C0(Port E1)
+ DDRC &= ~0b01111111;
+ PORTC |= 0b01111111;
+ DDRE &= ~0b00000010;
+ PORTE |= 0b00000010;
+ //DDRB &= ~0b00000100;
+ //PORTB |= 0b00000100;
+ // modifier B3/4,F4/5,E4 always input
+ // A0
+ //DDRA |= 0b00000001;
+ //PORTA &= 0b00000001;
+ //DDRB |= 0b00011000;
+ //PORTB &= 0b00011000;
+ //DDRF |= ~0b00110000;
+ //PORTF &= 0b00110000;
+ //DDRB &= ~0b00011000;
+ //PORTB |= 0b00011000;
+ //DDRF &= ~0b00110000;
+ //PORTF |= 0b00110000;
+ //DDRE &= ~0b00010000;
+ //PORTE |= 0b00010000;
+
+ // 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;
+}
+
+uint8_t matrix_scan(void)
+{
+ if (!debouncing) {
+ uint8_t *tmp = matrix_prev;
+ matrix_prev = matrix;
+ matrix = tmp;
+ }
+
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ unselect_rows();
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ if ( i == ( MATRIX_ROWS - 1 ) ) { // CHECK CAPS LOCK
+ if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { // CAPS LOCK is ON on HOST
+ if ( ~read_col(i) & (1<< 4) ) { // CAPS LOCK is still DOWN ( 0bXXX1_XXXX)
+ matrix[i] = ~read_col(i) & 0b11101111; // change CAPS LOCK as released
+ } else { // CAPS LOCK in UP
+ matrix[i] = ~read_col(i) | 0b00010000; // send fake caps lock down
+ }
+ } else { // CAPS LOCK is OFF on HOST
+ if (matrix[i] != (uint8_t)~read_col(i)) {
+ matrix[i] = (uint8_t)~read_col(i);
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); print("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ } else {
+ if (matrix[i] != (uint8_t)~read_col(i)) {
+ matrix[i] = (uint8_t)~read_col(i);
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); print("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ }
+ unselect_rows();
+
+ if (debouncing) {
+ debouncing--;
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ 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)
+{
+#ifdef MATRIX_HAS_GHOST
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_has_ghost_in_row(i))
+ return true;
+ }
+#endif
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+// if ( row == ( MATRIX_ROWS - 1 ) && col == 4) { // CHECK CAPS LOCK
+// if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { // CAPS LOCK is ON on HOST
+// if ((matrix_prev[row] & 0b00010000) && (~matrix[row] & 0b00010000)) {
+// debug("CapsLock Reverse:");debug_hex(matrix[row]);
+// matrix[row] |= 0b00010000;
+// matrix_prev[row] &= ~0b00010000;
+// debug("->");debug_hex(matrix[row]);debug("\n");
+// }
+// }
+// }
+ return (matrix[row] & (1<<col));
+}
+
+inline
+#if (MATRIX_COLS <= 8)
+uint8_t matrix_get_row(uint8_t row)
+#else
+uint16_t matrix_get_row(uint8_t row)
+#endif
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+#if (MATRIX_COLS <= 8)
+ pbin_reverse(matrix_get_row(row));
+#else
+ pbin_reverse16(matrix_get_row(row));
+#endif
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+#if (MATRIX_COLS <= 8)
+ count += bitpop(matrix[i]);
+#else
+ count += bitpop16(matrix[i]);
+#endif
+ }
+ return count;
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]) == matrix[row])
+ return true;
+ }
+ return false;
+}
+#endif
+
+inline
+static uint8_t read_col(uint8_t row)
+{
+ // For normal : Column C1 ~ C7 (PortC0-6), C0(Port E1)
+ // For modifier : B3(CNTRL)/4(SHIFT),F4(CMD/GUI)/5(OPTION,ALT)
+ // Modifier would be copied to report->mods except E4(CAPSLOCK)
+ uint8_t tmp;
+ if ( row == 10 ) {
+ tmp = 0xC0;
+ tmp |= (PINB >> 3 ) & 0b00000011; // LEFT CTRL is 0bit in modifier (HID Spec)
+ // LEFT SHIFT is 1bit in modifier (HID Spec)
+ tmp |= (PINF >> 3 ) & 0b00000100; // LEFT ALT is 2bit in modifier (HID Spec)
+ tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec)
+ tmp |= (PINA << 4 ) & 0b00010000; // CAPSLOCK
+ tmp |= (PINB << 3 ) & 0b00100000; // POWER
+ } else {
+ tmp = 0x00;
+ tmp = (PINE >> 1)&0b00000001;
+ tmp |= PINC << 1 ;
+ }
+ return tmp;
+}
+
+inline
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ // DDR : 1, output 0, input
+ DDRB &= ~0b00000011; // PB: 1,0
+ PORTB &= ~0b00000011;
+ DDRD &= ~0b00010000; // PD: 4
+ PORTD &= ~0b00010000;
+ DDRE &= ~0b11000000; // PE: 7,6
+ PORTE &= ~0b11000000;
+ DDRF &= ~0b11000111; // PF: 7,6,2,1,0
+ PORTF &= ~0b11000111;
+ // to unselect virtual row(modifier), set port to output with low
+ DDRA |= 0b00000001; // PA: 0 for CAPSLOCK
+ PORTA &= ~0b00000001;
+ DDRB |= 0b00011100; // PB: 3,4 for modifier(row10)
+ PORTB &= ~0b00011100; // PB: 2 for power
+ DDRF |= 0b00110000; // PF: 4,5 for modifier
+ PORTF &= ~0b00110000;
+}
+
+inline
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ // with row enable, column could send low to AVR when pressed
+ // row: 0 1 2 3 4 5 6 7 8 9
+ // pin: PB1, PB0, PE7, PE6, PD4, PF2, PF0, PF1, PF6 PF7
+ switch (row) {
+ case 0:
+ DDRB |= (1<<1);
+ PORTB &= ~(1<<1);
+ break;
+ case 1:
+ DDRB |= (1<<0);
+ PORTB &= ~(1<<0);
+ break;
+ case 2:
+ DDRE |= (1<<7);
+ PORTE &= ~(1<<7);
+ break;
+ case 3:
+ DDRE |= (1<<6);
+ PORTE &= ~(1<<6);
+ break;
+ case 4:
+ DDRD |= (1<<4);
+ PORTD &= ~(1<<4);
+ break;
+ case 5:
+ DDRF |= (1<<2);
+ PORTF &= ~(1<<2);
+ break;
+ case 6:
+ DDRF |= (1<<0);
+ PORTF &= ~(1<<0);
+ break;
+ case 7:
+ DDRF |= (1<<1);
+ PORTF &= ~(1<<1);
+ break;
+ case 8:
+ DDRF |= (1<<6);
+ PORTF &= ~(1<<6);
+ break;
+ case 9:
+ DDRF |= (1<<7);
+ PORTF &= ~(1<<7);
+ break;
+ case 10:
+ // modifier has no row enable
+ // to select virtual row, set port as input
+ DDRA &= ~0b00000001;
+ PORTA |= 0b00000001;
+ DDRB &= ~0b00011100;
+ PORTB |= 0b00011100;
+ DDRF &= ~0b00110000;
+ PORTF |= 0b00110000;
+ break;
+
+ }
+}
diff --git a/keyboard/alps64/Makefile b/keyboard/alps64/Makefile
new file mode 100644
index 0000000000..e90dcedb67
--- /dev/null
+++ b/keyboard/alps64/Makefile
@@ -0,0 +1,134 @@
+#----------------------------------------------------------------------------
+# 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 = alps64
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_plain.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# MCU name
+MCU = atmega32u2
+
+# 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
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/alps64/config.h b/keyboard/alps64/config.h
new file mode 100644
index 0000000000..06649a092d
--- /dev/null
+++ b/keyboard/alps64/config.h
@@ -0,0 +1,70 @@
+/*
+Copyright 2015 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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6464
+#define DEVICE_VER 0x0001
+#define MANUFACTURER geekhack
+#define PRODUCT Alps64
+#define DESCRIPTION t.m.k. keyboard firmware for Alps64
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* 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/keyboard/alps64/keymap_common.c b/keyboard/alps64/keymap_common.c
new file mode 100644
index 0000000000..fdb1769e1c
--- /dev/null
+++ b/keyboard/alps64/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/keyboard/alps64/keymap_common.h b/keyboard/alps64/keymap_common.h
new file mode 100644
index 0000000000..b2d6ad5c4a
--- /dev/null
+++ b/keyboard/alps64/keymap_common.h
@@ -0,0 +1,70 @@
+/*
+Copyright 2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* Alps64 keymap definition macro */
+#define KEYMAP( \
+ K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \
+ K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+ K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+ K31, K41, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, K22, \
+ K30, K40, K50, K60, K70, K00, K10, K20 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 } \
+}
+
+/* AEK US */
+#define KEYMAP_AEK( \
+ K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K27, \
+ K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+ K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+ K31, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, \
+ K30, K40, K50, K60, K00, K10, K20 \
+) KEYMAP( \
+ K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, NO, K27, \
+ K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
+ K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
+ K31, NO, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, NO, \
+ K30, K40, K50, K60, NO, K00, K10, K20 \
+)
+
+#endif
diff --git a/keyboard/alps64/keymap_hasu.c b/keyboard/alps64/keymap_hasu.c
new file mode 100644
index 0000000000..784b313134
--- /dev/null
+++ b/keyboard/alps64/keymap_hasu.c
@@ -0,0 +1,151 @@
+#include "keymap_common.h"
+
+/*
+ * Hasu
+ */
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ [0] = KEYMAP_AEK( \
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN1, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, \
+ LCTL,LGUI,LALT, FN4, RALT,FN5, RCTL),
+
+ /* HHKB mode[HHKB Fn]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del |
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ [1] = KEYMAP_AEK( \
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT, \
+ LCTL,LGUI,LALT, TRNS, RALT,RGUI,RCTL),
+
+ /* Vi mode[Slash]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del |
+ * |-----------------------------------------------------------|
+ * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
+ * `-----------------------------------------------------------'
+ */
+ [2] = KEYMAP_AEK( \
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL),
+
+ /* Mouse mode(IJKL)[Semicolon]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
+ * `-----------------------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ [3] = KEYMAP_AEK( \
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \
+ LCTL,LGUI,LALT, BTN1, TRNS,TRNS,TRNS),
+
+ /* Layer 4: Mouse mode(IJKL)[Space]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * |-----------------------------------------------------------|
+ * |Ctrl |Gui |Alt | Space |Alt |Fn5 |Ctrl |
+ * `-----------------------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ [4] = KEYMAP_AEK( \
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \
+ LCTL,LGUI,LALT, TRNS, TRNS,TRNS,TRNS),
+};
+
+
+/* id for user defined function/macro */
+enum function_id {
+ NONE,
+};
+
+enum macro_id {
+ ALT_TAB,
+};
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
+ [1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER), // HHKB layer
+ [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
+ [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
+ [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
+ [5] = ACTION_LAYER_MOMENTARY(3), // Mousekey layer(IJKL)
+ [6] = ACTION_LAYER_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
+ [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
+ [8] = ACTION_MACRO(ALT_TAB), // Application switching
+ [9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT),
+ [10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT),
+};
+
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch (id) {
+ case ALT_TAB:
+ return (record->event.pressed ?
+ MACRO( D(LALT), D(TAB), END ) :
+ MACRO( U(TAB), END ));
+ }
+ return MACRO_NONE;
+}
diff --git a/keyboard/alps64/keymap_plain.c b/keyboard/alps64/keymap_plain.c
new file mode 100644
index 0000000000..13a4407f8f
--- /dev/null
+++ b/keyboard/alps64/keymap_plain.c
@@ -0,0 +1,12 @@
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_AEK( \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL),
+};
+const uint16_t PROGMEM fn_actions[] = {};
diff --git a/keyboard/alps64/led.c b/keyboard/alps64/led.c
new file mode 100644
index 0000000000..d20c51aabe
--- /dev/null
+++ b/keyboard/alps64/led.c
@@ -0,0 +1,34 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // output high
+ DDRC |= (1<<5);
+ PORTC |= (1<<5);
+ } else {
+ // Hi-Z
+ DDRC &= ~(1<<5);
+ PORTC &= ~(1<<5);
+ }
+}
diff --git a/keyboard/alps64/matrix.c b/keyboard/alps64/matrix.c
new file mode 100644
index 0000000000..a49755c3a3
--- /dev/null
+++ b/keyboard/alps64/matrix.c
@@ -0,0 +1,190 @@
+/*
+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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // initialize row and col
+ unselect_rows();
+ init_cols();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i] != cols) {
+ matrix_debouncing[i] = cols;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+/* Column pin configuration
+ * col: 0 1 2 3 4 5 6 7
+ * pin: B0 B1 B2 B3 B4 B5 B6 B7
+ */
+static void init_cols(void)
+{
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRB &= ~0b11111111;
+ PORTB |= 0b11111111;
+}
+
+/* Returns status of switches(1:on, 0:off) */
+static matrix_row_t read_cols(void)
+{
+ // Invert because PIN indicates 'switch on' with low(0) and 'off' with high(1)
+ return ~PINB;
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4 5 6 7
+ * pin: D0 D1 D2 D3 D4 D5 D6 C2
+ */
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRD &= ~0b01111111;
+ PORTD &= ~0b01111111;
+ DDRC &= ~0b00000100;
+ PORTD &= ~0b00000100;
+}
+
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 0:
+ DDRD |= (1<<0);
+ PORTD &= ~(1<<0);
+ break;
+ case 1:
+ DDRD |= (1<<1);
+ PORTD &= ~(1<<1);
+ break;
+ case 2:
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<2);
+ break;
+ case 3:
+ DDRD |= (1<<3);
+ PORTD &= ~(1<<3);
+ break;
+ case 4:
+ DDRD |= (1<<4);
+ PORTD &= ~(1<<4);
+ break;
+ case 5:
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
+ break;
+ case 6:
+ DDRD |= (1<<6);
+ PORTD &= ~(1<<6);
+ break;
+ case 7:
+ DDRC |= (1<<2);
+ PORTC &= ~(1<<2);
+ break;
+ }
+}
diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile
new file mode 100644
index 0000000000..083b87c30a
--- /dev/null
+++ b/keyboard/gh60/Makefile
@@ -0,0 +1,135 @@
+#----------------------------------------------------------------------------
+# 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 = gh60_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_poker.c $(SRC)
+endif
+
+CONFIG_H = config.h
+
+
+# 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
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Optimize size but this may cause error "relocation truncated to fit"
+#EXTRALDFLAGS = -Wl,--relax
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/gh60/Makefile.pjrc b/keyboard/gh60/Makefile.pjrc
new file mode 100644
index 0000000000..11bd3b7840
--- /dev/null
+++ b/keyboard/gh60/Makefile.pjrc
@@ -0,0 +1,116 @@
+#----------------------------------------------------------------------------
+# 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 = gh60_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ led.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_poker.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 = atmega32u4
+#MCU = at90usb1286
+
+
+# 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
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+plain: OPT_DEFS += -DKEYMAP_PLAIN
+plain: all
+
+poker: OPT_DEFS += -DKEYMAP_POKER
+poker: all
+
+poker_set: OPT_DEFS += -DKEYMAP_POKER_SET
+poker_set: all
+
+poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT
+poker_bit: all
diff --git a/keyboard/gh60/README.md b/keyboard/gh60/README.md
new file mode 100644
index 0000000000..510cb5c8b6
--- /dev/null
+++ b/keyboard/gh60/README.md
@@ -0,0 +1,141 @@
+GH60 keyboard firmware
+======================
+DIY compact keyboard designed and run by komar007 and Geekhack community.
+
+- Both Rev.A and Rev.B PCB are supported by one firmware binary(issue #64)
+
+## GH60 Resources
+- [KOMAR's project page](http://blog.komar.be/projects/gh60-programmable-keyboard/)
+- [Prototyping](http://geekhack.org/index.php?topic=34959.0)
+- [Rev.A PCB test](http://geekhack.org/index.php?topic=37570.0)
+- [Rev.B PCB test](http://geekhack.org/index.php?topic=50685.0)
+- [Group buy](http://geekhack.org/index.php?topic=41464.0)
+
+
+## Build
+Move to this directory then just run `make` like:
+
+ $ make
+
+Use `make -f Makefile.pjrc` if you want to use PJRC stack but I find no reason to do so now.
+
+
+## Keymap
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files.
+
+To build firmware binary hex file with a certain keymap just do `make` with `KEYMAP` option like:
+
+ $ make KEYMAP=[poker|poker_set|poker_bit|plain|hasu|spacefn|hhkb|<name>]
+
+
+### 1 Poker
+[keymap_poker.c](keymap_poker.c) emulates original Poker layers
+while both [keymap_poker_bit.c](keymap_poker_bit.c) and [keymap_poker_set.c](keymap_poker_set.c) implements same layout in different way and they fix a minor issue of original Poker and enhance arrow keys.
+
+ Fn + Esc = `
+ Fn + {left, down, up, right} = {home, pgdown, pgup, end}
+
+#### 1.0 Default layer
+ ,-----------------------------------------------------------.
+ | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ |-----------------------------------------------------------|
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------|
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
+ |-----------------------------------------------------------|
+ |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl|
+ `-----------------------------------------------------------'
+#### 1.1 Poker Fn layer
+ ,-----------------------------------------------------------.
+ |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |
+ |-----------------------------------------------------------|
+ | |FnQ| Up| | | | | | |Cal| |Hom|Ins| |
+ |-----------------------------------------------------------|
+ | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| |
+ |-----------------------------------------------------------|
+ | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| Up |
+ |-----------------------------------------------------------|
+ | | | | FnS |Fn |Left|Down|Righ|
+ `-----------------------------------------------------------'
+
+
+### 2. Plain
+Without any Fn layer this will be useful if you want to use key remapping tool like AHK on host.
+See [keymap_plain.c](keymap_plain.c) for detail.
+
+#### 1.0 Plain Default layer
+ ,-----------------------------------------------------------.
+ |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ |-----------------------------------------------------------|
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------|
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
+ |-----------------------------------------------------------|
+ |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
+ `-----------------------------------------------------------'
+
+
+### 3. Hasu
+This is my favorite keymap with HHKB Fn, Vi cursor and Mousekey layer. See [keymap_hasu.c](keymap_hasu.c) for detail.
+
+
+### 4. SpaceFN
+This layout proposed by spiceBar uses space bar to change layer with using Dual role key technique. See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhack.org/index.php?topic=51069.0).
+
+#### 4.0 Default layer
+ ,-----------------------------------------------------------.
+ |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ |-----------------------------------------------------------|
+ |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------|
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
+ |-----------------------------------------------------------|
+ |Ctrl|Gui |Alt | Space/Fn |Alt |Gui |App |Ctrl|
+ `-----------------------------------------------------------'
+#### 4.1 SpaceFN layer
+ ,-----------------------------------------------------------.
+ |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ |-----------------------------------------------------------|
+ | | | | | | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ |-----------------------------------------------------------|
+ | | | | | | |PgU|Lef|Dow|Rig| | | |
+ |-----------------------------------------------------------|
+ | | | | | |Spc|PgD|` |~ | | | |
+ |-----------------------------------------------------------|
+ | | | | Fn | | | | |
+ `-----------------------------------------------------------'
+
+
+### 5. HHKB
+[keymap_hhkb.c](keymap_hhkb.c) emulates original HHKB layers.
+#### 5.0: Default layer
+ ,-----------------------------------------------------------.
+ |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ |-----------------------------------------------------------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc |
+ |-----------------------------------------------------------|
+ |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ |-----------------------------------------------------------|
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn |
+ |-----------------------------------------------------------|
+ | |Gui |Alt | Space | |Alt |Gui | |
+ `-----------------------------------------------------------'
+#### 5.1: HHKB Fn layer
+ ,-----------------------------------------------------------.
+ |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ |-----------------------------------------------------------|
+ |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ |-----------------------------------------------------------|
+ | |VoD|VoU|Mut|Ejc| | *| /|Hom|PgU|Lef|Rig|Enter |
+ |-----------------------------------------------------------|
+ | | | | | | | +| -|End|PgD|Dow| | |
+ |-----------------------------------------------------------|
+ | | | | | | | | |
+ `-----------------------------------------------------------'
+
diff --git a/keyboard/gh60/config.h b/keyboard/gh60/config.h
new file mode 100644
index 0000000000..e9c0f4366d
--- /dev/null
+++ b/keyboard/gh60/config.h
@@ -0,0 +1,70 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6060
+#define DEVICE_VER 0x0001
+#define MANUFACTURER geekhack
+#define PRODUCT GH60
+#define DESCRIPTION t.m.k. keyboard firmware for GH60
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 14
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* 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/keyboard/gh60/keymap_common.c b/keyboard/gh60/keymap_common.c
new file mode 100644
index 0000000000..fdb1769e1c
--- /dev/null
+++ b/keyboard/gh60/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h
new file mode 100644
index 0000000000..896badd748
--- /dev/null
+++ b/keyboard/gh60/keymap_common.h
@@ -0,0 +1,84 @@
+/*
+Copyright 2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+/* GH60 keymap definition macro
+ * K2C, K31 and K3C are extra keys for ISO
+ */
+#define KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \
+ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+ K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
+}
+
+/* ANSI valiant. No extra keys for ISO */
+#define KEYMAP_ANSI( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
+ K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \
+ K40, K41, K42, K45, K4A, K4B, K4C, K4D \
+) KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \
+ K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \
+ K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \
+)
+
+
+#define KEYMAP_HHKB( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
+ K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3C, \
+ K40, K41, K42, K45, K4A, K4B, K4C, K4D \
+) KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \
+ K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
+ K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D \
+)
+
+#endif
diff --git a/keyboard/gh60/keymap_hasu.c b/keyboard/gh60/keymap_hasu.c
new file mode 100644
index 0000000000..e6af28585b
--- /dev/null
+++ b/keyboard/gh60/keymap_hasu.c
@@ -0,0 +1,145 @@
+#include "keymap_common.h"
+
+/*
+ * Hasu
+ */
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Keymap 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Caps | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space |Alt |Fn4 |Fn4 |Fn1 |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_ANSI(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN2, QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, FN9, \
+ LCTL,LGUI,LALT, SPC, RALT,FN3, FN3, FN0),
+ /* Keymap 1: colemak */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \
+ BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \
+ LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
+ /* Keymap 2: dvorak */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \
+ TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \
+ CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \
+ LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
+ /* Keymap 3: workman */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \
+ BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \
+ LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, FN0),
+
+ /* Overlay 4: HHKB mode
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Inser|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space |Alt |Gui |App | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,INS, \
+ LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, \
+ LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,FN4, TRNS),
+ /* Overlay 5: Vi mode (Slash)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgU|End| | | | |
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgU|End| |Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, TRNS,TRNS,TRNS,TRNS, \
+ LCTL,TRNS,LEFT,DOWN,RGHT,TRNS,LEFT,DOWN,UP, RGHT,TRNS,TRNS, ENT, \
+ LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,PGDN,PGUP,END, TRNS, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL),
+ /* Overlay 6: Mouse mode (Semicolon/App)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|MwU|MwR| | | | |
+ * |-----------------------------------------------------------|
+ * |Contro| |Ac0|Ac1|Ac1| |McL|McD|McU|McR| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space | | | | |
+ * `-----------------------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \
+ TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,TRNS, \
+ LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,TRNS, ENT, \
+ LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,TRNS, RSFT, \
+ LCTL,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,RCTL),
+ /* Overlay 7: Layout selector
+ * ,-----------------------------------------------------------.
+ * | Lq| Lc| Ld| Lw| | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | |Lq |Lw | | | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | |Ld | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | |Lc | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ * Lq: set Qwerty layout
+ * Lc: set Colemak layout
+ * Ld: set Dvorak layout
+ * Lw: set Workman layout
+ */
+ KEYMAP_ANSI(
+ FN5, FN6, FN7, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,FN5, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(4),
+ [1] = ACTION_LAYER_TAP_KEY(5, KC_SLASH),
+ [2] = ACTION_LAYER_TAP_KEY(6, KC_SCLN),
+ [3] = ACTION_LAYER_MOMENTARY(6),
+ [4] = ACTION_LAYER_MOMENTARY(7), // to Layout selector
+ [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout
+ [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout
+ [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout
+ [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout
+ [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV),
+};
diff --git a/keyboard/gh60/keymap_hhkb.c b/keyboard/gh60/keymap_hhkb.c
new file mode 100644
index 0000000000..ce1b816ecb
--- /dev/null
+++ b/keyboard/gh60/keymap_hhkb.c
@@ -0,0 +1,52 @@
+#include "keymap_common.h"
+
+/*
+ * HHKB Layout
+ */
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: Default layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc |
+ * |-----------------------------------------------------------|
+ * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn |
+ * |-----------------------------------------------------------|
+ * | |Gui |Alt | Space | |Alt |Gui | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_HHKB(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,FN0, \
+ NO, LGUI,LALT, SPC, NO, RALT,RGUI,NO),
+ /* 1: HHKB Fn layer
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |-----------------------------------------------------------|
+ * | |VoD|VoU|Mut|Ejc| | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_HHKB(
+ PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,TRNS, \
+ TRNS,VOLD,VOLU,MUTE,EJCT,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, PENT, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, TRNS,TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/keyboard/gh60/keymap_plain.c b/keyboard/gh60/keymap_plain.c
new file mode 100644
index 0000000000..3138c18077
--- /dev/null
+++ b/keyboard/gh60/keymap_plain.c
@@ -0,0 +1,11 @@
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NO, ENT, \
+ LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL),
+};
+const uint16_t PROGMEM fn_actions[] = {};
diff --git a/keyboard/gh60/keymap_poker.c b/keyboard/gh60/keymap_poker.c
new file mode 100644
index 0000000000..7a612ee44d
--- /dev/null
+++ b/keyboard/gh60/keymap_poker.c
@@ -0,0 +1,104 @@
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 1: colemak */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, \
+ BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, \
+ LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 2: dvorak */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, \
+ TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, \
+ CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, \
+ LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 3: workman */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, \
+ BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, \
+ LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 4: Poker with Arrow */
+ KEYMAP_ANSI(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT),
+ /* 5: Poker with Esc */
+ KEYMAP_ANSI(
+ ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+ /* 6: Poker Fn
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |
+ * |-----------------------------------------------------------|
+ * | |FnQ| Up| | | | | | |Cal| |Hom|Ins|FnL |
+ * |-----------------------------------------------------------|
+ * | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| |
+ * |-----------------------------------------------------------|
+ * | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| |
+ * |-----------------------------------------------------------|
+ * | | | | FnS | | | | |
+ * `-----------------------------------------------------------'
+ * Fn: to Fn overlay
+ * FnL: to Layout selector overaly
+ * FnQ: toggle Esc overlay
+ * FnS: toggle Arrow overlay
+ */
+ KEYMAP_ANSI(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ TRNS,FN2, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, FN4, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN3, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \
+ TRNS,TRNS,TRNS, FN1, TRNS,TRNS,TRNS,TRNS),
+ /* 7: Layout selector
+ * ,-----------------------------------------------------------.
+ * | Lq| Lc| Ld| Lw| | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | |Lq |Lw | | | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | |Ld | | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | |Lc | | | | | | | | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ * Lq: set Qwerty layout
+ * Lc: set Colemak layout
+ * Ld: set Dvorak layout
+ * Lw: set Workman layout
+ */
+ KEYMAP_ANSI(
+ FN5, FN6, FN7, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,FN5, FN8, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+};
+const uint16_t PROGMEM fn_actions[] = {
+ /* Poker Layout */
+ [0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay
+ [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
+ [2] = ACTION_LAYER_TOGGLE(5), // toggle Esc overlay
+ [3] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // Task(RControl,RShift+Esc)
+ [4] = ACTION_LAYER_MOMENTARY(7), // to Layout selector
+ [5] = ACTION_DEFAULT_LAYER_SET(0), // set qwerty layout
+ [6] = ACTION_DEFAULT_LAYER_SET(1), // set colemak layout
+ [7] = ACTION_DEFAULT_LAYER_SET(2), // set dvorak layout
+ [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout
+};
diff --git a/keyboard/gh60/keymap_poker_bit.c b/keyboard/gh60/keymap_poker_bit.c
new file mode 100644
index 0000000000..b8870fdd81
--- /dev/null
+++ b/keyboard/gh60/keymap_poker_bit.c
@@ -0,0 +1,50 @@
+#include "keymap_common.h"
+
+// Poker fix with toggle and bit operation
+// Fn + Esc = `
+// Fn + {left, down, up, right} = {home, pgdown, pgup, end}
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 4: Poker Default + Fn'd */
+ [4] = KEYMAP_ANSI(
+ TRNS,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ CAPS,FN2, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN4, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \
+ TRNS,TRNS,TRNS, FN1, TRNS,TRNS,TRNS,TRNS),
+ /* 5: Poker with Arrow */
+ KEYMAP_ANSI(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, PGUP, \
+ TRNS,TRNS,TRNS, TRNS, FN3, HOME,PGDN,END),
+ /* 6: Poker with Esc */
+ KEYMAP_ANSI(
+ ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+ /* 7: Poker with Arrow + Fn'd */
+ KEYMAP_ANSI(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT),
+};
+const uint16_t PROGMEM fn_actions[] = {
+ /* Poker Layout */
+ [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc)
+ [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle
+ [2] = ACTION_LAYER_TOGGLE(6), // Poker Esc toggle
+ [3] = ACTION_LAYER_BIT_XOR(1, 0b1101, ON_BOTH), // Poker Fn(with fix for Arrow)
+ [4] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN3 Task(RControl,RShift+Esc)
+};
diff --git a/keyboard/gh60/keymap_poker_set.c b/keyboard/gh60/keymap_poker_set.c
new file mode 100644
index 0000000000..aaa31fc571
--- /dev/null
+++ b/keyboard/gh60/keymap_poker_set.c
@@ -0,0 +1,82 @@
+#include "keymap_common.h"
+
+// Poker fix with set(state transition)
+// Fn + Esc = `
+// Fn + {left, down, up, right} = {home, pgdown, pgup, end}
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI(
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, SPC, FN0, RGUI,APP, RCTL),
+ /* 1: Poker with Arrow */
+ KEYMAP_ANSI(
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \
+ TRNS,TRNS,TRNS, TRNS, FN1, LEFT,DOWN,RGHT),
+ /* 2: Poker with Esc */
+ KEYMAP_ANSI(
+ ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, FN2, TRNS,TRNS,TRNS),
+ /* 3: Poker with Arrow and Esc */
+ KEYMAP_ANSI(
+ ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \
+ TRNS,TRNS,TRNS, TRNS, FN3, LEFT,DOWN,RGHT),
+ /* 4: Poker Fn'd */
+ KEYMAP_ANSI(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ TRNS,FN6, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \
+ TRNS,TRNS,TRNS, FN5, FN4, TRNS,TRNS,TRNS),
+ /* 5: Poker Fn'd arrow */
+ KEYMAP_ANSI(
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ TRNS,FN7, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \
+ TRNS,TRNS,TRNS, FN4, FN5, HOME,PGDN,END),
+ /* 6: Poker Fn'd Esc */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ TRNS,FN4, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, TRNS, \
+ TRNS,TRNS,TRNS, FN7, FN6, TRNS,TRNS,TRNS),
+ /* 7: Poker Fn'd Arrow + Esc */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
+ TRNS,FN5, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,CALC,TRNS,HOME,INS, TRNS, \
+ TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,PSCR,SLCK,PAUS,TRNS,FN8, END, TRNS, \
+ TRNS,DEL, TRNS,WHOM,MUTE,VOLU,VOLD,TRNS,PGUP,PGDN,DEL, PGUP, \
+ TRNS,TRNS,TRNS, FN6, FN7, HOME,PGDN,END),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ /* Poker Layout */
+ [0] = ACTION_LAYER_SET(4, ON_PRESS), // FN0 move to Fn'd when press
+ [1] = ACTION_LAYER_SET(5, ON_PRESS), // FN1 move to Fn'd arrow when press
+ [2] = ACTION_LAYER_SET(6, ON_PRESS), // FN2 move to Fn'd Esc when press
+ [3] = ACTION_LAYER_SET(7, ON_PRESS), // FN3 move to Fn'd arrow + Esc when press
+
+ //[4] = ACTION_LAYER_CLEAR(ON_RELEASE), // FN4 clear overlay when release
+ [4] = ACTION_LAYER_SET(0, ON_RELEASE), // FN4 clear overlay when release
+ [5] = ACTION_LAYER_SET(1, ON_RELEASE), // FN5 move to arrow when release
+ [6] = ACTION_LAYER_SET(2, ON_RELEASE), // FN6 move to Esc when release
+ [7] = ACTION_LAYER_SET(3, ON_RELEASE), // FN7 move to arrow + Esc when release
+
+ [8] = ACTION_MODS_KEY(MOD_RCTL|MOD_RSFT, KC_ESC), // FN8 Task(RControl,RShift+Esc)
+};
diff --git a/keyboard/gh60/keymap_spacefn.c b/keyboard/gh60/keymap_spacefn.c
new file mode 100644
index 0000000000..8077dcee7b
--- /dev/null
+++ b/keyboard/gh60/keymap_spacefn.c
@@ -0,0 +1,55 @@
+#include "keymap_common.h"
+
+/*
+ * SpaceFN
+ * http://geekhack.org/index.php?topic=51069.0
+ */
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Keymap 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_ANSI(
+ ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
+ LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL),
+
+ /* Overlay 1: SpaceFN
+ * ,-----------------------------------------------------------.
+ * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * | | | | | | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ * |-----------------------------------------------------------|
+ * | | | | | | |PgU|Lef|Dow|Rig| | | |
+ * |-----------------------------------------------------------|
+ * | | | | | |Spc|PgD|` |~ | | | |
+ * |-----------------------------------------------------------|
+ * | | | | | | | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_ANSI(
+ GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+};
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+};
diff --git a/keyboard/gh60/led.c b/keyboard/gh60/led.c
new file mode 100644
index 0000000000..62abcd79da
--- /dev/null
+++ b/keyboard/gh60/led.c
@@ -0,0 +1,34 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ // output low
+ DDRB |= (1<<2);
+ PORTB &= ~(1<<2);
+ } else {
+ // Hi-Z
+ DDRB &= ~(1<<2);
+ PORTB &= ~(1<<2);
+ }
+}
diff --git a/keyboard/gh60/matrix.c b/keyboard/gh60/matrix.c
new file mode 100644
index 0000000000..a61215152c
--- /dev/null
+++ b/keyboard/gh60/matrix.c
@@ -0,0 +1,211 @@
+/*
+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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // initialize row and col
+ unselect_rows();
+ init_cols();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i] != cols) {
+ matrix_debouncing[i] = cols;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+/* Column pin configuration
+ * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
+ * pin: F0 F1 E6 C7 C6 B6 D4 B1 B0 B5 B4 D7 D6 B3 (Rev.A)
+ * pin: B7 (Rev.B)
+ */
+static void init_cols(void)
+{
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRF &= ~(1<<0 | 1<<1);
+ PORTF |= (1<<0 | 1<<1);
+ DDRE &= ~(1<<6);
+ PORTE |= (1<<6);
+ DDRD &= ~(1<<7 | 1<<6 | 1<<4);
+ PORTD |= (1<<7 | 1<<6 | 1<<4);
+ DDRC &= ~(1<<7 | 1<<6);
+ PORTC |= (1<<7 | 1<<6);
+ DDRB &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
+ PORTB |= (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 | 1<<1 | 1<<0);
+}
+
+static matrix_row_t read_cols(void)
+{
+ return (PINF&(1<<0) ? 0 : (1<<0)) |
+ (PINF&(1<<1) ? 0 : (1<<1)) |
+ (PINE&(1<<6) ? 0 : (1<<2)) |
+ (PINC&(1<<7) ? 0 : (1<<3)) |
+ (PINC&(1<<6) ? 0 : (1<<4)) |
+ (PINB&(1<<6) ? 0 : (1<<5)) |
+ (PIND&(1<<4) ? 0 : (1<<6)) |
+ (PINB&(1<<1) ? 0 : (1<<7)) |
+ ((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<8)) | // Rev.A and B
+ (PINB&(1<<5) ? 0 : (1<<9)) |
+ (PINB&(1<<4) ? 0 : (1<<10)) |
+ (PIND&(1<<7) ? 0 : (1<<11)) |
+ (PIND&(1<<6) ? 0 : (1<<12)) |
+ (PINB&(1<<3) ? 0 : (1<<13));
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4
+ * pin: D0 D1 D2 D3 D5
+ */
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRD &= ~0b00101111;
+ PORTD &= ~0b00101111;
+}
+
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 0:
+ DDRD |= (1<<0);
+ PORTD &= ~(1<<0);
+ break;
+ case 1:
+ DDRD |= (1<<1);
+ PORTD &= ~(1<<1);
+ break;
+ case 2:
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<2);
+ break;
+ case 3:
+ DDRD |= (1<<3);
+ PORTD &= ~(1<<3);
+ break;
+ case 4:
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
+ break;
+ }
+}
diff --git a/keyboard/ghost_squid/Makefile.lufa b/keyboard/ghost_squid/Makefile.lufa
new file mode 100644
index 0000000000..54adb1e3d8
--- /dev/null
+++ b/keyboard/ghost_squid/Makefile.lufa
@@ -0,0 +1,117 @@
+#----------------------------------------------------------------------------
+# 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 = ghostsquid_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+# MCU name
+MCU = atmega32u2
+
+# 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)
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/ghost_squid/README.md b/keyboard/ghost_squid/README.md
new file mode 100644
index 0000000000..dda67e6ba1
--- /dev/null
+++ b/keyboard/ghost_squid/README.md
@@ -0,0 +1,20 @@
+The Ghost Squid controller
+==========================
+Custom controller for the Cooler Master QuickFire XT keyboard designed by bpiphany.
+
+*Note that this is not the official firmware*
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.lufa
+
+At the moment only the LUFA stack is supported.
+
+
+Bootloader
+---------
+To enter bootloader by hardware use a magnet above the controller before connecting the usb cable.
+
+It is still possible to use Boot Magic and Command (LSFT+RSFT+PAUS) to access the bootloader though.
diff --git a/keyboard/ghost_squid/config.h b/keyboard/ghost_squid/config.h
new file mode 100644
index 0000000000..54f03143c1
--- /dev/null
+++ b/keyboard/ghost_squid/config.h
@@ -0,0 +1,43 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED // 0x2516 (original CM XT value)
+#define PRODUCT_ID 0x001A
+#define DEVICE_VER 0x0000
+#define MANUFACTURER Cooler Master
+#define PRODUCT Cooler Master QuickFire XT
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Cooler Master QuickFire XT
+
+/* matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 18
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/ghost_squid/keymap.c b/keyboard/ghost_squid/keymap.c
new file mode 100644
index 0000000000..e9ad9efe1a
--- /dev/null
+++ b/keyboard/ghost_squid/keymap.c
@@ -0,0 +1,102 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+/*
+ Matrix col/row mapping
+
+ ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------.
+ |06/6| |07/4|08/4|08/2|08/6| |15/5|11/6|12/2|12/4| |14/4|14/5|14/6|14/0| |13/5|13/7|15/7|
+ `----' `-------------------' `-------------------' `-------------------' `--------------'
+ ,-------------------------------------------------------------------------. ,--------------. ,-------------------.
+ |06/4|06/5|07/5|08/5|09/5|09/4|10/4|10/5|11/5|12/5|05/5|05/4|11/4| 14/2| |17/4|02/4|04/4| |16/1|17/1|04/1|04/0|
+ |-------------------------------------------------------------------------| |--------------| |-------------------|
+ |06/2 |06/7|07/7|08/7|09/7|09/2|10/2|10/7|11/7|12/7|05/7|05/2|11/2| 14/3| |16/4|02/5|04/5| |16/7|17/7|04/7| |
+ |-------------------------------------------------------------------------| '--------------' |-------------- 02/7|
+ |02/7 |06/3|07/3|08/3|09/3|09/6|10/6|10/3|11/3|12/3|05/3|05/6| 14/1| |16/2|17/2|04/2| |
+ |-------------------------------------------------------------------------| ,----. |-------------------|
+ |01/2 |06/1|07/1|08/1|09/1|09/0|10/0|10/1|11/1|12/1|05/0| 01/3| |02/6| |16/3|17/3|04/3| |
+ |-------------------------------------------------------------------------| ,--------------. |-------------- 02/3|
+ |15/4|03/2|13/6| 16/6 |13/0|0/3|12/0|15/1| |02/0|16/0|17/0| | 17/6 |04/6| |
+ `-------------------------------------------------------------------------' `--------------' `-------------------'
+*/
+
+#define KEYMAP( \
+ KG6, KH4, KI4, KI2, KI6, KP5, KL6, KM2, KM4, KO4, KO5, KO6, KO0, KN5, KN7, KP7, \
+ KG4, KG5, KH5, KI5, KJ5, KJ4, KK4, KK5, KL5, KM5, KF5, KF4, KL4, KO2, KR4, KC4, KE4, KQ1, KR1, KE1, KE0, \
+ KG2, KG7, KH7, KI7, KJ7, KJ2, KK2, KK7, KL7, KM7, KF7, KF2, KL2, KO3, KQ4, KC5, KE5, KQ7, KR7, KE7, KC7, \
+ KH2, KG3, KH3, KI3, KJ3, KJ6, KK6, KK3, KL3, KM3, KF3, KF6, KO1, KQ2, KR2, KE2, \
+ KB2, KH6, KG1, KH1, KI1, KJ1, KJ0, KK0, KK1, KL1, KM1, KF0, KB3, KC6, KQ3, KR3, KE3, KC3, \
+ KP4, KD2, KN6, KQ6, KN0, KA3, KM0, KP1, KC0, KQ0, KR0, KR6, KE6 \
+) { \
+/* 0 1 2 3 4 5 6 7 */ \
+/* A 0 */ {KC_NO, KC_NO, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* B 1 */ {KC_NO, KC_NO, KC_##KB2, KC_##KB3, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* C 2 */ {KC_##KC0, KC_NO, KC_NO, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7},\
+/* D 3 */ {KC_NO, KC_NO, KC_##KD2, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* E 4 */ {KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7},\
+/* F 5 */ {KC_##KF0, KC_NO, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7},\
+/* G 6 */ {KC_NO, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7},\
+/* H 7 */ {KC_NO, KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7},\
+/* I 8 */ {KC_NO, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7},\
+/* J 9 */ {KC_##KJ0, KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7},\
+/* K 10 */ {KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7},\
+/* L 11 */ {KC_NO, KC_##KL1, KC_##KL2, KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7},\
+/* M 12 */ {KC_##KM0, KC_##KM1, KC_##KM2, KC_##KM3, KC_##KM4, KC_##KM5, KC_NO, KC_##KM7},\
+/* N 13 */ {KC_##KN0, KC_NO, KC_NO, KC_NO, KC_NO, KC_##KN5, KC_##KN6, KC_##KN7},\
+/* O 14 */ {KC_##KO0, KC_##KO1, KC_##KO2, KC_##KO3, KC_##KO4, KC_##KO5, KC_##KO6, KC_NO },\
+/* P 15 */ {KC_NO, KC_##KP1, KC_NO, KC_NO, KC_##KP4, KC_##KP5, KC_NO, KC_##KP7},\
+/* Q 16 */ {KC_##KQ0, KC_##KQ1, KC_##KQ2, KC_##KQ3, KC_##KQ4, KC_NO, KC_##KQ6, KC_##KQ7},\
+/* R 17 */ {KC_##KR0, KC_##KR1, KC_##KR2, KC_##KR3, KC_##KR4, KC_NO, KC_##KR6, KC_##KR7} \
+}
+
+#include "keymap_ansi.h"
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.col)][(key.row)]);
+ } else {
+ return pgm_read_byte(&keymaps[0][(key.col)][(key.row)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/ghost_squid/keymap_ansi.h b/keyboard/ghost_squid/keymap_ansi.h
new file mode 100644
index 0000000000..ed1088baa9
--- /dev/null
+++ b/keyboard/ghost_squid/keymap_ansi.h
@@ -0,0 +1,23 @@
+
+static const uint8_t PROGMEM keymaps[][MATRIX_COLS][MATRIX_ROWS] = {
+ /* Layer 0: Standard ANSI layer */
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, \
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI, FN0,RCTL, LEFT,DOWN,RGHT, P0, PDOT), \
+ /* Layer 1: Function layer */
+ KEYMAP(\
+ CALC,MYCM,WSCH,WHOM,MAIL,VOLD,VOLU,MSEL,MSTP,MPLY,MPRV,MNXT,TRNS, WAKE, PWR,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS)
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/ghost_squid/led.c b/keyboard/ghost_squid/led.c
new file mode 100644
index 0000000000..da5dbd7ae2
--- /dev/null
+++ b/keyboard/ghost_squid/led.c
@@ -0,0 +1,60 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+/* LED pin configuration
+ *
+ * Scroll Lock PB7
+ * CAPS PC6
+ * NUMLOCK PC5
+ *
+ */
+void led_set(uint8_t usb_led)
+{
+ DDRB |= (1<<7);
+ DDRC |= (1<<5) | (1<<6);
+
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ PORTC &= ~(1<<6);
+ }
+ else
+ {
+ PORTC |= (1<<6);
+ }
+
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ {
+ PORTC &= ~(1<<5);
+ }
+ else
+ {
+ PORTC |= (1<<5);
+ }
+
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ {
+ PORTB &= ~(1<<7);
+ }
+ else
+ {
+ PORTB |= (1<<7);
+ }
+}
diff --git a/keyboard/ghost_squid/matrix.c b/keyboard/ghost_squid/matrix.c
new file mode 100644
index 0000000000..d6a82ef759
--- /dev/null
+++ b/keyboard/ghost_squid/matrix.c
@@ -0,0 +1,237 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+inline uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ unselect_cols();
+ init_rows();
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ select_col(col);
+ _delay_us(3);
+ uint8_t rows = read_rows();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row pin configuration
+ *
+ * row: 0 1 2 3 4 5 6 7
+ * pin: PB1 PC2 PB6 PB4 PB3 PB5 PB0 PB2
+ *
+ */
+static void init_rows(void)
+{
+ DDRC &= ~0b00000100;
+ DDRB &= ~0b01111111;
+ PORTC |= 0b00000100;
+ PORTB |= 0b01111111;
+}
+
+static uint8_t read_rows(void)
+{
+ return (PINB&(1<<1) ? 0 : (1<<0)) |
+ (PINC&(1<<2) ? 0 : (1<<1)) |
+ (PINB&(1<<6) ? 0 : (1<<2)) |
+ (PINB&(1<<4) ? 0 : (1<<3)) |
+ (PINB&(1<<3) ? 0 : (1<<4)) |
+ (PINB&(1<<5) ? 0 : (1<<5)) |
+ (PINB&(1<<0) ? 0 : (1<<6)) |
+ (PINB&(1<<2) ? 0 : (1<<7));
+}
+
+/* These columns uses two 74HC42 4 to 10 bit demultiplexers (low active).
+ *
+ * COL PD6 PD5 PD4 PD3 PD2 PD1
+ * 10 1 1 0 0 0 0
+ * 15 1 1 0 0 0 1
+ * 8 1 1 0 0 1 0
+ * 14 1 1 0 1 0 0
+ * 6 1 1 0 1 0 1
+ * 13 1 1 0 1 1 0
+ * 12 1 1 1 0 0 0
+ * 9 1 1 1 0 1 0
+ * 11 1 1 1 1 0 0
+ * 7 1 1 1 1 1 0
+ *
+ * COL PD1 PD2 PD3 PD4 PD5 PD6
+ * 3 1 1 0 0 0 1
+ * 4 1 1 0 0 1 0
+ * 17 1 1 0 1 0 0
+ * 16 1 1 0 1 1 0
+ * 0 1 1 1 0 0 1
+ * 5 1 1 1 0 1 0
+ * 2 1 1 1 1 0 0
+ * 1 1 1 1 1 1 0
+ */
+static void unselect_cols(void)
+{
+ DDRD |= 0b01111111;
+ PORTD &= ~0b01111111;
+}
+
+static void select_col(uint8_t col)
+{
+ switch (col) {
+ case 0:
+ PORTD |= (1<<6) | (1<<3) | (1<<2) | (1<<1);
+ break;
+ case 1:
+ PORTD |= (1<<5) | (1<<4) | (1<<3) | (1<<2) | (1<<1);
+ break;
+ case 2:
+ PORTD |= (1<<4) | (1<<3) | (1<<2) | (1<<1);
+ break;
+ case 3:
+ PORTD |= (1<<6) | (1<<2) | (1<<1);
+ break;
+ case 4:
+ PORTD |= (1<<5) | (1<<2) | (1<<1);
+ break;
+ case 5:
+ PORTD |= (1<<5) | (1<<3) | (1<<2) | (1<<1);
+ break;
+ case 6:
+ PORTD |= (1<<6) | (1<<5) | (1<<3) | (1<<1);
+ break;
+ case 7:
+ PORTD |= (1<<6) | (1<<5) | (1<<4) | (1<<3) | (1<<2);
+ break;
+ case 8:
+ PORTD |= (1<<6) | (1<<5) | (1<<2);
+ break;
+ case 9:
+ PORTD |= (1<<6) | (1<<5) | (1<<4) | (1<<2);
+ break;
+ case 10:
+ PORTD |= (1<<6) | (1<<5);
+ break;
+ case 11:
+ PORTD |= (1<<6) | (1<<5) | (1<<4) | (1<<3);
+ break;
+ case 12:
+ PORTD |= (1<<6) | (1<<5) | (1<<4);
+ break;
+ case 13:
+ PORTD |= (1<<6) | (1<<5) | (1<<3) | (1<<2);
+ break;
+ case 14:
+ PORTD |= (1<<6) | (1<<5) | (1<<3);
+ break;
+ case 15:
+ PORTD |= (1<<6) | (1<<5) | (1<<1);
+ break;
+ case 16:
+ PORTD |= (1<<5) | (1<<4) | (1<<2) | (1<<1);
+ break;
+ case 17:
+ PORTD |= (1<<4) | (1<<2) | (1<<1);
+ break;
+ }
+}
diff --git a/keyboard/hbkb/Makefile.lufa b/keyboard/hbkb/Makefile.lufa
new file mode 100644
index 0000000000..322f219d69
--- /dev/null
+++ b/keyboard/hbkb/Makefile.lufa
@@ -0,0 +1,120 @@
+#----------------------------------------------------------------------------
+# 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 = hbkb_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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)
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/hbkb/config.h b/keyboard/hbkb/config.h
new file mode 100644
index 0000000000..fef8c05ed3
--- /dev/null
+++ b/keyboard/hbkb/config.h
@@ -0,0 +1,49 @@
+/*
+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
+
+
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xBB00
+#define MANUFACTURER t.m.k.
+#define DEVICE_VER 0x0100
+#define PRODUCT Happy Buckling Keyboard
+
+#define DESCRIPTION mod version of IBM Model M keyboard
+
+/* matrix size */
+#define MATRIX_ROWS 12
+#define MATRIX_COLS 8
+
+/* define if matrix has ghost */
+#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) \
+)
+
+#endif
diff --git a/keyboard/hbkb/keymap.c b/keyboard/hbkb/keymap.c
new file mode 100644
index 0000000000..b89bdf8e42
--- /dev/null
+++ b/keyboard/hbkb/keymap.c
@@ -0,0 +1,231 @@
+/*
+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/>.
+*/
+
+/*
+ * Keymap for Macway mod
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+
+
+/*
+ * Layout: 59key
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| BS |
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Fn4 |Alt | |Fn1 |
+ * `-----' `---------------------------------------' `-----'
+ *
+ * Matrix: 12x8
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
+ * ---+---------+---------+---------+---------+---------+---------+---------+---------
+ * 0 | | | LCTRL | | | | RCTRL |
+ * 1 | | LSHIFT | | | | | RSHIFT |
+ * 2 | | Tab | Grave | 1 | Q | A | Z |
+ * 3 | | Cpslck | | 2 | W | S | X |
+ * 4 | | | | 3 | E | D | C |
+ * 5 | G | T | 5 | 4 | R | F | V | B
+ * 6 | | Bckspc | | | Key*1 | Bckslsh | Enter | Space
+ * 7 | H | Y | 6 | 7 | U | J | M | N
+ * 8 | | Rbrckt | Equal | 8 | I | K | Comma |
+ * 9 | | | | 9 | O | L | Dot |
+ * A | | Lbrckt | Minus | 0 | P | Smcolon | | Slash
+ * B | LALT | | | | | | | RALT
+ * Key*1 This key locates between Equal and Backspace.
+ *
+ * Original matrix here: http://geekhack.org/showthread.php?7767-Wireless-Model-M&p=133911&viewfull=1#post133911
+ */
+#define KEYMAP( \
+ K22, K23, K33, K43, K53, K52, K72, K73, K83, K93, KA3, KA2, K82, K64, K61, \
+ K21, K24, K34, K44, K54, K51, K71, K74, K84, K94, KA4, KA1, K81, K65, \
+ K31, K25, K35, K45, K55, K50, K70, K75, K85, K95, KA5, KA0, K66, \
+ K11, K26, K36, K46, K56, K57, K77, K76, K86, K96, KA7, K16, \
+ K02, KB0, K67, KB7, K06 \
+) { \
+ { KC_NO, KC_NO, KC_##K02, KC_NO, KC_NO, KC_NO, KC_##K06, KC_NO }, \
+ { KC_NO, KC_##K11, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K16, KC_NO }, \
+ { KC_NO, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
+ { KC_NO, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
+ { KC_NO, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_##K93, KC_##K94, KC_##K95, KC_##K96, KC_NO }, \
+ { KC_##KA0, KC_##KA1, KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_NO, KC_##KA7 }, \
+ { KC_##KB0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##KB7 }, \
+}
+
+#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 1, // Fn1
+ 2, // Fn2
+ 3, // Fn3
+ 4, // Fn4
+ 0, // Fn5
+ 0, // Fn6
+ 0 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_SLSH, // Fn2
+ KC_SCLN, // Fn3
+ KC_SPC, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| BS |
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Fn4 |Alt | |Fn1 |
+ * `-----' `---------------------------------------' `-----'
+ */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, FN1, \
+ LGUI, LALT, FN4, RALT, FN1),
+
+
+ /* Layer 1: HHKB mode (HHKB Fn)
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig| |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Space |Alt | |Fn1 |
+ * `-----' `---------------------------------------' `-----'
+ */
+ KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,BRK, UP, NO, NO, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, \
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,FN1, \
+ LGUI, LALT, SPC, RALT, FN1),
+
+
+ /* Layer 2: Vi mode (Quote/Rmeta)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
+ * |-----------------------------------------------------------|
+ * | \ |Hom|PgD|Up |PgU|End|Hom|PgD|PgU|End| | | | |
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | | |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgU|End|xxx|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Space |Alt | |Fn1 |
+ * `-----' `---------------------------------------' `-----'
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NO, NO, \
+ BSLS,HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, NO, \
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, \
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT, \
+ LGUI, LALT, SPC, RALT, NO),
+
+
+
+ /* Layer 3: Mouse mode (Semicolon)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
+ * |-----------------------------------------------------------|
+ * | \ |MwL|MwD|McU|MwU|MwR|MwL|MwD|MwU|MwR| | | | |
+ * |-----------------------------------------------------------|
+ * |Contro| |McL|McD|McR| |McL|McD|McU|McR|xxx| | |
+ * |-----------------------------------------------------------|
+ * |Shift | | |Mb1|Mb2|Mb3|Mb2|Mb1| | | |Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Space |Alt | | |
+ * `-----' `---------------------------------------' `-----'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NO, NO, \
+ BSLS,WH_L,WH_D,MS_U,WH_U,WH_R,WH_L,WH_D,WH_U,WH_R,NO, NO, NO, NO, \
+ LCTL,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN3, NO, NO, \
+ LSFT,NO, NO, BTN1,BTN2,BTN3,BTN2,BTN1,NO, NO, NO, RSFT, \
+ LGUI, LALT, BTN1, RALT, NO),
+
+
+ /* Layer 4: Matias half keyboard style (Space)
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * |Backs| P| O| I| U| Y| T| R| E| W| Q| | |Tab |
+ * |-----------------------------------------------------------|
+ * |Contro| ;| L| K| J| H| G| F| D| S| A|Con|Control |
+ * |-----------------------------------------------------------|
+ * |Shift | /| .| ,| M| N| B| V| C| X| Z|Shift |
+ * |-----------------------------------------------------------|
+ * |Ctrl | |Alt | Fn4 |Alt | | |
+ * `-----' `---------------------------------------' `-----'
+ */
+ KEYMAP(MINS,0, 9, 8, 7, 6, 5, 4, 3, 2, 1, NO, NO, NO, ESC, \
+ BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \
+ LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \
+ LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT, \
+ LGUI, LALT, FN4, RALT, NO),
+
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return KEYCODE(layer, row, col);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/keyboard/hbkb/led.c b/keyboard/hbkb/led.c
new file mode 100644
index 0000000000..fc0eeb0ff7
--- /dev/null
+++ b/keyboard/hbkb/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/keyboard/hbkb/matrix.c b/keyboard/hbkb/matrix.c
new file mode 100644
index 0000000000..ee32312d9a
--- /dev/null
+++ b/keyboard/hbkb/matrix.c
@@ -0,0 +1,206 @@
+/*
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+/*
+ * Happy Buckling Keyboard(IBM Model M mod)
+ *
+ * Pin usage:
+ * COL: PD0-7
+ * ROW: PB0-7, PF4-7
+ */
+#ifndef DEBOUNCE
+# define DEBOUNCE 10
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+static matrix_row_t read_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+
+ // initialize rows
+ unselect_rows();
+
+ // initialize columns to input with pull-up(DDR:0, PORT:1)
+ DDRD = 0x00;
+ PORTD = 0xFF;
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i] != cols) {
+ matrix_debouncing[i] = cols;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]))
+ return true;
+ }
+ return false;
+}
+#endif
+
+inline
+static matrix_row_t read_cols(void)
+{
+ return ~PIND;
+}
+
+inline
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRB &= ~0b11111111;
+ PORTB &= ~0b11111111;
+ DDRF &= ~0b11110000;
+ PORTF &= ~0b11110000;
+}
+
+inline
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ DDRB |= (1<<row);
+ PORTB &= ~(1<<row);
+ break;
+ case 8:
+ DDRF |= (1<<4);
+ PORTF &= ~(1<<4);
+ break;
+ case 9:
+ case 10:
+ case 11:
+ DDRF |= (1<<(row-4));
+ PORTF &= ~(1<<(row-4));
+ break;
+ }
+}
diff --git a/keyboard/hhkb/Makefile b/keyboard/hhkb/Makefile
new file mode 100644
index 0000000000..2f87d42fb7
--- /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 = ../../tmk_core
+
+# 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..7d0f8c3a9c
--- /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 = ../../tmk_core
+
+# 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..cbb2b744c9
--- /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 = ../../tmk_core
+
+# 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 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/doc/Bluetooth.txt b/keyboard/hhkb/doc/Bluetooth.txt
new file mode 100644
index 0000000000..24243aff86
--- /dev/null
+++ b/keyboard/hhkb/doc/Bluetooth.txt
@@ -0,0 +1,39 @@
+HHKB Bluetooth mod
+==================
+See this article:
+http://geekhack.org/showwiki.php?title=Island:20851
+
+
+
+Power consume
+=============
+Switch board
+------------
+5V
+18mA full scan/no power control
+16.5mA full scan with power control of POWER_ON/POWER_OFF in matrix.c
+3.5-6mA 60ms watchdog timer sleep iwrap/main.c
+
+- the longer sleep time the less power is consumed.
+- power control of swtich board must be needed.
+FET switch may be better, though 18mA is with in port sink current limit. In current design switch board ground is connected to PB5 pin and power it on by making the pin low.
+
+Blueguiga WT12
+--------------
+3.3V
+-42mA startup/searching/connecting
+19-23mA connected
+4mA -8mA not connected
+
+iWRAP sleep command may not work. to be looked into.
+
+Power Over all
+--------------
+5V
+-65mA startup
+17-24mA idle/not connected
+-42mA connecting
+32-37mA idle/connecting(with sleep)
+50-53mA typing/connecting(no sleep)
+
+2013/06/07
diff --git a/keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpg b/keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpg
new file mode 100644
index 0000000000..2e5a25e81e
--- /dev/null
+++ b/keyboard/hhkb/doc/Bluetooth_img/BT_circuit.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB.txt b/keyboard/hhkb/doc/HHKB.txt
new file mode 100644
index 0000000000..98397b8477
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB.txt
@@ -0,0 +1,203 @@
+Internal of HHKB pro
+=====================
+HHKB pro has MCU and some chips on separate two PCBs.
+
+Controller PCB
+--------------
+ M38K07M4 Renesas MCU with USB function
+ http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
+
+ (HHKB_controller.jpg)
+
+Keyswitch PCB
+-------------
+ HC4051 Analog Multiplexer: select a row line.
+ http://www.ti.com/lit/ds/schs122j/schs122j.pdf
+ LS145 BCD Decoder: select a column line.
+ http://www.ti.com/lit/ds/symlink/sn74ls145.pdf
+ BU9831 Non-volatile electronic potentiometer: for calibration?
+ https://www.spezial.com/doc/rohm-a/bu9831.pdf
+ TP1683/4 Capacitive Sensing controller: no datasheet available.
+
+ (HHKB_keyswitch.jpg)
+
+ Topre original chip?
+ (HHKB_TP1684.jpg)
+
+
+Connector Cable
+---------------
+Two PCBs are connected by 15 lines(13 in case of Pro2).
+Vcc and GND use 3(2) lines each, other lines are for keyboard signaling.
+
+ HHKB connector lines:
+ JP Pro2 Pro Function Description Teensy++ pins
+ --------------------------------------------------------------------------------------------
+ 1 Vcc(5V) 5V
+ 1 1 2 Vcc(5V) 5V
+ 2 2 3 Vcc(5V) 5V
+ 3 3 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
+ 4 4 5 TP1684 KEY_PREV: make threshold PE7 output
+ 5 5 6 HC4051 A(bit0)\ PB0 output
+ 6 6 7 HC4051 B(bit1) > select row 0-7 PB1 output
+ 7 7 8 HC4051 C(bit2)/ PB2 output
+ 8 8 9 LS145 A(bit0)\ PB3 output
+ 9 9 10 LS145 B(bit1) > select column 0-7 PB4 output
+ 10 10 11 LS145 C(bit2)/ PB5 output
+ 11 11 12 LS145 D(enable) Low(0) enables selected column PB6 output
+ 12 12 13 GND GND
+ 13 13 14 GND GND
+ 15 GND
+ 14 HC4051(Z2) ~Enable of Z2 row0-7
+ 15 HC4051(Z3) ~Enable of Z3 row8-15
+
+ NOTE: guessing pin5(KEY_PREV) may work for hysteresis of capacitive sensing.
+ NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK.
+ NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them.
+
+ (HHKB_connector.jpg)
+
+
+Keyswitch matrix
+----------------
+HHKB switch matrix is ghost-free and bounce-free.
+
+ Pro/Pro2(8x8):
+ COL 0 1 2 3 4 5 6 7
+ ROW ---------------------------------------------------------------
+ 0| 2 q w s a z x c
+ 1| 3 4 r e d f v b
+ 2| 5 6 y t g h n _NONE_
+ 3| 1 Esc Tab Control LShift LAlt LMeta Space
+ 4| 7 8 u i k j m _NONE_
+ 5| \ ` Delete Return Fn RShift RAlt RMeta
+ 6| 9 0 o p ; l , _NONE_
+ 7| - + ] [ ' / . _NONE_
+
+
+ JP(16x8):
+ COL 0 1 2 3 4 5 6 7
+ ROW ---------------------------------------------------------------
+ 0| ESC TAB LFn LShift LCtrl
+ 1| 4 E MuHKN C D
+ 2| 3 W LAlt X S
+ 3| 1 HHK
+ 4|
+ 5| 5 R V F
+ 6| 2 Q LGui Z A
+ 7| 6 T Space B G
+ 8| 9 I Kana , K
+ 9| 8 U Henkan M J
+ A| 7 Y N H
+ B| 0 O RAlt . L
+ C| BS Right RShift Enter
+ D| \ [ Down Up ]
+ E| - P RFn / ;
+ F| ~ @ Left Ro :
+
+
+Matrix diagram:
+
+ Pro/Pro2:
+ +-------------------------+-+-+-+-+-+-+-+ Vcc
+ |bias control? - - - - - - - - ---
+ | 3.9K*8 R R R R R R R R |
+ +--------^+ +--------+ - - - - - - - - |
+ | 2| | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
+ | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
+ | TP1684 |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
+ | 11<------| <3-------|-|-|-|-|-|-|-|--|R|-+
+ | | | <4-------|-|-|-|-|-|-|-|--|R|-+
+ | | | <5-------|-|-|-|-|-|-|-|--|R|-+
+ | <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+
+ | 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+
+ +---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
+ KEY PREV | A B C +-----------------+
+ | | +-^----+ | | | | LS145 |
+ Vcc | | |BU9831| | | | +-^--^--^--^------+
+ --- | | +------+ | | | A B C D +-------+
+ | | | | | | | | | | | |
+ 1-3 4 5 6 7 8 9 10 11 12 13-15 Pro |
+ 1-2 3 4 5 6 7 8 9 10 11 12-13 Pro2|
+ +--------------------------------------------------+ |
+ | connector | ---
+ +--------------------------------------------------+ GND
+
+
+ JP:
+ +-----------------------------+-+-+-+-+ Vcc
+ |bias control? - - - - - ---
+ | 3.9K*5 R R R R R |
+ +--------^+ +--------+ - - - - - |
+ | | | HC4051 <0-----------|-|-|-|-|----|R|-+
+ | |capa. | Z2 <1-----------|-|-|-|-|----|R|-+
+ | TP1684 |sense | <2-----------|-|-|-|-|----|R|-+
+ | <---+--| <3-----------|-|-|-|-|----|R|-+
+ | | | | <4-----------|-|-|-|-|----|R|-+
+ | | ~En| <5-----------|-|-|-|-|----|R|-+
+ | | +----> <6-----------|-|-|-|-|----|R|-+
+ | | | | | A B C <7-----------|-|-|-|-|----|R|-+
+ +---V---^-+ | | +-^-^-^--+ | | | | | |
+ KEY PREV | | | | | | | | | | |
+ | | | | +--------+ | | | | | |
+ | | | | | HC4051 <8-----------|-|-|-|-|----|R|-+
+ | | | | | Z3 <9-----------|-|-|-|-|----|R|-+
+ | | | +--| <A-----------|-|-|-|-|----|R|-+
+ | | | | <B-----------|-|-|-|-|----|R|-+
+ | | | | <C-----------|-|-|-|-|----|R|-+
+ | | | ~En| <D-----------|-|-|-|-|----|R|-+
+ | | | +-> <E-----------|-|-|-|-|----|R|-+
+ | | | | | A B C <F-----------|-|-|-|-|----|R|-+
+ | | | | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
+ | | | | | | | +-----------------+
+ | | | | | | | | LS145 |
+ Vcc | | | | | | | +-^--^--^--^------+
+ --- | | | | | | | A B C D +-------+
+ | | | | | | | | | | | | | |
+ 1-2 3 4 14 15 5 6 7 8 9 10 11 12-13 |
+ +--------------------------------------------------+ |
+ | connector | ---
+ +--------------------------------------------------+ GND
+
+
+Signals charts
+--------------
+ While pressing space bar, watched HHKB Pro original controller signals by logic analyzer.
+ Row and column is looping between 0-7 each for selecting a key.
+ A key is scaned every about 15ms, so scan rate is 66Hz.
+
+ (HHKB_chart1.jpg)
+
+ Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
+ Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
+
+ (HHKB_chart2.jpg)
+
+
+ Signal of JP:
+
+ 1) Select row
+ rowC ____~~~~____~~~~ 3.8/3.8ms(JP) 7.7/7.7ms(Pro) S2 of HC4051
+ rowB __~~__~~__~~__~~ 1.9/1.9ms(JP) 3.8/3.8ms(Pro) S1 of HC4051
+ rowA _~_~_~_~_~_~_~_~ 1.0/1.0ms(JP) 1.9/1.9ms(Pro) S0 of HC4051
+ 0123456701234567 selected row(Pro)
+ 0123456789ABCDEF selected row(JP)
+ rowEn0 ________~~~~~~~~ 7.7/7.7ms(JP only) ~Enable of Z2 HC4051(JP only)
+ rowEn1 ~~~~~~~~________ 7.7/7.7ms(JP only) ~Enable of Z3 HC4051(JP only)
+
+ 2) Select column
+ colC ____~~~~____~~~~ 550/410us(JP) / us(Pro)
+ colB __~~__~~__~~__~~ 200/210us(JP) 450/460us(Pro)
+ colA _~_~_~_~_~_~_~_~ 100/110us(JP) 220/230us(Pro)
+ 0123456701234567 selected column
+
+ 3) Wait 5us after column select, then set prev, strobe colD to spit out key status and read it.
+ prev _~~~~_____ 20us if previous key state is low
+ colD ~~~__~~~~~ 10us strobe
+ key ~~~____~~~ 22us indicates current state of the key
+
+ NOTE: JP scans twice fast as Pro/Pro2 does. So Pro/Pro2 scans 8x8 matrix in 15.4ms while JP scans 16x8 in that time.
+
+
+
+EOF
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpg
new file mode 100644
index 0000000000..0a03164094
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_TP1684.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpg
new file mode 100644
index 0000000000..1f09bd185c
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_chart1.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpg
new file mode 100644
index 0000000000..45f5ada905
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_chart2.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpg
new file mode 100644
index 0000000000..e8a09e9b28
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_connector.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpg
new file mode 100644
index 0000000000..e3dae8e86c
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_controller.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg b/keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg
new file mode 100644
index 0000000000..3afc269e7b
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/HHKB_keyswitch.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/connector_contact.jpg b/keyboard/hhkb/doc/HHKB_img/connector_contact.jpg
new file mode 100644
index 0000000000..5304bc8d7e
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/connector_contact.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpg b/keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpg
new file mode 100644
index 0000000000..f1b438ae77
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/logic_analyzer.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/probe_contact.jpg b/keyboard/hhkb/doc/HHKB_img/probe_contact.jpg
new file mode 100644
index 0000000000..dc79afa0cc
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/probe_contact.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/teensy_install.jpg b/keyboard/hhkb/doc/HHKB_img/teensy_install.jpg
new file mode 100644
index 0000000000..873d988edb
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/teensy_install.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpg b/keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpg
new file mode 100644
index 0000000000..1c4eb67434
--- /dev/null
+++ b/keyboard/hhkb/doc/HHKB_img/teensy_wiring.jpg
Binary files differ
diff --git a/keyboard/hhkb/doc/Power.txt b/keyboard/hhkb/doc/Power.txt
new file mode 100644
index 0000000000..1287053c3c
--- /dev/null
+++ b/keyboard/hhkb/doc/Power.txt
@@ -0,0 +1,48 @@
+HHKB Power consumption
+----------------------
+
+**Power consumption
+ board clock/prescaler keyswitch power ctrl current
+ --------------------------------------------------------------------------
+ tmk 16MHz no no 26.4mA
+ tmk 16MHz pro1 no 45.1mA
+ tmk 16MHz/2 no no 18.1mA
+ tmk 16MHz/2 pro1 no 37.3mA
+ tmk 8MHz no no 18.9mA
+ tmk 8MHz pro2 no(w/o FET) 32.1mA
+ tmk 8MHz pro2 no(w FET) 32.1mA withou POWER_ON/FF
+ tmk 8MHz pro2 no(w FET) 32.6mA with POWR_ON/OFF
+ tmk 8MHz pro2 15ms(w FET) 21.3mA with POWR_ON/OFF, enumerated but error -32
+ tmk 8MHz pro2 60ms(w FET) 13.3mA with POWR_ON/OFF, not enumerated
+
+ gh60 16MHz 25.8mA
+ gh60 16MHz USB suspend w LED breathing 17.6-29.1mA
+ gh60 16MHz USB suspend w/o LED 0.2mA(0.231-0.276mA)
+ Poker 5.6mA
+ Poker USB suspend 0.3mA(0.301mA)
+ gh60 16MHz stock firmware by komar 26.8mA
+
+
+ HHKB pro2 Over All 139.4mA
+ HHKB pro2 Controller 115.1mA
+ HHKB pro1 Controller 25.9mA
+
+
+keyswitch power consumption:
+pro1: 45.1-26.4=18.7mA
+ 37.3-18.1=19.2mA
+pro2: 32.1-18.9=13.2mA
+
+
+
+
+
+**Low Freq Crystal or Prescaler?
+No advantage of Low Freq Crystal against Prescaled.
+
+Clock routing
+X'tal --+---->Prescaler-------> System Clock
+ |
+ +---------------------> USB PLL
+
+Design Decision: Install 16MHz crystal on board with using clock rescaler.
diff --git a/keyboard/hhkb/doc/V-USB.md b/keyboard/hhkb/doc/V-USB.md
new file mode 100644
index 0000000000..7ae86f452f
--- /dev/null
+++ b/keyboard/hhkb/doc/V-USB.md
@@ -0,0 +1,39 @@
+V-USB controller for HHKB
+=========================
+Not supported actively any more.
+
+## Build
+Use `Makefile.vusb` for [V-USB] controller.
+ $ make -f Makefile.vusb
+
+##Hardware
+###3. V-USB connection
+ +---+ +---------------+
+ USB GND | | ATmega328p |
+ ~~~ C3 | |
+ 5V <-------+--------+---|Vcc,AVCC | HHKB pro pro2
+ R1 | | ~~~~~~~~ ~~~~
+ D- <----+--+-----R2-----|INT1 PB2-4|------->ROW (6-8) (5-7)
+ D+ <----|---+----R3-----|INT0 PC0-2|------->COL (9-11) (8-10)
+ Z1 Z2 | PC3|------->ENABLE (12) (11)
+ GND<----+---+-----------|GND PB0|<-------KEY (4) (3)
+ | PB1|------->PREV (5) (4)
+ | |
+ GND+-C2--+--|XTAL1 RXD|------->Debug Console
+ X1 | TXD|<-------Debug Console
+ GND+-C3--+--|XTAL2 RST|---SW--+GND
+ +---------------+
+ R1: 1.5K Ohm
+ R2,R3: 68 Ohm
+ Z1,Z2: Zener 3.6V
+ C1,C2: 22pF
+ C3: 0.1uF
+ X1: Crystal 12MHz
+ SW: Push Switch(for bootloader)
+
+- NOTE: See [V-USB] documentation for more detail of hardware and the USB stack.
+- NOTE: [USBaspLoader] is very useful for firmware update.
+
+
+[V-USB]: http://www.obdev.at/products/vusb/index.html
+[USBaspLoader]: http://www.obdev.at/products/vusb/usbasploader.html
diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h
new file mode 100644
index 0000000000..4e7e070364
--- /dev/null
+++ b/keyboard/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/keyboard/hhkb/keymap_common.c b/keyboard/hhkb/keymap_common.c
new file mode 100644
index 0000000000..e938fb6270
--- /dev/null
+++ b/keyboard/hhkb/keymap_common.c
@@ -0,0 +1,33 @@
+/*
+Copyright 2012,2013 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/>.
+*/
+#include <stdint.h>
+#include "action.h"
+#include <avr/pgmspace.h>
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/keyboard/hhkb/keymap_common.h b/keyboard/hhkb/keymap_common.h
new file mode 100644
index 0000000000..3622665f3a
--- /dev/null
+++ b/keyboard/hhkb/keymap_common.h
@@ -0,0 +1,84 @@
+/*
+Copyright 2012,2013 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_code.h"
+#include "action_layer.h"
+#include "action_macro.h"
+#include "action_util.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+#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 \
+) \
+{ \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_NO } \
+}
+
+
+#define KEYMAP_JP( \
+ K02, K32, K62, K22, K12, K52, K72, KA2, K92, K82, KB2, KE2, KF2, KD2, KC2, \
+ K03, K63, K23, K13, K53, K73, KA3, K93, K83, KB3, KE3, KF3, KD3, \
+ K06, K66, K26, K16, K56, K76, KA6, K96, K86, KB6, KE6, KF6, KD6, KC6, \
+ K05, K65, K25, K15, K55, K75, KA5, K95, K85, KB5, KE5, KF5, KD5, KC5, \
+ K04, K34, K64, K24, K14, K74, K94, K84, KB4, KE4, KF4, KD4, KC4 \
+) \
+{ \
+ { KC_NO, KC_NO, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K32, KC_NO, KC_##K34, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_NO, KC_##K55, KC_##K56, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86, KC_NO }, \
+ { KC_NO, KC_NO, KC_##K92, KC_##K93, KC_##K94, KC_##K95, KC_##K96, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KA2, KC_##KA3, KC_NO, KC_##KA5, KC_##KA6, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KB2, KC_##KB3, KC_##KB4, KC_##KB5, KC_##KB6, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KC2, KC_NO, KC_##KC4, KC_##KC5, KC_##KC6, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KD2, KC_##KD3, KC_##KD4, KC_##KD5, KC_##KD6, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_NO }, \
+ { KC_NO, KC_NO, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_NO } \
+}
+
+#endif
diff --git a/keyboard/hhkb/keymap_hasu.c b/keyboard/hhkb/keymap_hasu.c
new file mode 100644
index 0000000000..a5602ded31
--- /dev/null
+++ b/keyboard/hhkb/keymap_hasu.c
@@ -0,0 +1,282 @@
+/*
+ * Hasu: my personal keymap
+ */
+#include "keymap_common.h"
+
+
+#ifdef KEYMAP_SECTION_ENABLE
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+#endif
+ /* Layer 0: 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|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Fn6 |
+ * |-----------------------------------------------------------|
+ * |Fn7 | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1|
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Fn4 |Fn5 |Gui|
+ * `-------------------------------------------'
+ */
+ [0] = \
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN6, \
+ FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \
+ LGUI,LALT, FN4, FN5, RGUI),
+
+ /* Layer 1: HHKB mode[HHKB Fn]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [1] = \
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \
+ LGUI,LALT, TRNS, RALT,RGUI),
+
+ /* Layer 2: Vi mode[Slash]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | Space |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ [2] = \
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,TRNS, \
+ LGUI,LALT, SPC, RALT,RGUI),
+
+ /* Layer 3: Mouse mode(IJKL)[Semicolon]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ [3] = \
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,FN9, FN10,FN8, \
+ LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,FN3, NO, ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
+ LGUI,LALT, BTN1, TRNS,TRNS),
+
+ /* Layer 4: Mouse mode(IJKL)[Space]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Fn |Fn |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ [4] = \
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN8, \
+ LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
+ LGUI,LALT, TRNS, TRNS,TRNS),
+
+#if 0
+ /* Layer 3: Mouse mode(HJKL)[Semicolon]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |McL|McD|McU|McR|Fn0| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Mb1 |Alt |Fn0|
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, NO, NO, NO, NO, NO, NO, WH_D,WH_U,RGHT,NO, NO, NO, BSPC, \
+ LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,SLSH,RSFT,NO, \
+ LGUI,LALT, BTN1, RALT,TRNS),
+
+ /* Layer4: Mouse mode(HJKL)[Space]
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|MwU|MwR| |Wbk|Wfr|Alt-T|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |McL|McD|McU|McR|Fn0| |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Fn0 |Alt |Fn0|
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ FN8, NO, NO, NO, NO, NO, NO, WH_D,WH_U,RGHT,NO, FN9, FN10,FN8, \
+ LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,BTN1,NO, ENT, \
+ LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,NO, \
+ LGUI,LALT, TRNS, RALT,RGUI),
+#endif
+#if 0
+ /* Layer x: Matias half-qwerty keyboard style[Space]
+ * ,-----------------------------------------------------------.
+ * | -| 0| 9| 8| 7| 6| 5| 4| 3| 2| 1| | | |Esc|
+ * |-----------------------------------------------------------|
+ * |Backs| P| O| I| U| Y| T| R| E| W| Q| | |Tab |
+ * |-----------------------------------------------------------|
+ * |Contro| ;| L| K| J| H| G| F| D| S| A|Con|Control |
+ * |-----------------------------------------------------------|
+ * |Shift | /| .| ,| M| N| B| V| C| X| Z|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt | Fn0 |Alt |Gui|
+ * `--------------------------------------------'
+ */
+ KEYMAP(MINS,0, 9, 8, 7, 6, 5, 4, 3, 2, 1, NO, NO, NO, ESC, \
+ BSPC,P, O, I, U, Y, T, R, E, W, Q, NO, NO, TAB, \
+ LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \
+ LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \
+ LGUI,LALT, TRNS, RALT,RGUI),
+#endif
+};
+
+
+
+/* id for user defined functions */
+enum function_id {
+ LSHIFT_LPAREN,
+};
+
+enum macro_id {
+ HELLO,
+ VOLUP,
+ ALT_TAB,
+};
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
+ [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
+ [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
+ [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
+ [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
+ [5] = ACTION_LAYER_MOMENTARY(4), // Mousekey layer(IJKL)
+ [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
+ [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
+ [8] = ACTION_MACRO(ALT_TAB), // Application switching
+ [9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT),
+ [10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT),
+
+// [x] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_BSPC), // LControl with tap Backspace
+// [x] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_ESC), // LControl with tap Esc
+// [x] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // Function: LShift with tap '('
+// [x] = ACTION_MACRO(HELLO), // Macro: say hello
+// [x] = ACTION_MACRO(VOLUP), // Macro: media key
+};
+
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch (id) {
+ case HELLO:
+ return (record->event.pressed ?
+ MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
+ MACRO_NONE );
+ case VOLUP:
+ return (record->event.pressed ?
+ MACRO( D(VOLU), U(VOLU), END ) :
+ MACRO_NONE );
+ case ALT_TAB:
+ return (record->event.pressed ?
+ MACRO( D(LALT), D(TAB), END ) :
+ MACRO( U(TAB), END ));
+ }
+ return MACRO_NONE;
+}
+
+
+
+/*
+ * user defined action function
+ */
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ if (record->event.pressed) dprint("P"); else dprint("R");
+ dprintf("%d", record->tap.count);
+ if (record->tap.interrupted) dprint("i");
+ dprint("\n");
+
+ switch (id) {
+ case LSHIFT_LPAREN:
+ // Shift parentheses example: LShft + tap '('
+ // http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses
+ // http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899
+ if (record->event.pressed) {
+ if (record->tap.count > 0 && !record->tap.interrupted) {
+ if (record->tap.interrupted) {
+ dprint("tap interrupted\n");
+ register_mods(MOD_BIT(KC_LSHIFT));
+ }
+ } else {
+ register_mods(MOD_BIT(KC_LSHIFT));
+ }
+ } else {
+ if (record->tap.count > 0 && !(record->tap.interrupted)) {
+ add_weak_mods(MOD_BIT(KC_LSHIFT));
+ send_keyboard_report();
+ register_code(KC_9);
+ unregister_code(KC_9);
+ del_weak_mods(MOD_BIT(KC_LSHIFT));
+ send_keyboard_report();
+ record->tap.count = 0; // ad hoc: cancel tap
+ } else {
+ unregister_mods(MOD_BIT(KC_LSHIFT));
+ }
+ }
+ break;
+ }
+}
diff --git a/keyboard/hhkb/keymap_hhkb.c b/keyboard/hhkb/keymap_hhkb.c
new file mode 100644
index 0000000000..1fc016f8e2
--- /dev/null
+++ b/keyboard/hhkb/keymap_hhkb.c
@@ -0,0 +1,62 @@
+/*
+ * HHKB Layout
+ */
+#include "keymap_common.h"
+
+
+#ifdef KEYMAP_SECTION_ENABLE
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+#endif
+ /* Layer 0: 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|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
+ * `-----------------------------------------------------------'
+ * |Alt|Gui | Space |Gui |Alt|
+ * `-------------------------------------------'
+ */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
+ LALT,LGUI, SPC, RGUI,RALT),
+
+ /* 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 | |Backs|
+ * |-----------------------------------------------------------|
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | |
+ * `-----------------------------------------------------------'
+ * | | | | | |
+ * `-------------------------------------------'
+ */
+ KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \
+ TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
+ TRNS,TRNS, TRNS, TRNS,TRNS),
+};
+
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/keyboard/hhkb/keymap_jp.c b/keyboard/hhkb/keymap_jp.c
new file mode 100644
index 0000000000..48d0ee70ba
--- /dev/null
+++ b/keyboard/hhkb/keymap_jp.c
@@ -0,0 +1,50 @@
+/*
+ * HHKB JP Layout
+ */
+#include "keymap_common.h"
+
+
+#ifdef KEYMAP_SECTION_ENABLE
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
+#else
+const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
+#endif
+ /* Layer 0: Default Layer */
+ KEYMAP_JP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, UP, RSFT, \
+ FN0, ZKHK,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,FN0, LEFT,DOWN,RGHT),
+
+ /* 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| | | |
+ * |-----------------------------------------------------------|
+ * | || | | | | | | | | || | | |
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP_JP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, \
+ TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS,PENT, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
+};
+
+
+
+/*
+ * Fn action definition
+ */
+#ifdef KEYMAP_SECTION_ENABLE
+const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
+#else
+const uint16_t fn_actions[] PROGMEM = {
+#endif
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
diff --git a/keyboard/hhkb/keymap_spacefn.c b/keyboard/hhkb/keymap_spacefn.c
new file mode 100644
index 0000000000..deff920ae2
--- /dev/null
+++ b/keyboard/hhkb/keymap_spacefn.c
@@ -0,0 +1,116 @@
+/*
+ * SpaceFN
+ * http://geekhack.org/index.php?topic=51069.0
+ */
+#include "keymap_common.h"
+
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|BSp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
+ * `-----------------------------------------------------------'
+ * |Gui|Alt | SpaceFN |Alt |Gui|
+ * `-------------------------------------------'
+ */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
+ LGUI,LALT, FN1, RALT,RGUI),
+
+ /* 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 | |Backs|
+ * |-----------------------------------------------------------|
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | |
+ * `-----------------------------------------------------------'
+ * | | | | | |
+ * `-------------------------------------------'
+ */
+ KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \
+ TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
+ TRNS,TRNS, SPC, TRNS,TRNS),
+
+ /* Layer 2: SpaceFN
+ * ,-----------------------------------------------------------.
+ * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |Del|
+ * |-----------------------------------------------------------|
+ * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
+ * |-----------------------------------------------------------|
+ * | | | | | | |PgU|Lef|Dow|Rig| | | |
+ * |-----------------------------------------------------------|
+ * | | | | | |Spc|PgD|` |~ | | | | |
+ * `-----------------------------------------------------------'
+ * | | | | | |
+ * `-------------------------------------------'
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, \
+ TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,FN3, END, PSCR,SLCK,PAUS,INS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN2, TRNS,TRNS,TRNS,NO, \
+ TRNS,TRNS, TRNS, TRNS,TRNS),
+};
+
+
+/*
+ * user defined action function
+ */
+enum function_id {
+ CTRL_SPACE_I, // Ctrl + Up(SpaceFN) -> PgUp
+};
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+# define MODS_CTRL_MASK (MOD_BIT(KC_LCTRL)|MOD_BIT(KC_RCTRL))
+ static uint8_t ctrl_space_i_prev_ctrl;
+
+ switch (id) {
+ // Ctrl + Up(SpaceFN) -> PgUp
+ case CTRL_SPACE_I:
+ ctrl_space_i_prev_ctrl = get_mods()&MODS_CTRL_MASK;
+ if (record->event.pressed) {
+ if (ctrl_space_i_prev_ctrl) {
+ del_mods(ctrl_space_i_prev_ctrl); // remove Ctrl
+ add_key(KC_PGUP);
+ send_keyboard_report(); // send PgUp without Ctrl
+ add_mods(ctrl_space_i_prev_ctrl); // return Ctrl but not sent
+ } else {
+ add_key(KC_UP);
+ send_keyboard_report();
+ }
+ } else {
+ if (ctrl_space_i_prev_ctrl) {
+ del_key(KC_PGUP);
+ send_keyboard_report();
+ } else {
+ del_key(KC_UP);
+ send_keyboard_report();
+ }
+ }
+ break;
+ }
+}
+
+
+/*
+ * Fn action definition
+ */
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE),
+ [2] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
+ [3] = ACTION_FUNCTION(CTRL_SPACE_I), // Ctrl + Up(SpaceFN) -> PgUp
+};
diff --git a/keyboard/hhkb/led.c b/keyboard/hhkb/led.c
new file mode 100644
index 0000000000..8a08fe27fc
--- /dev/null
+++ b/keyboard/hhkb/led.c
@@ -0,0 +1,33 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+/* HHKB has no LEDs */
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ DDRD |= (1<<6);
+ PORTD |= (1<<6);
+ } else {
+ DDRD |= (1<<6);
+ PORTD &= ~(1<<6);
+ }
+}
diff --git a/keyboard/hhkb/matrix.c b/keyboard/hhkb/matrix.c
new file mode 100644
index 0000000000..fb96997944
--- /dev/null
+++ b/keyboard/hhkb/matrix.c
@@ -0,0 +1,190 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "timer.h"
+#include "matrix.h"
+#include "hhkb_avr.h"
+#include <avr/wdt.h>
+#include "suspend.h"
+#include "lufa.h"
+
+
+// matrix power saving
+#define MATRIX_POWER_SAVE 10000
+static uint32_t matrix_last_modified = 0;
+
+// matrix state buffer(1:on, 0:off)
+static matrix_row_t *matrix;
+static matrix_row_t *matrix_prev;
+static matrix_row_t _matrix0[MATRIX_ROWS];
+static matrix_row_t _matrix1[MATRIX_ROWS];
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+#ifdef DEBUG
+ debug_enable = true;
+ debug_keyboard = true;
+#endif
+
+ KEY_INIT();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00;
+ matrix = _matrix0;
+ matrix_prev = _matrix1;
+}
+
+uint8_t matrix_scan(void)
+{
+ uint8_t *tmp;
+
+ tmp = matrix_prev;
+ matrix_prev = matrix;
+ matrix = tmp;
+
+ // power on
+ if (!KEY_POWER_STATE()) KEY_POWER_ON();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ KEY_SELECT(row, col);
+ _delay_us(5);
+
+ // Not sure this is needed. This just emulates HHKB controller's behaviour.
+ if (matrix_prev[row] & (1<<col)) {
+ KEY_PREV_ON();
+ }
+ _delay_us(10);
+
+ // NOTE: KEY_STATE is valid only in 20us after KEY_ENABLE.
+ // If V-USB interrupts in this section we could lose 40us or so
+ // and would read invalid value from KEY_STATE.
+ uint8_t last = TIMER_RAW;
+
+ KEY_ENABLE();
+
+ // Wait for KEY_STATE outputs its value.
+ // 1us was ok on one HHKB, but not worked on another.
+ // no wait doesn't work on Teensy++ with pro(1us works)
+ // no wait does work on tmk PCB(8MHz) with pro2
+ // 1us wait does work on both of above
+ // 1us wait doesn't work on tmk(16MHz)
+ // 5us wait does work on tmk(16MHz)
+ // 5us wait does work on tmk(16MHz/2)
+ // 5us wait does work on tmk(8MHz)
+ // 10us wait does work on Teensy++ with pro
+ // 10us wait does work on 328p+iwrap with pro
+ // 10us wait doesn't work on tmk PCB(8MHz) with pro2(very lagged scan)
+ _delay_us(5);
+
+ if (KEY_STATE()) {
+ matrix[row] &= ~(1<<col);
+ } else {
+ matrix[row] |= (1<<col);
+ }
+
+ // Ignore if this code region execution time elapses more than 20us.
+ // MEMO: 20[us] * (TIMER_RAW_FREQ / 1000000)[count per us]
+ // MEMO: then change above using this rule: a/(b/c) = a*1/(b/c) = a*(c/b)
+ if (TIMER_DIFF_RAW(TIMER_RAW, last) > 20/(1000000/TIMER_RAW_FREQ)) {
+ matrix[row] = matrix_prev[row];
+ }
+
+ _delay_us(5);
+ KEY_PREV_OFF();
+ KEY_UNABLE();
+
+ // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE.
+ // This takes 25us or more to make sure KEY_STATE returns to idle state.
+ _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();
+ }
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix[i] != matrix_prev[i])
+ return true;
+ }
+ return false;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
+ }
+}
+
+void matrix_power_up(void) {
+ KEY_POWER_ON();
+}
+void matrix_power_down(void) {
+ KEY_POWER_OFF();
+}
diff --git a/keyboard/hhkb/not_supported/Makefile.iwrap b/keyboard/hhkb/not_supported/Makefile.iwrap
new file mode 100644
index 0000000000..1614c21d75
--- /dev/null
+++ b/keyboard/hhkb/not_supported/Makefile.iwrap
@@ -0,0 +1,103 @@
+#
+# Makefile for iWRAP
+#
+
+
+# Target file name (without extension).
+TARGET = hhkb_iwrap
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = \
+ keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config_iwrap.h
+
+
+# V-USB debug level: To use ps2_usart.c level must be 0
+# ps2_usart.c requires USART to receive PS/2 signal.
+OPT_DEFS = -DDEBUG_LEVEL=0
+
+
+# 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 = atmega328p
+
+
+# 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 = 12000000
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=2048
+
+
+# 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 --------------------------
+AVRDUDE = avrdude
+# Type: avrdude -c ? to get a full listing.
+AVRDUDE_PROGRAMMER = usbasp
+AVRDUDE_PORT =
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/iwrap.mk
+# TODO: to be selectable: V-USB, LUFA or PJRC
+#include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/hhkb/not_supported/Makefile.vusb b/keyboard/hhkb/not_supported/Makefile.vusb
new file mode 100644
index 0000000000..1f8d84684b
--- /dev/null
+++ b/keyboard/hhkb/not_supported/Makefile.vusb
@@ -0,0 +1,97 @@
+#
+# Makefile for V-USB
+#
+
+
+# Target file name (without extension).
+TARGET = hhkb_vusb
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = \
+ keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config_vusb.h
+
+
+# V-USB debug level: To use ps2_usart.c level must be 0
+# ps2_usart.c requires USART to receive PS/2 signal.
+OPT_DEFS = -DDEBUG_LEVEL=0
+
+
+# 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 = atmega328p
+# avrdude doesn't know atmega168p
+AVRDUDE_MCU = $(MCU)
+
+
+# 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 = 12000000
+
+
+# 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 --------------------------
+AVRDUDE = avrdude
+# Type: avrdude -c ? to get a full listing.
+AVRDUDE_PROGRAMMER = usbasp
+AVRDUDE_PORT =
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+#AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level. Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+#AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
+AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
+AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
+
+PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/vusb.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+debug-on: EXTRAFLAGS += -DDEBUG
+debug-on: all
diff --git a/keyboard/hhkb/not_supported/config_iwrap.h b/keyboard/hhkb/not_supported/config_iwrap.h
new file mode 100644
index 0000000000..747c755132
--- /dev/null
+++ b/keyboard/hhkb/not_supported/config_iwrap.h
@@ -0,0 +1,54 @@
+/*
+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 0xBEEA
+// TODO: share these strings with usbconfig.h
+// Edit usbconfig.h to change these.
+#define MANUFACTURER t.m.k.
+#define PRODUCT HHKB mod
+#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
+
+
+/* matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+/* pins for Software UART */
+#define SUART_IN_PIN PINC
+#define SUART_IN_BIT 5
+#define SUART_OUT_PORT PORTC
+#define SUART_OUT_BIT 4
+
+
+#define DEBUG_LED 1
+#define DEBUG_LED_CONFIG (DDRD |= (1<<4))
+#define DEBUG_LED_OFF (PORTD |= (1<<4))
+#define DEBUG_LED_ON (PORTD &= ~(1<<4))
+
+/* period of tapping(ms) */
+#define TAPPING_TERM 300
+/* tap count needed for toggling a feature */
+#define TAPPING_TOGGLE 5
+
+#endif
diff --git a/keyboard/hhkb/not_supported/config_vusb.h b/keyboard/hhkb/not_supported/config_vusb.h
new file mode 100644
index 0000000000..44f7acd6cd
--- /dev/null
+++ b/keyboard/hhkb/not_supported/config_vusb.h
@@ -0,0 +1,38 @@
+/*
+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 0xC0FE
+// TODO: share these strings with usbconfig.h
+// Edit usbconfig.h to change these.
+#define MANUFACTURER t.m.k.
+#define PRODUCT HHKB mod
+#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
+
+
+/* matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 8
+
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+#endif
diff --git a/keyboard/hhkb/not_supported/iwrap.txt b/keyboard/hhkb/not_supported/iwrap.txt
new file mode 100644
index 0000000000..20a2420a0b
--- /dev/null
+++ b/keyboard/hhkb/not_supported/iwrap.txt
@@ -0,0 +1,32 @@
+
+iWRAP
+-----
+ +---------------+ WT12
+ 5V | ATmega168 | 5V/3.3V~~~~
+ +-----+---|Vcc,AVCC PC4|---/--->iWRAP(RxD)
+USB | C3 | PC5|<--/----iWRAP(TxD)
+~~~ | + | |
+5V <--BATT + GND | | HHKB
+ R1 | | ~~~~
+D- <----+-----+--R2-----|INT1 PB2-4|------->ROW(6-8)
+D+ <----|---+----R3-----|INT0 PC0-2|------->COL(9-11)
+ Z1 Z2 | PC3|------->ENABLE(12)
+GND<----+---+-----------|GND PB0|<-------KEY(4)
+ | PB1|------->PREV(5)
+ | |
+ GND+-C2--+--|XTAL1 RXD|------->Debug Console
+ X1 | TXD|<-------Debug Console
+ GND+-C3--+--|XTAL2 RST|---SW--+GND
+ +---------------+
+
+R1: 1.5K Ohm
+R2,R3: 68 Ohm
+Z1,Z2: Zener 3.6V
+C1,C2: 22pF
+C3: 0.1uF
+X1: Crystal 12MHz
+SW: Push Switch(Optional)
+BATT: Li-Po Battery, Battery Charger and Voltage Regulator(5V and 3.3V).
+
+
+
diff --git a/keyboard/hhkb/not_supported/usbconfig.h b/keyboard/hhkb/not_supported/usbconfig.h
new file mode 100644
index 0000000000..c3aad34bef
--- /dev/null
+++ b/keyboard/hhkb/not_supported/usbconfig.h
@@ -0,0 +1,388 @@
+/* Name: usbconfig.h
+ * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
+ * Author: Christian Starkjohann
+ * Creation Date: 2005-04-01
+ * Tabsize: 4
+ * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
+ * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
+ * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
+ */
+
+#ifndef __usbconfig_h_included__
+#define __usbconfig_h_included__
+
+#include "config_vusb.h"
+
+/*
+General Description:
+This file is an example configuration (with inline documentation) for the USB
+driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
+also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
+wire the lines to any other port, as long as D+ is also wired to INT0 (or any
+other hardware interrupt, as long as it is the highest level interrupt, see
+section at the end of this file).
+*/
+
+/* ---------------------------- Hardware Config ---------------------------- */
+
+#define USB_CFG_IOPORTNAME D
+/* This is the port where the USB bus is connected. When you configure it to
+ * "B", the registers PORTB, PINB and DDRB will be used.
+ */
+#define USB_CFG_DMINUS_BIT 3
+/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
+ * This may be any bit in the port.
+ */
+#define USB_CFG_DPLUS_BIT 2
+/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
+ * This may be any bit in the port. Please note that D+ must also be connected
+ * to interrupt pin INT0! [You can also use other interrupts, see section
+ * "Optional MCU Description" below, or you can connect D- to the interrupt, as
+ * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
+ * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
+ * markers every millisecond.]
+ */
+#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
+/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
+ * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
+ * require no crystal, they tolerate +/- 1% deviation from the nominal
+ * frequency. All other rates require a precision of 2000 ppm and thus a
+ * crystal!
+ * Since F_CPU should be defined to your actual clock rate anyway, you should
+ * not need to modify this setting.
+ */
+#define USB_CFG_CHECK_CRC 0
+/* Define this to 1 if you want that the driver checks integrity of incoming
+ * data packets (CRC checks). CRC checks cost quite a bit of code size and are
+ * currently only available for 18 MHz crystal clock. You must choose
+ * USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
+ */
+
+/* ----------------------- Optional Hardware Config ------------------------ */
+
+/* #define USB_CFG_PULLUP_IOPORTNAME D */
+/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
+ * V+, you can connect and disconnect the device from firmware by calling
+ * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
+ * This constant defines the port on which the pullup resistor is connected.
+ */
+/* #define USB_CFG_PULLUP_BIT 4 */
+/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
+ * above) where the 1.5k pullup resistor is connected. See description
+ * above for details.
+ */
+
+/* --------------------------- Functional Range ---------------------------- */
+
+#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
+/* Define this to 1 if you want to compile a version with two endpoints: The
+ * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
+ * number).
+ */
+#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
+/* Define this to 1 if you want to compile a version with three endpoints: The
+ * default control endpoint 0, an interrupt-in endpoint 3 (or the number
+ * configured below) and a catch-all default interrupt-in endpoint as above.
+ * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
+ */
+#define USB_CFG_EP3_NUMBER 3
+/* If the so-called endpoint 3 is used, it can now be configured to any other
+ * endpoint number (except 0) with this macro. Default if undefined is 3.
+ */
+/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
+/* The above macro defines the startup condition for data toggling on the
+ * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
+ * Since the token is toggled BEFORE sending any data, the first packet is
+ * sent with the oposite value of this configuration!
+ */
+#define USB_CFG_IMPLEMENT_HALT 0
+/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
+ * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
+ * it is required by the standard. We have made it a config option because it
+ * bloats the code considerably.
+ */
+#define USB_CFG_SUPPRESS_INTR_CODE 0
+/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
+ * want to send any data over them. If this macro is defined to 1, functions
+ * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
+ * you need the interrupt-in endpoints in order to comply to an interface
+ * (e.g. HID), but never want to send any data. This option saves a couple
+ * of bytes in flash memory and the transmit buffers in RAM.
+ */
+#define USB_CFG_INTR_POLL_INTERVAL 10
+/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
+ * interval. The value is in milliseconds and must not be less than 10 ms for
+ * low speed devices.
+ */
+#define USB_CFG_IS_SELF_POWERED 0
+/* Define this to 1 if the device has its own power supply. Set it to 0 if the
+ * device is powered from the USB bus.
+ */
+#define USB_CFG_MAX_BUS_POWER 100
+/* Set this variable to the maximum USB bus power consumption of your device.
+ * The value is in milliamperes. [It will be divided by two since USB
+ * communicates power requirements in units of 2 mA.]
+ */
+#define USB_CFG_IMPLEMENT_FN_WRITE 1
+/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
+ * transfers. Set it to 0 if you don't need it and want to save a couple of
+ * bytes.
+ */
+#define USB_CFG_IMPLEMENT_FN_READ 0
+/* Set this to 1 if you need to send control replies which are generated
+ * "on the fly" when usbFunctionRead() is called. If you only want to send
+ * data from a static buffer, set it to 0 and return the data from
+ * usbFunctionSetup(). This saves a couple of bytes.
+ */
+#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
+/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
+ * You must implement the function usbFunctionWriteOut() which receives all
+ * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
+ * can be found in 'usbRxToken'.
+ */
+#define USB_CFG_HAVE_FLOWCONTROL 0
+/* Define this to 1 if you want flowcontrol over USB data. See the definition
+ * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
+ * usbdrv.h.
+ */
+#define USB_CFG_DRIVER_FLASH_PAGE 0
+/* If the device has more than 64 kBytes of flash, define this to the 64 k page
+ * where the driver's constants (descriptors) are located. Or in other words:
+ * Define this to 1 for boot loaders on the ATMega128.
+ */
+#define USB_CFG_LONG_TRANSFERS 0
+/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
+ * in a single control-in or control-out transfer. Note that the capability
+ * for long transfers increases the driver size.
+ */
+/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
+/* This macro is a hook if you want to do unconventional things. If it is
+ * defined, it's inserted at the beginning of received message processing.
+ * If you eat the received message and don't want default processing to
+ * proceed, do a return after doing your things. One possible application
+ * (besides debugging) is to flash a status LED on each packet.
+ */
+/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
+/* This macro is a hook if you need to know when an USB RESET occurs. It has
+ * one parameter which distinguishes between the start of RESET state and its
+ * end.
+ */
+/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
+/* This macro (if defined) is executed when a USB SET_ADDRESS request was
+ * received.
+ */
+#define USB_COUNT_SOF 1
+/* define this macro to 1 if you need the global variable "usbSofCount" which
+ * counts SOF packets. This feature requires that the hardware interrupt is
+ * connected to D- instead of D+.
+ */
+/* #ifdef __ASSEMBLER__
+ * macro myAssemblerMacro
+ * in YL, TCNT0
+ * sts timer0Snapshot, YL
+ * endm
+ * #endif
+ * #define USB_SOF_HOOK myAssemblerMacro
+ * This macro (if defined) is executed in the assembler module when a
+ * Start Of Frame condition is detected. It is recommended to define it to
+ * the name of an assembler macro which is defined here as well so that more
+ * than one assembler instruction can be used. The macro may use the register
+ * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
+ * immediately after an SOF pulse may be lost and must be retried by the host.
+ * What can you do with this hook? Since the SOF signal occurs exactly every
+ * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
+ * designs running on the internal RC oscillator.
+ * Please note that Start Of Frame detection works only if D- is wired to the
+ * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
+ */
+#define USB_CFG_CHECK_DATA_TOGGLING 0
+/* define this macro to 1 if you want to filter out duplicate data packets
+ * sent by the host. Duplicates occur only as a consequence of communication
+ * errors, when the host does not receive an ACK. Please note that you need to
+ * implement the filtering yourself in usbFunctionWriteOut() and
+ * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
+ * for each control- and out-endpoint to check for duplicate packets.
+ */
+#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
+/* define this macro to 1 if you want the function usbMeasureFrameLength()
+ * compiled in. This function can be used to calibrate the AVR's RC oscillator.
+ */
+#define USB_USE_FAST_CRC 0
+/* The assembler module has two implementations for the CRC algorithm. One is
+ * faster, the other is smaller. This CRC routine is only used for transmitted
+ * messages where timing is not critical. The faster routine needs 31 cycles
+ * per byte while the smaller one needs 61 to 69 cycles. The faster routine
+ * may be worth the 32 bytes bigger code size if you transmit lots of data and
+ * run the AVR close to its limit.
+ */
+
+/* -------------------------- Device Description --------------------------- */
+
+#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
+/* USB vendor ID for the device, low byte first. If you have registered your
+ * own Vendor ID, define it here. Otherwise you may use one of obdev's free
+ * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
+ * *** IMPORTANT NOTE ***
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
+ * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
+ * the implications!
+ */
+#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
+/* This is the ID of the product, low byte first. It is interpreted in the
+ * scope of the vendor ID. If you have registered your own VID with usb.org
+ * or if you have licensed a PID from somebody else, define it here. Otherwise
+ * you may use one of obdev's free shared VID/PID pairs. See the file
+ * USB-IDs-for-free.txt for details!
+ * *** IMPORTANT NOTE ***
+ * This template uses obdev's shared VID/PID pair for Vendor Class devices
+ * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
+ * the implications!
+ */
+#define USB_CFG_DEVICE_VERSION 0x00, 0x01
+/* Version number of the device: Minor number first, then major number.
+ */
+#define USB_CFG_VENDOR_NAME 't', '.', 'm', '.', 'k', '.'
+#define USB_CFG_VENDOR_NAME_LEN 6
+/* These two values define the vendor name returned by the USB device. The name
+ * must be given as a list of characters under single quotes. The characters
+ * are interpreted as Unicode (UTF-16) entities.
+ * If you don't want a vendor name string, undefine these macros.
+ * ALWAYS define a vendor name containing your Internet domain name if you use
+ * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
+ * details.
+ */
+#define USB_CFG_DEVICE_NAME 'H', 'H', 'K', 'B', ' ', 'm', 'o', 'd'
+#define USB_CFG_DEVICE_NAME_LEN 8
+/* Same as above for the device name. If you don't want a device name, undefine
+ * the macros. See the file USB-IDs-for-free.txt before you assign a name if
+ * you use a shared VID/PID.
+ */
+/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
+/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
+/* Same as above for the serial number. If you don't want a serial number,
+ * undefine the macros.
+ * It may be useful to provide the serial number through other means than at
+ * compile time. See the section about descriptor properties below for how
+ * to fine tune control over USB descriptors such as the string descriptor
+ * for the serial number.
+ */
+#define USB_CFG_DEVICE_CLASS 0
+#define USB_CFG_DEVICE_SUBCLASS 0
+/* See USB specification if you want to conform to an existing device class.
+ * Class 0xff is "vendor specific".
+ */
+#define USB_CFG_INTERFACE_CLASS 3 /* HID */
+#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
+#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
+/* See USB specification if you want to conform to an existing device class or
+ * protocol. The following classes must be set at interface level:
+ * HID class is 3, no subclass and protocol required (but may be useful!)
+ * CDC class is 2, use subclass 2 and protocol 1 for ACM
+ */
+#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
+/* Define this to the length of the HID report descriptor, if you implement
+ * an HID device. Otherwise don't define it or define it to 0.
+ * If you use this define, you must add a PROGMEM character array named
+ * "usbHidReportDescriptor" to your code which contains the report descriptor.
+ * Don't forget to keep the array and this define in sync!
+ */
+
+/* #define USB_PUBLIC static */
+/* Use the define above if you #include usbdrv.c instead of linking against it.
+ * This technique saves a couple of bytes in flash memory.
+ */
+
+/* ------------------- Fine Control over USB Descriptors ------------------- */
+/* If you don't want to use the driver's default USB descriptors, you can
+ * provide our own. These can be provided as (1) fixed length static data in
+ * flash memory, (2) fixed length static data in RAM or (3) dynamically at
+ * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
+ * information about this function.
+ * Descriptor handling is configured through the descriptor's properties. If
+ * no properties are defined or if they are 0, the default descriptor is used.
+ * Possible properties are:
+ * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
+ * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
+ * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
+ * you want RAM pointers.
+ * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
+ * in static memory is in RAM, not in flash memory.
+ * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
+ * the driver must know the descriptor's length. The descriptor itself is
+ * found at the address of a well known identifier (see below).
+ * List of static descriptor names (must be declared PROGMEM if in flash):
+ * char usbDescriptorDevice[];
+ * char usbDescriptorConfiguration[];
+ * char usbDescriptorHidReport[];
+ * char usbDescriptorString0[];
+ * int usbDescriptorStringVendor[];
+ * int usbDescriptorStringDevice[];
+ * int usbDescriptorStringSerialNumber[];
+ * Other descriptors can't be provided statically, they must be provided
+ * dynamically at runtime.
+ *
+ * Descriptor properties are or-ed or added together, e.g.:
+ * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
+ *
+ * The following descriptors are defined:
+ * USB_CFG_DESCR_PROPS_DEVICE
+ * USB_CFG_DESCR_PROPS_CONFIGURATION
+ * USB_CFG_DESCR_PROPS_STRINGS
+ * USB_CFG_DESCR_PROPS_STRING_0
+ * USB_CFG_DESCR_PROPS_STRING_VENDOR
+ * USB_CFG_DESCR_PROPS_STRING_PRODUCT
+ * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
+ * USB_CFG_DESCR_PROPS_HID
+ * USB_CFG_DESCR_PROPS_HID_REPORT
+ * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
+ *
+ * Note about string descriptors: String descriptors are not just strings, they
+ * are Unicode strings prefixed with a 2 byte header. Example:
+ * int serialNumberDescriptor[] = {
+ * USB_STRING_DESCRIPTOR_HEADER(6),
+ * 'S', 'e', 'r', 'i', 'a', 'l'
+ * };
+ */
+
+#define USB_CFG_DESCR_PROPS_DEVICE 0
+#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
+//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
+#define USB_CFG_DESCR_PROPS_STRINGS 0
+#define USB_CFG_DESCR_PROPS_STRING_0 0
+#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
+#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
+#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
+#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
+//#define USB_CFG_DESCR_PROPS_HID 0
+#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
+//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
+#define USB_CFG_DESCR_PROPS_UNKNOWN 0
+
+/* ----------------------- Optional MCU Description ------------------------ */
+
+/* The following configurations have working defaults in usbdrv.h. You
+ * usually don't need to set them explicitly. Only if you want to run
+ * the driver on a device which is not yet supported or with a compiler
+ * which is not fully supported (such as IAR C) or if you use a differnt
+ * interrupt than INT0, you may have to define some of these.
+ */
+/* #define USB_INTR_CFG MCUCR */
+/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
+/* #define USB_INTR_CFG_CLR 0 */
+/* #define USB_INTR_ENABLE GIMSK */
+/* #define USB_INTR_ENABLE_BIT INT0 */
+/* #define USB_INTR_PENDING GIFR */
+/* #define USB_INTR_PENDING_BIT INTF0 */
+/* #define USB_INTR_VECTOR INT0_vect */
+
+/* Set INT1 for D- falling edge to count SOF */
+/* #define USB_INTR_CFG EICRA */
+#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
+/* #define USB_INTR_CFG_CLR 0 */
+/* #define USB_INTR_ENABLE EIMSK */
+#define USB_INTR_ENABLE_BIT INT1
+/* #define USB_INTR_PENDING EIFR */
+#define USB_INTR_PENDING_BIT INTF1
+#define USB_INTR_VECTOR INT1_vect
+
+#endif /* __usbconfig_h_included__ */
diff --git a/keyboard/hhkb/rn42.mk b/keyboard/hhkb/rn42.mk
new file mode 100644
index 0000000000..fd6f7db1a8
--- /dev/null
+++ b/keyboard/hhkb/rn42.mk
@@ -0,0 +1,12 @@
+RN42_DIR = rn42
+
+SRC += serial_uart.c \
+ rn42/suart.S \
+ rn42/rn42.c \
+ rn42/rn42_task.c \
+ rn42/battery.c \
+ rn42/main.c
+
+OPT_DEFS += -DPROTOCOL_RN42
+
+VPATH += $(RN42_DIR)
diff --git a/keyboard/hhkb/rn42/MEMO.txt b/keyboard/hhkb/rn42/MEMO.txt
new file mode 100644
index 0000000000..0363c2f433
--- /dev/null
+++ b/keyboard/hhkb/rn42/MEMO.txt
@@ -0,0 +1,255 @@
+Memo of deveopment
+==================
+just memo, NOT WORTH READING
+
+Bug:
+- Factory Reset PIO4 doesn't work
+ - the reason is unclear - 12/08 NOT LOOK INTO ANY MORE
+ - WORKAROUND: use serial pins(3.3V, GND, RX and TX)
+ - SF,1 and R,1 to set factory defalult
+
+
+Todo:
+- LED cover and switch knob and new Slide Switch
+- RN42 auto configuration
+ - configure the module as HID device every time powering up
+ - this'll reduce work load of assembly
+
+- move rn42 to protocol directory when it becomes reusable stack
+
+- sendchar() in lufa.c no buffer
+ - no buffering. character lost can be caused.
+- LUFA sendchar should be buffered and serial_uart.c buffur size is too large(256).
+
+- BT operations
+ - disconnect
+ - new connection
+ - remove connection
+
+- sendchar() in lufa.c block loop - DONE 11/29
+ - block loop when powered with AC adapter
+ - FrameNumber is not updated when adapter powered
+
+Improving:
+- ADC resolution
+ AVR120
+ AVR32138
+ - Enhancing ADC resolution by oversampling
+ AVR121 http://www.atmel.com/images/doc8003.pdf
+ - disable digital input buffer DIDR(7.8.6)
+
+Design:
+- suspend.h - DONE 11/26
+ - remove argument from suspend_power_down() for backward compatitibility
+- remove MCU dependent power saving code from core/keyboard - DONE 11/23
+ - it should be located in project matrix.c
+- HHKB matrix.c needs matrix_prev?
+ - is_modified() is obsolete now. really needs?
+- ADC: removing AREF capacitor C10
+ - seems to be better while usb powered
+ - still bad while battery powered
+ http://electronics.stackexchange.com/questions/105849/avcc-and-capacitor-using-adc
+- ADC: smaller resistors for voltage dividor
+ - 1K + 1K: not improved. - 11/27
+
+
+LUFA:
+USB connection check: state of USB deivce
+- USB_DeviceState:
+ USB_Deivce_State_t { Unattached, Powered, Default, Addressed, Configured*, Suspended* }
+ Unattached: unpluged
+ Powered: pluged with power adapter
+ Default: enumerate process bigin
+ Addressed: addressed
+ Configured: enumerated
+ Suspended: suspended
+
+- USB_IsInitialized: state of LUFA core setup
+ becomes true in USB_Init() USBController_AVR8.c
+ becomes false in USB_Disable() USBController_AVR8.c
+- USB_VBUS_GetStatus(): state of VBUS(power/connection)
+- USB_Disable() detaches, disables all interrupts, controller, PLL, regulater.
+
+- When connect to power adapter
+ - event happened: CW or CSW or C or DDC
+ - USB state: not configured
+
+- USB evnets
+ - USB connect: CSWRWRW
+ - USB connect but fail to enumeration: CWRWRWRWS
+ - USB disconnect: D
+ - Power adapter connect: CW, CSW, C
+ - Power adapter disconnect: D
+
+
+Power saving:
+- Pro2 current consumption
+ - active: 138.2mA(no device on Hub)
+ - suspended: 30.9mA(WakeUp enabled DIPSW6)
+ - suspended: 0mA->46.0mA(WakeUp disabled DIPSW6)
+- Pro current consumption
+ - active: 54.0mA
+ - suspended: 40.5mA(WakeUp enabled DIPSW6)
+ - suspended: 0.3mA(WakeUp disabled DIPSW6)
+
+- RN42 3.3V
+ - disconnected(Idle): 5mA (config mode)
+ - connected(Active):
+ SW,0000: 23-26mA
+ SW,0010: 27-29mA worse than 0000 for unknown reason
+ SW,0020: 17-19mA mouse NG
+ SW,0030: 13-16mA laggy mouse NG
+ SW,0050: 10-13mA laggy mouse NG
+
+- matrix power saving
+ - power saving while externally powered and not while unpluged
+- confirm suspend mode lufa.c: matrix_power_*, suspend_wakeup_condition
+- 8MHz clock
+- When not connected in a few minutes get into deep sleep to save battery life
+- CTS is needed for waking up from deep sleep? How deep sleep is activated?
+- firmware controlled 3.3V DC converter to switch on/off BT module
+- sleep MCU and BT module(keyboard is not used)
+- deep sleep MCU and BT module(keyboard is not used for long time)
+- deep sleep MCU and turn off BT module(keyboard is not used and not connected)
+- Battery ADC; switching, high resistance
+ - switching gnd end of divider with PF4
+ - high resistor 100K/1M?
+ capacitor 10nF
+ http://www.eevblog.com/forum/beginners/measuring-battery-voltage-without-consuming-current/
+- During USB suspend change clock source to internal RC from external Xtal(6.8)
+- FRZCLK: you can freeze clock for power saving. still WAKEUPI and VBUSTI interrupts are available while freezing.(21.7.3)
+- Suspend: Clear Suspend Bit, Freeze clock, disable PLL, MCU sleep(21.13)
+- Voltage reference(8.1.1)
+ - to reduce power consumption while power down mode
+- unset ADEN before sleep(24.7)
+
+
+
+
+
+
+
+Lipo
+----
+850mA lasts around 9 hours(07/28)
+
+Sparkfun Polymer Lithium Ion Battery 850mAh:
+https://www.sparkfun.com/products/341
+Lipo Cell spec:
+https://www.sparkfun.com/datasheets/Batteries/063048%20Li-polymer.pdf
+Protection spec:
+http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Prototyping/BatteryProtection.pdf
+ min typical max
+ over-charge 4.255 4.280 4.305
+ over-charge discover? 4.030 4.080 4.130
+ over-discharge 2.827 2.900 2.973
+ over-discharge discover 3.022 3.100 3.178
+
+ADC voltage monitor: voltage divider 10K+10K(0.5)
+ ADC=V*0.5/2.56*1024
+
+ V ADC
+ ------------------
+ 4.20 0x347(839)
+ 3.10 0x26b(619)
+
+
+
+
+TROUBLE SHOOT
+-------------
+07/16 After fix of voltage dividor on GPIO6, had a trouble that it could not send a char to BT module, though could receive.
+ Found R8 had wrong 1K resistor and changed to 10K, after that it can send to the module again. Not sure how it had sent with the wrong 1K before.
+
+07/18 On Linux, had an USB related trouble; keyboard or console didn't work for some reason. Changing PID cured this problem. Very annoying, took very long time before resolved it.
+
+12/07 rn42_rts() read 1 every time. R12 broke in open mode(no coductive), idk why, too much heat with soldering? and PF1 pin was not soldered.
+ It resolved with resoldering PF1 and new resistor on R12.
+
+
+
+
+Done:
+- low battery alert(solid light) 09/04
+- *** Rev.E BT test *** - DONE
+ - with MCP73832, new Schottky, tantalum caps - DONE 12/07
+ * MCP73832 doesn't leak from Vcc pin when unpluged and battery powered
+ 34mV vs 2.07V(MCP73831) at Vcc pin
+ MCP73832 doesn't need revese protection diode D5
+ * PMEG2010ER is very low VF while reverse current/voltage is high
+ VF=0.96 vs 1.98(RB160M-30TR)with Fluke 175
+ Anode of D11 is 680mV vs 20mV(RB160M-30TR)
+ 780mV is still low < 1.4V VBUS plugin detection(21.11)
+ this doesn't cause false VBUS detect
+ and 780mV on MCP73832 Vcc pin is also no problem.
+ D5 can be removed.
+ - ADC divider switching - DONE 12/07
+ * Drain and Source of Q4 Pch was reversed wrongly on Rev.E.
+
+ - reverse current from Lipo charger - DONE 12/07
+ * MCP73832 has no recverse current from Vcc pin unlike MCP73831
+
+
+- Rev.F design - DONE
+ - current measure point - DONE 12/08
+ - change value of cap 68->47 - DONE 12/08
+ - PPTC land pattern: no solder jumper, use 0Ohm resistor instead - CANCEL 12/08
+ - Q4 Pch FET: wrong Drain and Source - DONE 12/08
+ - D5 can be removed. - DONE 12/08
+
+
+
+- BT_INDICATOR LED turns on wrongly when touching line or pin. -- pull-up enabled on PF6/GPIO2 08/30
+- Lipo charger configuration: fast charge time: USB charger spec? -- used 2kohm
+- use LED of charger to alarm low battery. LED should be powered directly from Lipo? - cancel; powered from VUSB
+- Use RTS in serial_uart.c to resolve missing chars from help message of RN-42 - done
+- CTS/RTS lines are needed? just connect in loop back if no flow control is needed. - done
+- add IO pin to charger status CHRG; LED control(low) and detect charge status(input HiZ) 07.24
+- LINKED: add trace on PIO2 to PF6 07.24
+- Lipo voltage ADC sensing
+- Lipo charger MCP73831: needs capacitor 4.7uF *2
+- USB connection check - 07.01
+- BT on/off check: whether RX line is pulled up? - checking RTS 07.01
+- USB/BT switching BT is on -> BT, BT is off -> USB - 07.01
+- Under voltage lock out UVLO for protection of Lipo - Lipo has discharge protection at 3.100V 07.01
+- Power saving: HHKB scan, BT radio control - 9h with 850mAh, this is enough 07.01
+- Power selector doesn't work; Q4 MOSFET leaks from Lipo to USB power line. -- use Schottky instead 07/04
+
+- wrongly suspended when powered from adapter without USB connection - DONE
+ - suspend event may occur when plug into adapter
+ - and never wake until conected to real USB line
+ - without debug print via USB no problem; CSW(wake just after suspend as real USB line)
+ - seems like USB print causes this problem after suspended
+
+- lose USB connection during power-down mode - DONE
+ - USB initialize code in main() causes this - WRONG
+ - Do not power-down during USB connection is active - DONE 11/11
+ (USB_DeviceState == USB_DEVICE_Configured) is used to check USB connection
+ matrix_power_down() matrix.c - 11/23
+
+- with Nexus5 keyboard and mouse are very laggy.
+ Not confirmed. 01/15
+
+- switch BT host connections - CANCEL 01/15
+ - switch next connection
+ cannot switch connection with version 6.15 at least
+
+- When given power only from wall wart adapter - DONE? not confirmed 01/15
+ - it sleeps. it should not sleep
+ - Configured state without USB connection?
+
+- timer is slow while power down - DONE 11/26
+ - time out interrupt is lost while power down?
+ - interrupt of watchdog timer compensates timer counter(avr/suspend.c)
+
+- repeated CHARGING/FULL_CHARGED - No longer problem 01/15
+ - In LTC sharp pulses are observed.
+ - MCP has no pulse but still has a problem.
+ - needs more wait before read pin state? - NO
+
+- USB plug-in fails while BT - No longer problem 01/15
+ - it ends in suspend state
+ - maybe, not responsive to host enumeration process due to power-down.
+ - matrix_power_down() only when state is unattached - 11/26
+ - need to observe a while
+
diff --git a/keyboard/hhkb/rn42/PowerSave.txt b/keyboard/hhkb/rn42/PowerSave.txt
new file mode 100644
index 0000000000..4b9c8f415d
--- /dev/null
+++ b/keyboard/hhkb/rn42/PowerSave.txt
@@ -0,0 +1,88 @@
+Power Saving
+============
+
+
+MCU+HHKB Power Comsumption
+--------------------------
+Battery drive:
+ idle 18.9mA
+ active 35.8mA
+
+USB powered:
+ 40.0mA
+ 52mA 01/17
+
+Other keyboards:
+HHKB Pro 55mA
+HHKB Pro2 140mA
+HHKB Pro 42mA(Alt)
+HHKB Pro2 52mA(Alt BT controller USB mode)
+HHKB Pro2 88mA(Alt BT controller BT mode connected)
+HHKB Pro2 68mA(Alt BT controller BT mode config mode)
+Poker X 6mA
+Infinity 24mA(TMK)
+ 65mA(kiibohd)
+
+
+HHKB key switch power control
+-----------------------------
+MOS FET Nch: BSS138 or IRLML6344T, either works and no apparent difference.
+Normally on(pull-up) or off(pull-down)? interms of power saving it prefers pull-down?
+
+Pull-down will be better for power saving, normally off.
+
+
+
+Used Timer
+----------
+
+8MHz clock
+----------
+1) 16MHz xtal with system prescaler div2: F_CPU=8MHz, F_USB=16MHz
+2) 8MHz xtal with div1: F_CPU=8MHz, F_USB=8MHz
+Hardware USART doesn't work at 115200bps with 8MHz(F_CPU).
+
+workaround:
+a) use Sotwre serial for communcation with RN-42
+b) reduce baud of RN-42 to lower rate;(factory default is 115200bps)
+10/03
+
+
+
+Slave mode
+----------
+Discovery/Inquire
+Connect/Page
+
+SI,0012
+SJ,0012
+InqWindw=0100
+PagWindw=0100
+
+
+Sniff mode
+----------
+0.625ms * <hex>
+SW,0320 Very sluggish. Type is not lost but very slow to register.
+SW,0160 Still sluggish. may transposed? can type but ...
+ Mouse point move intermittently
+SW,0020 feel a bit late like stumble(20ms)
+SW,0010 feel no latency(10ms)
+
+
+Deep sleep
+----------
+SW,8010
+
+
+TX power
+--------
+SY,fff4
+
+
+IO pins
+-------
+S%,1000 status led and connection control don't work
+ GPIO5: status LED
+ GPIO6: Connection control
+ GPIO2: linked status
diff --git a/keyboard/hhkb/rn42/RN42.txt b/keyboard/hhkb/rn42/RN42.txt
new file mode 100644
index 0000000000..64c3fdd4ec
--- /dev/null
+++ b/keyboard/hhkb/rn42/RN42.txt
@@ -0,0 +1,408 @@
+RN-42 Bluetooth Module Support
+==============================
+Bluetooth controller board works with HHKB Pro2, JP, Type-S and Type-S JP and it supports both USB and Bluetooth as keyboard output protocol. Bluetooth module Roving Networks/Microchip RN-42 is installed on the board.
+
+
+RN-42:
+http://www.microchip.com/wwwproducts/Devices.aspx?product=RN42
+
+
+Capabitlities:
+- USB keyboard functions
+ completely equivarent to USB controller including mouse keys and NKRO.
+- Switching between USB and Bluetooth
+ You can switch the two connections with BT switch or key combination.
+- RN-42 config mode
+ You can change power/connection configuration of the module if needed.
+- Low battery alert
+ Red LED turns on when low voltage.
+- RN-42 status indicator
+ LED indicates status of Bluetooth connection.
+- Pairing
+ The module stores up to 8 connections.
+- Auto connect
+ The module connects the last connected device automatically.
+- iOS support
+ works as keyboard with iPhone5. No tested completely.
+- Android support
+ works as keyboard and mouse with Nexus5. No tested completely.
+- Mouse keys over BT
+ Note that iOS doesn't accept mouse device.
+
+
+Limitations:
+- Short battery life
+ Around 12hr with 1000mAh
+- No connection switching
+ RN-42 auto-connects to the last connected device.
+ Some of consumer products can switch between devices, for example Logitech K480.
+ http://www.logitech.com/en-us/product/multi-device-keyboard-k480?crid=26
+- HHKB JP requires case modification for BT switch and LEDs.
+ without switch power controlled by MCU? Probably using 3.3V regulator enable pin power of RN-42 can be controlled.
+
+NOTE:
+- LIPO BATTERY IS VERY DANGEROUS, TAKE EXTRA CARE OF YOUR SAFETY AND PROPERTY.
+- RN-42 version 6.15 is supported.
+- No NKRO over Bluetooth
+- Check you country's wiress regulation and certification of RN-42.
+
+Bugs:
+
+Todos:
+
+
+Lipo Battery
+------------
+You can use 3.7V Lithium Ion battery with JST PH 2pin connector and protection circuit.
+Battery space inside HHKB is around 54mm x 50mm and its height is 7mm.
+
+Sparkfun 850mAh
+https://www.sparkfun.com/products/341
+Sparkfun 1000mAh
+https://www.sparkfun.com/products/339
+
+Sparkfun 2000mAh battery won't fit due to its size.
+
+Learn about Lipo battery:
+https://learn.adafruit.com/li-ion-and-lipoly-batteries
+
+
+
+
+
+LED Status
+----------
+Configuring 10 times per sec
+Startup/configuration timer 2 times per sec
+Discoverable/Inquiring/Idle once per sec
+Connected solid on
+
+
+RN-42 Magic Command
+--------------------
+Magic key combination is 'LShift+RShift' by default in case of HHKB.
+
+Here is help.
+
+ ----- Bluetooth RN-42 Help -----
+ i: RN-42 info
+ b: battery voltage
+ Del: enter/exit RN-42 config mode
+ Slck: RN-42 initialize
+ p: pairing
+ u: toggle Force USB mode
+
+ RN-42 info: displays information of the module on console.
+ battery voltage: displays current voltage of battery and uptime.
+ RN-42 initialize: does factory reset and configures RN-42
+ pairing: enters Pairing mode.
+ toggle Force USB mode: switch between USB and Bluetooth
+
+
+RN-42 Config mode
+-----------------
+You can tune/operate RN-42 yourself with config(command) mode.
+
+1. hook up USB cable
+2. run `hid_listen` command in console
+3. turn on Bluetooth switch
+4. press LShift+RShift+Delete(Fn+~) you will see output like followings:
+
+ Entering config mode ...
+ CMD
+ v
+ Ver 6.15 04/26/2013
+ (c) Roving Networks
+
+5. do config with RN-42 commands. See documentations of RN-42.
+6. to exit also press LShift+RShift+Delete(Fn+~)
+
+ Exiting config mode ...
+ ---
+ END
+
+
+RN-42 Initial Configuration
+---------------------------
+RN-42 is configured as SPP device at factory reset, you need to configure it as HID device. This is needed just once first time.
+
+1. hook up USB cable
+2. run `hid_listen` command in console
+3. turn on Bluetooth switch
+4. press LShift+RShift+ScrLk(Fn+O) you will see output like followings:
+
+ Entering config mode ...
+ CMD
+ Ver 6.15 04/26/2013
+ (c) Roving Networks
+ ECHO ON
+ SF,1
+ AOK
+ S-,TmkBT
+ AOK
+ SS,Keyboard/Mouse
+ AOK
+ SM,4
+ AOK
+ SW,8000
+ AOK
+ S~,6
+ AOK
+ SH,003C
+ AOK
+ SY,FFF4
+ AOK
+ R,1
+ Reboot!
+ Exiting config mode ...
+
+5. output of command 'X' after cofiguration
+
+ Ver 6.15 04/26/2013
+ (c) Roving Networks
+ ***Settings***
+ BTA=00066667BBE9
+ BTName=TmkBT-BBE9
+ Baudrt(SW4)=115K
+ Mode =DTR
+ Authen=1
+ PinCod=1234
+ Bonded=0
+ Rem=NONE SET
+ ***ADVANCED Settings***
+ SrvName= Keyboard/Mouse
+ SrvClass=0000
+ DevClass=1F00
+ InqWindw=0100
+ PagWindw=0100
+ CfgTimer=255
+ StatuStr=NULL
+ HidFlags=3c
+ DTRtimer=8
+ KeySwapr=0
+ ***OTHER Settings***
+ Profile= HID
+ CfgChar= $
+ SniffEna=8000
+ LowPower=0
+ TX Power=fff4
+ IOPorts= 0
+ IOValues=0
+ Sleeptmr=0
+ DebugMod=0
+ RoleSwch=0
+
+
+Switch to USB mode
+------------------
+You can switch between USB and Bluetooth with pressing 'LShift+RShift+u'.
+
+
+Pairing mode
+------------
+This disconnects current connect and enter pairing mode.
+
+
+
+
+For deveropment
+===============
+
+RN-42 Serial Connection
+-----------------------
+UART: 115200bps, 8bit, 1-stopbit, non-parity, no flow control
+SSP: 115200bps, 8bit, 1-stopbit, non-parity, no flow control(via Bluetooth)
+
+To enter command mode disconnect the module from host and type '$$$'.(you will see 'CMD') and type '+' to get local echo. To exit type '---'(you will see 'END').
+
+
+RN-42 Commands
+--------------
+S-,tmkBT // Device name
+SS,keyboard/mouse // service name
+SM,4 // Auto Connect DTR mode
+SW,8010 // Sniff enable 0x10*0.625ms=10ms; 50ms is laggish and not much power save
+S~,6 // HID profile
+S~,0 // SPP profile
+SH,003C // HID register
+SY,0004 // Transmit power
+SC,0000 // COD: 000005C0 (see HID spec/Bluegiga doc)
+SD,05C0 // bit 12-8 7 6 5-0
+ // 00101 1 1 0
+ // peripheral pointing keybaord joystick, gamepad, ...
+SM,6 // Pairing mode: auto connect
+SM,4 // Master mode: Connection can be controled with GPIO6
+SF,1 // Factroy reset
+R,1 // reboot
+SR,Z // removes all remote addresses for reconnecting.
+ // can be used to connect another host
+SR,I // registers last inquiry address
+
+
+Operation Modes
+---------------
+SM,3 Auto Connect Master mode
+SM,4 Auto Connect DTR Mode uses GPIO6 to make and break connection(Mode =DTR)
+ confirm: auto connect works and control connection with GPIO6
+SM,5 Auto Connect ANY Mode (Mode =ANY)
+ each time GPIO is set, make inquiry and connect to the first found device
+SM,6 automatically reconnect(Mode =Pair)
+ confirm: auto connect works well but difficult to enter command mode.
+
+
+HID flag register
+-----------------
+SH,0200
+GH
+
+10 0000 0000(0200) default
+00 0011 1000(0038) Combo
+|| | | |\_\____ number of paired devices to which the module can reconnect
+|| | | \_______ send out reports over UART (0xFF <len> <data>)
+|| \__\_________ descriptor type
+|\______________ toggle virtual keyboard on iOS when first connected
+\_______________ Force HID mode if GPIO11 is high on power-up
+
+ Descriptor type:
+ 0000: keybaord
+ 0001: Game Pad
+ 0010: Mouse
+ 0011: Combo
+ 0100: Joystick
+ 1xxx: reserved
+
+
+Out report - Indicator
+----------------------
+0xFE 0x02 0x01 <LED_state>
+
+
+Apple iOS
+---------
+Keyboard can be used with iPhone, but mouse cannot.
+
+
+Android
+-------
+3.7.1.5 Note: To connect with Android phone the modules must wake up 11ms every 2.5seconds.
+
+
+Power Management
+----------------
+Inquiry and Page window Idle or Active (3.1.1)
+ Downside: delay in discovery or connection time
+ SI, // set inquiry scan window(discovery) on/off duty?
+ SJ, // set page scan window(connection)
+ This reduces averaege power >20mA to 5mA(3mA in Sniff mode)
+
+Sniff mode Transmit
+ Sniff mode is disabled by default and radio is active continuously when connected.(25-30mA)
+ In Sniff mode the radio wakes up intermittently and sleeps in very low power mode.(2mA)
+ SW,<val> // set interval timer(*0.625ms) 0000-7FFF
+
+Deep sleep Idle (3.1.2)
+ In this mode the module shuts down completly and only draws about 300uA. To enable this set the most signifant bit(0x8000) of Sniff interaval timer.
+ SW,8320 // deep sleep enable(interval=0x320*0.625=500ms)
+ In normal sleep the firmware is still running in idle mode, and wakes up about 20 times per second to check ports, update LEDs, etc. During deep sleep, the firmware actually stops runnig some tasks and the LEDs only update about once per second.
+ To wake from deep sleep there are three ways: (in worst case wake up takes 5ms)
+ *send a charactor to the UART(first charactor will be lost)
+ *toggle CTS low to high and wait 5ms
+ *wake automatically every slot time(<val>*0.625ms)
+ Once the radio is awake it stay active for exactly 1 second of inactivity and then sleeps again.
+ Downside: latency and data loss
+
+Disable Output driver Idle or Active (3.1.3)
+ S%,1000 // set all GPIO pins(0-11) to inputs.
+
+Lower Transmit Power Idle or Active (3.1.4)
+ SY,<hex> // transmit power setting(takes effect after a power cycle and reboot)
+ Downside: reducing effective range
+
+
+Optimizig for Latency
+---------------------
+By default the firmware is optimized for throughput.
+SQ,16 // set latency bit
+SQ,0 // unset latency bit
+
+
+Configuration timer settings
+----------------------------
+Remote configuration is used for the module to be configured with various commands over Bluetooth(SPP profile only?).
+
+The module has remote configuration timer to allow remote configuration over Bluetooth after power up in Slave mode. In Master modes the remote configuration timer is set to 0(no remote configuration). (In Trigger Master mode the timer is used as an idle timer to break the connection after time expires with no charactors receive.)
+ ST,0 // no remote, no local when connected
+ ST,<1-252> // local and remote with timeout in seconds from power up
+ ST,253 // local only without timeout
+ ST,254 // remote only without timeout
+ ST,255 // local and remote without timeout
+
+
+Commands
+--------
+S7, 7bit mode
+SA, Authenticaiton
+SB, Send break
+SC, Service class
+SD, Device class
+SM,<val> Operation mode
+SP,<string> Pin code(alpahnumeric)
+SQ,<mask> Special configuration(GPIO, discovery mode, low latency, reboot, UART)
+SR,<hex> Store remote address
+SR,Z Erase all address
+SS,<string> Set service name(1-20)**
+ST,<val> Remote configuration timer(Master:0, Slave:0-255, Triger:as idle timer)
+SU,<val> UART baud rate
+SW,<val> low-power sniff mode** deep sleep and wake up every 625us * <val>
+SX,<0|1> bonding enable only acceps device that matches the stored address
+SY,<hex> power setting**
+SZ,<val> non-standard raw baud rate <val>=baud*0.004096
+S~,<val> Profile 0:SPP, 5:APL, 6:HID
+S-,<string> Device name -15 alphanumeric charactors
+S?,<0|1> role switch enable
+S$,<char> command mode char
+$|,<hex> low-power connect mode deep sleep/active(discoverable and connectable) cycle
+D display basic setting
+E display extended setting
+GB display the device's Bluetooth address
+GF display Bluetooth address of connected device
+GK show connection status
+GR show remote address for reconnecting
+G& show GPIO pin
+G<char> show stored setting
++ toggle local echo on/off
+& show GPIO 3,4,6,7(DIP switch)
+C connect to stored remote address
+C,<address> connect last address
+CFI connect and go into fast data mode
+CFR connect and go into fast data mode
+CT,<address>,<val> connect to the address and disconnect after val?
+F,1 fast data mod:
+H display help
+I,<time>,<cod> inquiry scan with <cod>
+IN,<time>,<cod> inquiry scan with <cod>, return without BT name
+IR inquiry scan with 0055AA
+IS inquiry scan with 001F00
+J hide pin code
+K, kill disconnects current connection
+L link quality
+M show modem signlal status
+O display other settings
+P,<char> pass through?
+Q quiet mode make the module not discoverable
+Q,0 discoverable and connectable
+Q,1 not discoverable and not connectable
+Q,2 not discoverable and connectable
+Q,? display current quiet mode
+R,1 reboot
+T,<0|1> pass received data while in command mode
+U,<baud>,<parity> change UART setting tentatively
+V display firmware version
+W wake from quiet mode enable discovery and connection
+Z deep sleep mode(<2mA)
+
+
+Reset to Factory Default
+------------------------
+SF,1
+R,1
diff --git a/keyboard/hhkb/rn42/battery.c b/keyboard/hhkb/rn42/battery.c
new file mode 100644
index 0000000000..7e868c9646
--- /dev/null
+++ b/keyboard/hhkb/rn42/battery.c
@@ -0,0 +1,130 @@
+#include <avr/io.h>
+#include <util/delay.h>
+#include "battery.h"
+
+
+/*
+ * Battery
+ */
+void battery_init(void)
+{
+ // blink
+ battery_led(LED_ON); _delay_ms(500);
+ battery_led(LED_OFF); _delay_ms(500);
+ battery_led(LED_ON); _delay_ms(500);
+ battery_led(LED_OFF); _delay_ms(500);
+ // LED indicates charger status
+ battery_led(LED_CHARGER);
+
+ // ADC setting for voltage monitor
+ // Ref:2.56V band-gap, Input:ADC0(PF0), Prescale:128(16MHz/128=125KHz)
+ ADMUX = (1<<REFS1) | (1<<REFS0);
+ ADCSRA = (1<<ADPS2) | (1<<ADPS1) | (1<<ADPS0);
+ // digital input buffer disable(24.9.5)
+ DIDR0 = (1<<ADC0D) | (1<<ADC4D) | (1<<ADC7D);
+ DIDR1 = (1<<AIN0D);
+ DIDR2 = (1<<ADC8D) | (1<<ADC9D) | (1<<ADC11D) | (1<<ADC12D) | (1<<ADC13D);
+
+ // ADC disable voltate divider(PF4)
+ DDRF |= (1<<4);
+ PORTF &= ~(1<<4);
+}
+
+// Indicator for battery
+void battery_led(battery_led_t val)
+{
+ if (val == LED_TOGGLE) {
+ // Toggle LED
+ DDRF |= (1<<5);
+ PINF |= (1<<5);
+ } else if (val == LED_ON) {
+ // On overriding charger status
+ DDRF |= (1<<5);
+ PORTF &= ~(1<<5);
+ } else if (val == LED_OFF) {
+ // Off overriding charger status
+ DDRF |= (1<<5);
+ PORTF |= (1<<5);
+ } else {
+ // Display charger status
+ DDRF &= ~(1<<5);
+ PORTF &= ~(1<<5);
+ }
+}
+
+bool battery_charging(void)
+{
+ if (!(USBSTA&(1<<VBUS))) return false;
+
+ // Charger Status:
+ // MCP73831 MCP73832 LTC4054 Status
+ // Hi-Z Hi-Z Hi-Z Shutdown/No Battery
+ // Low Low Low Charging
+ // Hi Hi-Z Hi-Z Charged
+
+ // preserve last register status
+ uint8_t ddrf_prev = DDRF;
+ uint8_t portf_prev = PORTF;
+
+ // Input with pullup
+ DDRF &= ~(1<<5);
+ PORTF |= (1<<5);
+ _delay_ms(1);
+ bool charging = PINF&(1<<5) ? false : true;
+
+ // restore last register status
+ DDRF = (DDRF&~(1<<5)) | (ddrf_prev&(1<<5));
+ PORTF = (PORTF&~(1<<5)) | (portf_prev&(1<<5));
+
+ // TODO: With MCP73831 this can not get stable status when charging.
+ // LED is powered from PSEL line(USB or Lipo)
+ // due to weak low output of STAT pin?
+ // due to pull-up'd via resitor and LED?
+ return charging;
+}
+
+// Returns voltage in mV
+uint16_t battery_voltage(void)
+{
+ // ADC disable voltate divider(PF4)
+ DDRF |= (1<<4);
+ PORTF |= (1<<4);
+
+ volatile uint16_t bat;
+ ADCSRA |= (1<<ADEN);
+ _delay_ms(1); // wait for charging S/H capacitance
+
+ ADCSRA |= (1<<ADSC);
+ while (ADCSRA & (1<<ADSC)) ;
+ bat = ADC;
+
+ ADCSRA &= ~(1<<ADEN);
+
+ // ADC disable voltate divider(PF4)
+ DDRF |= (1<<4);
+ PORTF &= ~(1<<4);
+
+ return (bat - BATTERY_ADC_OFFSET) * BATTERY_ADC_RESOLUTION;
+}
+
+static bool low_voltage(void) {
+ static bool low = false;
+ uint16_t v = battery_voltage();
+ if (v < BATTERY_VOLTAGE_LOW_LIMIT) {
+ low = true;
+ } else if (v > BATTERY_VOLTAGE_LOW_RECOVERY) {
+ low = false;
+ }
+ return low;
+}
+
+battery_status_t battery_status(void)
+{
+ if (USBSTA&(1<<VBUS)) {
+ /* powered */
+ return battery_charging() ? CHARGING : FULL_CHARGED;
+ } else {
+ /* not powered */
+ return low_voltage() ? LOW_VOLTAGE : DISCHARGING;
+ }
+}
diff --git a/keyboard/hhkb/rn42/battery.h b/keyboard/hhkb/rn42/battery.h
new file mode 100644
index 0000000000..180d4dcfaa
--- /dev/null
+++ b/keyboard/hhkb/rn42/battery.h
@@ -0,0 +1,35 @@
+#ifndef POWER_H
+#define POWER_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+typedef enum {
+ FULL_CHARGED,
+ CHARGING,
+ DISCHARGING,
+ LOW_VOLTAGE,
+ UNKNOWN,
+} battery_status_t;
+
+typedef enum {
+ LED_CHARGER = 0,
+ LED_ON,
+ LED_OFF,
+ LED_TOGGLE,
+} battery_led_t;
+
+/* Battery API */
+void battery_init(void);
+void battery_led(battery_led_t val);
+bool battery_charging(void);
+uint16_t battery_voltage(void);
+battery_status_t battery_status(void);
+
+#define BATTERY_VOLTAGE_LOW_LIMIT 3500
+#define BATTERY_VOLTAGE_LOW_RECOVERY 3700
+// ADC offset:16, resolution:5mV
+#define BATTERY_ADC_OFFSET 16
+#define BATTERY_ADC_RESOLUTION 5
+
+#endif
diff --git a/keyboard/hhkb/rn42/main.c b/keyboard/hhkb/rn42/main.c
new file mode 100644
index 0000000000..83d9950388
--- /dev/null
+++ b/keyboard/hhkb/rn42/main.c
@@ -0,0 +1,111 @@
+#include <avr/io.h>
+#include <avr/power.h>
+#include <avr/wdt.h>
+#include "lufa.h"
+#include "print.h"
+#include "sendchar.h"
+#include "rn42.h"
+#include "rn42_task.h"
+#include "serial.h"
+#include "keyboard.h"
+#include "keycode.h"
+#include "action.h"
+#include "action_util.h"
+#include "wait.h"
+#include "suart.h"
+#include "suspend.h"
+
+static int8_t sendchar_func(uint8_t c)
+{
+ xmit(c); // SUART
+ sendchar(c); // LUFA
+ return 0;
+}
+
+static void SetupHardware(void)
+{
+ /* Disable watchdog if enabled by bootloader/fuses */
+ MCUSR &= ~(1 << WDRF);
+ wdt_disable();
+
+ /* Disable clock division */
+ clock_prescale_set(clock_div_1);
+
+ // Leonardo needs. Without this USB device is not recognized.
+ USB_Disable();
+
+ USB_Init();
+
+ // for Console_Task
+ USB_Device_EnableSOFEvents();
+ print_set_sendchar(sendchar_func);
+
+ // SUART PD0:output, PD1:input
+ DDRD |= (1<<0);
+ PORTD |= (1<<0);
+ DDRD &= ~(1<<1);
+ PORTD |= (1<<1);
+}
+
+int main(void) __attribute__ ((weak));
+int main(void)
+{
+ SetupHardware();
+ sei();
+
+ /* wait for USB startup to get ready for debug output */
+ uint8_t timeout = 255; // timeout when USB is not available(Bluetooth)
+ while (timeout-- && USB_DeviceState != DEVICE_STATE_Configured) {
+ wait_ms(4);
+#if defined(INTERRUPT_CONTROL_ENDPOINT)
+ ;
+#else
+ USB_USBTask();
+#endif
+ }
+ print("\nUSB init\n");
+
+ rn42_init();
+ rn42_task_init();
+ print("RN-42 init\n");
+
+ /* init modules */
+ keyboard_init();
+
+ if (!rn42_rts()) {
+ host_set_driver(&rn42_driver);
+ } else {
+ host_set_driver(&lufa_driver);
+ }
+
+#ifdef SLEEP_LED_ENABLE
+ sleep_led_init();
+#endif
+
+ print("Keyboard start\n");
+ while (1) {
+ while (rn42_rts() && // RN42 is off
+ USB_DeviceState == DEVICE_STATE_Suspended) {
+ print("[s]");
+ matrix_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ suspend_power_down();
+ if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
+ USB_Device_SendRemoteWakeup();
+ }
+ }
+
+ keyboard_task();
+
+#if !defined(INTERRUPT_CONTROL_ENDPOINT)
+ USB_USBTask();
+#endif
+
+ rn42_task();
+ }
+}
diff --git a/keyboard/hhkb/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c
new file mode 100644
index 0000000000..756285d7bb
--- /dev/null
+++ b/keyboard/hhkb/rn42/rn42.c
@@ -0,0 +1,237 @@
+#include <avr/io.h>
+#include "host.h"
+#include "host_driver.h"
+#include "serial.h"
+#include "rn42.h"
+#include "print.h"
+#include "timer.h"
+#include "wait.h"
+
+
+/* Host driver */
+static uint8_t keyboard_leds(void);
+static void send_keyboard(report_keyboard_t *report);
+static void send_mouse(report_mouse_t *report);
+static void send_system(uint16_t data);
+static void send_consumer(uint16_t data);
+
+host_driver_t rn42_driver = {
+ keyboard_leds,
+ send_keyboard,
+ send_mouse,
+ send_system,
+ send_consumer
+};
+
+
+void rn42_init(void)
+{
+ // JTAG disable for PORT F. write JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+
+ // PF7: BT connection control(high: connect, low: disconnect)
+ rn42_autoconnect();
+
+ // PF6: linked(input without pull-up)
+ DDRF &= ~(1<<6);
+ PORTF |= (1<<6);
+
+ // PF1: RTS(low: allowed to send, high: not allowed)
+ DDRF &= ~(1<<1);
+ PORTF &= ~(1<<1);
+
+ // PD5: CTS(low: allow to send, high:not allow)
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
+
+ serial_init();
+}
+
+int16_t rn42_getc(void)
+{
+ return serial_recv2();
+}
+
+const char *rn42_gets(uint16_t timeout)
+{
+ static char s[24];
+ uint16_t t = timer_read();
+ uint8_t i = 0;
+ int16_t c;
+ while (i < 23 && timer_elapsed(t) < timeout) {
+ if ((c = rn42_getc()) != -1) {
+ if ((char)c == '\r') continue;
+ if ((char)c == '\n') break;
+ s[i++] = c;
+ }
+ }
+ s[i] = '\0';
+ return s;
+}
+
+void rn42_putc(uint8_t c)
+{
+ serial_send(c);
+}
+
+void rn42_puts(char *s)
+{
+ while (*s)
+ serial_send(*s++);
+}
+
+bool rn42_autoconnecting(void)
+{
+ // GPIO6 for control connection(high: auto connect, low: disconnect)
+ // Note that this needs config: SM,4(Auto-Connect DTR Mode)
+ return (PORTF & (1<<7) ? true : false);
+}
+
+void rn42_autoconnect(void)
+{
+ // hi to auto connect
+ DDRF |= (1<<7);
+ PORTF |= (1<<7);
+}
+
+void rn42_disconnect(void)
+{
+ // low to disconnect
+ DDRF |= (1<<7);
+ PORTF &= ~(1<<7);
+}
+
+bool rn42_rts(void)
+{
+ // low when RN-42 is powered and ready to receive
+ return PINF&(1<<1);
+}
+
+void rn42_cts_hi(void)
+{
+ // not allow to send
+ PORTD |= (1<<5);
+}
+
+void rn42_cts_lo(void)
+{
+ // allow to send
+ PORTD &= ~(1<<5);
+}
+
+bool rn42_linked(void)
+{
+ // RN-42 GPIO2
+ // Hi-Z: Not powered
+ // High: Linked
+ // Low: Connecting
+ return PINF&(1<<6);
+}
+
+
+static uint8_t leds = 0;
+static uint8_t keyboard_leds(void) { return leds; }
+void rn42_set_leds(uint8_t l) { leds = l; }
+
+static void send_keyboard(report_keyboard_t *report)
+{
+ // wake from deep sleep
+/*
+ PORTD |= (1<<5); // high
+ wait_ms(5);
+ PORTD &= ~(1<<5); // low
+*/
+
+ serial_send(0xFD); // Raw report mode
+ serial_send(9); // length
+ serial_send(1); // descriptor type
+ serial_send(report->mods);
+ serial_send(0x00);
+ serial_send(report->keys[0]);
+ serial_send(report->keys[1]);
+ serial_send(report->keys[2]);
+ serial_send(report->keys[3]);
+ serial_send(report->keys[4]);
+ serial_send(report->keys[5]);
+}
+
+static void send_mouse(report_mouse_t *report)
+{
+ // wake from deep sleep
+/*
+ PORTD |= (1<<5); // high
+ wait_ms(5);
+ PORTD &= ~(1<<5); // low
+*/
+
+ serial_send(0xFD); // Raw report mode
+ serial_send(5); // length
+ serial_send(2); // descriptor type
+ serial_send(report->buttons);
+ serial_send(report->x);
+ serial_send(report->y);
+ serial_send(report->v);
+}
+
+static void send_system(uint16_t data)
+{
+ // Table 5-6 of RN-BT-DATA-UB
+ // 81,82,83 scan codes can be used?
+}
+
+
+static uint16_t usage2bits(uint16_t usage)
+{
+ switch (usage) {
+ case AC_HOME: return 0x01;
+ case AL_EMAIL: return 0x02;
+ case AC_SEARCH: return 0x04;
+ //case AL_KBD_LAYOUT: return 0x08; // Apple virtual keybaord toggle
+ case AUDIO_VOL_UP: return 0x10;
+ case AUDIO_VOL_DOWN: return 0x20;
+ case AUDIO_MUTE: return 0x40;
+ case TRANSPORT_PLAY_PAUSE: return 0x80;
+ case TRANSPORT_NEXT_TRACK: return 0x100;
+ case TRANSPORT_PREV_TRACK: return 0x200;
+ case TRANSPORT_STOP: return 0x400;
+ case TRANSPORT_STOP_EJECT: return 0x800;
+ //case return 0x1000; // Fast forward
+ //case return 0x2000; // Rewind
+ //case return 0x4000; // Stop/eject
+ //case return 0x8000; // Internet browser
+ };
+ return 0;
+}
+
+static void send_consumer(uint16_t data)
+{
+ uint16_t bits = usage2bits(data);
+ serial_send(0xFD); // Raw report mode
+ serial_send(3); // length
+ serial_send(3); // descriptor type
+ serial_send(bits&0xFF);
+ serial_send((bits>>8)&0xFF);
+}
+
+
+/* Null driver for config_mode */
+static uint8_t config_keyboard_leds(void);
+static void config_send_keyboard(report_keyboard_t *report);
+static void config_send_mouse(report_mouse_t *report);
+static void config_send_system(uint16_t data);
+static void config_send_consumer(uint16_t data);
+
+host_driver_t rn42_config_driver = {
+ config_keyboard_leds,
+ config_send_keyboard,
+ config_send_mouse,
+ config_send_system,
+ config_send_consumer
+};
+
+static uint8_t config_keyboard_leds(void) { return leds; }
+static void config_send_keyboard(report_keyboard_t *report) {}
+static void config_send_mouse(report_mouse_t *report) {}
+static void config_send_system(uint16_t data) {}
+static void config_send_consumer(uint16_t data) {}
diff --git a/keyboard/hhkb/rn42/rn42.h b/keyboard/hhkb/rn42/rn42.h
new file mode 100644
index 0000000000..db6916fe86
--- /dev/null
+++ b/keyboard/hhkb/rn42/rn42.h
@@ -0,0 +1,23 @@
+#ifndef RN42_H
+#define RN42_H
+
+#include <stdbool.h>
+
+host_driver_t rn42_driver;
+host_driver_t rn42_config_driver;
+
+void rn42_init(void);
+int16_t rn42_getc(void);
+const char *rn42_gets(uint16_t timeout);
+void rn42_putc(uint8_t c);
+void rn42_puts(char *s);
+bool rn42_autoconnecting(void);
+void rn42_autoconnect(void);
+void rn42_disconnect(void);
+bool rn42_rts(void);
+void rn42_cts_hi(void);
+void rn42_cts_lo(void);
+bool rn42_linked(void);
+void rn42_set_leds(uint8_t l);
+
+#endif
diff --git a/keyboard/hhkb/rn42/rn42_task.c b/keyboard/hhkb/rn42/rn42_task.c
new file mode 100644
index 0000000000..5107fef483
--- /dev/null
+++ b/keyboard/hhkb/rn42/rn42_task.c
@@ -0,0 +1,478 @@
+#include <stdint.h>
+#include <string.h>
+#include <avr/pgmspace.h>
+#include <avr/eeprom.h>
+#include "keycode.h"
+#include "serial.h"
+#include "host.h"
+#include "action.h"
+#include "action_util.h"
+#include "lufa.h"
+#include "rn42_task.h"
+#include "print.h"
+#include "debug.h"
+#include "timer.h"
+#include "wait.h"
+#include "command.h"
+#include "battery.h"
+
+static bool config_mode = false;
+static bool force_usb = false;
+
+static void status_led(bool on)
+{
+ if (on) {
+ DDRE |= (1<<6);
+ PORTE &= ~(1<<6);
+ } else {
+ DDRE |= (1<<6);
+ PORTE |= (1<<6);
+ }
+}
+
+void rn42_task_init(void)
+{
+ battery_init();
+}
+
+void rn42_task(void)
+{
+ int16_t c;
+ // Raw mode: interpret output report of LED state
+ while ((c = rn42_getc()) != -1) {
+ // LED Out report: 0xFE, 0x02, 0x01, <leds>
+ // To get the report over UART set bit3 with SH, command.
+ static enum {LED_INIT, LED_FE, LED_02, LED_01} state = LED_INIT;
+ switch (state) {
+ case LED_INIT:
+ if (c == 0xFE) state = LED_FE;
+ else {
+ if (0x0 <= c && c <= 0x7f) xprintf("%c", c);
+ else xprintf(" %02X", c);
+ }
+ break;
+ case LED_FE:
+ if (c == 0x02) state = LED_02;
+ else state = LED_INIT;
+ break;
+ case LED_02:
+ if (c == 0x01) state = LED_01;
+ else state = LED_INIT;
+ break;
+ case LED_01:
+ dprintf("LED status: %02X\n", c);
+ rn42_set_leds(c);
+ state = LED_INIT;
+ break;
+ default:
+ state = LED_INIT;
+ }
+ }
+
+ /* Bluetooth mode when ready */
+ if (!config_mode && !force_usb) {
+ if (!rn42_rts() && host_get_driver() != &rn42_driver) {
+ clear_keyboard();
+ host_set_driver(&rn42_driver);
+ } else if (rn42_rts() && host_get_driver() != &lufa_driver) {
+ clear_keyboard();
+ host_set_driver(&lufa_driver);
+ }
+ }
+
+
+ static uint16_t prev_timer = 0;
+ uint16_t e = timer_elapsed(prev_timer);
+ if (e > 1000) {
+ /* every second */
+ prev_timer += e/1000*1000;
+
+ /* Low voltage alert */
+ uint8_t bs = battery_status();
+ if (bs == LOW_VOLTAGE) {
+ battery_led(LED_ON);
+ } else {
+ battery_led(LED_CHARGER);
+ }
+
+ /* every minute */
+ uint32_t t = timer_read32()/1000;
+ if (t%60 == 0) {
+ uint16_t v = battery_voltage();
+ uint8_t h = t/3600;
+ uint8_t m = t%3600/60;
+ uint8_t s = t%60;
+ dprintf("%02u:%02u:%02u\t%umV\n", h, m, s, v);
+ /* TODO: xprintf doesn't work for this.
+ xprintf("%02u:%02u:%02u\t%umV\n", (t/3600), (t%3600/60), (t%60), v);
+ */
+ }
+ }
+
+
+ /* Connection monitor */
+ if (!rn42_rts() && rn42_linked()) {
+ status_led(true);
+ } else {
+ status_led(false);
+ }
+}
+
+
+
+/******************************************************************************
+ * Command
+ ******************************************************************************/
+static host_driver_t *prev_driver = &rn42_driver;
+
+static void print_rn42(void)
+{
+ int16_t c;
+ while ((c = rn42_getc()) != -1) {
+ xprintf("%c", c);
+ }
+}
+
+static void clear_rn42(void)
+{
+ while (rn42_getc() != -1) ;
+}
+
+#define SEND_STR(str) send_str(PSTR(str))
+#define SEND_COMMAND(cmd) send_command(PSTR(cmd))
+
+static void send_str(const char *str)
+{
+ uint8_t c;
+ while ((c = pgm_read_byte(str++)))
+ rn42_putc(c);
+}
+
+static const char *send_command(const char *cmd)
+{
+ static const char *s;
+ send_str(cmd);
+ wait_ms(500);
+ s = rn42_gets(100);
+ xprintf("%s\r\n", s);
+ print_rn42();
+ return s;
+}
+
+static void enter_command_mode(void)
+{
+ prev_driver = host_get_driver();
+ clear_keyboard();
+ host_set_driver(&rn42_config_driver); // null driver; not to send a key to host
+ rn42_disconnect();
+ while (rn42_linked()) ;
+
+ print("Entering config mode ...\n");
+ wait_ms(1100); // need 1 sec
+ SEND_COMMAND("$$$");
+ wait_ms(600); // need 1 sec
+ print_rn42();
+ const char *s = SEND_COMMAND("v\r\n");
+ if (strncmp("v", s, 1) != 0) SEND_COMMAND("+\r\n"); // local echo on
+}
+
+static void exit_command_mode(void)
+{
+ print("Exiting config mode ...\n");
+ SEND_COMMAND("---\r\n"); // exit
+
+ rn42_autoconnect();
+ clear_keyboard();
+ host_set_driver(prev_driver);
+}
+
+static void init_rn42(void)
+{
+ // RN-42 configure
+ if (!config_mode) enter_command_mode();
+ SEND_COMMAND("SF,1\r\n"); // factory defaults
+ SEND_COMMAND("S-,TmkBT\r\n");
+ SEND_COMMAND("SS,Keyboard/Mouse\r\n");
+ SEND_COMMAND("SM,4\r\n"); // auto connect(DTR)
+ SEND_COMMAND("SW,8000\r\n"); // Sniff disable
+ SEND_COMMAND("S~,6\r\n"); // HID profile
+ SEND_COMMAND("SH,003C\r\n"); // combo device, out-report, 4-reconnect
+ SEND_COMMAND("SY,FFF4\r\n"); // transmit power -12
+ SEND_COMMAND("R,1\r\n");
+ if (!config_mode) exit_command_mode();
+}
+
+#if 0
+// Switching connections
+// NOTE: Remote Address doesn't work in the way manual says.
+// EEPROM address for link store
+#define RN42_LINK0 (uint8_t *)128
+#define RN42_LINK1 (uint8_t *)140
+#define RN42_LINK2 (uint8_t *)152
+#define RN42_LINK3 (uint8_t *)164
+static void store_link(uint8_t *eeaddr)
+{
+ enter_command_mode();
+ SEND_STR("GR\r\n"); // remote address
+ const char *s = rn42_gets(500);
+ if (strcmp("GR", s) == 0) s = rn42_gets(500); // ignore local echo
+ xprintf("%s(%d)\r\n", s, strlen(s));
+ if (strlen(s) == 12) {
+ for (int i = 0; i < 12; i++) {
+ eeprom_write_byte(eeaddr+i, *(s+i));
+ dprintf("%c ", *(s+i));
+ }
+ dprint("\r\n");
+ }
+ exit_command_mode();
+}
+
+static void restore_link(const uint8_t *eeaddr)
+{
+ enter_command_mode();
+ SEND_COMMAND("SR,Z\r\n"); // remove remote address
+ SEND_STR("SR,"); // set remote address from EEPROM
+ for (int i = 0; i < 12; i++) {
+ uint8_t c = eeprom_read_byte(eeaddr+i);
+ rn42_putc(c);
+ dprintf("%c ", c);
+ }
+ dprintf("\r\n");
+ SEND_COMMAND("\r\n");
+ SEND_COMMAND("R,1\r\n"); // reboot
+ exit_command_mode();
+}
+
+static const char *get_link(uint8_t * eeaddr)
+{
+ static char s[13];
+ for (int i = 0; i < 12; i++) {
+ uint8_t c = eeprom_read_byte(eeaddr+i);
+ s[i] = c;
+ }
+ s[12] = '\0';
+ return s;
+}
+#endif
+
+static void pairing(void)
+{
+ enter_command_mode();
+ SEND_COMMAND("SR,Z\r\n"); // remove remote address
+ SEND_COMMAND("R,1\r\n"); // reboot
+ exit_command_mode();
+}
+
+bool command_extra(uint8_t code)
+{
+ uint32_t t;
+ uint16_t b;
+ switch (code) {
+ case KC_H:
+ case KC_SLASH: /* ? */
+ print("\n\n----- Bluetooth RN-42 Help -----\n");
+ print("i: RN-42 info\n");
+ print("b: battery voltage\n");
+ print("Del: enter/exit RN-42 config mode\n");
+ print("Slck: RN-42 initialize\n");
+#if 0
+ print("1-4: restore link\n");
+ print("F1-F4: store link\n");
+#endif
+ print("p: pairing\n");
+
+ if (config_mode) {
+ return true;
+ } else {
+ print("u: toggle Force USB mode\n");
+ return false; // to display default command help
+ }
+ case KC_P:
+ pairing();
+ return true;
+#if 0
+ /* Store link address to EEPROM */
+ case KC_F1:
+ store_link(RN42_LINK0);
+ return true;
+ case KC_F2:
+ store_link(RN42_LINK1);
+ return true;
+ case KC_F3:
+ store_link(RN42_LINK2);
+ return true;
+ case KC_F4:
+ store_link(RN42_LINK3);
+ return true;
+ /* Restore link address to EEPROM */
+ case KC_1:
+ restore_link(RN42_LINK0);
+ return true;
+ case KC_2:
+ restore_link(RN42_LINK1);
+ return true;
+ case KC_3:
+ restore_link(RN42_LINK2);
+ return true;
+ case KC_4:
+ restore_link(RN42_LINK3);
+ return true;
+#endif
+ case KC_I:
+ print("\n----- RN-42 info -----\n");
+ xprintf("protocol: %s\n", (host_get_driver() == &rn42_driver) ? "RN-42" : "LUFA");
+ xprintf("force_usb: %X\n", force_usb);
+ xprintf("rn42: %s\n", rn42_rts() ? "OFF" : (rn42_linked() ? "CONN" : "ON"));
+ xprintf("rn42_autoconnecting(): %X\n", rn42_autoconnecting());
+ xprintf("config_mode: %X\n", config_mode);
+ xprintf("USB State: %s\n",
+ (USB_DeviceState == DEVICE_STATE_Unattached) ? "Unattached" :
+ (USB_DeviceState == DEVICE_STATE_Powered) ? "Powered" :
+ (USB_DeviceState == DEVICE_STATE_Default) ? "Default" :
+ (USB_DeviceState == DEVICE_STATE_Addressed) ? "Addressed" :
+ (USB_DeviceState == DEVICE_STATE_Configured) ? "Configured" :
+ (USB_DeviceState == DEVICE_STATE_Suspended) ? "Suspended" : "?");
+ xprintf("battery: ");
+ switch (battery_status()) {
+ case FULL_CHARGED: xprintf("FULL"); break;
+ case CHARGING: xprintf("CHARG"); break;
+ case DISCHARGING: xprintf("DISCHG"); break;
+ case LOW_VOLTAGE: xprintf("LOW"); break;
+ default: xprintf("?"); break;
+ };
+ xprintf("\n");
+ xprintf("RemoteWakeupEnabled: %X\n", USB_Device_RemoteWakeupEnabled);
+ xprintf("VBUS: %X\n", USBSTA&(1<<VBUS));
+ t = timer_read32()/1000;
+ uint8_t d = t/3600/24;
+ uint8_t h = t/3600;
+ uint8_t m = t%3600/60;
+ uint8_t s = t%60;
+ xprintf("uptime: %02u %02u:%02u:%02u\n", d, h, m, s);
+#if 0
+ xprintf("LINK0: %s\r\n", get_link(RN42_LINK0));
+ xprintf("LINK1: %s\r\n", get_link(RN42_LINK1));
+ xprintf("LINK2: %s\r\n", get_link(RN42_LINK2));
+ xprintf("LINK3: %s\r\n", get_link(RN42_LINK3));
+#endif
+ return true;
+ case KC_B:
+ // battery monitor
+ t = timer_read32()/1000;
+ b = battery_voltage();
+ xprintf("BAT: %umV\t", b);
+ xprintf("%02u:", t/3600);
+ xprintf("%02u:", t%3600/60);
+ xprintf("%02u\n", t%60);
+ return true;
+ case KC_U:
+ if (config_mode) return false;
+ if (force_usb) {
+ print("Auto mode\n");
+ force_usb = false;
+ } else {
+ print("USB mode\n");
+ force_usb = true;
+ clear_keyboard();
+ host_set_driver(&lufa_driver);
+ }
+ return true;
+ case KC_DELETE:
+ /* RN-42 Command mode */
+ if (rn42_autoconnecting()) {
+ enter_command_mode();
+
+ command_state = CONSOLE;
+ config_mode = true;
+ } else {
+ exit_command_mode();
+
+ command_state = ONESHOT;
+ config_mode = false;
+ }
+ return true;
+ case KC_SCROLLLOCK:
+ init_rn42();
+ return true;
+ default:
+ if (config_mode)
+ return true;
+ else
+ return false; // yield to default command
+ }
+ return true;
+}
+
+/*
+ * RN-42 Command mode
+ * sends charactors to the module
+ */
+static uint8_t code2asc(uint8_t code);
+bool command_console_extra(uint8_t code)
+{
+ rn42_putc(code2asc(code));
+ return true;
+}
+
+// convert keycode into ascii charactor
+static uint8_t code2asc(uint8_t code)
+{
+ bool shifted = (get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))) ? true : false;
+ switch (code) {
+ case KC_A: return (shifted ? 'A' : 'a');
+ case KC_B: return (shifted ? 'B' : 'b');
+ case KC_C: return (shifted ? 'C' : 'c');
+ case KC_D: return (shifted ? 'D' : 'd');
+ case KC_E: return (shifted ? 'E' : 'e');
+ case KC_F: return (shifted ? 'F' : 'f');
+ case KC_G: return (shifted ? 'G' : 'g');
+ case KC_H: return (shifted ? 'H' : 'h');
+ case KC_I: return (shifted ? 'I' : 'i');
+ case KC_J: return (shifted ? 'J' : 'j');
+ case KC_K: return (shifted ? 'K' : 'k');
+ case KC_L: return (shifted ? 'L' : 'l');
+ case KC_M: return (shifted ? 'M' : 'm');
+ case KC_N: return (shifted ? 'N' : 'n');
+ case KC_O: return (shifted ? 'O' : 'o');
+ case KC_P: return (shifted ? 'P' : 'p');
+ case KC_Q: return (shifted ? 'Q' : 'q');
+ case KC_R: return (shifted ? 'R' : 'r');
+ case KC_S: return (shifted ? 'S' : 's');
+ case KC_T: return (shifted ? 'T' : 't');
+ case KC_U: return (shifted ? 'U' : 'u');
+ case KC_V: return (shifted ? 'V' : 'v');
+ case KC_W: return (shifted ? 'W' : 'w');
+ case KC_X: return (shifted ? 'X' : 'x');
+ case KC_Y: return (shifted ? 'Y' : 'y');
+ case KC_Z: return (shifted ? 'Z' : 'z');
+ case KC_1: return (shifted ? '!' : '1');
+ case KC_2: return (shifted ? '@' : '2');
+ case KC_3: return (shifted ? '#' : '3');
+ case KC_4: return (shifted ? '$' : '4');
+ case KC_5: return (shifted ? '%' : '5');
+ case KC_6: return (shifted ? '^' : '6');
+ case KC_7: return (shifted ? '&' : '7');
+ case KC_8: return (shifted ? '*' : '8');
+ case KC_9: return (shifted ? '(' : '9');
+ case KC_0: return (shifted ? ')' : '0');
+ case KC_ENTER: return '\n';
+ case KC_ESCAPE: return 0x1B;
+ case KC_BSPACE: return '\b';
+ case KC_TAB: return '\t';
+ case KC_SPACE: return ' ';
+ case KC_MINUS: return (shifted ? '_' : '-');
+ case KC_EQUAL: return (shifted ? '+' : '=');
+ case KC_LBRACKET: return (shifted ? '{' : '[');
+ case KC_RBRACKET: return (shifted ? '}' : ']');
+ case KC_BSLASH: return (shifted ? '|' : '\\');
+ case KC_NONUS_HASH: return (shifted ? '|' : '\\');
+ case KC_SCOLON: return (shifted ? ':' : ';');
+ case KC_QUOTE: return (shifted ? '"' : '\'');
+ case KC_GRAVE: return (shifted ? '~' : '`');
+ case KC_COMMA: return (shifted ? '<' : ',');
+ case KC_DOT: return (shifted ? '>' : '.');
+ case KC_SLASH: return (shifted ? '?' : '/');
+ case KC_DELETE: return '\0'; // Delete to disconnect
+ default: return ' ';
+ }
+}
diff --git a/keyboard/hhkb/rn42/rn42_task.h b/keyboard/hhkb/rn42/rn42_task.h
new file mode 100644
index 0000000000..8f6c3ab64d
--- /dev/null
+++ b/keyboard/hhkb/rn42/rn42_task.h
@@ -0,0 +1,10 @@
+#ifndef RN42_TASK_H
+#define RN42_TASK_H
+
+#include <stdbool.h>
+#include "rn42.h"
+
+void rn42_task_init(void);
+void rn42_task(void);
+
+#endif
diff --git a/keyboard/hhkb/rn42/suart.S b/keyboard/hhkb/rn42/suart.S
new file mode 100644
index 0000000000..9fa5452928
--- /dev/null
+++ b/keyboard/hhkb/rn42/suart.S
@@ -0,0 +1,156 @@
+;---------------------------------------------------------------------------;
+; Software implemented UART module ;
+; (C)ChaN, 2005 (http://elm-chan.org/) ;
+;---------------------------------------------------------------------------;
+; Bit rate settings:
+;
+; 1MHz 2MHz 4MHz 6MHz 8MHz 10MHz 12MHz 16MHz 20MHz
+; 2.4kbps 138 - - - - - - - -
+; 4.8kbps 68 138 - - - - - - -
+; 9.6kbps 33 68 138 208 - - - - -
+; 19.2kbps - 33 68 102 138 173 208 - -
+; 38.4kbps - - 33 50 68 85 102 138 172
+; 57.6kbps - - 21 33 44 56 68 91 114
+; 115.2kbps - - - - 21 27 33 44 56
+
+.nolist
+#include <avr/io.h>
+.list
+
+#define BPS 44 /* Bit delay. (see above table) */
+#define BIDIR 0 /* 0:Separated Tx/Rx, 1:Shared Tx/Rx */
+
+#define OUT_1 sbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 1 */
+#define OUT_0 cbi _SFR_IO_ADDR(SUART_OUT_PORT), SUART_OUT_BIT /* Output 0 */
+#define SKIP_IN_1 sbis _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 1 */
+#define SKIP_IN_0 sbic _SFR_IO_ADDR(SUART_IN_PIN), SUART_IN_BIT /* Skip if 0 */
+
+
+
+#ifdef SPM_PAGESIZE
+.macro _LPMI reg
+ lpm \reg, Z+
+.endm
+.macro _MOVW dh,dl, sh,sl
+ movw \dl, \sl
+.endm
+#else
+.macro _LPMI reg
+ lpm
+ mov \reg, r0
+ adiw ZL, 1
+.endm
+.macro _MOVW dh,dl, sh,sl
+ mov \dl, \sl
+ mov \dh, \sh
+.endm
+#endif
+
+
+
+;---------------------------------------------------------------------------;
+; Transmit a byte in serial format of N81
+;
+;Prototype: void xmit (uint8_t data);
+;Size: 16 words
+
+.global xmit
+.func xmit
+xmit:
+#if BIDIR
+ ldi r23, BPS-1 ;Pre-idle time for bidirectional data line
+5: dec r23 ;
+ brne 5b ;/
+#endif
+ in r0, _SFR_IO_ADDR(SREG) ;Save flags
+
+ com r24 ;C = start bit
+ ldi r25, 10 ;Bit counter
+ cli ;Start critical section
+
+1: ldi r23, BPS-1 ;----- Bit transferring loop
+2: dec r23 ;Wait for a bit time
+ brne 2b ;/
+ brcs 3f ;MISO = bit to be sent
+ OUT_1 ;
+3: brcc 4f ;
+ OUT_0 ;/
+4: lsr r24 ;Get next bit into C
+ dec r25 ;All bits sent?
+ brne 1b ; no, coutinue
+
+ out _SFR_IO_ADDR(SREG), r0 ;End of critical section
+ ret
+.endfunc
+
+
+
+;---------------------------------------------------------------------------;
+; Receive a byte
+;
+;Prototype: uint8_t rcvr (void);
+;Size: 19 words
+
+.global rcvr
+.func rcvr
+rcvr:
+ in r0, _SFR_IO_ADDR(SREG) ;Save flags
+
+ ldi r24, 0x80 ;Receiving shift reg
+ cli ;Start critical section
+
+1: SKIP_IN_1 ;Wait for idle
+ rjmp 1b
+2: SKIP_IN_0 ;Wait for start bit
+ rjmp 2b
+ ldi r25, BPS/2 ;Wait for half bit time
+3: dec r25
+ brne 3b
+
+4: ldi r25, BPS ;----- Bit receiving loop
+5: dec r25 ;Wait for a bit time
+ brne 5b ;/
+ lsr r24 ;Next bit
+ SKIP_IN_0 ;Get a data bit into r24.7
+ ori r24, 0x80
+ brcc 4b ;All bits received? no, continue
+
+ out _SFR_IO_ADDR(SREG), r0 ;End of critical section
+ ret
+.endfunc
+
+
+; Not wait for start bit. This should be called after detecting start bit.
+.global recv
+.func recv
+recv:
+ in r0, _SFR_IO_ADDR(SREG) ;Save flags
+
+ ldi r24, 0x80 ;Receiving shift reg
+ cli ;Start critical section
+
+;1: SKIP_IN_1 ;Wait for idle
+; rjmp 1b
+;2: SKIP_IN_0 ;Wait for start bit
+; rjmp 2b
+ ldi r25, BPS/2 ;Wait for half bit time
+3: dec r25
+ brne 3b
+
+4: ldi r25, BPS ;----- Bit receiving loop
+5: dec r25 ;Wait for a bit time
+ brne 5b ;/
+ lsr r24 ;Next bit
+ SKIP_IN_0 ;Get a data bit into r24.7
+ ori r24, 0x80
+ brcc 4b ;All bits received? no, continue
+
+ ldi r25, BPS/2 ;Wait for half bit time
+6: dec r25
+ brne 6b
+7: SKIP_IN_1 ;Wait for stop bit
+ rjmp 7b
+
+ out _SFR_IO_ADDR(SREG), r0 ;End of critical section
+ ret
+.endfunc
diff --git a/protocol/iwrap/suart.h b/keyboard/hhkb/rn42/suart.h
index 72725b998f..72725b998f 100644
--- a/protocol/iwrap/suart.h
+++ b/keyboard/hhkb/rn42/suart.h
diff --git a/keyboard/hid_liber/Makefile.lufa b/keyboard/hid_liber/Makefile.lufa
new file mode 100644
index 0000000000..5fc4156a9e
--- /dev/null
+++ b/keyboard/hid_liber/Makefile.lufa
@@ -0,0 +1,138 @@
+#----------------------------------------------------------------------------
+# 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 = hid_liber_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+custom: OPT_DEFS += -DLAYOUT_CUSTOM
+custom: all
+
+alaricljs: OPT_DEFS += -DLAYOUT_ALARICLJS
+alaricljs: all
diff --git a/keyboard/hid_liber/Makefile.pjrc b/keyboard/hid_liber/Makefile.pjrc
new file mode 100644
index 0000000000..326bbe86f5
--- /dev/null
+++ b/keyboard/hid_liber/Makefile.pjrc
@@ -0,0 +1,111 @@
+#----------------------------------------------------------------------------
+# 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 = hid_liber_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# 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
+NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+custom: OPT_DEFS += -DLAYOUT_CUSTOM
+custom: all
+
+alaricljs: OPT_DEFS += -DLAYOUT_ALARICLJS
+alaricljs: all
diff --git a/keyboard/hid_liber/README.md b/keyboard/hid_liber/README.md
new file mode 100644
index 0000000000..a5534ce711
--- /dev/null
+++ b/keyboard/hid_liber/README.md
@@ -0,0 +1,17 @@
+hid_liberation firmware
+======================
+DIY daughterboard for Filco Majestouch TKL developed by Geekhack and Deskthority communities.
+The PCB was engineered by bpiphany.
+
+## Wiki on Deskthority.net
+- [Instructions](http://deskthority.net/wiki/HID_Liberation_Device_-_Instructions)
+- [Assembly Instructions](http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions)
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.[pjrc|lufa] [ansi|iso|custom|alaricljs]
+
+Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack.
diff --git a/keyboard/hid_liber/config.h b/keyboard/hid_liber/config.h
new file mode 100644
index 0000000000..968ccf5500
--- /dev/null
+++ b/keyboard/hid_liber/config.h
@@ -0,0 +1,49 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xB919
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT HID Liberation
+
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for HID Liberation
+
+
+/* matrix size */
+#define MATRIX_ROWS 18
+#define MATRIX_COLS 8
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 8
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/hid_liber/keymap.c b/keyboard/hid_liber/keymap.c
new file mode 100644
index 0000000000..433a620975
--- /dev/null
+++ b/keyboard/hid_liber/keymap.c
@@ -0,0 +1,125 @@
+/*
+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/>.
+*/
+
+/*
+ * Keymap for HID Liberator controller
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ KG1, KH7, KJ7, KJ6, KJ1, KO5, KL1, KA6, KA7, KD7, KD5, KD1, KD2, KB5, KB3, KO3, \
+ KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \
+ KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \
+ KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \
+ KF6, KH1, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \
+ KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \
+) { \
+/* 0 1 2 3 4 5 6 7 */ \
+/* A */ { KC_##KA0, KC_NO , KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7 }, \
+/* B */ { KC_NO , KC_##KB1, KC_##KB2, KC_##KB3, KC_NO , KC_##KB5, KC_NO , KC_NO }, \
+/* C */ { KC_NO , KC_##KC1, KC_##KC2, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7 }, \
+/* D */ { KC_##KD0, KC_##KD1, KC_##KD2, KC_NO , KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \
+/* E */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KE6, KC_NO }, \
+/* F */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KF4, KC_NO , KC_##KF6, KC_NO }, \
+/* G */ { KC_##KG0, KC_##KG1, KC_NO , KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
+/* H */ { KC_##KH0, KC_##KH1, KC_NO , KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
+/* I */ { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
+/* J */ { KC_##KJ0, KC_##KJ1, KC_NO , KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
+/* K */ { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \
+/* L */ { KC_##KL0, KC_##KL1, KC_NO , KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7 }, \
+/* M */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KM5, KC_NO , KC_##KM7 }, \
+/* N */ { KC_NO , KC_##KN1, KC_##KN2, KC_NO , KC_NO , KC_##KN5, KC_NO , KC_##KN7 }, \
+/* O */ { KC_##KO0, KC_NO , KC_NO , KC_##KO3, KC_NO , KC_##KO5, KC_NO , KC_##KO7 }, \
+/* P */ { KC_NO , KC_##KP1, KC_##KP2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KP7 }, \
+/* Q */ { KC_NO , KC_NO , KC_##KQ2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KQ7 }, \
+/* R */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KR4, KC_NO , KC_NO , KC_NO } \
+}
+
+/*
+ * Tenkeyless keyboard default layout, ISO & ANSI (ISO is between Left Shift
+ * and Z, and the ANSI \ key above Return/Enter is used for the additional ISO
+ * switch in the ASD row next to enter. Use NUBS as keycode for the first and
+ * NUHS as the keycode for the second.
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|ISO| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+/*
+ * Add different layouts. If no layout is defined the default layout will be set to ANSI.
+*/
+#if defined(LAYOUT_CUSTOM)
+ #include "keymap_custom.h"
+#elif defined(LAYOUT_ALARICLJS)
+ #include "keymap_alaricljs.h"
+#elif defined(LAYOUT_ISO)
+ #include "keymap_iso.h"
+#elif defined(LAYOUT_ANSI)
+ #include "keymap_ansi.h"
+#else
+ #include "keymap_ansi.h"
+#endif
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/hid_liber/keymap_alaricljs.h b/keyboard/hid_liber/keymap_alaricljs.h
new file mode 100644
index 0000000000..8903fc683b
--- /dev/null
+++ b/keyboard/hid_liber/keymap_alaricljs.h
@@ -0,0 +1,61 @@
+// hid_liber alaricljs
+// this was the standard layout when hid_liber was merged into tmk's firmware
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Layer 0: Default ANSI
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \
+ FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
+ LSFT, NUBS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
+ LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
+
+/* Layer 1:
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Slp|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9|Mut|V- |V+ |Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I|MSt|Ply|Prv|Nxt|Media| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X|Clc| V| B| N| M| ,| .| /|Caps | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, SLEP, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9,MUTE, VOLD, VOLU, BSPC, INS, HOME, PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I,MSTP,MPLY, MPRV, MNXT, MSEL, DEL, END, PGDN, \
+ FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
+ LSFT, NUBS, Z, X,CALC, V, B, N, M, COMM, DOT, SLSH, CAPS, UP, \
+ LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
+
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_MOMENTARY(1), // activate layer 1 when FN1 pressed
+};
diff --git a/keyboard/hid_liber/keymap_ansi.h b/keyboard/hid_liber/keymap_ansi.h
new file mode 100644
index 0000000000..8ce85a4997
--- /dev/null
+++ b/keyboard/hid_liber/keymap_ansi.h
@@ -0,0 +1,32 @@
+// hid_liber ANSI
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Layer 0: Default ANSI
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \
+ CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
+ LSFT, NUBS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
+ LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
+
+};
+
+static const uint16_t PROGMEM fn_actions[] = {};
diff --git a/keyboard/hid_liber/keymap_custom.h b/keyboard/hid_liber/keymap_custom.h
new file mode 100644
index 0000000000..03e1a1bfaf
--- /dev/null
+++ b/keyboard/hid_liber/keymap_custom.h
@@ -0,0 +1,64 @@
+// hid_liber custom
+// ANSI layout with FN key instead of APP button
+// Layer 1 has mediakeys on the nav cluster and keypad numbers for alt-codes
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Layer 0: Default ANSI
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|FN1|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \
+ CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
+ LSFT, NUBS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
+ LCTL, LGUI, LALT, SPC, RALT, RGUI, FN1, RCTL, LEFT, DOWN, RGHT),
+
+/*
+ * Layer 1: Media Keys
+ * Keypad numbers instead of normal numbers
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ |KP1|KP2|KP3|KP4|KP5|KP6|KP7|KP8|KP9|KP0| -| =|Backsp | |Ins|Med|Vl+|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|Mut|Vl-|
+ * |-----------------------------------------------------------| `-----------'
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X| C| V| B| N| M| ,| .| /|Shift | |Ply|
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|FN1|Ctl| |Prv|Stp|Nxt|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS, P1, P2, P3, P4, P5, P6, P7, P8, P9, P0, TRNS, TRNS, TRNS, TRNS, MSEL, VOLU, \
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MUTE, VOLD, \
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MPLY, \
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN1, TRNS, MPRV, MSTP, MNXT),
+
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_MOMENTARY(1), // activate layer 1 when FN1 pressed
+};
diff --git a/keyboard/hid_liber/keymap_iso.h b/keyboard/hid_liber/keymap_iso.h
new file mode 100644
index 0000000000..c18453675b
--- /dev/null
+++ b/keyboard/hid_liber/keymap_iso.h
@@ -0,0 +1,32 @@
+// hid_liber ISO
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Layer 0: Default ISO
+ *
+ * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ * `---' `---------------' `---------------' `---------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ * |-----------------------------------------------------------| `-----------'
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ * |-----------------------------------------------------------| ,---.
+ * |Shft|iso| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ * |-----------------------------------------------------------| ,-----------.
+ * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, NUHS, DEL, END, PGDN, \
+ CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
+ LSFT, NUBS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
+ LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
+
+};
+
+static const uint16_t PROGMEM fn_actions[] = {};
diff --git a/keyboard/hid_liber/led.c b/keyboard/hid_liber/led.c
new file mode 100644
index 0000000000..e577424c59
--- /dev/null
+++ b/keyboard/hid_liber/led.c
@@ -0,0 +1,34 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ PORTB &= ~(1<<5);
+ else
+ PORTB |= (1<<5);
+
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ PORTB &= ~(1<<6);
+ else
+ PORTB |= (1<<6);
+}
diff --git a/keyboard/hid_liber/matrix.c b/keyboard/hid_liber/matrix.c
new file mode 100644
index 0000000000..adf6ac8c42
--- /dev/null
+++ b/keyboard/hid_liber/matrix.c
@@ -0,0 +1,231 @@
+/* Copyright 2012 Jun Wako <wakojun@gmail.com>
+ *
+ * This is heavily based on hid_liber/board.{c|h}.
+ * https://github.com/BathroomEpiphanies/AVR-Keyboard
+ *
+ * Copyright (c) 2012 Fredrik Atmer, Bathroom Epiphanies Inc
+ * http://bathroomepiphanies.com
+ *
+ * As for liscensing consult with the original files or its author.
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+// bit array of key state(1:on, 0:off)
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+
+#define _DDRA (uint8_t *const)&DDRA
+#define _DDRB (uint8_t *const)&DDRB
+#define _DDRC (uint8_t *const)&DDRC
+#define _DDRD (uint8_t *const)&DDRD
+#define _DDRE (uint8_t *const)&DDRE
+#define _DDRF (uint8_t *const)&DDRF
+
+#define _PINA (uint8_t *const)&PINA
+#define _PINB (uint8_t *const)&PINB
+#define _PINC (uint8_t *const)&PINC
+#define _PIND (uint8_t *const)&PIND
+#define _PINE (uint8_t *const)&PINE
+#define _PINF (uint8_t *const)&PINF
+
+#define _PORTA (uint8_t *const)&PORTA
+#define _PORTB (uint8_t *const)&PORTB
+#define _PORTC (uint8_t *const)&PORTC
+#define _PORTD (uint8_t *const)&PORTD
+#define _PORTE (uint8_t *const)&PORTE
+#define _PORTF (uint8_t *const)&PORTF
+
+#define _BIT0 0x01
+#define _BIT1 0x02
+#define _BIT2 0x04
+#define _BIT3 0x08
+#define _BIT4 0x10
+#define _BIT5 0x20
+#define _BIT6 0x40
+#define _BIT7 0x80
+
+/* Specifies the ports and pin numbers for the rows */
+static
+uint8_t *const row_ddr[MATRIX_ROWS] = {
+ _DDRB, _DDRB,
+ _DDRC, _DDRC,
+ _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD,
+ _DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF};
+
+static
+uint8_t *const row_port[MATRIX_ROWS] = {
+ _PORTB, _PORTB,
+ _PORTC, _PORTC,
+ _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD,
+ _PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF};
+
+static
+uint8_t *const row_pin[MATRIX_ROWS] = {
+ _PINB, _PINB,
+ _PINC, _PINC,
+ _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND,
+ _PINF, _PINF, _PINF, _PINF, _PINF, _PINF};
+
+static
+const uint8_t row_bit[MATRIX_ROWS] = {
+ _BIT4, _BIT7,
+ _BIT6, _BIT7,
+ _BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7,
+ _BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7};
+
+static
+const uint8_t mask = 0x0E;
+
+/* Specifies the ports and pin numbers for the columns */
+static
+const uint8_t col_bit[MATRIX_COLS] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E};
+
+static
+inline void pull_column(int col) {
+ PORTB = col_bit[col] | (PORTB & ~mask);
+}
+
+static
+inline void release_column(int col) {
+}
+
+/* PORTB is set as input with pull-up resistors
+ PORTC,D,E,F are set to high output */
+static
+void setup_io_pins(void) {
+ uint8_t row;
+ DDRB |= 0x0E;
+ PORTB &= ~0x0E;
+ for(row = 0; row < MATRIX_ROWS; row++) {
+ *row_ddr[row] &= ~row_bit[row];
+ *row_port[row] &= ~row_bit[row];
+ }
+}
+
+static
+void setup_leds(void) {
+ DDRB |= 0x60;
+ PORTB |= 0x60;
+}
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+
+ // initialize row and col
+ setup_io_pins();
+ setup_leds();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7
+ pull_column(col); // output hi on theline
+ _delay_us(5); // without this wait it won't read stable value.
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17
+ bool prev_bit = matrix_debouncing[row] & (1<<col);
+ bool curr_bit = *row_pin[row] & row_bit[row];
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprintf("bounce!: %02X\n", debouncing);
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ release_column(col);
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ // NOTE: no longer used
+ return true;
+}
+
+inline
+bool matrix_has_ghost(void)
+{
+ return false;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ for (uint8_t j = 0; j < MATRIX_COLS; j++) {
+ if (matrix_is_on(i, j))
+ count++;
+ }
+ }
+ return count;
+}
diff --git a/keyboard/infinity/Makefile b/keyboard/infinity/Makefile
new file mode 100644
index 0000000000..aa3e9bff1a
--- /dev/null
+++ b/keyboard/infinity/Makefile
@@ -0,0 +1,42 @@
+PROJECT = infinity
+
+TMK_DIR = ../../tmk_core
+MBED_DIR = $(TMK_DIR)/mbed-sdk
+
+#VPATH += $(MBED_DIR):$(TMK_DIR)
+vpath %.s .:$(MBED_DIR):$(TMK_DIR)
+vpath %.c .:$(MBED_DIR):$(TMK_DIR)
+vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
+
+OBJDIR = ./build
+
+OBJECTS = \
+ $(OBJDIR)/matrix.o \
+ $(OBJDIR)/keymap_common.o \
+ $(OBJDIR)/led.o \
+ $(OBJDIR)/main.o
+
+ifdef KEYMAP
+ OBJECTS := $(OBJDIR)/keymap_$(KEYMAP).o $(OBJECTS)
+else
+ OBJECTS := $(OBJDIR)/keymap.o $(OBJECTS)
+endif
+
+CONFIG_H = config.h
+
+INCLUDE_PATHS = -I.
+
+
+# Build Options
+# Comment out to disable
+#BOOTMAGIC_ENABLE = yes
+#MOUSEKEY_ENABLE = yes
+
+
+include mbed-infinity.mk
+include $(TMK_DIR)/tool/mbed/mbed.mk
+include $(TMK_DIR)/tool/mbed/common.mk
+include $(TMK_DIR)/tool/mbed/gcc.mk
+
+program: $(OBJDIR)/$(PROJECT).bin
+ dfu-util -D $(OBJDIR)/$(PROJECT).bin
diff --git a/keyboard/infinity/README b/keyboard/infinity/README
new file mode 100644
index 0000000000..53d1c91737
--- /dev/null
+++ b/keyboard/infinity/README
@@ -0,0 +1,81 @@
+Infinity
+========
+Massdrop Infinity Keyboard:
+https://www.massdrop.com/buy/infinity-keyboard-kit
+
+kiibohd controller(MD1):
+https://github.com/kiibohd/controller
+
+DFU bootloader:
+https://github.com/kiibohd/controller/tree/master/Bootloader
+
+Program with bootloader:
+ $ dfu-util -D kiibohd.dfu.bin
+
+Pinout:
+https://github.com/kiibohd/controller/blob/master/Scan/MD1/pinout
+
+MCHCK compatible:
+https://mchck.org/about/
+
+MCU Freescale MK20DX128VLF5 48-QFP:
+http://cache.freescale.com/files/32bit/doc/data_sheet/K20P48M50SF0.pdf
+
+
+
+Pin Usage
+=========
+Key Matrix:
+ Strobe(output high): PTB0 PTB1 PTB2 PTB3 PTB16 PTB17 PTC4 PTC5 PTD0
+ Sense(input with pull-down): PTD1 PTD2 PTD3 PTD4 PTD5 PTD6 PTD7
+
+
+SWD pinout:
+ SWD_CLK(PTA0) SWD_DIO(PTA3)
+ SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, VCC from top.
+ Note that RESET is also needed to get full control with OpenOCD.
+
+LED:
+ PTA19(turns on with output high)
+
+
+
+Memory map
+==========
+kiibohd bootloader: Lib/mk20dx128vlf5.bootloader.ld
+0x0000_0000 +-------------------+ -----------------+---------------+ Vector table
+ | .vectors | ------------. | StackPointer0 | of Bootloader
+ | .startup | \ | ResetHandler1 |
+ | .rodata | `--+---------------+ 0xF8
+0x0000_0400 | .flashconfig(0x10)|
+ _0410 | .text |
+ | .init |
+0x0000_1000 +-------------------+ -----------------+---------------+ Vector table
+ | _app_rom | ------------. | | of App
+ | | \ | |
+ | | `--+---------------+
+ | |
+ ~ ~
+ | |
+0x07FF_FFFF +-------------------+ 128KB
+
+
+0x1FFF_E000 +-------------------+ -----------------+---------------+ Vector table
+ _E0F8 | | ------------. | | of App(copied)
+ | | \ | |
+ | | `--+---------------+ mbed NVIC
+ | |
+ | RAM |
+ | 8KB|
+0x2000_0000 +-------------------+
+ | |
+ | |
+ | |
+ | |
+ | RAM |
+ | 8KB|
+0x2000_2000 +-------------------+ _estack
+
+
+
+
diff --git a/keyboard/infinity/config.h b/keyboard/infinity/config.h
new file mode 100644
index 0000000000..dc734dbdbe
--- /dev/null
+++ b/keyboard/infinity/config.h
@@ -0,0 +1,43 @@
+/*
+Copyright 2014 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
+
+#if 0
+// duplicated name against mbed USBDeivce
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x3BED
+#endif
+#define DEVICE_VER 0x0001
+#define MANUFACTURER tmk.
+#define PRODUCT Infinitiy
+#define DESCRIPTION Massdrop Infinity keyboard firmware by tmk
+
+
+/* matrix size */
+#define MATRIX_ROWS 9 // Strobe
+#define MATRIX_COLS 7 // Sense
+
+/* key combination for command */
+#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
+
+
+/* for prototype */
+//#define INFINITY_PROTOTYPE
+
+#endif
diff --git a/keyboard/infinity/keymap.c b/keyboard/infinity/keymap.c
new file mode 100644
index 0000000000..4726cee653
--- /dev/null
+++ b/keyboard/infinity/keymap.c
@@ -0,0 +1,48 @@
+#include "keymap_common.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| `|BSp|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
+ * |-----------------------------------------------------------'
+ * | |Gui|Alt | Space |Alt |Gui| | |
+ * `-----------------------------------------------------------'
+ */
+ [0] =
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
+ NO, LGUI,LALT, SPC, RALT,RGUI,NO, NO),
+
+ /* 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 | |Backs|
+ * |-----------------------------------------------------------|
+ * | |VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * | | | | | | | +| -|End|PgD|Dow| | |
+ * `-----------------------------------------------------------'
+ * | |Gui|Alt | Space |Alt |Gui| | |
+ * `-----------------------------------------------------------'
+ */
+ [1] =
+ KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \
+ TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+};
+
diff --git a/keyboard/infinity/keymap_common.c b/keyboard/infinity/keymap_common.c
new file mode 100644
index 0000000000..fdb1769e1c
--- /dev/null
+++ b/keyboard/infinity/keymap_common.c
@@ -0,0 +1,30 @@
+/*
+Copyright 2012,2013 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/>.
+*/
+#include "keymap_common.h"
+
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/keyboard/infinity/keymap_common.h b/keyboard/infinity/keymap_common.h
new file mode 100644
index 0000000000..b0f765bfeb
--- /dev/null
+++ b/keyboard/infinity/keymap_common.h
@@ -0,0 +1,80 @@
+/*
+Copyright 2014 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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+
+#ifdef INFINITY_PROTOTYPE
+
+/* Infinity prototype */
+#define KEYMAP( \
+ K00, K10, K20, K30, K40, K50, K60, K70, K80, K01, K11, K21, K31, K41, K86, \
+ K51, K61, K71, K81, K02, K12, K22, K32, K42, K52, K62, K72, K82, K03, \
+ K13, K23, K33, K43, K53, K63, K73, K83, K04, K14, K24, K34, K44, \
+ K54, K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, \
+ K06, K16, K26, K36, K46, K56, K66, K76 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
+ { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
+}
+
+#else
+
+/* Infinity production */
+#define KEYMAP( \
+ K00, K10, K20, K30, K40, K50, K60, K70, K80, K01, K11, K21, K31, K41, K51, \
+ K61, K71, K81, K02, K12, K22, K32, K42, K52, K62, K72, K82, K03, K13, \
+ K23, K33, K43, K53, K63, K73, K83, K04, K14, K24, K34, K44, K54, \
+ K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, K06, \
+ K16, K26, K36, K46, K56, K66, K76, K86 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
+ { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
+}
+
+#endif
+
+#endif
diff --git a/keyboard/infinity/led.c b/keyboard/infinity/led.c
new file mode 100644
index 0000000000..b7e638b254
--- /dev/null
+++ b/keyboard/infinity/led.c
@@ -0,0 +1,25 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+/* HHKB has no LEDs */
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/keyboard/infinity/main.cpp b/keyboard/infinity/main.cpp
new file mode 100644
index 0000000000..847668a1de
--- /dev/null
+++ b/keyboard/infinity/main.cpp
@@ -0,0 +1,44 @@
+#include "MK20D5.h"
+#include "wait.h"
+#include "gpio_api.h"
+#include "PinNames.h"
+#include "matrix.h"
+#include "timer.h"
+
+#include "action.h"
+#include "keycode.h"
+#include "host.h"
+#include "host_driver.h"
+#include "mbed_driver.h"
+
+
+int main() {
+ gpio_t led;
+ gpio_init_out(&led, PTA19);
+
+ uint16_t t = 0;
+
+ host_set_driver(&mbed_driver);
+ keyboard_init();
+
+ while(1) {
+ keyboard_task();
+
+ bool matrix_on = false;
+ matrix_scan();
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_get_row(i)) {
+ matrix_on = true;
+ break;
+ }
+ }
+ if (matrix_on)
+ gpio_write(&led, 1);
+ else {
+ if (timer_elapsed(t) > 500) {
+ gpio_write(&led, !gpio_read(&led));
+ t = timer_read();
+ }
+ }
+ }
+}
diff --git a/keyboard/infinity/matrix.c b/keyboard/infinity/matrix.c
new file mode 100644
index 0000000000..478a40fd9e
--- /dev/null
+++ b/keyboard/infinity/matrix.c
@@ -0,0 +1,107 @@
+#include <stdint.h>
+#include <stdbool.h>
+#include "gpio_api.h"
+#include "timer.h"
+#include "wait.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+#define DEBOUNCE 5
+#endif
+
+/*
+ * Infinity Pinusage:
+ * Column pins are input with internal pull-down. Row pins are output and strobe with high.
+ * Key is high or 1 when it turns on.
+ *
+ * col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 }
+ * row: { PTB0, PTB1, PTB2, PTB3, PTB16, PTB17, PTC4, PTC5, PTD0 }
+ */
+static gpio_t col[MATRIX_COLS];
+static gpio_t row[MATRIX_ROWS];
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+static bool debouncing = false;
+static uint16_t debouncing_time = 0;
+
+
+void matrix_init(void)
+{
+ /* Column(sense) */
+ gpio_init_in_ex(&col[0], PTD1, PullDown);
+ gpio_init_in_ex(&col[1], PTD2, PullDown);
+ gpio_init_in_ex(&col[2], PTD3, PullDown);
+ gpio_init_in_ex(&col[3], PTD4, PullDown);
+ gpio_init_in_ex(&col[4], PTD5, PullDown);
+ gpio_init_in_ex(&col[5], PTD6, PullDown);
+ gpio_init_in_ex(&col[6], PTD7, PullDown);
+
+ /* Row(strobe) */
+ gpio_init_out_ex(&row[0], PTB0, 0);
+ gpio_init_out_ex(&row[1], PTB1, 0);
+ gpio_init_out_ex(&row[2], PTB2, 0);
+ gpio_init_out_ex(&row[3], PTB3, 0);
+ gpio_init_out_ex(&row[4], PTB16, 0);
+ gpio_init_out_ex(&row[5], PTB17, 0);
+ gpio_init_out_ex(&row[6], PTC4, 0);
+ gpio_init_out_ex(&row[7], PTC5, 0);
+ gpio_init_out_ex(&row[8], PTD0, 0);
+}
+
+uint8_t matrix_scan(void)
+{
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ matrix_row_t r = 0;
+
+ gpio_write(&row[i], 1);
+ wait_us(1); // need wait to settle pin state
+ for (int j = 0; j < MATRIX_COLS; j++) {
+ if (gpio_read(&col[j])) {
+ r |= (1<<j);
+ }
+ }
+ gpio_write(&row[i], 0);
+
+ if (matrix_debouncing[i] != r) {
+ matrix_debouncing[i] = r;
+ debouncing = true;
+ debouncing_time = timer_read();
+ }
+ }
+
+ if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ debouncing = false;
+ }
+/*
+ if (debouncing) {
+ if (--debouncing) {
+ return 0;
+ } else {
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+*/
+ return 1;
+}
+
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & (1<<col));
+}
+
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+}
diff --git a/keyboard/infinity/mbed-infinity.mk b/keyboard/infinity/mbed-infinity.mk
new file mode 100644
index 0000000000..d4603010e0
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity.mk
@@ -0,0 +1,47 @@
+# based on Makefile exported form mbed.org
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+CPU = -mcpu=cortex-m4 -mthumb
+
+CC_SYMBOLS += \
+ -DTARGET_INFINITY \
+ -DTARGET_K20D50M \
+ -DTARGET_M4 \
+ -DTARGET_CORTEX_M \
+ -DTARGET_Freescale \
+ -DTOOLCHAIN_GCC_ARM \
+ -DTOOLCHAIN_GCC \
+ -D__CORTEX_M4 \
+ -DARM_MATH_CM4 \
+ -D__MBED__=1
+
+OBJECTS += \
+ $(OBJDIR)/mbed-infinity/cmsis_nvic.o \
+ $(OBJDIR)/mbed-infinity/system_MK20D5.o \
+ $(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \
+ $(OBJDIR)/mbed-infinity/startup_MK20D5.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \
+ $(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o
+
+INCLUDE_PATHS += \
+ -Imbed \
+ -I$(MBED_DIR)/libraries/mbed/targets \
+ -I$(MBED_DIR)/libraries/mbed/targets/cmsis \
+ -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \
+ -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \
+ -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \
+ -I$(MBED_DIR)/libraries/mbed/targets/hal \
+ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \
+ -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M
+
+LINKER_SCRIPT = mbed-infinity/infinity.ld
diff --git a/keyboard/infinity/mbed-infinity/README b/keyboard/infinity/mbed-infinity/README
new file mode 100644
index 0000000000..43051c9003
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/README
@@ -0,0 +1,83 @@
+mbed fix for Infinity
+=====================
+Without linker script patch it doesn't place vector table in final binary.
+And clock is configured to 48MHz using internal clock reference and FLL multiplication.
+
+
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
+ Fix SystemInit: clock setup for internal clock. Inifinity has no external Xtal.
+
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/cmsis_nvic.c
+ Fix NVIC vector address of firmware 0x1000 instead of 0x0
+
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/MK20D5.ld
+ Fix memory map for Infinity bootloader
+ Flash starts at 0x1000
+ No flash config bytes sector
+
+USBDevice/USBDevice/USBHAL_KL25Z.cpp
+ Fix USB clock setup, see below.
+
+
+2015/01/04 Based on mbed-sdk @2f63fa7d78a26.
+
+
+
+Kinetis USB config
+==================
+Clock source: Internal reference clock wth FLL
+ SIM_SOPT[USBSRC] = 1(MCGPLLCLK/MCGFLLCLK)
+ SIM_SOPT[PLLSEL] = 0(MCGFLLCLK)
+
+Clock dividor:
+ SIM_CLKDIV2[USBDIV] = 0
+ SIM_CLKDIV2[USBFAC] = 0
+
+Clock enable:
+ SIM_SCGC4[USBOTG] = 1
+
+
+
+Infinity bootloader change
+==========================
+After @2c7542e(2015/01) Infinity bootloader doesn't disable watchdog timer and keyboard firmware has to do it itself. mbed disables watchdog in startup sequence but unfortunately timer is timed out bofore that.
+
+We have to do that in earlier phase of mbed startup sequence.
+
+
+mbed starup sequence files:
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_M20D5.s
+mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/system_MK20D5.c
+
+Infinity booloader change commit:
+https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483
+
+discussion:
+https://geekhack.org/index.php?topic=41989.msg1686616#msg1686616
+
+
+WORKAROUND
+----------
+Call SystemInit early in Reset_Handler.
+
+$ diff -u ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s mbed-infinity
+--- ../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM/startup_MK20D5.s 2015-03-22 10:33:22.779866000 +0900
++++ mbed-infinity/startup_MK20D5.s 2015-03-22 10:32:56.483866000 +0900
+@@ -147,6 +147,8 @@
+ * __etext: End of code section, i.e., begin of data sections to copy from.
+ * __data_start__/__data_end__: RAM address range that data should be
+ * copied to. Both must be aligned to 4 bytes boundary. */
++ ldr r0, =SystemInit
++ blx r0
+
+ ldr r1, =__etext
+ ldr r2, =__data_start__
+@@ -161,8 +163,6 @@
+
+ .Lflash_to_ram_loop_end:
+
+- ldr r0, =SystemInit
+- blx r0
+ ldr r0, =_start
+ bx r0
+ .pool
diff --git a/keyboard/infinity/mbed-infinity/USBHAL_KL25Z.cpp b/keyboard/infinity/mbed-infinity/USBHAL_KL25Z.cpp
new file mode 100644
index 0000000000..90f02fa322
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/USBHAL_KL25Z.cpp
@@ -0,0 +1,557 @@
+/* Copyright (c) 2010-2011 mbed.org, MIT License
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+* and associated documentation files (the "Software"), to deal in the Software without
+* restriction, including without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all copies or
+* substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#if defined(TARGET_KL25Z) | defined(TARGET_KL43Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D50M) | defined(TARGET_K64F) | defined(TARGET_K22F)
+
+#include "USBHAL.h"
+
+USBHAL * USBHAL::instance;
+
+static volatile int epComplete = 0;
+
+// Convert physical endpoint number to register bit
+#define EP(endpoint) (1<<(endpoint))
+
+// Convert physical to logical
+#define PHY_TO_LOG(endpoint) ((endpoint)>>1)
+
+// Get endpoint direction
+#define IN_EP(endpoint) ((endpoint) & 1U ? true : false)
+#define OUT_EP(endpoint) ((endpoint) & 1U ? false : true)
+
+#define BD_OWN_MASK (1<<7)
+#define BD_DATA01_MASK (1<<6)
+#define BD_KEEP_MASK (1<<5)
+#define BD_NINC_MASK (1<<4)
+#define BD_DTS_MASK (1<<3)
+#define BD_STALL_MASK (1<<2)
+
+#define TX 1
+#define RX 0
+#define ODD 0
+#define EVEN 1
+// this macro waits a physical endpoint number
+#define EP_BDT_IDX(ep, dir, odd) (((ep * 4) + (2 * dir) + (1 * odd)))
+
+#define SETUP_TOKEN 0x0D
+#define IN_TOKEN 0x09
+#define OUT_TOKEN 0x01
+#define TOK_PID(idx) ((bdt[idx].info >> 2) & 0x0F)
+
+// for each endpt: 8 bytes
+typedef struct BDT {
+ uint8_t info; // BD[0:7]
+ uint8_t dummy; // RSVD: BD[8:15]
+ uint16_t byte_count; // BD[16:32]
+ uint32_t address; // Addr
+} BDT;
+
+
+// there are:
+// * 16 bidirectionnal endpt -> 32 physical endpt
+// * as there are ODD and EVEN buffer -> 32*2 bdt
+__attribute__((__aligned__(512))) BDT bdt[NUMBER_OF_PHYSICAL_ENDPOINTS * 2];
+uint8_t * endpoint_buffer[(NUMBER_OF_PHYSICAL_ENDPOINTS - 2) * 2];
+uint8_t * endpoint_buffer_iso[2*2];
+
+static uint8_t set_addr = 0;
+static uint8_t addr = 0;
+
+static uint32_t Data1 = 0x55555555;
+
+static uint32_t frameNumber() {
+ return((USB0->FRMNUML | (USB0->FRMNUMH << 8)) & 0x07FF);
+}
+
+uint32_t USBHAL::endpointReadcore(uint8_t endpoint, uint8_t *buffer) {
+ return 0;
+}
+
+USBHAL::USBHAL(void) {
+ // Disable IRQ
+ NVIC_DisableIRQ(USB0_IRQn);
+
+#if defined(TARGET_K64F)
+ MPU->CESR=0;
+#endif
+ // fill in callback array
+ epCallback[0] = &USBHAL::EP1_OUT_callback;
+ epCallback[1] = &USBHAL::EP1_IN_callback;
+ epCallback[2] = &USBHAL::EP2_OUT_callback;
+ epCallback[3] = &USBHAL::EP2_IN_callback;
+ epCallback[4] = &USBHAL::EP3_OUT_callback;
+ epCallback[5] = &USBHAL::EP3_IN_callback;
+ epCallback[6] = &USBHAL::EP4_OUT_callback;
+ epCallback[7] = &USBHAL::EP4_IN_callback;
+ epCallback[8] = &USBHAL::EP5_OUT_callback;
+ epCallback[9] = &USBHAL::EP5_IN_callback;
+ epCallback[10] = &USBHAL::EP6_OUT_callback;
+ epCallback[11] = &USBHAL::EP6_IN_callback;
+ epCallback[12] = &USBHAL::EP7_OUT_callback;
+ epCallback[13] = &USBHAL::EP7_IN_callback;
+ epCallback[14] = &USBHAL::EP8_OUT_callback;
+ epCallback[15] = &USBHAL::EP8_IN_callback;
+ epCallback[16] = &USBHAL::EP9_OUT_callback;
+ epCallback[17] = &USBHAL::EP9_IN_callback;
+ epCallback[18] = &USBHAL::EP10_OUT_callback;
+ epCallback[19] = &USBHAL::EP10_IN_callback;
+ epCallback[20] = &USBHAL::EP11_OUT_callback;
+ epCallback[21] = &USBHAL::EP11_IN_callback;
+ epCallback[22] = &USBHAL::EP12_OUT_callback;
+ epCallback[23] = &USBHAL::EP12_IN_callback;
+ epCallback[24] = &USBHAL::EP13_OUT_callback;
+ epCallback[25] = &USBHAL::EP13_IN_callback;
+ epCallback[26] = &USBHAL::EP14_OUT_callback;
+ epCallback[27] = &USBHAL::EP14_IN_callback;
+ epCallback[28] = &USBHAL::EP15_OUT_callback;
+ epCallback[29] = &USBHAL::EP15_IN_callback;
+
+#if defined(TARGET_KL43Z)
+ // enable USBFS clock
+ SIM->SCGC4 |= SIM_SCGC4_USBFS_MASK;
+
+ // enable the IRC48M clock
+ USB0->CLK_RECOVER_IRC_EN |= USB_CLK_RECOVER_IRC_EN_IRC_EN_MASK;
+
+ // enable the USB clock recovery tuning
+ USB0->CLK_RECOVER_CTRL |= USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN_MASK;
+
+ // choose usb src clock
+ SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK;
+#elif defined(TARGET_INFINITY)
+ // USB clock source: FLL
+ SIM->SOPT2 |= SIM_SOPT2_USBSRC_MASK;
+
+ // enable OTG clock
+ SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;
+#else
+ // choose usb src as PLL
+ SIM->SOPT2 &= ~SIM_SOPT2_PLLFLLSEL_MASK;
+ SIM->SOPT2 |= (SIM_SOPT2_USBSRC_MASK | (1 << SIM_SOPT2_PLLFLLSEL_SHIFT));
+
+ // enable OTG clock
+ SIM->SCGC4 |= SIM_SCGC4_USBOTG_MASK;
+#endif
+
+ // Attach IRQ
+ instance = this;
+ NVIC_SetVector(USB0_IRQn, (uint32_t)&_usbisr);
+ NVIC_EnableIRQ(USB0_IRQn);
+
+ // USB Module Configuration
+ // Reset USB Module
+ USB0->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
+ while(USB0->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
+
+ // Set BDT Base Register
+ USB0->BDTPAGE1 = (uint8_t)((uint32_t)bdt>>8);
+ USB0->BDTPAGE2 = (uint8_t)((uint32_t)bdt>>16);
+ USB0->BDTPAGE3 = (uint8_t)((uint32_t)bdt>>24);
+
+ // Clear interrupt flag
+ USB0->ISTAT = 0xff;
+
+ // USB Interrupt Enablers
+ USB0->INTEN |= USB_INTEN_TOKDNEEN_MASK |
+ USB_INTEN_SOFTOKEN_MASK |
+ USB_INTEN_ERROREN_MASK |
+ USB_INTEN_USBRSTEN_MASK;
+
+ // Disable weak pull downs
+ USB0->USBCTRL &= ~(USB_USBCTRL_PDE_MASK | USB_USBCTRL_SUSP_MASK);
+
+ USB0->USBTRC0 |= 0x40;
+}
+
+USBHAL::~USBHAL(void) { }
+
+void USBHAL::connect(void) {
+ // enable USB
+ USB0->CTL |= USB_CTL_USBENSOFEN_MASK;
+ // Pull up enable
+ USB0->CONTROL |= USB_CONTROL_DPPULLUPNONOTG_MASK;
+}
+
+void USBHAL::disconnect(void) {
+ // disable USB
+ USB0->CTL &= ~USB_CTL_USBENSOFEN_MASK;
+ // Pull up disable
+ USB0->CONTROL &= ~USB_CONTROL_DPPULLUPNONOTG_MASK;
+
+ //Free buffers if required:
+ for (int i = 0; i<(NUMBER_OF_PHYSICAL_ENDPOINTS - 2) * 2; i++) {
+ free(endpoint_buffer[i]);
+ endpoint_buffer[i] = NULL;
+ }
+ free(endpoint_buffer_iso[2]);
+ endpoint_buffer_iso[2] = NULL;
+ free(endpoint_buffer_iso[0]);
+ endpoint_buffer_iso[0] = NULL;
+}
+
+void USBHAL::configureDevice(void) {
+ // not needed
+}
+
+void USBHAL::unconfigureDevice(void) {
+ // not needed
+}
+
+void USBHAL::setAddress(uint8_t address) {
+ // we don't set the address now otherwise the usb controller does not ack
+ // we set a flag instead
+ // see usbisr when an IN token is received
+ set_addr = 1;
+ addr = address;
+}
+
+bool USBHAL::realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t flags) {
+ uint32_t handshake_flag = 0;
+ uint8_t * buf;
+
+ if (endpoint > NUMBER_OF_PHYSICAL_ENDPOINTS - 1) {
+ return false;
+ }
+
+ uint32_t log_endpoint = PHY_TO_LOG(endpoint);
+
+ if ((flags & ISOCHRONOUS) == 0) {
+ handshake_flag = USB_ENDPT_EPHSHK_MASK;
+ if (IN_EP(endpoint)) {
+ if (endpoint_buffer[EP_BDT_IDX(log_endpoint, TX, ODD)] == NULL)
+ endpoint_buffer[EP_BDT_IDX(log_endpoint, TX, ODD)] = (uint8_t *) malloc (64*2);
+ buf = &endpoint_buffer[EP_BDT_IDX(log_endpoint, TX, ODD)][0];
+ } else {
+ if (endpoint_buffer[EP_BDT_IDX(log_endpoint, RX, ODD)] == NULL)
+ endpoint_buffer[EP_BDT_IDX(log_endpoint, RX, ODD)] = (uint8_t *) malloc (64*2);
+ buf = &endpoint_buffer[EP_BDT_IDX(log_endpoint, RX, ODD)][0];
+ }
+ } else {
+ if (IN_EP(endpoint)) {
+ if (endpoint_buffer_iso[2] == NULL)
+ endpoint_buffer_iso[2] = (uint8_t *) malloc (1023*2);
+ buf = &endpoint_buffer_iso[2][0];
+ } else {
+ if (endpoint_buffer_iso[0] == NULL)
+ endpoint_buffer_iso[0] = (uint8_t *) malloc (1023*2);
+ buf = &endpoint_buffer_iso[0][0];
+ }
+ }
+
+ // IN endpt -> device to host (TX)
+ if (IN_EP(endpoint)) {
+ USB0->ENDPOINT[log_endpoint].ENDPT |= handshake_flag | // ep handshaking (not if iso endpoint)
+ USB_ENDPT_EPTXEN_MASK; // en TX (IN) tran
+ bdt[EP_BDT_IDX(log_endpoint, TX, ODD )].address = (uint32_t) buf;
+ bdt[EP_BDT_IDX(log_endpoint, TX, EVEN)].address = 0;
+ }
+ // OUT endpt -> host to device (RX)
+ else {
+ USB0->ENDPOINT[log_endpoint].ENDPT |= handshake_flag | // ep handshaking (not if iso endpoint)
+ USB_ENDPT_EPRXEN_MASK; // en RX (OUT) tran.
+ bdt[EP_BDT_IDX(log_endpoint, RX, ODD )].byte_count = maxPacket;
+ bdt[EP_BDT_IDX(log_endpoint, RX, ODD )].address = (uint32_t) buf;
+ bdt[EP_BDT_IDX(log_endpoint, RX, ODD )].info = BD_OWN_MASK | BD_DTS_MASK;
+ bdt[EP_BDT_IDX(log_endpoint, RX, EVEN)].info = 0;
+ }
+
+ Data1 |= (1 << endpoint);
+
+ return true;
+}
+
+// read setup packet
+void USBHAL::EP0setup(uint8_t *buffer) {
+ uint32_t sz;
+ endpointReadResult(EP0OUT, buffer, &sz);
+}
+
+void USBHAL::EP0readStage(void) {
+ Data1 &= ~1UL; // set DATA0
+ bdt[0].info = (BD_DTS_MASK | BD_OWN_MASK);
+}
+
+void USBHAL::EP0read(void) {
+ uint32_t idx = EP_BDT_IDX(PHY_TO_LOG(EP0OUT), RX, 0);
+ bdt[idx].byte_count = MAX_PACKET_SIZE_EP0;
+}
+
+uint32_t USBHAL::EP0getReadResult(uint8_t *buffer) {
+ uint32_t sz;
+ endpointReadResult(EP0OUT, buffer, &sz);
+ return sz;
+}
+
+void USBHAL::EP0write(uint8_t *buffer, uint32_t size) {
+ endpointWrite(EP0IN, buffer, size);
+}
+
+void USBHAL::EP0getWriteResult(void) {
+}
+
+void USBHAL::EP0stall(void) {
+ stallEndpoint(EP0OUT);
+}
+
+EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) {
+ endpoint = PHY_TO_LOG(endpoint);
+ uint32_t idx = EP_BDT_IDX(endpoint, RX, 0);
+ bdt[idx].byte_count = maximumSize;
+ return EP_PENDING;
+}
+
+EP_STATUS USBHAL::endpointReadResult(uint8_t endpoint, uint8_t * buffer, uint32_t *bytesRead) {
+ uint32_t n, sz, idx, setup = 0;
+ uint8_t not_iso;
+ uint8_t * ep_buf;
+
+ uint32_t log_endpoint = PHY_TO_LOG(endpoint);
+
+ if (endpoint > NUMBER_OF_PHYSICAL_ENDPOINTS - 1) {
+ return EP_INVALID;
+ }
+
+ // if read on a IN endpoint -> error
+ if (IN_EP(endpoint)) {
+ return EP_INVALID;
+ }
+
+ idx = EP_BDT_IDX(log_endpoint, RX, 0);
+ sz = bdt[idx].byte_count;
+ not_iso = USB0->ENDPOINT[log_endpoint].ENDPT & USB_ENDPT_EPHSHK_MASK;
+
+ //for isochronous endpoint, we don't wait an interrupt
+ if ((log_endpoint != 0) && not_iso && !(epComplete & EP(endpoint))) {
+ return EP_PENDING;
+ }
+
+ if ((log_endpoint == 0) && (TOK_PID(idx) == SETUP_TOKEN)) {
+ setup = 1;
+ }
+
+ // non iso endpoint
+ if (not_iso) {
+ ep_buf = endpoint_buffer[idx];
+ } else {
+ ep_buf = endpoint_buffer_iso[0];
+ }
+
+ for (n = 0; n < sz; n++) {
+ buffer[n] = ep_buf[n];
+ }
+
+ if (((Data1 >> endpoint) & 1) == ((bdt[idx].info >> 6) & 1)) {
+ if (setup && (buffer[6] == 0)) // if no setup data stage,
+ Data1 &= ~1UL; // set DATA0
+ else
+ Data1 ^= (1 << endpoint);
+ }
+
+ if (((Data1 >> endpoint) & 1)) {
+ bdt[idx].info = BD_DTS_MASK | BD_DATA01_MASK | BD_OWN_MASK;
+ }
+ else {
+ bdt[idx].info = BD_DTS_MASK | BD_OWN_MASK;
+ }
+
+ USB0->CTL &= ~USB_CTL_TXSUSPENDTOKENBUSY_MASK;
+ *bytesRead = sz;
+
+ epComplete &= ~EP(endpoint);
+ return EP_COMPLETED;
+}
+
+EP_STATUS USBHAL::endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size) {
+ uint32_t idx, n;
+ uint8_t * ep_buf;
+
+ if (endpoint > NUMBER_OF_PHYSICAL_ENDPOINTS - 1) {
+ return EP_INVALID;
+ }
+
+ // if write on a OUT endpoint -> error
+ if (OUT_EP(endpoint)) {
+ return EP_INVALID;
+ }
+
+ idx = EP_BDT_IDX(PHY_TO_LOG(endpoint), TX, 0);
+ bdt[idx].byte_count = size;
+
+
+ // non iso endpoint
+ if (USB0->ENDPOINT[PHY_TO_LOG(endpoint)].ENDPT & USB_ENDPT_EPHSHK_MASK) {
+ ep_buf = endpoint_buffer[idx];
+ } else {
+ ep_buf = endpoint_buffer_iso[2];
+ }
+
+ for (n = 0; n < size; n++) {
+ ep_buf[n] = data[n];
+ }
+
+ if ((Data1 >> endpoint) & 1) {
+ bdt[idx].info = BD_OWN_MASK | BD_DTS_MASK;
+ } else {
+ bdt[idx].info = BD_OWN_MASK | BD_DTS_MASK | BD_DATA01_MASK;
+ }
+
+ Data1 ^= (1 << endpoint);
+
+ return EP_PENDING;
+}
+
+EP_STATUS USBHAL::endpointWriteResult(uint8_t endpoint) {
+ if (epComplete & EP(endpoint)) {
+ epComplete &= ~EP(endpoint);
+ return EP_COMPLETED;
+ }
+
+ return EP_PENDING;
+}
+
+void USBHAL::stallEndpoint(uint8_t endpoint) {
+ USB0->ENDPOINT[PHY_TO_LOG(endpoint)].ENDPT |= USB_ENDPT_EPSTALL_MASK;
+}
+
+void USBHAL::unstallEndpoint(uint8_t endpoint) {
+ USB0->ENDPOINT[PHY_TO_LOG(endpoint)].ENDPT &= ~USB_ENDPT_EPSTALL_MASK;
+}
+
+bool USBHAL::getEndpointStallState(uint8_t endpoint) {
+ uint8_t stall = (USB0->ENDPOINT[PHY_TO_LOG(endpoint)].ENDPT & USB_ENDPT_EPSTALL_MASK);
+ return (stall) ? true : false;
+}
+
+void USBHAL::remoteWakeup(void) {
+ // [TODO]
+}
+
+
+void USBHAL::_usbisr(void) {
+ instance->usbisr();
+}
+
+
+void USBHAL::usbisr(void) {
+ uint8_t i;
+ uint8_t istat = USB0->ISTAT;
+
+ // reset interrupt
+ if (istat & USB_ISTAT_USBRST_MASK) {
+ // disable all endpt
+ for(i = 0; i < 16; i++) {
+ USB0->ENDPOINT[i].ENDPT = 0x00;
+ }
+
+ // enable control endpoint
+ realiseEndpoint(EP0OUT, MAX_PACKET_SIZE_EP0, 0);
+ realiseEndpoint(EP0IN, MAX_PACKET_SIZE_EP0, 0);
+
+ Data1 = 0x55555555;
+ USB0->CTL |= USB_CTL_ODDRST_MASK;
+
+ USB0->ISTAT = 0xFF; // clear all interrupt status flags
+ USB0->ERRSTAT = 0xFF; // clear all error flags
+ USB0->ERREN = 0xFF; // enable error interrupt sources
+ USB0->ADDR = 0x00; // set default address
+
+ return;
+ }
+
+ // resume interrupt
+ if (istat & USB_ISTAT_RESUME_MASK) {
+ USB0->ISTAT = USB_ISTAT_RESUME_MASK;
+ }
+
+ // SOF interrupt
+ if (istat & USB_ISTAT_SOFTOK_MASK) {
+ USB0->ISTAT = USB_ISTAT_SOFTOK_MASK;
+ // SOF event, read frame number
+ SOF(frameNumber());
+ }
+
+ // stall interrupt
+ if (istat & 1<<7) {
+ if (USB0->ENDPOINT[0].ENDPT & USB_ENDPT_EPSTALL_MASK)
+ USB0->ENDPOINT[0].ENDPT &= ~USB_ENDPT_EPSTALL_MASK;
+ USB0->ISTAT |= USB_ISTAT_STALL_MASK;
+ }
+
+ // token interrupt
+ if (istat & 1<<3) {
+ uint32_t num = (USB0->STAT >> 4) & 0x0F;
+ uint32_t dir = (USB0->STAT >> 3) & 0x01;
+ uint32_t ev_odd = (USB0->STAT >> 2) & 0x01;
+
+ // setup packet
+ if ((num == 0) && (TOK_PID((EP_BDT_IDX(num, dir, ev_odd))) == SETUP_TOKEN)) {
+ Data1 &= ~0x02;
+ bdt[EP_BDT_IDX(0, TX, EVEN)].info &= ~BD_OWN_MASK;
+ bdt[EP_BDT_IDX(0, TX, ODD)].info &= ~BD_OWN_MASK;
+
+ // EP0 SETUP event (SETUP data received)
+ EP0setupCallback();
+
+ } else {
+ // OUT packet
+ if (TOK_PID((EP_BDT_IDX(num, dir, ev_odd))) == OUT_TOKEN) {
+ if (num == 0)
+ EP0out();
+ else {
+ epComplete |= (1 << EP(num));
+ if ((instance->*(epCallback[EP(num) - 2]))()) {
+ epComplete &= ~(1 << EP(num));
+ }
+ }
+ }
+
+ // IN packet
+ if (TOK_PID((EP_BDT_IDX(num, dir, ev_odd))) == IN_TOKEN) {
+ if (num == 0) {
+ EP0in();
+ if (set_addr == 1) {
+ USB0->ADDR = addr & 0x7F;
+ set_addr = 0;
+ }
+ }
+ else {
+ epComplete |= (1 << (EP(num) + 1));
+ if ((instance->*(epCallback[EP(num) + 1 - 2]))()) {
+ epComplete &= ~(1 << (EP(num) + 1));
+ }
+ }
+ }
+ }
+
+ USB0->ISTAT = USB_ISTAT_TOKDNE_MASK;
+ }
+
+ // sleep interrupt
+ if (istat & 1<<4) {
+ USB0->ISTAT |= USB_ISTAT_SLEEP_MASK;
+ }
+
+ // error interrupt
+ if (istat & USB_ISTAT_ERROR_MASK) {
+ USB0->ERRSTAT = 0xFF;
+ USB0->ISTAT |= USB_ISTAT_ERROR_MASK;
+ }
+}
+
+
+#endif
diff --git a/keyboard/infinity/mbed-infinity/cmsis_nvic.c b/keyboard/infinity/mbed-infinity/cmsis_nvic.c
new file mode 100644
index 0000000000..985c1d33f5
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/cmsis_nvic.c
@@ -0,0 +1,55 @@
+/* mbed Microcontroller Library
+ * CMSIS-style functionality to support dynamic vectors
+ *******************************************************************************
+ * Copyright (c) 2011 ARM Limited. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of ARM Limited nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *******************************************************************************
+ */
+#include "cmsis_nvic.h"
+
+#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFE000) // Vectors positioned at start of RAM
+#define NVIC_FLASH_VECTOR_ADDRESS (0x1000) // Initial vector position in flash
+
+void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
+ uint32_t *vectors = (uint32_t*)SCB->VTOR;
+ uint32_t i;
+
+ // Copy and switch to dynamic vectors if the first time called
+ if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
+ uint32_t *old_vectors = vectors;
+ vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
+ for (i=0; i<NVIC_NUM_VECTORS; i++) {
+ vectors[i] = old_vectors[i];
+ }
+ SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
+ }
+ vectors[IRQn + 16] = vector;
+}
+
+uint32_t NVIC_GetVector(IRQn_Type IRQn) {
+ uint32_t *vectors = (uint32_t*)SCB->VTOR;
+ return vectors[IRQn + 16];
+}
diff --git a/keyboard/infinity/mbed-infinity/infinity.ld b/keyboard/infinity/mbed-infinity/infinity.ld
new file mode 100644
index 0000000000..decdaa26e0
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/infinity.ld
@@ -0,0 +1,156 @@
+/*
+ * Linker script for Massdrop Infinity
+ * Infinity has bootloader in top 4KB sector of flash and app should be placed after the area.
+ *
+ * based on mbed.org K20 ARM GCC linker script file: MK20D5.ld
+ */
+
+MEMORY
+{
+ /* Infinity blootloader uses 4KB */
+ FLASH (rx) : ORIGIN = 4K, LENGTH = 128K - 4K
+ RAM (rwx) : ORIGIN = 0x1FFFE0F8, LENGTH = 16K - 0xF8
+}
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ * _reset_init : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ * __exidx_start
+ * __exidx_end
+ * __etext
+ * __data_start__
+ * __preinit_array_start
+ * __preinit_array_end
+ * __init_array_start
+ * __init_array_end
+ * __fini_array_start
+ * __fini_array_end
+ * __data_end__
+ * __bss_start__
+ * __bss_end__
+ * __end__
+ * end
+ * __HeapLimit
+ * __StackLimit
+ * __StackTop
+ * __stack
+ */
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+ .text :
+ {
+ __vector_table = .;
+ KEEP(*(.isr_vector))
+ *(.text.Reset_Handler)
+ *(.text.System_Init)
+ . = ALIGN(4);
+
+ *(.text*)
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+
+ *(.rodata*)
+
+ KEEP(*(.eh_frame*))
+ } > FLASH
+
+ .ARM.extab :
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > FLASH
+
+ __exidx_start = .;
+ .ARM.exidx :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > FLASH
+ __exidx_end = .;
+
+ __etext = .;
+
+ .data : AT (__etext)
+ {
+ __data_start__ = .;
+ *(vtable)
+ *(.data*)
+
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP(*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+
+
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+
+ . = ALIGN(4);
+ /* All data end */
+ __data_end__ = .;
+
+ } > RAM
+
+ .bss :
+ {
+ __bss_start__ = .;
+ *(.bss*)
+ *(COMMON)
+ __bss_end__ = .;
+ } > RAM
+
+ .heap :
+ {
+ __end__ = .;
+ end = __end__;
+ *(.heap*)
+ __HeapLimit = .;
+ } > RAM
+
+ /* .stack_dummy section doesn't contains any symbols. It is only
+ * used for linker to calculate size of stack sections, and assign
+ * values to stack symbols later */
+ .stack_dummy :
+ {
+ *(.stack)
+ } > RAM
+
+ /* Set stack top to end of RAM, and stack limit move down by
+ * size of stack_dummy section */
+ __StackTop = ORIGIN(RAM) + LENGTH(RAM);
+ __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+ PROVIDE(__stack = __StackTop);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+}
diff --git a/keyboard/infinity/mbed-infinity/startup_MK20D5.s b/keyboard/infinity/mbed-infinity/startup_MK20D5.s
new file mode 100644
index 0000000000..7a8d7ba45a
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/startup_MK20D5.s
@@ -0,0 +1,259 @@
+/* File: startup_MK20D5.s
+ * Purpose: startup file for Cortex-M4 devices. Should use with
+ * GCC for ARM Embedded Processors
+ * Version: V1.3
+ * Date: 08 Feb 2012
+ *
+ * Copyright (c) 2012, ARM Limited
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the ARM Limited nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ .syntax unified
+ .arch armv7-m
+
+ .section .stack
+ .align 3
+#ifdef __STACK_SIZE
+ .equ Stack_Size, __STACK_SIZE
+#else
+ .equ Stack_Size, 0x400
+#endif
+ .globl __StackTop
+ .globl __StackLimit
+__StackLimit:
+ .space Stack_Size
+ .size __StackLimit, . - __StackLimit
+__StackTop:
+ .size __StackTop, . - __StackTop
+
+ .section .heap
+ .align 3
+#ifdef __HEAP_SIZE
+ .equ Heap_Size, __HEAP_SIZE
+#else
+ .equ Heap_Size, 0xC00
+#endif
+ .globl __HeapBase
+ .globl __HeapLimit
+__HeapBase:
+ .if Heap_Size
+ .space Heap_Size
+ .endif
+ .size __HeapBase, . - __HeapBase
+__HeapLimit:
+ .size __HeapLimit, . - __HeapLimit
+
+ .section .isr_vector
+ .align 2
+ .globl __isr_vector
+__isr_vector:
+ .long __StackTop /* Top of Stack */
+ .long Reset_Handler /* Reset Handler */
+ .long NMI_Handler /* NMI Handler */
+ .long HardFault_Handler /* Hard Fault Handler */
+ .long MemManage_Handler /* MPU Fault Handler */
+ .long BusFault_Handler /* Bus Fault Handler */
+ .long UsageFault_Handler /* Usage Fault Handler */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long 0 /* Reserved */
+ .long SVC_Handler /* SVCall Handler */
+ .long DebugMon_Handler /* Debug Monitor Handler */
+ .long 0 /* Reserved */
+ .long PendSV_Handler /* PendSV Handler */
+ .long SysTick_Handler /* SysTick Handler */
+
+ /* External interrupts */
+ .long DMA0_IRQHandler /* 0: Watchdog Timer */
+ .long DMA1_IRQHandler /* 1: Real Time Clock */
+ .long DMA2_IRQHandler /* 2: Timer0 / Timer1 */
+ .long DMA3_IRQHandler /* 3: Timer2 / Timer3 */
+ .long DMA_Error_IRQHandler /* 4: MCIa */
+ .long 0 /* 5: MCIb */
+ .long FTFL_IRQHandler /* 6: UART0 - DUT FPGA */
+ .long Read_Collision_IRQHandler /* 7: UART1 - DUT FPGA */
+ .long LVD_LVW_IRQHandler /* 8: UART2 - DUT FPGA */
+ .long LLW_IRQHandler /* 9: UART4 - not connected */
+ .long Watchdog_IRQHandler /* 10: AACI / AC97 */
+ .long I2C0_IRQHandler /* 11: CLCD Combined Interrupt */
+ .long SPI0_IRQHandler /* 12: Ethernet */
+ .long I2S0_Tx_IRQHandler /* 13: USB Device */
+ .long I2S0_Rx_IRQHandler /* 14: USB Host Controller */
+ .long UART0_LON_IRQHandler /* 15: Character LCD */
+ .long UART0_RX_TX_IRQHandler /* 16: Flexray */
+ .long UART0_ERR_IRQHandler /* 17: CAN */
+ .long UART1_RX_TX_IRQHandler /* 18: LIN */
+ .long UART1_ERR_IRQHandler /* 19: I2C ADC/DAC */
+ .long UART2_RX_TX_IRQHandler /* 20: Reserved */
+ .long UART2_ERR_IRQHandler /* 21: Reserved */
+ .long ADC0_IRQHandler /* 22: Reserved */
+ .long CMP0_IRQHandler /* 23: Reserved */
+ .long CMP1_IRQHandler /* 24: Reserved */
+ .long FTM0_IRQHandler /* 25: Reserved */
+ .long FTM1_IRQHandler /* 26: Reserved */
+ .long CMT_IRQHandler /* 27: Reserved */
+ .long RTC_IRQHandler /* 28: Reserved - CPU FPGA CLCD */
+ .long RTC_Seconds_IRQHandler /* 29: Reserved - CPU FPGA */
+ .long PIT0_IRQHandler /* 30: UART3 - CPU FPGA */
+ .long PIT1_IRQHandler /* 31: SPI Touchscreen - CPU FPGA */
+ .long PIT2_IRQHandler
+ .long PIT3_IRQHandler
+ .long PDB0_IRQHandler
+ .long USB0_IRQHandler
+ .long USBDCD_IRQHandler
+ .long TSI0_IRQHandler
+ .long MCG_IRQHandler
+ .long LPTimer_IRQHandler
+ .long PORTA_IRQHandler
+ .long PORTB_IRQHandler
+ .long PORTC_IRQHandler
+ .long PORTD_IRQHandler
+ .long PORTE_IRQHandler
+ .long SWI_IRQHandler
+ .size __isr_vector, . - __isr_vector
+
+ .section .text.Reset_Handler
+ .thumb
+ .thumb_func
+ .align 2
+ .globl Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+/* Loop to copy data from read only memory to RAM. The ranges
+ * of copy from/to are specified by following symbols evaluated in
+ * linker script.
+ * __etext: End of code section, i.e., begin of data sections to copy from.
+ * __data_start__/__data_end__: RAM address range that data should be
+ * copied to. Both must be aligned to 4 bytes boundary. */
+ ldr r0, =SystemInit
+ blx r0
+
+ ldr r1, =__etext
+ ldr r2, =__data_start__
+ ldr r3, =__data_end__
+
+.Lflash_to_ram_loop:
+ cmp r2, r3
+ ittt lt
+ ldrlt r0, [r1], #4
+ strlt r0, [r2], #4
+ blt .Lflash_to_ram_loop
+
+.Lflash_to_ram_loop_end:
+
+ ldr r0, =_start
+ bx r0
+ .pool
+ .size Reset_Handler, . - Reset_Handler
+
+ .text
+/* Macro to define default handlers. Default handler
+ * will be weak symbol and just dead loops. They can be
+ * overwritten by other handlers */
+ .macro def_default_handler handler_name
+ .align 1
+ .thumb_func
+ .weak \handler_name
+ .type \handler_name, %function
+\handler_name :
+ b .
+ .size \handler_name, . - \handler_name
+ .endm
+
+ def_default_handler NMI_Handler
+ def_default_handler HardFault_Handler
+ def_default_handler MemManage_Handler
+ def_default_handler BusFault_Handler
+ def_default_handler UsageFault_Handler
+ def_default_handler SVC_Handler
+ def_default_handler DebugMon_Handler
+ def_default_handler PendSV_Handler
+ def_default_handler SysTick_Handler
+ def_default_handler Default_Handler
+
+ .macro def_irq_default_handler handler_name
+ .weak \handler_name
+ .set \handler_name, Default_Handler
+ .endm
+
+ def_irq_default_handler DMA0_IRQHandler
+ def_irq_default_handler DMA1_IRQHandler
+ def_irq_default_handler DMA2_IRQHandler
+ def_irq_default_handler DMA3_IRQHandler
+ def_irq_default_handler DMA_Error_IRQHandler
+ def_irq_default_handler FTFL_IRQHandler
+ def_irq_default_handler Read_Collision_IRQHandler
+ def_irq_default_handler LVD_LVW_IRQHandler
+ def_irq_default_handler LLW_IRQHandler
+ def_irq_default_handler Watchdog_IRQHandler
+ def_irq_default_handler I2C0_IRQHandler
+ def_irq_default_handler SPI0_IRQHandler
+ def_irq_default_handler I2S0_Tx_IRQHandler
+ def_irq_default_handler I2S0_Rx_IRQHandler
+ def_irq_default_handler UART0_LON_IRQHandler
+ def_irq_default_handler UART0_RX_TX_IRQHandler
+ def_irq_default_handler UART0_ERR_IRQHandler
+ def_irq_default_handler UART1_RX_TX_IRQHandler
+ def_irq_default_handler UART1_ERR_IRQHandler
+ def_irq_default_handler UART2_RX_TX_IRQHandler
+ def_irq_default_handler UART2_ERR_IRQHandler
+ def_irq_default_handler ADC0_IRQHandler
+ def_irq_default_handler CMP0_IRQHandler
+ def_irq_default_handler CMP1_IRQHandler
+ def_irq_default_handler FTM0_IRQHandler
+ def_irq_default_handler FTM1_IRQHandler
+ def_irq_default_handler CMT_IRQHandler
+ def_irq_default_handler RTC_IRQHandler
+ def_irq_default_handler RTC_Seconds_IRQHandler
+ def_irq_default_handler PIT0_IRQHandler
+ def_irq_default_handler PIT1_IRQHandler
+ def_irq_default_handler PIT2_IRQHandler
+ def_irq_default_handler PIT3_IRQHandler
+ def_irq_default_handler PDB0_IRQHandler
+ def_irq_default_handler USB0_IRQHandler
+ def_irq_default_handler USBDCD_IRQHandler
+ def_irq_default_handler TSI0_IRQHandler
+ def_irq_default_handler MCG_IRQHandler
+ def_irq_default_handler LPTimer_IRQHandler
+ def_irq_default_handler PORTA_IRQHandler
+ def_irq_default_handler PORTB_IRQHandler
+ def_irq_default_handler PORTC_IRQHandler
+ def_irq_default_handler PORTD_IRQHandler
+ def_irq_default_handler PORTE_IRQHandler
+ def_irq_default_handler SWI_IRQHandler
+ def_irq_default_handler DEF_IRQHandler
+
+/* Flash protection region, placed at 0x400 */
+ .text
+ .thumb
+ .align 2
+ .section .kinetis_flash_config_field,"a",%progbits
+kinetis_flash_config:
+ .long 0xffffffff
+ .long 0xffffffff
+ .long 0xffffffff
+ .long 0xfffffffe
+
+ .end
diff --git a/keyboard/infinity/mbed-infinity/system_MK20D5.c b/keyboard/infinity/mbed-infinity/system_MK20D5.c
new file mode 100644
index 0000000000..4f4e2a2624
--- /dev/null
+++ b/keyboard/infinity/mbed-infinity/system_MK20D5.c
@@ -0,0 +1,299 @@
+/*
+** ###################################################################
+** Compilers: ARM Compiler
+** Freescale C/C++ for Embedded ARM
+** GNU C Compiler
+** IAR ANSI C/C++ Compiler for ARM
+**
+** Reference manuals: K20P64M50SF0RM Rev. 1, Oct 2011
+** K20P32M50SF0RM Rev. 1, Oct 2011
+** K20P48M50SF0RM Rev. 1, Oct 2011
+**
+** Version: rev. 1.0, 2011-12-15
+**
+** Abstract:
+** Provides a system configuration function and a global variable that
+** contains the system frequency. It configures the device and initializes
+** the oscillator (PLL) that is part of the microcontroller device.
+**
+** Copyright: 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+**
+** http: www.freescale.com
+** mail: support@freescale.com
+**
+** Revisions:
+** - rev. 1.0 (2011-12-15)
+** Initial version
+**
+** ###################################################################
+*/
+
+/**
+ * @file MK20D5
+ * @version 1.0
+ * @date 2011-12-15
+ * @brief Device specific configuration file for MK20D5 (implementation file)
+ *
+ * Provides a system configuration function and a global variable that contains
+ * the system frequency. It configures the device and initializes the oscillator
+ * (PLL) that is part of the microcontroller device.
+ */
+
+#include <stdint.h>
+#include "MK20D5.h"
+
+#define DISABLE_WDOG 1
+
+#define CLOCK_SETUP 3
+/* Predefined clock setups
+ 0 ... Multipurpose Clock Generator (MCG) in FLL Engaged Internal (FEI) mode
+ Reference clock source for MCG module is the slow internal clock source 32.768kHz
+ Core clock = 41.94MHz, BusClock = 41.94MHz
+ 1 ... Multipurpose Clock Generator (MCG) in PLL Engaged External (PEE) mode
+ Reference clock source for MCG module is an external crystal 8MHz
+ Core clock = 48MHz, BusClock = 48MHz
+ 2 ... Multipurpose Clock Generator (MCG) in Bypassed Low Power External (BLPE) mode
+ Core clock/Bus clock derived directly from an external crystal 8MHz with no multiplication
+ Core clock = 8MHz, BusClock = 8MHz
+*/
+
+/*----------------------------------------------------------------------------
+ Define clock source values
+ *----------------------------------------------------------------------------*/
+#if (CLOCK_SETUP == 0)
+ #define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
+ #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
+ #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
+ #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
+ #define DEFAULT_SYSTEM_CLOCK 41943040u /* Default System clock value */
+#elif (CLOCK_SETUP == 1)
+ #define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
+ #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
+ #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
+ #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
+ #define DEFAULT_SYSTEM_CLOCK 48000000u /* Default System clock value */
+#elif (CLOCK_SETUP == 2)
+ #define CPU_XTAL_CLK_HZ 8000000u /* Value of the external crystal or oscillator clock frequency in Hz */
+ #define CPU_XTAL32k_CLK_HZ 32768u /* Value of the external 32k crystal or oscillator clock frequency in Hz */
+ #define CPU_INT_SLOW_CLK_HZ 32768u /* Value of the slow internal oscillator clock frequency in Hz */
+ #define CPU_INT_FAST_CLK_HZ 4000000u /* Value of the fast internal oscillator clock frequency in Hz */
+ #define DEFAULT_SYSTEM_CLOCK 8000000u /* Default System clock value */
+#elif (CLOCK_SETUP == 3)
+ /* for Infinity */
+ #define CPU_XTAL_CLK_HZ 8000000u
+ #define CPU_XTAL32k_CLK_HZ 32768u
+ #define CPU_INT_SLOW_CLK_HZ 32768u
+ #define CPU_INT_FAST_CLK_HZ 4000000u
+ #define DEFAULT_SYSTEM_CLOCK 48000000u
+#endif
+
+
+/* ----------------------------------------------------------------------------
+ -- Core clock
+ ---------------------------------------------------------------------------- */
+
+uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
+
+/* ----------------------------------------------------------------------------
+ -- SystemInit()
+ ---------------------------------------------------------------------------- */
+
+void SystemInit (void) {
+#if (DISABLE_WDOG)
+ /* Disable the WDOG module */
+ /* WDOG_UNLOCK: WDOGUNLOCK=0xC520 */
+ WDOG->UNLOCK = (uint16_t)0xC520u; /* Key 1 */
+ /* WDOG_UNLOCK : WDOGUNLOCK=0xD928 */
+ WDOG->UNLOCK = (uint16_t)0xD928u; /* Key 2 */
+ /* WDOG_STCTRLH: ??=0,DISTESTWDOG=0,BYTESEL=0,TESTSEL=0,TESTWDOG=0,??=0,STNDBYEN=1,WAITEN=1,STOPEN=1,DBGEN=0,ALLOWUPDATE=1,WINEN=0,IRQRSTEN=0,CLKSRC=1,WDOGEN=0 */
+ WDOG->STCTRLH = (uint16_t)0x01D2u;
+#endif /* (DISABLE_WDOG) */
+#if (CLOCK_SETUP == 0)
+ /* SIM->CLKDIV1: OUTDIV1=0,OUTDIV2=0,OUTDIV3=1,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
+ SIM->CLKDIV1 = (uint32_t)0x00110000u; /* Update system prescalers */
+ /* Switch to FEI Mode */
+ /* MCG->C1: CLKS=0,FRDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
+ MCG->C1 = (uint8_t)0x06u;
+ /* MCG->C2: ??=0,??=0,RANGE0=0,HGO=0,EREFS=0,LP=0,IRCS=0 */
+ MCG->C2 = (uint8_t)0x00u;
+ /* MCG_C4: DMX32=0,DRST_DRS=1 */
+ MCG->C4 = (uint8_t)((MCG->C4 & (uint8_t)~(uint8_t)0xC0u) | (uint8_t)0x20u);
+ /* MCG->C5: ??=0,PLLCLKEN=0,PLLSTEN=0,PRDIV0=0 */
+ MCG->C5 = (uint8_t)0x00u;
+ /* MCG->C6: LOLIE=0,PLLS=0,CME=0,VDIV0=0 */
+ MCG->C6 = (uint8_t)0x00u;
+ while((MCG->S & MCG_S_IREFST_MASK) == 0u) { /* Check that the source of the FLL reference clock is the internal reference clock. */
+ }
+ while((MCG->S & 0x0Cu) != 0x00u) { /* Wait until output of the FLL is selected */
+ }
+#elif (CLOCK_SETUP == 1)
+ /* SIM->CLKDIV1: OUTDIV1=0,OUTDIV2=0,OUTDIV3=1,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
+ SIM->CLKDIV1 = (uint32_t)0x00110000u; /* Update system prescalers */
+ /* Switch to FBE Mode */
+ /* OSC0->CR: ERCLKEN=0,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
+ OSC0->CR = (uint8_t)0x00u;
+ /* MCG->C7: OSCSEL=0 */
+ MCG->C7 = (uint8_t)0x00u;
+ /* MCG->C2: ??=0,??=0,RANGE0=2,HGO=0,EREFS=1,LP=0,IRCS=0 */
+ MCG->C2 = (uint8_t)0x24u;
+ /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
+ MCG->C1 = (uint8_t)0x9Au;
+ /* MCG->C4: DMX32=0,DRST_DRS=0 */
+ MCG->C4 &= (uint8_t)~(uint8_t)0xE0u;
+ /* MCG->C5: ??=0,PLLCLKEN=0,PLLSTEN=0,PRDIV0=3 */
+ MCG->C5 = (uint8_t)0x03u;
+ /* MCG->C6: LOLIE=0,PLLS=0,CME=0,VDIV0=0 */
+ MCG->C6 = (uint8_t)0x00u;
+ while((MCG->S & MCG_S_OSCINIT0_MASK) == 0u) { /* Check that the oscillator is running */
+ }
+#if 0 /* ARM: THIS CHECK IS REMOVED DUE TO BUG WITH SLOW IRC IN REV. 1.0 */
+ while((MCG->S & MCG_S_IREFST_MASK) != 0u) { /* Check that the source of the FLL reference clock is the external reference clock. */
+ }
+#endif
+ while((MCG->S & 0x0Cu) != 0x08u) { /* Wait until external reference clock is selected as MCG output */
+ }
+ /* Switch to PBE Mode */
+ /* MCG_C5: ??=0,PLLCLKEN=0,PLLSTEN=0,PRDIV0=3 */
+ MCG->C5 = (uint8_t)0x03u;
+ /* MCG->C6: LOLIE=0,PLLS=1,CME=0,VDIV0=0 */
+ MCG->C6 = (uint8_t)0x40u;
+ while((MCG->S & MCG_S_PLLST_MASK) == 0u) { /* Wait until the source of the PLLS clock has switched to the PLL */
+ }
+ while((MCG->S & MCG_S_LOCK0_MASK) == 0u) { /* Wait until locked */
+ }
+ /* Switch to PEE Mode */
+ /* MCG->C1: CLKS=0,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
+ MCG->C1 = (uint8_t)0x1Au;
+ while((MCG->S & 0x0Cu) != 0x0Cu) { /* Wait until output of the PLL is selected */
+ }
+ while((MCG->S & MCG_S_LOCK0_MASK) == 0u) { /* Wait until locked */
+ }
+#elif (CLOCK_SETUP == 2)
+ /* SIM_CLKDIV1: OUTDIV1=0,OUTDIV2=0,OUTDIV3=1,OUTDIV4=1,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0 */
+ SIM->CLKDIV1 = (uint32_t)0x00110000u; /* Update system prescalers */
+ /* Switch to FBE Mode */
+ /* OSC0->CR: ERCLKEN=0,??=0,EREFSTEN=0,??=0,SC2P=0,SC4P=0,SC8P=0,SC16P=0 */
+ OSC0->CR = (uint8_t)0x00u;
+ /* MCG->C7: OSCSEL=0 */
+ MCG->C7 = (uint8_t)0x00u;
+ /* MCG->C2: ??=0,??=0,RANGE0=2,HGO=0,EREFS=1,LP=0,IRCS=0 */
+ MCG->C2 = (uint8_t)0x24u;
+ /* MCG->C1: CLKS=2,FRDIV=3,IREFS=0,IRCLKEN=1,IREFSTEN=0 */
+ MCG->C1 = (uint8_t)0x9Au;
+ /* MCG->C4: DMX32=0,DRST_DRS=0 */
+ MCG->C4 &= (uint8_t)~(uint8_t)0xE0u;
+ /* MCG->C5: ??=0,PLLCLKEN=0,PLLSTEN=0,PRDIV0=0 */
+ MCG->C5 = (uint8_t)0x00u;
+ /* MCG->C6: LOLIE=0,PLLS=0,CME=0,VDIV0=0 */
+ MCG->C6 = (uint8_t)0x00u;
+ while((MCG->S & MCG_S_OSCINIT0_MASK) == 0u) { /* Check that the oscillator is running */
+ }
+#if 0 /* ARM: THIS CHECK IS REMOVED DUE TO BUG WITH SLOW IRC IN REV. 1.0 */
+ while((MCG->S & MCG_S_IREFST_MASK) != 0u) { /* Check that the source of the FLL reference clock is the external reference clock. */
+ }
+#endif
+ while((MCG->S & 0x0CU) != 0x08u) { /* Wait until external reference clock is selected as MCG output */
+ }
+ /* Switch to BLPE Mode */
+ /* MCG->C2: ??=0,??=0,RANGE0=2,HGO=0,EREFS=1,LP=0,IRCS=0 */
+ MCG->C2 = (uint8_t)0x24u;
+
+#elif (CLOCK_SETUP == 3)
+ /* for Infinity FEI: 48MHz */
+
+ /* OUTDIV1(core/system): 48/1, OUTDIV2(bus): 48/1, OUTDIV4(flash): 48/2 */
+ SIM->CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) | SIM_CLKDIV1_OUTDIV4(1);
+ MCG->C1 = MCG_C1_IREFS_MASK | MCG_C1_IRCLKEN_MASK;
+ /* 32.768KHz x FLL(1464) = 48MHz */
+ MCG->C4 = MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(1);
+ /* USB clock source: MCGPLLCLK/MCGFLLCLK */
+ //SIM->SOPT2 = SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_TRACECLKSEL_MASK;
+
+ while((MCG->S & MCG_S_IREFST_MASK) == 0u) { }
+ while((MCG->S & 0x0Cu) != 0x00u) { }
+#endif
+}
+
+/* ----------------------------------------------------------------------------
+ -- SystemCoreClockUpdate()
+ ---------------------------------------------------------------------------- */
+
+void SystemCoreClockUpdate (void) {
+ uint32_t MCGOUTClock; /* Variable to store output clock frequency of the MCG module */
+ uint8_t Divider;
+
+ if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x0u) {
+ /* Output of FLL or PLL is selected */
+ if ((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u) {
+ /* FLL is selected */
+ if ((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u) {
+ /* External reference clock is selected */
+ if ((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u) {
+ MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */
+ } else { /* (!((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u)) */
+ MCGOUTClock = CPU_XTAL32k_CLK_HZ; /* RTC 32 kHz oscillator drives MCG clock */
+ } /* (!((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u)) */
+ Divider = (uint8_t)(1u << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT));
+ MCGOUTClock = (MCGOUTClock / Divider); /* Calculate the divided FLL reference clock */
+ if ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) {
+ MCGOUTClock /= 32u; /* If high range is enabled, additional 32 divider is active */
+ } /* ((MCG->C2 & MCG_C2_RANGE0_MASK) != 0x0u) */
+ } else { /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
+ MCGOUTClock = CPU_INT_SLOW_CLK_HZ; /* The slow internal reference clock is selected */
+ } /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x0u)) */
+ /* Select correct multiplier to calculate the MCG output clock */
+ switch (MCG->C4 & (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS_MASK)) {
+ case 0x0u:
+ MCGOUTClock *= 640u;
+ break;
+ case 0x20u:
+ MCGOUTClock *= 1280u;
+ break;
+ case 0x40u:
+ MCGOUTClock *= 1920u;
+ break;
+ case 0x60u:
+ MCGOUTClock *= 2560u;
+ break;
+ case 0x80u:
+ MCGOUTClock *= 732u;
+ break;
+ case 0xA0u:
+ MCGOUTClock *= 1464u;
+ break;
+ case 0xC0u:
+ MCGOUTClock *= 2197u;
+ break;
+ case 0xE0u:
+ MCGOUTClock *= 2929u;
+ break;
+ default:
+ break;
+ }
+ } else { /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
+ /* PLL is selected */
+ Divider = (1u + (MCG->C5 & MCG_C5_PRDIV0_MASK));
+ MCGOUTClock = (uint32_t)(CPU_XTAL_CLK_HZ / Divider); /* Calculate the PLL reference clock */
+ Divider = ((MCG->C6 & MCG_C6_VDIV0_MASK) + 24u);
+ MCGOUTClock *= Divider; /* Calculate the MCG output clock */
+ } /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x0u)) */
+ } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x40u) {
+ /* Internal reference clock is selected */
+ if ((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u) {
+ MCGOUTClock = CPU_INT_SLOW_CLK_HZ; /* Slow internal reference clock selected */
+ } else { /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
+ MCGOUTClock = CPU_INT_FAST_CLK_HZ / (1 << ((MCG->SC & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT)); /* Fast internal reference clock selected */
+ } /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x0u)) */
+ } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u) {
+ /* External reference clock is selected */
+ if ((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u) {
+ MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */
+ } else { /* (!((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u)) */
+ MCGOUTClock = CPU_XTAL32k_CLK_HZ; /* RTC 32 kHz oscillator drives MCG clock */
+ } /* (!((MCG->C7 & MCG_C7_OSCSEL_MASK) == 0x0u)) */
+ } else { /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
+ /* Reserved value */
+ return;
+ } /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80u)) */
+ SystemCoreClock = (MCGOUTClock / (1u + ((SIM->CLKDIV1 & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT)));
+}
diff --git a/keyboard/infinity/tool/README b/keyboard/infinity/tool/README
new file mode 100644
index 0000000000..698314e250
--- /dev/null
+++ b/keyboard/infinity/tool/README
@@ -0,0 +1,103 @@
+OpenOCD config files for Kinetis
+================================
+http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD
+
+These are needed for debug and programing bootloader with SWD. To flash keyboard firmware use 'dfu-util'.
+
+Flash security of Freescale kinetis
+-----------------------------------
+If FSEC of flash config is changed accidentally SWD/JTAG you can't get debug access until doing 'mdm mass_erase' with JTAG, CMSIS-DAP or OpenSAD adapter. HLA(high level adapter) like stlink doesn't work for this.
+
+
+Example
+-------
+Debug:
+ $ openocd -s tool -f tool/openocd.cfg
+ $ arm-none-eabi-gdb build/infinity.elf -ex "target remote localhost:3333"
+
+Flash bootloader:
+ $ openocd -s tool -f tool/openocd.cfg -c "mt_flash kiibohd_bootloader.bin"
+
+
+Infinity SWD pinout
+-------------------
+SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, 5V from top.
+Note that RESET is also needed to get full control with OpenOCD.
+
+ --------
+ | ___ o |CLK
+ ||RST| o |DIO
+ ||BTN| o |GND
+ | --- o |5V
+ --------
+
+
+Kinetis sercure state
+----------------------
+openocd 0.9.0
+
+Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
+Warn : **** ****
+Warn : **** Your Kinetis MCU is in secured state, which means that, ****
+Warn : **** with exception for very basic communication, JTAG/SWD ****
+Warn : **** interface will NOT work. In order to restore its ****
+Warn : **** functionality please issue 'kinetis mdm mass_erase' ****
+Warn : **** command, power cycle the MCU and restart OpenOCD. ****
+Warn : **** ****
+Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
+
+
+Info : MDM: Chip is unsecured. Continuing.
+target state: halted
+target halted due to debug-request, current mode: Thread
+xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
+auto erase enabled
+Info : Probing flash info for bank 0
+Warn : flash configuration field erased, please reset the device
+wrote 4096 bytes from file kiibohd_bootloader.bin in 2.442562s (1.638 KiB/s)
+Info : MDM: Chip is unsecured. Continuing.
+
+
+
+
+Open On-Chip Debugger 0.9.0-dev-00346-g3e1dfdc-dirty (2015-03-21-20:41)
+Licensed under GNU GPL v2
+For bug reports, read
+ http://openocd.sourceforge.net/doc/doxygen/bugs.html
+Info : only one transport option; autoselect 'cmsis-dap'
+Kinetis MUST need Hardware SRST Control to Recover Secure-State!
+adapter_nsrst_delay: 200
+srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
+Info : add flash_bank kinetis k20.pflash
+cortex_m reset_config sysresetreq
+adapter speed: 1000 kHz
+srst_only separate srst_nogate srst_open_drain connect_assert_srst
+Info : CMSIS-DAP: SWD Supported
+Info : CMSIS-DAP: Interface Initialised (SWD)
+Info : CMSIS-DAP: FW Version = 1.0
+Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
+Info : Connecting under reset
+Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
+Info : CMSIS-DAP: Interface ready
+Info : clock speed 1000 kHz
+Info : IDCODE 0x2ba01477
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Warn : Adapter returned success despite SSTICKYERR being set.
+Info : k20.cpu: hardware has 6 breakpoints, 4 watchpoints
+Info : MDM: Chip is unsecured. Continuing.
+Info : MDM: Chip is unsecured. Continuing.
+target state: halted
+target halted due to debug-request, current mode: Thread
+xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
+auto erase enabled
+Info : Probing flash info for bank 0
+Warn : flash configuration field erased, please reset the device
+wrote 4096 bytes from file kiibohd_bootloader.bin in 2.446902s (1.635 KiB/s)
+Info : MDM: Chip is unsecured. Continuing.
+Info : Halt timed out, wake up GDB.
+Error: timed out while waiting for target halted
+Runtime Error: tool/k20dx32_flash.cfg:81:
+in procedure 'mt_flash'
+in procedure 'halt' called at file "tool/k20dx32_flash.cfg", line 81
diff --git a/keyboard/infinity/tool/k20dx32_flash.cfg b/keyboard/infinity/tool/k20dx32_flash.cfg
new file mode 100644
index 0000000000..1e3deb0910
--- /dev/null
+++ b/keyboard/infinity/tool/k20dx32_flash.cfg
@@ -0,0 +1,139 @@
+# FreeScale Kinetis K20 devices with 32kB Flash and 8kB Local On-Chip SRAM,
+# Nemuisan's Special for MK20DN32VFT5,MK20DX32VFT5,MK10DN32VFT5,MK10DX32VFT5
+
+
+# 0.8.0 has no these procs
+proc using_jtag {} {
+ set _TRANSPORT [ transport select ]
+ expr { [ string first "jtag" $_TRANSPORT ] != -1 }
+}
+
+proc using_swd {} {
+ set _TRANSPORT [ transport select ]
+ expr { [ string first "swd" $_TRANSPORT ] != -1 }
+}
+
+proc using_hla {} {
+ set _TRANSPORT [ transport select ]
+ expr { [ string first "hla" $_TRANSPORT ] != -1 }
+}
+
+source [find target/swj-dp.tcl]
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME k20
+}
+
+if { [info exists ENDIAN] } {
+ set _ENDIAN $ENDIAN
+} else {
+ set _ENDIAN little
+}
+
+if { [info exists CPUTAPID] } {
+ set _CPUTAPID $CPUTAPID
+} else {
+ if { [using_jtag] } {
+ set _CPUTAPID 0x4BA00477
+ } {
+ # this is the SW-DP tap id not the jtag tap id
+ set _CPUTAPID 0x2BA01477
+ }
+}
+
+# Work-area is a space in RAM used for flash programming
+# By default use 8kB
+if { [info exists WORKAREASIZE] == 0 } {
+ set _WORKAREASIZE 0x2000
+}
+
+# Select "srst_only", Nemuisan said so!
+echo "Kinetis MUST need Hardware SRST Control to Recover Secure-State!"
+adapter_nsrst_delay 200
+reset_config srst_only
+
+swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
+set _TARGETNAME $_CHIPNAME.cpu
+target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME
+
+# It is important that "kinetis mdm check_security" is called for
+# 'examine-end' event and not 'eximine-start'. Calling it in 'examine-start'
+# causes "kinetis mdm check_security" to fail the first time openocd
+# calls it when it tries to connect after the CPU has been power-cycled.
+$_CHIPNAME.cpu configure -event examine-end {
+ kinetis mdm check_security
+# Uncomment when gone into s*ck'n secured state!
+# kinetis mdm mass_erase
+}
+
+# K20 has minimun 8kB of SRAM and starts at 1FFFF000.
+$_TARGETNAME configure -work-area-phys 0x1FFFF000 -work-area-size $_WORKAREASIZE -work-area-backup 0 -rtos auto
+
+# MK20DN32VFT5,MK20DX32VFT5,MK10DN32VFT5,MK10DX32VFT5 has 32kB of flash memory.
+flash bank $_CHIPNAME.pflash kinetis 0x00000000 0x8000 0 4 $_TARGETNAME
+
+
+proc mt_flash {IMGFILE} {
+ flash write_image erase $IMGFILE
+ reset run
+ halt
+ verify_image $IMGFILE
+ reset run
+ shutdown
+}
+
+proc mt_flash_bin {IMGFILE OFFSET} {
+ flash write_image erase $IMGFILE $OFFSET bin
+ reset run
+ halt
+ verify_image $IMGFILE $OFFSET bin
+ reset run
+ shutdown
+}
+
+proc mt_flash_hex {IMGFILE} {
+ flash write_image erase $IMGFILE 0 ihex
+ reset run
+ halt
+ verify_image $IMGFILE 0 ihex
+ reset run
+ shutdown
+}
+
+proc mt_flash_srec {IMGFILE} {
+ flash write_image erase $IMGFILE 0 s19
+ reset run
+ halt
+ verify_image $IMGFILE 0 s19
+ reset run
+ shutdown
+}
+
+proc mass_erase {} {
+ kinetis mdm mass_erase
+}
+
+proc eraser {} {
+# Verbose procedure confirmed erase routine
+ flash info 0
+# CAUTION! "flash erase_sector 0 0 last" goes into secure state!!!
+# USE "mass_erase" command instead of
+# flash erase_sector 0 0 last
+ mass_erase
+ shutdown
+}
+
+#debug_level 3
+# HLA doesn't have cortex_m commands
+if {![using_hla]} {
+ # if srst is not fitted use SYSRESETREQ to
+ # perform a soft reset
+ cortex_m reset_config sysresetreq
+}
+adapter_khz 1000
+reset_config srst_only srst_nogate connect_assert_srst
+gdb_target_description disable
+init
+reset init
diff --git a/keyboard/infinity/tool/openocd.cfg b/keyboard/infinity/tool/openocd.cfg
new file mode 100644
index 0000000000..2b0a63b933
--- /dev/null
+++ b/keyboard/infinity/tool/openocd.cfg
@@ -0,0 +1,13 @@
+# mchack openocd
+# https://github.com/mchck/mchck/wiki/Openocd
+#
+# adapter: frdm-kl05z with cmsis-dap firmware
+# inteface: cmsis-dap
+# transport: hla_swd
+# target: MK20DX128VLF5 Freescale Kinetis
+
+# adapter/interface
+source [find interface/cmsis-dap.cfg]
+
+# CPU
+source [find k20dx32_flash.cfg]
diff --git a/keyboard/kitten_paw/Makefile.lufa b/keyboard/kitten_paw/Makefile.lufa
new file mode 100644
index 0000000000..a45a3edb96
--- /dev/null
+++ b/keyboard/kitten_paw/Makefile.lufa
@@ -0,0 +1,117 @@
+#----------------------------------------------------------------------------
+# 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 = kittenpaw_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+# MCU name
+MCU = atmega32u2
+
+# 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)
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/kitten_paw/README.md b/keyboard/kitten_paw/README.md
new file mode 100644
index 0000000000..1cc8c1016e
--- /dev/null
+++ b/keyboard/kitten_paw/README.md
@@ -0,0 +1,20 @@
+Kitten Paw controller firmware
+======================
+Custom controller for the Costar Majestouch keyboard designed by bpiphany.
+
+*Note that this is not the official firmware*
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.lufa
+
+At the moment only the LUFA stack is supported.
+
+
+Bootloader
+---------
+To enter bootloader by hardware use a magnet above the controller before connecting the usb cable.
+
+It is still possible to use Boot Magic and Command (LSFT+RSFT+PAUS) to access the bootloader though.
diff --git a/keyboard/kitten_paw/config.h b/keyboard/kitten_paw/config.h
new file mode 100644
index 0000000000..a29ca313e9
--- /dev/null
+++ b/keyboard/kitten_paw/config.h
@@ -0,0 +1,43 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6050
+#define DEVICE_VER 0x0104
+#define MANUFACTURER Costar
+#define PRODUCT Majestouch
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Majestouch
+
+/* matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 18
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/kitten_paw/keymap.c b/keyboard/kitten_paw/keymap.c
new file mode 100644
index 0000000000..e9ad9efe1a
--- /dev/null
+++ b/keyboard/kitten_paw/keymap.c
@@ -0,0 +1,102 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+/*
+ Matrix col/row mapping
+
+ ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------.
+ |06/6| |07/4|08/4|08/2|08/6| |15/5|11/6|12/2|12/4| |14/4|14/5|14/6|14/0| |13/5|13/7|15/7|
+ `----' `-------------------' `-------------------' `-------------------' `--------------'
+ ,-------------------------------------------------------------------------. ,--------------. ,-------------------.
+ |06/4|06/5|07/5|08/5|09/5|09/4|10/4|10/5|11/5|12/5|05/5|05/4|11/4| 14/2| |17/4|02/4|04/4| |16/1|17/1|04/1|04/0|
+ |-------------------------------------------------------------------------| |--------------| |-------------------|
+ |06/2 |06/7|07/7|08/7|09/7|09/2|10/2|10/7|11/7|12/7|05/7|05/2|11/2| 14/3| |16/4|02/5|04/5| |16/7|17/7|04/7| |
+ |-------------------------------------------------------------------------| '--------------' |-------------- 02/7|
+ |02/7 |06/3|07/3|08/3|09/3|09/6|10/6|10/3|11/3|12/3|05/3|05/6| 14/1| |16/2|17/2|04/2| |
+ |-------------------------------------------------------------------------| ,----. |-------------------|
+ |01/2 |06/1|07/1|08/1|09/1|09/0|10/0|10/1|11/1|12/1|05/0| 01/3| |02/6| |16/3|17/3|04/3| |
+ |-------------------------------------------------------------------------| ,--------------. |-------------- 02/3|
+ |15/4|03/2|13/6| 16/6 |13/0|0/3|12/0|15/1| |02/0|16/0|17/0| | 17/6 |04/6| |
+ `-------------------------------------------------------------------------' `--------------' `-------------------'
+*/
+
+#define KEYMAP( \
+ KG6, KH4, KI4, KI2, KI6, KP5, KL6, KM2, KM4, KO4, KO5, KO6, KO0, KN5, KN7, KP7, \
+ KG4, KG5, KH5, KI5, KJ5, KJ4, KK4, KK5, KL5, KM5, KF5, KF4, KL4, KO2, KR4, KC4, KE4, KQ1, KR1, KE1, KE0, \
+ KG2, KG7, KH7, KI7, KJ7, KJ2, KK2, KK7, KL7, KM7, KF7, KF2, KL2, KO3, KQ4, KC5, KE5, KQ7, KR7, KE7, KC7, \
+ KH2, KG3, KH3, KI3, KJ3, KJ6, KK6, KK3, KL3, KM3, KF3, KF6, KO1, KQ2, KR2, KE2, \
+ KB2, KH6, KG1, KH1, KI1, KJ1, KJ0, KK0, KK1, KL1, KM1, KF0, KB3, KC6, KQ3, KR3, KE3, KC3, \
+ KP4, KD2, KN6, KQ6, KN0, KA3, KM0, KP1, KC0, KQ0, KR0, KR6, KE6 \
+) { \
+/* 0 1 2 3 4 5 6 7 */ \
+/* A 0 */ {KC_NO, KC_NO, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* B 1 */ {KC_NO, KC_NO, KC_##KB2, KC_##KB3, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* C 2 */ {KC_##KC0, KC_NO, KC_NO, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7},\
+/* D 3 */ {KC_NO, KC_NO, KC_##KD2, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },\
+/* E 4 */ {KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7},\
+/* F 5 */ {KC_##KF0, KC_NO, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7},\
+/* G 6 */ {KC_NO, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7},\
+/* H 7 */ {KC_NO, KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7},\
+/* I 8 */ {KC_NO, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7},\
+/* J 9 */ {KC_##KJ0, KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7},\
+/* K 10 */ {KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7},\
+/* L 11 */ {KC_NO, KC_##KL1, KC_##KL2, KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7},\
+/* M 12 */ {KC_##KM0, KC_##KM1, KC_##KM2, KC_##KM3, KC_##KM4, KC_##KM5, KC_NO, KC_##KM7},\
+/* N 13 */ {KC_##KN0, KC_NO, KC_NO, KC_NO, KC_NO, KC_##KN5, KC_##KN6, KC_##KN7},\
+/* O 14 */ {KC_##KO0, KC_##KO1, KC_##KO2, KC_##KO3, KC_##KO4, KC_##KO5, KC_##KO6, KC_NO },\
+/* P 15 */ {KC_NO, KC_##KP1, KC_NO, KC_NO, KC_##KP4, KC_##KP5, KC_NO, KC_##KP7},\
+/* Q 16 */ {KC_##KQ0, KC_##KQ1, KC_##KQ2, KC_##KQ3, KC_##KQ4, KC_NO, KC_##KQ6, KC_##KQ7},\
+/* R 17 */ {KC_##KR0, KC_##KR1, KC_##KR2, KC_##KR3, KC_##KR4, KC_NO, KC_##KR6, KC_##KR7} \
+}
+
+#include "keymap_ansi.h"
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.col)][(key.row)]);
+ } else {
+ return pgm_read_byte(&keymaps[0][(key.col)][(key.row)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/kitten_paw/keymap_ansi.h b/keyboard/kitten_paw/keymap_ansi.h
new file mode 100644
index 0000000000..ed1088baa9
--- /dev/null
+++ b/keyboard/kitten_paw/keymap_ansi.h
@@ -0,0 +1,23 @@
+
+static const uint8_t PROGMEM keymaps[][MATRIX_COLS][MATRIX_ROWS] = {
+ /* Layer 0: Standard ANSI layer */
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, \
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, PENT, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI, FN0,RCTL, LEFT,DOWN,RGHT, P0, PDOT), \
+ /* Layer 1: Function layer */
+ KEYMAP(\
+ CALC,MYCM,WSCH,WHOM,MAIL,VOLD,VOLU,MSEL,MSTP,MPLY,MPRV,MNXT,TRNS, WAKE, PWR,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS)
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/kitten_paw/led.c b/keyboard/kitten_paw/led.c
new file mode 100644
index 0000000000..da5dbd7ae2
--- /dev/null
+++ b/keyboard/kitten_paw/led.c
@@ -0,0 +1,60 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+/* LED pin configuration
+ *
+ * Scroll Lock PB7
+ * CAPS PC6
+ * NUMLOCK PC5
+ *
+ */
+void led_set(uint8_t usb_led)
+{
+ DDRB |= (1<<7);
+ DDRC |= (1<<5) | (1<<6);
+
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ PORTC &= ~(1<<6);
+ }
+ else
+ {
+ PORTC |= (1<<6);
+ }
+
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ {
+ PORTC &= ~(1<<5);
+ }
+ else
+ {
+ PORTC |= (1<<5);
+ }
+
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ {
+ PORTB &= ~(1<<7);
+ }
+ else
+ {
+ PORTB |= (1<<7);
+ }
+}
diff --git a/keyboard/kitten_paw/matrix.c b/keyboard/kitten_paw/matrix.c
new file mode 100644
index 0000000000..08d64c5f4c
--- /dev/null
+++ b/keyboard/kitten_paw/matrix.c
@@ -0,0 +1,239 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+inline uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ unselect_cols();
+ init_rows();
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ select_col(col);
+ _delay_us(3);
+ uint8_t rows = read_rows();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row pin configuration
+ *
+ * row: 0 1 2 3 4 5 6 7
+ * pin: PC2 PB1 PB2 PB3 PC7 PB4 PB5 PB6
+ *
+ */
+static void init_rows(void)
+{
+ DDRC &= ~0b10000100;
+ DDRB &= ~0b01111110;
+ PORTC |= 0b10000100;
+ PORTB |= 0b01111110;
+}
+
+static uint8_t read_rows(void)
+{
+ return (PINC&(1<<2) ? 0 : (1<<0)) |
+ (PINB&(1<<1) ? 0 : (1<<1)) |
+ (PINB&(1<<2) ? 0 : (1<<2)) |
+ (PINB&(1<<3) ? 0 : (1<<3)) |
+ (PINC&(1<<7) ? 0 : (1<<4)) |
+ (PINB&(1<<4) ? 0 : (1<<5)) |
+ (PINB&(1<<5) ? 0 : (1<<6)) |
+ (PINB&(1<<6) ? 0 : (1<<7));
+}
+
+/* These columns uses two 74HC42 4 to 10 bit demultiplexers (low active).
+ *
+ * COL PD1 PD0 PD2 PD6 PD5 PD4
+ * 12 1 1 0 0 0 0
+ * 11 1 1 0 0 0 1
+ * 10 1 1 0 0 1 0
+ * 9 1 1 0 0 1 1
+ * 8 1 1 0 1 0 0
+ * 7 1 1 0 1 0 1
+ * 6 1 1 0 1 1 0
+ * 5 1 1 0 1 1 1
+ * 4 1 1 1 0 0 0
+ * 3 1 1 1 0 0 1
+
+ * COL PD2 PD6 PD1 PD0 PD5 PD4
+ * 2 1 1 0 0 0 0
+ * 1 1 1 0 0 0 1
+ * 0 1 1 0 0 1 0
+ * 17 1 1 0 0 1 1
+ * 16 1 1 0 1 0 0
+ * 1 1 0 1 0 1
+ * 1 1 0 1 1 0
+ * 15 1 1 0 1 1 1
+ * 14 1 1 1 0 0 0
+ * 13 1 1 1 0 0 1
+ */
+static void unselect_cols(void)
+{
+ DDRD |= 0b01110111;
+ PORTD &= ~0b01110111;
+}
+
+static void select_col(uint8_t col)
+{
+ switch (col) {
+ case 0:
+ PORTD |= (1<<5) | (1<<6) | (1<<2);
+ break;
+ case 1:
+ PORTD |= (1<<4) | (1<<6) | (1<<2);
+ break;
+ case 2:
+ PORTD |= (1<<6) | (1<<2);
+ break;
+ case 3:
+ PORTD |= (1<<4) | (1<<2) | (1<<0) | (1<<1);
+ break;
+ case 4:
+ PORTD |= (1<<2) | (1<<0) | (1<<1);
+ break;
+ case 5:
+ PORTD |= (1<<4) | (1<<5) | (1<<6) | (1<<0) | (1<<1);
+ break;
+ case 6:
+ PORTD |= (1<<5) | (1<<6) | (1<<0) | (1<<1);
+ break;
+ case 7:
+ PORTD |= (1<<4) | (1<<6) | (1<<0) | (1<<1);
+ break;
+ case 8:
+ PORTD |= (1<<6) | (1<<0) | (1<<1);
+ break;
+ case 9:
+ PORTD |= (1<<4) | (1<<5) | (1<<0) | (1<<1);
+ break;
+ case 10:
+ PORTD |= (1<<5) | (1<<0) | (1<<1);
+ break;
+ case 11:
+ PORTD |= (1<<4) | (1<<0) | (1<<1);
+ break;
+ case 12:
+ PORTD |= (1<<0) | (1<<1);
+ break;
+ case 13:
+ PORTD |= (1<<4) | (1<<1) | (1<<6) | (1<<2);
+ break;
+ case 14:
+ PORTD |= (1<<1) | (1<<6) | (1<<2);
+ break;
+ case 15:
+ PORTD |= (1<<4) | (1<<5) | (1<<0) | (1<<6) | (1<<2);
+ break;
+ case 16:
+ PORTD |= (1<<0) | (1<<6) | (1<<2);
+ break;
+ case 17:
+ PORTD |= (1<<4) | (1<<5) | (1<<6) | (1<<2);
+ break;
+ }
+}
diff --git a/keyboard/kmac/Makefile.lufa b/keyboard/kmac/Makefile.lufa
new file mode 100644
index 0000000000..9745f43cd4
--- /dev/null
+++ b/keyboard/kmac/Makefile.lufa
@@ -0,0 +1,130 @@
+#----------------------------------------------------------------------------
+# 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 = kmac_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c \
+ backlight.c
+
+CONFIG_H = config.h
+
+
+# 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 = 8000000
+
+
+#
+# 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)
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+winkey: OPT_DEFS += -DLAYOUT_WINKEY
+winkey: all
+
+winkeyless: OPT_DEFS += -DLAYOUT_WINKEYLESS
+winkeyless: all
diff --git a/keyboard/kmac/Makefile.pjrc b/keyboard/kmac/Makefile.pjrc
new file mode 100644
index 0000000000..b32d935bdf
--- /dev/null
+++ b/keyboard/kmac/Makefile.pjrc
@@ -0,0 +1,101 @@
+#----------------------------------------------------------------------------
+# 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 = kmac_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ backlight.c
+
+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 = 8000000
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+winkey: OPT_DEFS += -DLAYOUT_WINKEY
+winkey: all
+
+winkeyless: OPT_DEFS += -DLAYOUT_WINKEYLESS
+winkeyless: all
diff --git a/keyboard/kmac/README.md b/keyboard/kmac/README.md
new file mode 100644
index 0000000000..dc35870caa
--- /dev/null
+++ b/keyboard/kmac/README.md
@@ -0,0 +1,110 @@
+KMAC keyboard firmware
+======================
+Korean custom keyboard designed by Byungho Kim and KBDMania community.
+
+*Note that this is not the official firmware*
+
+Supported models
+----------------
+At the moment only the TKL models is supported.
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.[pjrc|lufa] [winkey|winkeyless]
+
+Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack.
+
+
+Bootloader
+---------
+The PCB is hardwired to run the bootloader if the key at the `Caps Lock` position is held down when connecting the keyboard.
+
+It is still possible to use Boot Magic and Command to access the bootloader though.
+
+
+Keymap
+------
+There are 2 different types of PCB.
+They each have their own keymap file.
+
+To customize a keymap:
+ 1. Edit the file that corresponds to your PCB.
+ 2. Specify your layout when building.
+
+### 1. Winkey
+This is the default keymap.
+
+See [keymap_winkey.h](keymap_winkey.h) for detail.
+
+#### 1.0. Winkey Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 1.1. Winkey Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Led| | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 2. Winkeyless
+Layout with 1.5 unit modifiers.
+
+See [keymap_winkeyless.h](keymap_winkeyless.h) for detail.
+
+#### 2.0. Winkeyless Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl |Gui|Alt | Space |Alt |Gui|Ctl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 2.1. Winkeyless Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Led| | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
diff --git a/keyboard/kmac/backlight.c b/keyboard/kmac/backlight.c
new file mode 100644
index 0000000000..af38f658ae
--- /dev/null
+++ b/keyboard/kmac/backlight.c
@@ -0,0 +1,58 @@
+/*
+Copyright 2013 Mathias Andersson <wraul@dbox.se>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "backlight.h"
+
+/* Backlight pin configuration
+ * F-row: High PB1
+ * W: Low PB4
+ * A: Low PB2
+ * S: Low PB3
+ * D: Low PD7
+ */
+void backlight_set(uint8_t level)
+{
+ // Set as output.
+ DDRB |= (1<<1) | (1<<2) | (1<<3) | (1<<4);
+ DDRD |= (1<<7);
+
+ // F-row
+ if(level & (1<<0))
+ {
+ PORTB |= (1<<1);
+ }
+ else
+ {
+ PORTB &= ~(1<<1);
+ }
+ // WASD
+ if(level & (1<<1))
+ {
+ PORTB &= ~(1<<4);
+ PORTB &= ~(1<<2);
+ PORTB &= ~(1<<3);
+ PORTD &= ~(1<<7);
+ }
+ else
+ {
+ PORTB |= (1<<4);
+ PORTB |= (1<<2);
+ PORTB |= (1<<3);
+ PORTD |= (1<<7);
+ }
+}
diff --git a/keyboard/kmac/config.h b/keyboard/kmac/config.h
new file mode 100644
index 0000000000..c88df94517
--- /dev/null
+++ b/keyboard/kmac/config.h
@@ -0,0 +1,50 @@
+/*
+Copyright 2013 Mathias Andersson <wraul@dbox.se>
+
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6050
+#define DEVICE_VER 0x0104
+#define MANUFACTURER KBDMania
+#define PRODUCT KMAC
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for KMAC
+
+/* matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 17
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 3
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/kmac/keymap.c b/keyboard/kmac/keymap.c
new file mode 100644
index 0000000000..1ffa60387e
--- /dev/null
+++ b/keyboard/kmac/keymap.c
@@ -0,0 +1,97 @@
+/*
+Copyright 2013 Mathias Andersson <wraul@dbox.se>
+
+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/>.
+*/
+
+/*
+ * Keymap for KMAC controller
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1P, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0O, K0P, K0Q \
+) { \
+/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ \
+/* 5 */ { KC_##K5A, KC_NO, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q}, \
+/* 4 */ { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q}, \
+/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3O, KC_##K3P, KC_##K3Q}, \
+/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_NO, KC_##K2N, KC_NO, KC_NO, KC_NO }, \
+/* 1 */ { KC_##K1A, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_NO, KC_NO, KC_##K1N, KC_NO, KC_##K1P, KC_NO }, \
+/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, KC_NO, KC_##K0G, KC_NO, KC_NO, KC_##K0K, KC_NO, KC_##K0L, KC_NO, KC_##K0M, KC_##K0N, KC_##K0O, KC_##K0P, KC_##K0Q} \
+}
+
+#define KEYMAP_WINKEYLESS( \
+ K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1P, \
+ K0A, K0B, K0C, K0G, K0L, K0M, K0N, K0O, K0P, K0Q \
+) KEYMAP( \
+ K5A, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1P, \
+ K0A, K0B, K0C, K0G, K0L, K0M, NO, K0N, K0O, K0P, K0Q \
+)
+
+#if defined(LAYOUT_WINKEYLESS)
+ #include "keymap_winkeyless.h"
+#else
+ #include "keymap_winkey.h"
+#endif
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/kmac/keymap_winkey.h b/keyboard/kmac/keymap_winkey.h
new file mode 100644
index 0000000000..3379789ecf
--- /dev/null
+++ b/keyboard/kmac/keymap_winkey.h
@@ -0,0 +1,24 @@
+// KMAC Winkey
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP(\
+ FN1, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_BACKLIGHT_STEP()
+};
+
diff --git a/keyboard/kmac/keymap_winkeyless.h b/keyboard/kmac/keymap_winkeyless.h
new file mode 100644
index 0000000000..939ee379b7
--- /dev/null
+++ b/keyboard/kmac/keymap_winkeyless.h
@@ -0,0 +1,24 @@
+// KMAC Winkeyless
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_WINKEYLESS(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP_WINKEYLESS(\
+ FN1, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_BACKLIGHT_STEP()
+};
+
diff --git a/keyboard/kmac/led.c b/keyboard/kmac/led.c
new file mode 100644
index 0000000000..7fa008a43e
--- /dev/null
+++ b/keyboard/kmac/led.c
@@ -0,0 +1,54 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+/* LED pin configuration
+ * Scroll Lock: Low PE6
+ * Caps Lock: Low PB0
+ */
+void led_set(uint8_t usb_led)
+{
+ // Set as output.
+ DDRB |= (1<<0);
+ DDRE |= (1<<6);
+
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ // Output low.
+ PORTB &= ~(1<<0);
+ }
+ else
+ {
+ // Output high.
+ PORTB |= (1<<0);
+ }
+
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ {
+ // Output low.
+ PORTE &= ~(1<<6);
+ }
+ else
+ {
+ // Output high.
+ PORTE |= (1<<6);
+ }
+}
diff --git a/keyboard/kmac/matrix.c b/keyboard/kmac/matrix.c
new file mode 100644
index 0000000000..5248a29b9d
--- /dev/null
+++ b/keyboard/kmac/matrix.c
@@ -0,0 +1,283 @@
+/*
+Copyright 2013 Mathias Andersson <wraul@dbox.se>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static uint8_t read_caps(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ unselect_cols();
+ init_rows();
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-16
+ select_col(col);
+ _delay_us(3); // TODO: Determine the correct value needed here.
+ uint8_t rows = read_rows();
+ // Use the otherwise unused col: 0 row: 3 for caps lock.
+ if(col == 0) {
+ rows |= read_caps();
+ }
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-5
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4 5
+ * pin: D0 D1 D2 D3 D5 B7
+ *
+ * Caps lock uses its own pin PE2
+ */
+static void init_rows(void)
+{
+ // Input (DDR:0, PORT:0)
+ DDRD &= ~0b00101111;
+ PORTD &= ~0b00101111;
+ DDRB &= ~(1<<7);
+ PORTB &= ~(1<<7);
+
+ // Input with pull-up (DDR:0, PORT:1)
+ DDRE &= ~(1<<2);
+ PORTE |= (1<<2);
+}
+
+static uint8_t read_rows(void)
+{
+ return (PIND&(1<<0) ? (1<<0) : 0) |
+ (PIND&(1<<1) ? (1<<1) : 0) |
+ (PIND&(1<<2) ? (1<<2) : 0) |
+ (PIND&(1<<3) ? (1<<3) : 0) |
+ (PIND&(1<<5) ? (1<<4) : 0) |
+ (PINB&(1<<7) ? (1<<5) : 0);
+}
+
+static uint8_t read_caps(void)
+{
+ return PINE&(1<<2) ? 0 : (1<<3);
+}
+
+/* Columns 0 - 15
+ * These columns uses two 74HC237D 3 to 8 bit demultiplexers.
+ * col / pin: PC6 PB6 PF0 PF1 PC7
+ * 0: 1 0 0 0 0
+ * 1: 1 0 1 0 0
+ * 2: 1 0 0 1 0
+ * 3: 1 0 1 1 0
+ * 4: 1 0 0 0 1
+ * 5: 1 0 1 0 1
+ * 6: 1 0 0 1 1
+ * 7: 1 0 1 1 1
+ * 8: 0 1 0 0 0
+ * 9: 0 1 1 0 0
+ * 10: 0 1 0 1 0
+ * 11: 0 1 1 1 0
+ * 12: 0 1 0 0 1
+ * 13: 0 1 1 0 1
+ * 14: 0 1 0 1 1
+ * 15: 0 1 1 1 1
+ *
+ * col: 16
+ * pin: PB5
+ */
+static void unselect_cols(void)
+{
+ DDRB |= (1<<5) | (1<<6);
+ PORTB &= ~((1<<5) | (1<<6));
+
+ DDRC |= (1<<6) | (1<<7);
+ PORTC &= ~((1<<6) | (1<<7));
+
+ DDRF |= (1<<0) | (1<<1);
+ PORTF &= ~((1<<0) | (1<<1));
+}
+
+static void select_col(uint8_t col)
+{
+ // Output high (DDR:1, PORT:1) to select
+ switch (col) {
+ case 0:
+ PORTC |= (1<<6);
+ break;
+ case 1:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0);
+ break;
+ case 2:
+ PORTC |= (1<<6);
+ PORTF |= (1<<1);
+ break;
+ case 3:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ break;
+ case 4:
+ PORTC |= (1<<6);
+ PORTC |= (1<<7);
+ break;
+ case 5:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0);
+ PORTC |= (1<<7);
+ break;
+ case 6:
+ PORTC |= (1<<6);
+ PORTF |= (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 7:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 8:
+ PORTB |= (1<<6);
+ break;
+ case 9:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0);
+ break;
+ case 10:
+ PORTB |= (1<<6);
+ PORTF |= (1<<1);
+ break;
+ case 11:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ break;
+ case 12:
+ PORTB |= (1<<6);
+ PORTC |= (1<<7);
+ break;
+ case 13:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0);
+ PORTC |= (1<<7);
+ break;
+ case 14:
+ PORTB |= (1<<6);
+ PORTF |= (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 15:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 16:
+ PORTB |= (1<<5);
+ break;
+ }
+}
diff --git a/keyboard/lightpad/Makefile.lufa b/keyboard/lightpad/Makefile.lufa
new file mode 100644
index 0000000000..88fb90ec4b
--- /dev/null
+++ b/keyboard/lightpad/Makefile.lufa
@@ -0,0 +1,117 @@
+#----------------------------------------------------------------------------
+# 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 = lightpad_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ backlight.c
+
+CONFIG_H = config.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 = 8000000
+
+#
+# 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)
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/lightpad/README.md b/keyboard/lightpad/README.md
new file mode 100644
index 0000000000..b21cccc6a2
--- /dev/null
+++ b/keyboard/lightpad/README.md
@@ -0,0 +1,24 @@
+Lightpad keypad firmware
+======================
+Korean custom keypad designed by Duck.
+
+*Note that this is not the official firmware*
+
+
+Supported models
+----------------
+All pcb options are supported.
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.lufa
+
+
+Bootloader
+---------
+The PCB is hardwired to run the bootloader if the key at the `top left` position is held down when connecting the keyboard.
+
+It is still possible to use Boot Magic and Command to access the bootloader though.
diff --git a/keyboard/lightpad/backlight.c b/keyboard/lightpad/backlight.c
new file mode 100644
index 0000000000..693c566fc5
--- /dev/null
+++ b/keyboard/lightpad/backlight.c
@@ -0,0 +1,129 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "backlight.h"
+
+/* Backlight pin configuration
+ *
+ * FN1 PB0 (low)
+ * FN2 PB5 (low)
+ * FN3 PB4 (low)
+ * FN4 PD7 (low)
+ * REAR PD6 (high)
+ * NUMPAD PB2 (high)
+ * NUMLOCK PB1 (low)
+ */
+void backlight_init_ports() {
+ DDRB |= (1<<0) | (1<<1) | (1<<2) | (1<<4) | (1<<5);
+ DDRD |= (1<<6) | (1<<7);
+
+ backlight_disable_numlock();
+}
+
+void backlight_set(uint8_t level) {
+ (level & BACKLIGHT_FN1) ? backlight_enable_fn1() : backlight_disable_fn1();
+ (level & BACKLIGHT_FN2) ? backlight_enable_fn2() : backlight_disable_fn2();
+ (level & BACKLIGHT_FN3) ? backlight_enable_fn3() : backlight_disable_fn3();
+ (level & BACKLIGHT_FN4) ? backlight_enable_fn4() : backlight_disable_fn4();
+ (level & BACKLIGHT_NUMPAD) ? backlight_enable_numpad() : backlight_disable_numpad();
+ (level & BACKLIGHT_REAR) ? backlight_enable_rear() : backlight_disable_rear();
+}
+
+void backlight_enable_fn1() {
+ PORTB &= ~(1<<0);
+}
+
+void backlight_disable_fn1() {
+ PORTB |= (1<<0);
+}
+
+void backlight_invert_fn1() {
+ PORTB ^= (1<<0);
+}
+
+void backlight_enable_fn2() {
+ PORTB &= ~(1<<5);
+}
+
+void backlight_disable_fn2() {
+ PORTB |= (1<<5);
+}
+
+void backlight_invert_fn2() {
+ PORTB ^= (1<<5);
+}
+
+void backlight_enable_fn3() {
+ PORTB &= ~(1<<4);
+}
+
+void backlight_disable_fn3() {
+ PORTB |= (1<<4);
+}
+
+void backlight_invert_fn3() {
+ PORTB ^= (1<<4);
+}
+
+void backlight_enable_fn4() {
+ PORTD &= ~(1<<7);
+}
+
+void backlight_disable_fn4() {
+ PORTD |= (1<<7);
+}
+
+void backlight_invert_fn4() {
+ PORTD ^= (1<<7);
+}
+
+void backlight_enable_numpad() {
+ PORTB |= (1<<2);
+}
+
+void backlight_disable_numpad() {
+ PORTB &= ~(1<<2);
+}
+
+void backlight_invert_numpad() {
+ PORTB ^= (1<<2);
+}
+
+void backlight_enable_numlock() {
+ PORTB &= ~(1<<1);
+}
+
+void backlight_disable_numlock() {
+ PORTB |= (1<<1);
+}
+
+void backlight_invert_numlock() {
+ PORTB ^= (1<<1);
+}
+
+void backlight_enable_rear() {
+ PORTD |= (1<<6);
+}
+
+void backlight_disable_rear() {
+ PORTD &= ~(1<<6);
+}
+
+void backlight_invert_rear() {
+ PORTD ^= (1<<6);
+}
diff --git a/keyboard/lightpad/backlight.h b/keyboard/lightpad/backlight.h
new file mode 100644
index 0000000000..3b3cfd9aea
--- /dev/null
+++ b/keyboard/lightpad/backlight.h
@@ -0,0 +1,39 @@
+
+enum backlight_level {
+ BACKLIGHT_FN1 = 0b0000001,
+ BACKLIGHT_FN2 = 0b0000010,
+ BACKLIGHT_FN3 = 0b0000100,
+ BACKLIGHT_FN4 = 0b0001000,
+ BACKLIGHT_NUMPAD = 0b0010000,
+ BACKLIGHT_REAR = 0b0100000,
+};
+
+void backlight_init_ports(void);
+
+void backlight_invert_fn1(void);
+void backlight_enable_fn1(void);
+void backlight_disable_fn1(void);
+
+void backlight_invert_fn2(void);
+void backlight_enable_fn2(void);
+void backlight_disable_fn2(void);
+
+void backlight_invert_fn3(void);
+void backlight_enable_fn3(void);
+void backlight_disable_fn3(void);
+
+void backlight_invert_fn4(void);
+void backlight_enable_fn4(void);
+void backlight_disable_fn4(void);
+
+void backlight_invert_numlock(void);
+void backlight_enable_numlock(void);
+void backlight_disable_numlock(void);
+
+void backlight_enable_numpad(void);
+void backlight_disable_numpad(void);
+void backlight_invert_numpad(void);
+
+void backlight_enable_rear(void);
+void backlight_disable_rear(void);
+void backlight_invert_rear(void);
diff --git a/keyboard/lightpad/config.h b/keyboard/lightpad/config.h
new file mode 100644
index 0000000000..7f5a596c0c
--- /dev/null
+++ b/keyboard/lightpad/config.h
@@ -0,0 +1,46 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6050
+#define DEVICE_VER 0x0104
+#define MANUFACTURER Duck
+#define PRODUCT Lightpad
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Lightpad
+
+/* matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 4
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 1
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/lightpad/keymap.c b/keyboard/lightpad/keymap.c
new file mode 100644
index 0000000000..2ca79a81b5
--- /dev/null
+++ b/keyboard/lightpad/keymap.c
@@ -0,0 +1,73 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+/* Map physical keyboard layout to matrix array */
+#define KEYMAP( \
+ K5A, K5B, K5C, K5D, \
+ K4A, K4B, K4C, K4D, \
+ K3A, K3B, K3C, K3D, \
+ K2A, K2B, K2C, \
+ K1A, K1B, K1C, K1D, \
+ K0A, K0B, K0C \
+) { \
+/* 0 1 2 3 */ \
+/* 5 */ { KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D}, \
+/* 4 */ { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D}, \
+/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D}, \
+/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_NO}, \
+/* 1 */ { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D}, \
+/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, } \
+}
+
+#include "keymap_lightpad.h"
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/lightpad/keymap_lightpad.h b/keyboard/lightpad/keymap_lightpad.h
new file mode 100644
index 0000000000..9333964e39
--- /dev/null
+++ b/keyboard/lightpad/keymap_lightpad.h
@@ -0,0 +1,29 @@
+#include "backlight.h"
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ KEYMAP(\
+ FN0, F1, DEL, BSPC, \
+ NLCK,PSLS,PAST,PMNS, \
+ P7, P8, P9, PPLS, \
+ P4, P5, P6, \
+ P1, P2, P3, PENT, \
+ P0, NO, PDOT), \
+ KEYMAP(\
+ TRNS,PGDN,PGUP,MUTE, \
+ MSEL,MPRV,MNXT,VOLD, \
+ P7, P8, P9, VOLU, \
+ FN4, FN5, FN6, \
+ FN1, FN2, FN3, MPLY, \
+ FN7, NO, MSTP)
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN1),
+ [2] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN2),
+ [3] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN3),
+ [4] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FN4),
+ [5] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_NUMPAD),
+ [6] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_REAR),
+ [7] = ACTION_BACKLIGHT_TOGGLE()
+};
diff --git a/keyboard/lightpad/led.c b/keyboard/lightpad/led.c
new file mode 100644
index 0000000000..ebfac3af89
--- /dev/null
+++ b/keyboard/lightpad/led.c
@@ -0,0 +1,24 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+void led_set(uint8_t usb_led) {
+ (usb_led & (1<<USB_LED_NUM_LOCK)) ? backlight_enable_numlock() : backlight_disable_numlock();
+}
diff --git a/keyboard/lightpad/matrix.c b/keyboard/lightpad/matrix.c
new file mode 100644
index 0000000000..87d338395b
--- /dev/null
+++ b/keyboard/lightpad/matrix.c
@@ -0,0 +1,205 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "eeconfig.h"
+#include "action_layer.h"
+#include "backlight.h"
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static uint8_t read_fwkey(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void misc_init(void) {
+}
+
+void matrix_init(void)
+{
+ backlight_init_ports();
+ unselect_cols();
+ init_rows();
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ select_col(col);
+ _delay_us(3);
+ uint8_t rows = read_rows();
+ // Use the otherwise unused col: 0 row: 0 for firmware key
+ if(col == 0) {
+ rows |= read_fwkey();
+ }
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row configuration
+ *
+ * row: 0 1 2 3 4 5
+ * pin: PD0 PD1 PD2 PD3 PD5 PB7
+ *
+ * Firmware uses pin PE2
+ */
+static void init_rows(void)
+{
+ DDRD &= ~0b00101111;
+ PORTD |= 0b00101111;
+
+ DDRB &= ~0b10000000;
+ PORTB |= 0b10000000;
+
+ DDRE &= ~0b00000100;
+ PORTE |= 0b00000100;
+}
+
+static uint8_t read_rows(void)
+{
+ return (PIND&(1<<0) ? (1<<0) : 0) |
+ (PIND&(1<<1) ? (1<<1) : 0) |
+ (PIND&(1<<2) ? (1<<2) : 0) |
+ (PIND&(1<<3) ? (1<<3) : 0) |
+ (PIND&(1<<5) ? (1<<4) : 0) |
+ (PINB&(1<<7) ? (1<<5) : 0);
+}
+
+static uint8_t read_fwkey(void)
+{
+ return PINE&(1<<2) ? 0 : (1<<0);
+}
+
+/* Column configuration
+ *
+ * col: 0 1 2 3
+ * pin: PF0 PF1 PC7 PC6
+ */
+static void unselect_cols(void)
+{
+ DDRF |= 0b00000011;
+ PORTF &= ~0b00000011;
+ DDRC |= 0b11000000;
+ PORTC &= ~0b11000000;
+}
+
+static void select_col(uint8_t col)
+{
+ switch (col) {
+ case 0:
+ PORTF |= (1<<0);
+ break;
+ case 1:
+ PORTF |= (1<<1);
+ break;
+ case 2:
+ PORTC |= (1<<7);
+ break;
+ case 3:
+ PORTC |= (1<<6);
+ break;
+ }
+}
diff --git a/keyboard/lightsaber/Makefile.lufa b/keyboard/lightsaber/Makefile.lufa
new file mode 100644
index 0000000000..99090c4367
--- /dev/null
+++ b/keyboard/lightsaber/Makefile.lufa
@@ -0,0 +1,126 @@
+#----------------------------------------------------------------------------
+# 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 = lightsaber_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ backlight.c
+
+CONFIG_H = config.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 = 8000000
+
+
+#
+# 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)
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+winkey: OPT_DEFS += -DLAYOUT_WINKEY
+winkey: all
diff --git a/keyboard/lightsaber/Makefile.pjrc b/keyboard/lightsaber/Makefile.pjrc
new file mode 100644
index 0000000000..0f6d399470
--- /dev/null
+++ b/keyboard/lightsaber/Makefile.pjrc
@@ -0,0 +1,94 @@
+#----------------------------------------------------------------------------
+# 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 = lightsaber_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c \
+ backlight.c
+
+CONFIG_H = config.h
+
+
+# MCU name
+MCU = atmega32u4
+
+
+# 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 = 8000000
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+winkey: OPT_DEFS += -DLAYOUT_WINKEY
+winkey: all
diff --git a/keyboard/lightsaber/README.md b/keyboard/lightsaber/README.md
new file mode 100644
index 0000000000..9dcd693095
--- /dev/null
+++ b/keyboard/lightsaber/README.md
@@ -0,0 +1,26 @@
+Lightsaber keyboard firmware
+======================
+Korean custom keyboard designed by Duck.
+
+*Note that this is not the official firmware*
+
+Supported models
+----------------
+All pcb options are supported.
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.[pjrc|lufa]
+
+Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack.
+
+
+Bootloader
+---------
+The PCB is hardwired to run the bootloader if the key at the `one above backspace` position is held down when connecting the keyboard.
+
+It is still possible to use Boot Magic and Command to access the bootloader though.
+
diff --git a/keyboard/lightsaber/backlight.c b/keyboard/lightsaber/backlight.c
new file mode 100644
index 0000000000..59b8b4a633
--- /dev/null
+++ b/keyboard/lightsaber/backlight.c
@@ -0,0 +1,86 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "backlight.h"
+
+/* Backlight pin configuration
+ *
+ * Alphas PB1 (high)
+ * Numeric PB2 (high)
+ * Mod+Num PB3 (high)
+ * Backside PD6 (high)
+ * TopRight PD7 (low)
+ * F-Row PE6 (high)
+ */
+
+void backlight_set(uint8_t level)
+{
+ // Set as output.
+ DDRB |= (1<<1) | (1<<2) | (1<<3);
+ DDRD |= (1<<6) | (1<<7);
+ DDRE |= (1<<6);
+
+ if (level & BACKLIGHT_ALPHA)
+ {
+ PORTB |= (1<<1);
+ }
+ else
+ {
+ PORTB &= ~(1<<1);
+ }
+ if (level & BACKLIGHT_NUMERIC)
+ {
+ PORTB |= (1<<2);
+ }
+ else
+ {
+ PORTB &= ~(1<<2);
+ }
+ if (level & BACKLIGHT_MODNUM)
+ {
+ PORTB |= (1<<3);
+ }
+ else
+ {
+ PORTB &= ~(1<<3);
+ }
+ if (level & BACKLIGHT_BACKSIDE)
+ {
+ PORTD |= (1<<6);
+ }
+ else
+ {
+ PORTD &= ~(1<<6);
+ }
+ if (level & BACKLIGHT_TOPRIGHT)
+ {
+ PORTD &= ~(1<<7);
+ }
+ else
+ {
+ PORTD |= (1<<7);
+ }
+ if (level & BACKLIGHT_FROW)
+ {
+ PORTE |= (1<<6);
+ }
+ else
+ {
+ PORTE &= ~(1<<6);
+ }
+}
diff --git a/keyboard/lightsaber/backlight.h b/keyboard/lightsaber/backlight.h
new file mode 100644
index 0000000000..6dc7967a62
--- /dev/null
+++ b/keyboard/lightsaber/backlight.h
@@ -0,0 +1,9 @@
+
+enum backlight_level {
+ BACKLIGHT_ALPHA = 0b0000001,
+ BACKLIGHT_NUMERIC = 0b0000010,
+ BACKLIGHT_MODNUM = 0b0000100,
+ BACKLIGHT_BACKSIDE = 0b0001000,
+ BACKLIGHT_TOPRIGHT = 0b0010000,
+ BACKLIGHT_FROW = 0b0100000,
+};
diff --git a/keyboard/lightsaber/config.h b/keyboard/lightsaber/config.h
new file mode 100644
index 0000000000..d971d038e3
--- /dev/null
+++ b/keyboard/lightsaber/config.h
@@ -0,0 +1,46 @@
+/*
+Copyright 2013 Mathias Andersson <wraul@dbox.se>
+
+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
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6050
+#define DEVICE_VER 0x0104
+#define MANUFACTURER Duck
+#define PRODUCT Lightsaber
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Lightsaber
+
+/* matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 18
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 1
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/lightsaber/keymap.c b/keyboard/lightsaber/keymap.c
new file mode 100644
index 0000000000..477da9d865
--- /dev/null
+++ b/keyboard/lightsaber/keymap.c
@@ -0,0 +1,77 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+/*
+ * Keymap for Lightsaber controller
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2O, K2P, K2Q, K2R, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1O, K1P, K1Q, K1R, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0O, K0P, K0Q, K0R \
+) { \
+/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */ \
+/* 5 */ { KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5G, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q, KC_##K5R}, \
+/* 4 */ { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q, KC_##K4R}, \
+/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3O, KC_##K3P, KC_##K3Q, KC_##K3R}, \
+/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2O, KC_##K2P, KC_##K2Q, KC_##K2R}, \
+/* 1 */ { KC_##K1A, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_NO, KC_##K1M, KC_##K1N, KC_##K1O, KC_##K1P, KC_##K1Q, KC_##K1R}, \
+/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, KC_NO, KC_##K0G, KC_NO, KC_NO, KC_##K0K, KC_NO, KC_##K0L, KC_NO, KC_##K0M, KC_##K0N, KC_##K0O, KC_##K0P, KC_##K0Q, KC_##K0R} \
+}
+
+#include "keymap_winkey.h"
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/lightsaber/keymap_winkey.h b/keyboard/lightsaber/keymap_winkey.h
new file mode 100644
index 0000000000..3e8367083c
--- /dev/null
+++ b/keyboard/lightsaber/keymap_winkey.h
@@ -0,0 +1,29 @@
+#include "backlight.h"
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, PSCR, SLCK, BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NUMLOCK,KP_SLASH,KP_ASTERISK,KP_MINUS, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, KP_7, KP_8, KP_9, KP_PLUS, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,FN0, ENT, KP_4, KP_5, KP_6, NO, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, KP_1, KP_2, KP_3, KP_ENTER, \
+ LCTL,LGUI,LALT, SPC, NO, RALT,RGUI,RCTL, KP_0, NO, KP_DOT, NO), \
+ KEYMAP(\
+ CALC,MYCM,WSCH,WHOM,MAIL,MUTE,VOLD,VOLU,MSEL,MSTP,MPLY,MPRV,MNXT,TRNS, TRNS, WAKE, PWR, SLEP, \
+ FN1, FN2, FN3, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS,TRNS,TRNS,TRNS,PGDN,TRNS,LEFT,DOWN,UP ,RGHT,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS, TRNS,TRNS,TRNS,TRNS,PGUP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS)
+};
+
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_BACKLIGHT_TOGGLE(),
+ [2] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_ALPHA),
+ [3] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_MODNUM),
+ [4] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_NUMERIC),
+ [5] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_FROW),
+ [6] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_BACKSIDE),
+ [7] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_TOPRIGHT)
+};
diff --git a/keyboard/lightsaber/led.c b/keyboard/lightsaber/led.c
new file mode 100644
index 0000000000..c3f85427f5
--- /dev/null
+++ b/keyboard/lightsaber/led.c
@@ -0,0 +1,54 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+/* LED pin configuration
+ *
+ * Caps PB0 (low)
+ * NumLock PB4 (low)
+ *
+ */
+void led_set(uint8_t usb_led)
+{
+ // Set as output.
+ DDRB |= (1<<0) | (1<<4);
+
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ // Output low.
+ PORTB &= ~(1<<0);
+ }
+ else
+ {
+ // Output high.
+ PORTB |= (1<<0);
+ }
+
+ if (usb_led & (1<<USB_LED_NUM_LOCK))
+ {
+ // Output low.
+ PORTB &= ~(1<<4);
+ }
+ else
+ {
+ // Output high.
+ PORTB |= (1<<4);
+ }
+}
diff --git a/keyboard/lightsaber/matrix.c b/keyboard/lightsaber/matrix.c
new file mode 100644
index 0000000000..e3eca84df8
--- /dev/null
+++ b/keyboard/lightsaber/matrix.c
@@ -0,0 +1,292 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static uint8_t read_fwkey(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ unselect_cols();
+ init_rows();
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-17
+ select_col(col);
+ _delay_us(3); // TODO: Determine the correct value needed here.
+ uint8_t rows = read_rows();
+ // Use the otherwise unused col: 12 row: 3 for firmware.
+ if(col == 12) {
+ rows |= read_fwkey();
+ }
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-5
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4 5
+ * pin: PD0 PD1 PD2 PD3 PD5 PB7
+ *
+ * Firmware uses its own pin PE2
+ */
+static void init_rows(void)
+{
+ // Input (DDR:0, PORT:0)
+ DDRD &= ~0b00101111;
+ PORTD &= ~0b00101111;
+ DDRB &= ~(1<<7);
+ PORTB &= ~(1<<7);
+
+ // Input with pull-up (DDR:0, PORT:1)
+ DDRE &= ~(1<<2);
+ PORTE |= (1<<2);
+}
+
+static uint8_t read_rows(void)
+{
+ return (PIND&(1<<0) ? (1<<0) : 0) |
+ (PIND&(1<<1) ? (1<<1) : 0) |
+ (PIND&(1<<2) ? (1<<2) : 0) |
+ (PIND&(1<<3) ? (1<<3) : 0) |
+ (PIND&(1<<5) ? (1<<4) : 0) |
+ (PINB&(1<<7) ? (1<<5) : 0);
+}
+
+static uint8_t read_fwkey(void)
+{
+ return PINE&(1<<2) ? 0 : (1<<3);
+}
+
+/* Columns 0 - 15
+ * These columns uses two 74HC237D 3 to 8 bit demultiplexers.
+ * col / pin: PC6 PB6 PF0 PF1 PC7
+ * 0: 1 0 0 0 0
+ * 1: 1 0 1 0 0
+ * 2: 1 0 0 1 0
+ * 3: 1 0 1 1 0
+ * 4: 1 0 0 0 1
+ * 5: 1 0 1 0 1
+ * 6: 1 0 0 1 1
+ * 7: 1 0 1 1 1
+ * 8: 0 1 0 0 0
+ * 9: 0 1 1 0 0
+ * 10: 0 1 0 1 0
+ * 11: 0 1 1 1 0
+ * 12: 0 1 0 0 1
+ * 13: 0 1 1 0 1
+ * 14: 0 1 0 1 1
+ * 15: 0 1 1 1 1
+ *
+ * col: 16
+ * pin: PB5
+ *
+ * col: 17
+ * pin: PD4
+ */
+static void unselect_cols(void)
+{
+ DDRB |= (1<<5) | (1<<6);
+ PORTB &= ~((1<<5) | (1<<6));
+
+ DDRC |= (1<<6) | (1<<7);
+ PORTC &= ~((1<<6) | (1<<7));
+
+ DDRD |= (1<<4);
+ PORTD &= ~(1<<4);
+
+ DDRF |= (1<<0) | (1<<1);
+ PORTF &= ~((1<<0) | (1<<1));
+}
+
+static void select_col(uint8_t col)
+{
+ // Output high (DDR:1, PORT:1) to select
+ switch (col) {
+ case 0:
+ PORTC |= (1<<6);
+ break;
+ case 1:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0);
+ break;
+ case 2:
+ PORTC |= (1<<6);
+ PORTF |= (1<<1);
+ break;
+ case 3:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ break;
+ case 4:
+ PORTC |= (1<<6);
+ PORTC |= (1<<7);
+ break;
+ case 5:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0);
+ PORTC |= (1<<7);
+ break;
+ case 6:
+ PORTC |= (1<<6);
+ PORTF |= (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 7:
+ PORTC |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 8:
+ PORTB |= (1<<6);
+ break;
+ case 9:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0);
+ break;
+ case 10:
+ PORTB |= (1<<6);
+ PORTF |= (1<<1);
+ break;
+ case 11:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ break;
+ case 12:
+ PORTB |= (1<<6);
+ PORTC |= (1<<7);
+ break;
+ case 13:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0);
+ PORTC |= (1<<7);
+ break;
+ case 14:
+ PORTB |= (1<<6);
+ PORTF |= (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 15:
+ PORTB |= (1<<6);
+ PORTF |= (1<<0) | (1<<1);
+ PORTC |= (1<<7);
+ break;
+ case 16:
+ PORTB |= (1<<5);
+ break;
+ case 17:
+ PORTD |= (1<<4);
+ break;
+ }
+}
diff --git a/keyboard/macway/Makefile.lufa b/keyboard/macway/Makefile.lufa
new file mode 100644
index 0000000000..8fff93ada5
--- /dev/null
+++ b/keyboard/macway/Makefile.lufa
@@ -0,0 +1,121 @@
+#----------------------------------------------------------------------------
+# 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 = macway_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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)
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+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
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+#OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/macway/Makefile.pjrc b/keyboard/macway/Makefile.pjrc
new file mode 100644
index 0000000000..6ee25b61af
--- /dev/null
+++ b/keyboard/macway/Makefile.pjrc
@@ -0,0 +1,97 @@
+#----------------------------------------------------------------------------
+# 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 = macway_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+EXTRAKEY_ENABLE = yes # Audio control and System control
+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/macway/config.h b/keyboard/macway/config.h
new file mode 100644
index 0000000000..e87da1ffa6
--- /dev/null
+++ b/keyboard/macway/config.h
@@ -0,0 +1,63 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0xBEE0
+#define DEVICE_VER 0x0202
+#define MANUFACTURER t.m.k.
+#define PRODUCT Macway mod
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Macway mod
+
+/* matrix size */
+#define MATRIX_ROWS 9
+#define MATRIX_COLS 8
+
+/* define if matrix has ghost */
+#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 5
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/* PS/2 mouse */
+#ifdef PS2_MOUSE_ENABLE
+# define PS2_CLOCK_PORT PORTF
+# define PS2_CLOCK_PIN PINF
+# define PS2_CLOCK_DDR DDRF
+# define PS2_CLOCK_BIT 0
+# define PS2_DATA_PORT PORTF
+# define PS2_DATA_PIN PINF
+# define PS2_DATA_DDR DDRF
+# define PS2_DATA_BIT 1
+#endif
+
+#endif
diff --git a/keyboard/macway/doc/back.jpg b/keyboard/macway/doc/back.jpg
new file mode 100644
index 0000000000..0774401f69
--- /dev/null
+++ b/keyboard/macway/doc/back.jpg
Binary files differ
diff --git a/keyboard/macway/doc/case.jpg b/keyboard/macway/doc/case.jpg
new file mode 100644
index 0000000000..c776d5e054
--- /dev/null
+++ b/keyboard/macway/doc/case.jpg
Binary files differ
diff --git a/keyboard/macway/doc/keys.jpg b/keyboard/macway/doc/keys.jpg
new file mode 100644
index 0000000000..f340ebe8e4
--- /dev/null
+++ b/keyboard/macway/doc/keys.jpg
Binary files differ
diff --git a/keyboard/macway/doc/side.jpg b/keyboard/macway/doc/side.jpg
new file mode 100644
index 0000000000..bdf8268f25
--- /dev/null
+++ b/keyboard/macway/doc/side.jpg
Binary files differ
diff --git a/keyboard/macway/doc/switch.jpg b/keyboard/macway/doc/switch.jpg
new file mode 100644
index 0000000000..a1500d707d
--- /dev/null
+++ b/keyboard/macway/doc/switch.jpg
Binary files differ
diff --git a/keyboard/macway/doc/teensy.jpg b/keyboard/macway/doc/teensy.jpg
new file mode 100644
index 0000000000..07207475d5
--- /dev/null
+++ b/keyboard/macway/doc/teensy.jpg
Binary files differ
diff --git a/keyboard/macway/doc/wiring.jpg b/keyboard/macway/doc/wiring.jpg
new file mode 100644
index 0000000000..0f3490f105
--- /dev/null
+++ b/keyboard/macway/doc/wiring.jpg
Binary files differ
diff --git a/keyboard/macway/doc/withHHKB.jpg b/keyboard/macway/doc/withHHKB.jpg
new file mode 100644
index 0000000000..9921856e7b
--- /dev/null
+++ b/keyboard/macway/doc/withHHKB.jpg
Binary files differ
diff --git a/keyboard/macway/doc/withThinkPad.jpg b/keyboard/macway/doc/withThinkPad.jpg
new file mode 100644
index 0000000000..231c61d036
--- /dev/null
+++ b/keyboard/macway/doc/withThinkPad.jpg
Binary files differ
diff --git a/keyboard/macway/keymap.c b/keyboard/macway/keymap.c
new file mode 100644
index 0000000000..b77348494a
--- /dev/null
+++ b/keyboard/macway/keymap.c
@@ -0,0 +1,195 @@
+/*
+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/>.
+*/
+
+/*
+ * Keymap for Macway mod
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "keymap.h"
+
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ K11, K10, K20, K30, K40, K41, K51, K50, K60, K70, K80, K81, K61, K02, \
+ K12, K13, K23, K33, K43, K42, K52, K53, K63, K73, K83, K82, K62, K01, \
+ K15, K14, K24, K34, K44, K45, K55, K54, K64, K74, K84, K85, K06, \
+ K67, K16, K26, K36, K46, K47, K57, K56, K66, K76, K87, K32, K35, \
+ K75, K22, K00, K07, K21, K04, K37, K27, K17 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_NO, KC_##K04, KC_NO, KC_##K06, KC_##K07 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_NO, KC_##K26, KC_##K27 }, \
+ { KC_##K30, KC_NO, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
+ { KC_##K70, KC_NO, KC_NO, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_NO }, \
+ { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_NO, KC_##K87 } \
+}
+
+#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
+
+
+// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
+static const uint8_t PROGMEM fn_layer[] = {
+ 0, // Fn0
+ 1, // Fn1
+ 2, // Fn2
+ 3, // Fn3
+ 4, // Fn4
+ 0, // Fn5
+ 3, // Fn6
+ 3 // Fn7
+};
+
+// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
+// See layer.c for details.
+static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_SLSH, // Fn2
+ KC_SCLN, // Fn3
+ KC_SPC, // Fn4
+ KC_NO, // Fn5
+ KC_NO, // Fn6
+ KC_NO // Fn7
+};
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default Layer
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| |
+ * |-----------------------------------------------------' |
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn1|
+ * |-----------------------------------------------------------|
+ * |Fn7|Gui |Alt |Fn4 |Alt |Gui|Fn6|Fn6|Ctr|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \
+ FN7, LGUI,LALT,FN4, RALT,GRV, FN6, FN6, RCTL),
+
+
+ /* Layer 1: HHKB mode (HHKB Fn)
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | | |
+ * |-----------------------------------------------------' |
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
+ * |-----------------------------------------------------------|
+ * | |Gui |Alt | |Alt |Gui| | |Ctr|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
+ CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,BRK, UP, INS, NLCK,\
+ LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
+ LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT,FN1, \
+ NO, LGUI,LALT,SPC, RALT,NO, NO, NO, RCTL),
+
+
+ /* Layer 2: Vi mode (Quote/Rmeta)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` |
+ * |-----------------------------------------------------------|
+ * | \ |Hom|PgD|Up |PgU|End|Hom|PgD|PgU|End| | | | |
+ * |-----------------------------------------------------' |
+ * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | | \ |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | |Hom|PgD|PgU|End|xxx|Shift | |
+ * |-----------------------------------------------------------|
+ * | |Gui |Alt |Space |Alt |Gui|Fn6|Fn6|Ctr|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
+ BSLS,HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, NO, \
+ LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, BSLS, \
+ LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,NO, \
+ NO, LGUI,LALT,SPC, RALT,RGUI,FN6, FN6, RCTL),
+
+
+ /* Layer 3: Mouse mode (Semicolon)
+ * ,-----------------------------------------------------------.
+ * | `| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` |
+ * |-----------------------------------------------------------|
+ * | \ |MwL|MwD|McU|MwU|MwR|MwL|MwD|MwU|MwR| | | | |
+ * |-----------------------------------------------------' |
+ * |Contro| |McL|McD|McR| |McL|McD|McU|McR|xxx| | \ |
+ * |-----------------------------------------------------------|
+ * |Shift | | |Mb1|Mb2|Mb3|Mb2|Mb1| | | |Shift | |
+ * |-----------------------------------------------------------|
+ * |xxx|Gui |Alt |Mb1 |Alt | | | | |
+ * `-----------------------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \
+ BSLS,WH_L,WH_D,MS_U,WH_U,WH_R,WH_L,WH_D,WH_U,WH_R,NO, NO, NO, NO, \
+ LCTL,NO, MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,FN3, NO, BSLS, \
+ LSFT,NO, NO, BTN1,BTN2,BTN3,BTN2,BTN1,NO, NO, NO, RSFT,NO, \
+ FN7, LGUI,LALT,BTN1,RALT,NO, FN6, FN6, NO),
+
+
+ /* Layer 4: Matias half keyboard style (Space)
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
+ * |-----------------------------------------------------------|
+ * |Backs| P| O| I| U| Y| T| R| E| W| Q|Tab|Tab| |
+ * |-----------------------------------------------------' |
+ * |Contro| ;| L| K| J| H| G| F| D| S| A|Con|Control |
+ * |-----------------------------------------------------------|
+ * |Shift | /| .| ,| M| N| B| V| C| X| Z|Shift | |
+ * |-----------------------------------------------------------|
+ * | |Gui |Alt |xxxxxxxxxxxxxxxxxxxxxx|Alt |Gui| | |Ctr|
+ * `-----------------------------------------------------------'
+ */
+ KEYMAP(MINS,0, 9, 8, 7, 6, 5, 4, 3, 2, 1, NO, NO, ESC, \
+ BSPC,P, O, I, U, Y, T, R, E, W, Q, TAB, TAB, TAB, \
+ LCTL,SCLN,L, K, J, H, G, F, D, S, A, RCTL,RCTL, \
+ LSFT,SLSH,DOT, COMM,M, N, B, V, C, X, Z, RSFT,NO, \
+ NO, LGUI,LALT,FN4, RALT,RGUI,NO, NO, RCTL),
+};
+
+
+uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
+{
+ return KEYCODE(layer, row, col);
+}
+
+uint8_t keymap_fn_layer(uint8_t index)
+{
+ return pgm_read_byte(&fn_layer[index]);
+}
+
+uint8_t keymap_fn_keycode(uint8_t index)
+{
+ return pgm_read_byte(&fn_keycode[index]);
+}
diff --git a/keyboard/macway/led.c b/keyboard/macway/led.c
new file mode 100644
index 0000000000..f76545f0ba
--- /dev/null
+++ b/keyboard/macway/led.c
@@ -0,0 +1,24 @@
+/*
+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/>.
+*/
+
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/keyboard/macway/matrix.c b/keyboard/macway/matrix.c
new file mode 100644
index 0000000000..3d10b304d4
--- /dev/null
+++ b/keyboard/macway/matrix.c
@@ -0,0 +1,217 @@
+/*
+Copyright 2011 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+#ifdef MATRIX_HAS_GHOST
+static bool matrix_has_ghost_in_row(uint8_t row);
+#endif
+static matrix_row_t read_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // initialize row and col
+ unselect_rows();
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRB = 0x00;
+ PORTB = 0xFF;
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i] != cols) {
+ matrix_debouncing[i] = cols;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 01234567\n");
+ for (uint8_t row = 0; row < matrix_rows(); row++) {
+ phex(row); print(": ");
+ pbin_reverse(matrix_get_row(row));
+#ifdef MATRIX_HAS_GHOST
+ if (matrix_has_ghost_in_row(row)) {
+ print(" <ghost");
+ }
+#endif
+ print("\n");
+ }
+}
+
+#ifdef MATRIX_HAS_GHOST
+inline
+static bool matrix_has_ghost_in_row(uint8_t row)
+{
+ // no ghost exists in case less than 2 keys on
+ if (((matrix[row] - 1) & matrix[row]) == 0)
+ return false;
+
+ // ghost exists in case same state as other row
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ if (i != row && (matrix[i] & matrix[row]))
+ return true;
+ }
+ return false;
+}
+#endif
+
+inline
+static matrix_row_t read_cols(void)
+{
+ return ~PINB;
+}
+
+inline
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRC &= ~0b01000000; // PC: 6
+ PORTC &= ~0b01000000;
+ DDRD &= ~0b11100111; // PD: 7,6,5,2,1,0
+ PORTD &= ~0b11100111;
+ DDRF &= ~0b11000000; // PF: 7,6
+ PORTF &= ~0b11000000;
+}
+
+inline
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ // row: 0 1 2 3 4 5 6 7 8
+ // pin: PD0, PD5, PD7, PF6, PD6, PD1, PD2, PC6, PF7
+ switch (row) {
+ case 0:
+ DDRD |= (1<<0);
+ PORTD &= ~(1<<0);
+ break;
+ case 1:
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
+ break;
+ case 2:
+ DDRD |= (1<<7);
+ PORTD &= ~(1<<7);
+ break;
+ case 3:
+ DDRF |= (1<<6);
+ PORTF &= ~(1<<6);
+ break;
+ case 4:
+ DDRD |= (1<<6);
+ PORTD &= ~(1<<6);
+ break;
+ case 5:
+ DDRD |= (1<<1);
+ PORTD &= ~(1<<1);
+ break;
+ case 6:
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<2);
+ break;
+ case 7:
+ DDRC |= (1<<6);
+ PORTC &= ~(1<<6);
+ break;
+ case 8:
+ DDRF |= (1<<7);
+ PORTF &= ~(1<<7);
+ break;
+ }
+}
diff --git a/keyboard/mbed_onekey/Makefile b/keyboard/mbed_onekey/Makefile
new file mode 100644
index 0000000000..b9c88fdd31
--- /dev/null
+++ b/keyboard/mbed_onekey/Makefile
@@ -0,0 +1,33 @@
+PROJECT = mbed_onekey
+
+TMK_DIR = ../../tmk_core
+MBED_DIR = $(TMK_DIR)/mbed-sdk
+
+#VPATH += $(MBED_DIR):$(TMK_DIR)
+vpath %.s .:$(MBED_DIR):$(TMK_DIR)
+vpath %.c .:$(MBED_DIR):$(TMK_DIR)
+vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
+
+OBJDIR = ./build
+
+OBJECTS = \
+ $(OBJDIR)/./main.o
+
+CONFIG_H = config.h
+
+SYS_OBJECTS =
+
+INCLUDE_PATHS = -I.
+
+LIBRARY_PATHS =
+LIBRARIES =
+
+# Build Options
+# Comment out to disable
+#BOOTMAGIC_ENABLE = yes
+#MOUSEKEY_ENABLE = yes
+
+
+include $(TMK_DIR)/tool/mbed/mbed.mk
+include $(TMK_DIR)/tool/mbed/common.mk
+include $(TMK_DIR)/tool/mbed/gcc.mk
diff --git a/keyboard/mbed_onekey/config.h b/keyboard/mbed_onekey/config.h
new file mode 100644
index 0000000000..a3aadd0389
--- /dev/null
+++ b/keyboard/mbed_onekey/config.h
@@ -0,0 +1,7 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+#endif
diff --git a/keyboard/mbed_onekey/main.cpp b/keyboard/mbed_onekey/main.cpp
new file mode 100644
index 0000000000..71342e7ec3
--- /dev/null
+++ b/keyboard/mbed_onekey/main.cpp
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "action.h"
+#include "keycode.h"
+#include "host.h"
+#include "mbed_driver.h"
+
+
+// Button and LEDs of LPC11U35 board
+DigitalIn isp(P0_1); // ISP button
+DigitalOut led_red(P0_20);
+DigitalOut led_green(P0_21);
+
+
+int main(void) {
+ isp.mode(PullUp);
+ led_red = 1;
+ led_green = 0;
+
+ host_set_driver(&mbed_driver);
+
+ bool last_isp = isp;
+ while (1) {
+ if (last_isp == isp) continue;
+ last_isp = isp;
+ if (last_isp == 0) {
+ led_red = 0; // on
+ register_code(KC_A);
+ } else {
+ led_red = 1; // off
+ unregister_code(KC_A);
+ }
+ }
+}
diff --git a/keyboard/nerd/Makefile b/keyboard/nerd/Makefile
new file mode 100644
index 0000000000..30149345ce
--- /dev/null
+++ b/keyboard/nerd/Makefile
@@ -0,0 +1,126 @@
+#----------------------------------------------------------------------------
+# 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 = nerd_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap_common.c \
+ matrix.c \
+ backlight.c
+
+ifdef LAYOUT
+ OPT_DEFS += -DNERD_LAYOUT_$(LAYOUT)
+endif
+
+ifdef KEYMAP
+ SRC := keymap_$(LAYOUT)_$(KEYMAP).c $(SRC)
+endif
+
+CONFIG_H = config.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 = 8000000
+
+#
+# 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)
+
+# 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
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/nerd/README.md b/keyboard/nerd/README.md
new file mode 100644
index 0000000000..5b4acd3ba9
--- /dev/null
+++ b/keyboard/nerd/README.md
@@ -0,0 +1,52 @@
+NerD keyboard firmware
+========================
+
+Korean Keyboard designed by GON.
+
+*Note that this is not the official firmware*
+
+
+Hardware revision
+-----------------
+
+This firmware was developed and tested for NerD pcb version 1.61 and 2.0.
+
+
+Supported features
+------------------
+
+* All layout options are supported
+* All leds are supported
+* 60% and 80% (TKL) pcbs are supported
+
+
+Changing Bootloader
+-------------------
+
+You can't simply just upload this firmware to a new NerD board because the original
+bootloader won't accept DFU connections.
+
+You can change the bootloader of the keyboard with an ISP programmer of your choice.
+The bootloader pins are easy to access on the NerD pcb.
+
+*Be aware that after changing the bootloader the official configuration software
+won't work anymore and you'll lose your warrenty. GON won't provide any support for this firmware.*
+
+
+Build
+-----
+
+For building you have to specify two build-options, LAYOUT and KEYMAP. The layout option defines
+pcb layout and can be either 60% or 80% at the momemnt. The keymap option selects your
+preferred keymapping.
+
+Move to this directory then just run `make LAYOUT=60 KEYMAP=ansi150`
+
+to compile a firmware for a 60% pcb with ANSI 150 key mapping.
+
+
+Jump to Bootloader
+------------------
+
+You can jump to bootloader by software if you have a macro defined for this in your keymap. The
+default command is (LSFT+RSFT+PAUS) to access the bootloader by software jump.
diff --git a/keyboard/nerd/backlight.c b/keyboard/nerd/backlight.c
new file mode 100644
index 0000000000..2dc85c7532
--- /dev/null
+++ b/keyboard/nerd/backlight.c
@@ -0,0 +1,81 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <avr/io.h>
+#include "backlight.h"
+#include "led.h"
+
+void backlight_init_ports()
+{
+ DDRB |= 0b11100000; // PB7 (switch), PB6 (pcb), PB5 (caps)
+}
+
+void led_set(uint8_t usb_led)
+{
+ (usb_led & (1<<USB_LED_CAPS_LOCK)) ? backlight_caps_enable() : backlight_caps_disable();
+}
+
+void backlight_set(uint8_t level)
+{
+ (level & BACKLIGHT_SWITCH) ? backlight_switch_enable() : backlight_switch_disable();
+ (level & BACKLIGHT_PCB) ? backlight_pcb_enable() : backlight_pcb_disable();
+}
+
+void backlight_switch_enable()
+{
+ PORTB |= 0b10000000;
+}
+
+void backlight_switch_disable()
+{
+ PORTB &= ~0b10000000;
+}
+
+void backlight_switch_invert()
+{
+ PORTB ^= 0b10000000;
+}
+
+void backlight_pcb_enable()
+{
+ PORTB |= 0b01000000;
+}
+
+void backlight_pcb_disable()
+{
+ PORTB &= ~0b01000000;
+}
+
+void backlight_pcb_invert()
+{
+ PORTB ^= 0b01000000;
+}
+
+void backlight_caps_enable()
+{
+ PORTB |= 0b00100000;
+}
+
+void backlight_caps_disable()
+{
+ PORTB &= ~0b00100000;
+}
+
+void backlight_caps_invert()
+{
+ PORTB ^= 0b00100000;
+}
diff --git a/keyboard/nerd/backlight.h b/keyboard/nerd/backlight.h
new file mode 100644
index 0000000000..4c75d9db65
--- /dev/null
+++ b/keyboard/nerd/backlight.h
@@ -0,0 +1,40 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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 BACKLIGHT_H
+#define BACKLIGHT_H
+
+enum backlight_level {
+ BACKLIGHT_SWITCH = 0b0000001,
+ BACKLIGHT_PCB = 0b0000010,
+};
+
+void backlight_init_ports(void);
+
+void backlight_switch_invert(void);
+void backlight_switch_enable(void);
+void backlight_switch_disable(void);
+
+void backlight_pcb_invert(void);
+void backlight_pcb_enable(void);
+void backlight_pcb_disable(void);
+
+void backlight_caps_invert(void);
+void backlight_caps_enable(void);
+void backlight_caps_disable(void);
+
+#endif // BACKLIGHT_H
diff --git a/keyboard/nerd/config.h b/keyboard/nerd/config.h
new file mode 100644
index 0000000000..ac2e6989d6
--- /dev/null
+++ b/keyboard/nerd/config.h
@@ -0,0 +1,49 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6060
+#define DEVICE_VER 0x0001
+#define MANUFACTURER GON
+#define PRODUCT NerD
+#define DESCRIPTION t.m.k. keyboard firmware for NerD
+
+/* key matrix size */
+#define MATRIX_ROWS 9
+#define MATRIX_COLS 10
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 2
+
+/* 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)) \
+)
+
+#endif
diff --git a/keyboard/nerd/keymap_60_ansi150.c b/keyboard/nerd/keymap_60_ansi150.c
new file mode 100644
index 0000000000..f85836ab55
--- /dev/null
+++ b/keyboard/nerd/keymap_60_ansi150.c
@@ -0,0 +1,30 @@
+#include "keymap_common.h"
+#include "backlight.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default */
+ KEYMAP_ANSI150(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
+ ESC, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, \
+ LCTL,LGUI,LALT, SPC, RALT,FN0 ,RCTL),
+ /* Layer 1: Space Fn */
+ KEYMAP_ANSI150(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS, FN1, TRNS,FN0, TRNS),
+ /* Layer 2: Functions */
+ KEYMAP_ANSI150(SLEP,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, MUTE, \
+ TRNS,BTN1,MS_U,BTN3,PSCR,SLCK,PAUS,HOME,INS, END, MPLY,VOLD,VOLU,FN3, \
+ CAPS,MS_L,MS_D,MS_R,PGDN,TRNS,LEFT,DOWN,UP ,RGHT,MPRV,MNXT, FN2, \
+ UP, TRNS,DEL, TRNS,TRNS,PGUP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ LEFT,DOWN,RGHT, TRNS, TRNS,TRNS,TRNS)
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(2),
+ [1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE),
+ [2] = ACTION_LAYER_TOGGLE(1),
+ [3] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_SWITCH)
+};
diff --git a/keyboard/nerd/keymap_80_ansi150.c b/keyboard/nerd/keymap_80_ansi150.c
new file mode 100644
index 0000000000..72a7d83c9b
--- /dev/null
+++ b/keyboard/nerd/keymap_80_ansi150.c
@@ -0,0 +1,33 @@
+#include "keymap_common.h"
+#include "backlight.h"
+
+const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Default */
+ KEYMAP_ANSI150(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,FN0, RCTL, LEFT,DOWN,RGHT),
+ /* Layer 1: Space Fn */
+ KEYMAP_ANSI150(TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ ESC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, FN1, TRNS,FN0, TRNS, TRNS,TRNS,TRNS),
+ /* Layer 2: Functions */
+ KEYMAP_ANSI150(SLEP, MYCM,WSCH,WHOM,MAIL,VOLD,VOLU,MUTE,MSEL,MPLY,MPRV,MNXT,MSTP, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,END, TRNS,TRNS,TRNS,TRNS,TRNS,HOME,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,BTN1,MS_U,BTN3,PSCR,SLCK,TRNS,TRNS,INS, TRNS,TRNS,TRNS,TRNS,FN3, TRNS,TRNS,TRNS, \
+ CAPS,MS_L,MS_D,MS_R,PGDN,TRNS,LEFT,DOWN,UP ,RGHT,TRNS,TRNS, FN2, \
+ TRNS, TRNS,DEL, TRNS,TRNS,PGUP,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(2),
+ [1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE),
+ [2] = ACTION_LAYER_TOGGLE(1),
+ [3] = ACTION_BACKLIGHT_LEVEL(BACKLIGHT_SWITCH)
+};
diff --git a/keyboard/nerd/keymap_common.c b/keyboard/nerd/keymap_common.c
new file mode 100644
index 0000000000..29ec4e53ef
--- /dev/null
+++ b/keyboard/nerd/keymap_common.c
@@ -0,0 +1,29 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+#include "keymap_common.h"
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
+}
diff --git a/keyboard/nerd/keymap_common.h b/keyboard/nerd/keymap_common.h
new file mode 100644
index 0000000000..e116635918
--- /dev/null
+++ b/keyboard/nerd/keymap_common.h
@@ -0,0 +1,89 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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 KEYMAP_COMMON_H
+#define KEYMAP_COMMON_H
+
+#include <stdint.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+extern const uint16_t fn_actions[];
+
+#define KEYMAP( \
+ K08, K09, K18, K19, K28, K29, K38, K39, K48, K49, K58, K59, K68, K69, K88, K89, \
+ K00, K01, K10, K11, K20, K21, K30, K31, K40, K41, K50, K51, K60, K61, K80, K81, K84, \
+ K02, K03, K12, K13, K22, K23, K32, K33, K42, K43, K52, K53, K62, K63, K82, K83, K85, \
+ K04, K14, K15, K24, K25, K34, K35, K44, K45, K54, K55, K64, K71, K65, \
+ K07, K79, K16, K17, K26, K27, K36, K37, K46, K47, K56, K57, K66, K67, K86, \
+ K06, K05, K78, K70, K72, K73, K74, K75, K76, K77, K87 \
+) { \
+ { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09 }, \
+ { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19 }, \
+ { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29 }, \
+ { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39 }, \
+ { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49 }, \
+ { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, KC_##K58, KC_##K59 }, \
+ { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_##K68, KC_##K69 }, \
+ { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, KC_##K78, KC_##K79 }, \
+ { KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86, KC_##K87, KC_##K88, KC_##K89 } \
+}
+
+#ifdef NERD_LAYOUT_60
+ #define KEYMAP_ANSI150( \
+ K08, K01, K10, K11, K20, K21, K30, K31, K40, K41, K50, K51, K60, K61, \
+ K02, K03, K12, K13, K22, K23, K32, K33, K42, K43, K52, K53, K62, K63, \
+ K04, K14, K15, K24, K25, K34, K35, K44, K45, K54, K55, K64, K65, \
+ K07, K16, K17, K26, K27, K36, K37, K46, K47, K56, K57, K66, \
+ K06, K05, K78, K70, K73, K74, K75 \
+ ) KEYMAP( \
+ K08, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, \
+ NO, K01, K10, K11, K20, K21, K30, K31, K40, K41, K50, K51, K60, K61, NO, NO, NO, \
+ K02, K03, K12, K13, K22, K23, K32, K33, K42, K43, K52, K53, K62, K63, NO, NO, NO, \
+ K04, K14, K15, K24, K25, K34, K35, K44, K45, K54, K55, K64, NO, K65, \
+ K07, NO, K16, K17, K26, K27, K36, K37, K46, K47, K56, K57, K66, NO, NO, \
+ K06, K05, K78, K70, NO, K73, K74, K75, NO, NO, NO \
+ )
+#endif
+
+#ifdef NERD_LAYOUT_80
+ #define KEYMAP_ANSI150( \
+ K08, K09, K18, K19, K28, K29, K38, K39, K48, K49, K58, K59, K68, K69, K88, K89, \
+ K00, K01, K10, K11, K20, K21, K30, K31, K40, K41, K50, K51, K60, K61, K80, K81, K84, \
+ K02, K03, K12, K13, K22, K23, K32, K33, K42, K43, K52, K53, K62, K63, K82, K83, K85, \
+ K04, K14, K15, K24, K25, K34, K35, K44, K45, K54, K55, K64, K65, \
+ K07, K16, K17, K26, K27, K36, K37, K46, K47, K56, K57, K66, K86, \
+ K06, K05, K78, K70, K73, K74, K75, K76, K77, K87 \
+ ) KEYMAP( \
+ K08, K09, K18, K19, K28, K29, K38, K39, K48, K49, K58, K59, K68, K69, K88, K89, \
+ K00, K01, K10, K11, K20, K21, K30, K31, K40, K41, K50, K51, K60, K61, K80, K81, K84, \
+ K02, K03, K12, K13, K22, K23, K32, K33, K42, K43, K52, K53, K62, K63, K82, K83, K85, \
+ K04, K14, K15, K24, K25, K34, K35, K44, K45, K54, K55, K64, NO, K65, \
+ K07, NO, K16, K17, K26, K27, K36, K37, K46, K47, K56, K57, K66, NO, K86, \
+ K06, K05, K78, K70, NO, K73, K74, K75, K76, K77, K87 \
+ )
+#endif
+
+#endif // KEYMAP_COMMON_H
diff --git a/keyboard/nerd/matrix.c b/keyboard/nerd/matrix.c
new file mode 100644
index 0000000000..eb5a9ab4f1
--- /dev/null
+++ b/keyboard/nerd/matrix.c
@@ -0,0 +1,221 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+
+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/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "backlight.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint16_t read_inputs(void);
+static void init_inputs(void);
+static void init_outputs(void);
+static void reset_inputs(void);
+static void reset_outputs(void);
+static void select_output(uint8_t col);
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ backlight_init_ports();
+ init_inputs();
+ init_outputs();
+
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ reset_inputs();
+ reset_outputs();
+ select_output(col);
+ _delay_us(3);
+ uint16_t rows = read_inputs();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+static void init_inputs(void)
+{
+ DDRE &= ~0b01000000; // PE6 (Col 0)
+ DDRB &= ~0b00001111; // PB0 (Col 1), PB1 (Col 2), PB2 (Col 3), PB3 (Col 4)
+ DDRF &= ~0b00000001; // PF0 (Col 5)
+ DDRD &= ~0b00100011; // PD0 (Col 6), PD1 (Col 8 TKL), PD5 (Col 7)
+}
+
+static uint16_t read_inputs(void)
+{
+ return (PINE&(1<<6) ? 0 : (1<<0)) | // PE6 (Col 0)
+ (PINB&(1<<0) ? 0 : (1<<1)) | // PB0 (Col 1)
+ (PINB&(1<<1) ? 0 : (1<<2)) | // PB1 (Col 2)
+ (PINB&(1<<2) ? 0 : (1<<3)) | // PB2 (Col 3)
+ (PINB&(1<<3) ? 0 : (1<<4)) | // PB3 (Col 4)
+ (PINF&(1<<0) ? 0 : (1<<5)) | // PF0 (Col 5)
+ (PIND&(1<<0) ? 0 : (1<<6)) | // PD0 (Col 6)
+ (PIND&(1<<5) ? 0 : (1<<7)) | // PD5 (Col 7)
+ (PIND&(1<<1) ? 0 : (1<<8)); // PD1 (Col 8 TKL)
+}
+
+static void reset_inputs(void)
+{
+ PORTE |= 0b01000000; // PE6 (Col 0)
+ PORTB |= 0b00001111; // PB0 (Col 1), PB1 (Col 2), PB2 (Col 3), PB3 (Col 4)
+ PORTF |= 0b00000001; // PF0 (Col 5)
+ PORTD |= 0b00100011; // PD0 (Col 6), PD1 (Col 8 TKL), PD5 (Col 7)
+}
+
+static void init_outputs(void)
+{
+ DDRB |= 0b00010000; // PB4 (Row 0)
+ DDRE |= 0b00000100; // PE2 (Row 1)
+ DDRF |= 0b11110010; // PF4 (Row 2), PF7 (Row 3), PF1 (Row 4), PF6 (Row 5), PF5 (Row 7)
+ DDRC |= 0b11000000; // PC6 (Row 6), PC7 (Row 9)
+ DDRD |= 0b10000000; // PD7 (Row 8)
+}
+
+static void reset_outputs(void)
+{
+ PORTB |= 0b00010000; // PB4 (Row 0)
+ PORTE |= 0b00000100; // PE2 (Row 1)
+ PORTF |= 0b11110010; // PF4 (Row 2), PF7 (Row 3), PF1 (Row 4), PF6 (Row 5), PF5 (Row 7)
+ PORTC |= 0b11000000; // PC6 (Row 6), PC7 (Row 9)
+ PORTD |= 0b10000000; // PD7 (Row 8)
+}
+
+static void select_output(uint8_t col)
+{
+ switch (col) {
+ case 0:
+ PORTB &= ~(1<<4);
+ break;
+ case 1:
+ PORTE &= ~(1<<2);
+ break;
+ case 2:
+ PORTF &= ~(1<<4);
+ break;
+ case 3:
+ PORTF &= ~(1<<7);
+ break;
+ case 4:
+ PORTF &= ~(1<<1);
+ break;
+ case 5:
+ PORTF &= ~(1<<6);
+ break;
+ case 6:
+ PORTC &= ~(1<<6);
+ break;
+ case 7:
+ PORTF &= ~(1<<5);
+ break;
+ case 8:
+ PORTD &= ~(1<<7);
+ break;
+ case 9:
+ PORTC &= ~(1<<7);
+ break;
+ }
+}
diff --git a/keyboard/onekey/Makefile b/keyboard/onekey/Makefile
new file mode 100644
index 0000000000..0b54e7d25c
--- /dev/null
+++ b/keyboard/onekey/Makefile
@@ -0,0 +1,132 @@
+#----------------------------------------------------------------------------
+# 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 = onekey_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+#PS2_USE_BUSYWAIT = yes # uses primitive reference code
+#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/onekey/Makefile.pjrc b/keyboard/onekey/Makefile.pjrc
new file mode 100644
index 0000000000..ebf0710f73
--- /dev/null
+++ b/keyboard/onekey/Makefile.pjrc
@@ -0,0 +1,103 @@
+#----------------------------------------------------------------------------
+# 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 = onekey_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# project specific files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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 = atmega32u4
+#MCU = at90usb1286
+
+
+# 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
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Build Options
+# comment out to disable the options.
+#
+#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+#EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+#COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+
+PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+PS2_USE_BUSYWAIT = yes # uses primitive reference code
+#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
+#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/protocol.mk
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/rules.mk
diff --git a/keyboard/onekey/README.md b/keyboard/onekey/README.md
new file mode 100644
index 0000000000..7413f3880e
--- /dev/null
+++ b/keyboard/onekey/README.md
@@ -0,0 +1,5 @@
+Onekey
+======
+Just one key keyboard for example. It sends 'a' key if pins PB0 and PB1 are short-circuited.
+
+https://github.com/tmk/tmk_keyboard/issues/56
diff --git a/keyboard/onekey/config.h b/keyboard/onekey/config.h
new file mode 100644
index 0000000000..bf1d2b1ed3
--- /dev/null
+++ b/keyboard/onekey/config.h
@@ -0,0 +1,156 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x1111
+#define DEVICE_VER 0x0001
+#define MANUFACTURER geekhack
+#define PRODUCT Onekey
+#define DESCRIPTION t.m.k. keyboard firmware for Onekey
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 1
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* 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
+
+
+/* PS/2 mouse */
+#ifdef PS2_USE_BUSYWAIT
+# define PS2_CLOCK_PORT PORTD
+# define PS2_CLOCK_PIN PIND
+# define PS2_CLOCK_DDR DDRD
+# define PS2_CLOCK_BIT 1
+# define PS2_DATA_PORT PORTD
+# define PS2_DATA_PIN PIND
+# define PS2_DATA_DDR DDRD
+# define PS2_DATA_BIT 2
+#endif
+
+
+/* PS/2 mouse interrupt version */
+#ifdef PS2_USE_INT
+/* uses INT1 for clock line(ATMega32U4) */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 1
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+
+#define PS2_INT_INIT() do { \
+ EICRA |= ((1<<ISC11) | \
+ (0<<ISC10)); \
+} while (0)
+#define PS2_INT_ON() do { \
+ EIMSK |= (1<<INT1); \
+} while (0)
+#define PS2_INT_OFF() do { \
+ EIMSK &= ~(1<<INT1); \
+} while (0)
+#define PS2_INT_VECT INT1_vect
+#endif
+
+
+/* PS/2 mouse USART version */
+#ifdef PS2_USE_USART
+#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
+/* XCK for clock line and RXD for data line */
+#define PS2_CLOCK_PORT PORTD
+#define PS2_CLOCK_PIN PIND
+#define PS2_CLOCK_DDR DDRD
+#define PS2_CLOCK_BIT 5
+#define PS2_DATA_PORT PORTD
+#define PS2_DATA_PIN PIND
+#define PS2_DATA_DDR DDRD
+#define PS2_DATA_BIT 2
+
+/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
+/* set DDR of CLOCK as input to be slave */
+#define PS2_USART_INIT() do { \
+ PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
+ PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
+ UCSR1C = ((1 << UMSEL10) | \
+ (3 << UPM10) | \
+ (0 << USBS1) | \
+ (3 << UCSZ10) | \
+ (0 << UCPOL1)); \
+ UCSR1A = 0; \
+ UBRR1H = 0; \
+ UBRR1L = 0; \
+} while (0)
+#define PS2_USART_RX_INT_ON() do { \
+ UCSR1B = ((1 << RXCIE1) | \
+ (1 << RXEN1)); \
+} while (0)
+#define PS2_USART_RX_POLL_ON() do { \
+ UCSR1B = (1 << RXEN1); \
+} while (0)
+#define PS2_USART_OFF() do { \
+ UCSR1C = 0; \
+ UCSR1B &= ~((1 << RXEN1) | \
+ (1 << TXEN1)); \
+} while (0)
+#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
+#define PS2_USART_RX_DATA UDR1
+#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
+#define PS2_USART_RX_VECT USART1_RX_vect
+#endif
+#endif
+
+#endif
diff --git a/keyboard/onekey/keymap.c b/keyboard/onekey/keymap.c
new file mode 100644
index 0000000000..dce4e9191e
--- /dev/null
+++ b/keyboard/onekey/keymap.c
@@ -0,0 +1,66 @@
+/*
+Copyright 2012,2013 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/>.
+*/
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "print.h"
+#include "debug.h"
+#include "keymap.h"
+
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ {{KC_A}},
+};
+
+/*
+ * Fn action definition
+ */
+static const uint16_t PROGMEM fn_actions[] = {
+};
+
+
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/onekey/led.c b/keyboard/onekey/led.c
new file mode 100644
index 0000000000..2d52fbf1c3
--- /dev/null
+++ b/keyboard/onekey/led.c
@@ -0,0 +1,25 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "stdint.h"
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+}
diff --git a/keyboard/onekey/matrix.c b/keyboard/onekey/matrix.c
new file mode 100644
index 0000000000..29df868321
--- /dev/null
+++ b/keyboard/onekey/matrix.c
@@ -0,0 +1,176 @@
+/*
+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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ debug_matrix = true;
+ debug_mouse = true;
+ // initialize row and col
+ unselect_rows();
+ init_cols();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i] != cols) {
+ matrix_debouncing[i] = cols;
+ if (debouncing) {
+ debug("bounce!: "); debug_hex(debouncing); debug("\n");
+ }
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+/* Column pin configuration
+ * col: 0
+ * pin: B0
+ */
+static void init_cols(void)
+{
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRB &= ~(1<<0);
+ PORTB |= (1<<0);
+}
+
+static matrix_row_t read_cols(void)
+{
+ return (PINB&(1<<0) ? 0 : (1<<0));
+}
+
+/* Row pin configuration
+ * row: 0
+ * pin: B1
+ */
+static void unselect_rows(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRB &= ~0b00000010;
+ PORTB &= ~0b00000010;
+}
+
+static void select_row(uint8_t row)
+{
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 0:
+ DDRB |= (1<<1);
+ PORTB &= ~(1<<1);
+ break;
+ }
+}
diff --git a/keyboard/phantom/Makefile.lufa b/keyboard/phantom/Makefile.lufa
new file mode 100644
index 0000000000..a0b3b1444d
--- /dev/null
+++ b/keyboard/phantom/Makefile.lufa
@@ -0,0 +1,137 @@
+#----------------------------------------------------------------------------
+# 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 = phantom_lufa
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+
+# List C source files here. (C dependencies are automatically generated.)
+SRC += keymap.c \
+ matrix.c \
+ led.c
+
+CONFIG_H = config.h
+
+
+# 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)
+
+
+# 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
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOTLOADER_SIZE=512
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/lufa.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+ansi_150: OPT_DEFS += -DLAYOUT_ANSI_150
+ansi_150: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+iso_150: OPT_DEFS += -DLAYOUT_ISO_150
+iso_150: all
+
+7bit: OPT_DEFS += -DLAYOUT_7BIT
+7bit: all
diff --git a/keyboard/phantom/Makefile.pjrc b/keyboard/phantom/Makefile.pjrc
new file mode 100644
index 0000000000..7bf5f80f40
--- /dev/null
+++ b/keyboard/phantom/Makefile.pjrc
@@ -0,0 +1,108 @@
+#----------------------------------------------------------------------------
+# 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 = phantom_pjrc
+
+# Directory common source filess exist
+TMK_DIR = ../../tmk_core
+
+# Directory keyboard dependent files exist
+TARGET_DIR = .
+
+# keyboard dependent files
+SRC = keymap.c \
+ matrix.c \
+ led.c
+
+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(+1000)
+#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
+CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TMK_DIR)
+
+include $(TMK_DIR)/protocol/pjrc.mk
+include $(TMK_DIR)/common.mk
+include $(TMK_DIR)/rules.mk
+
+ansi: OPT_DEFS += -DLAYOUT_ANSI
+ansi: all
+
+ansi_150: OPT_DEFS += -DLAYOUT_ANSI_150
+ansi_150: all
+
+iso: OPT_DEFS += -DLAYOUT_ISO
+iso: all
+
+iso_150: OPT_DEFS += -DLAYOUT_ISO_150
+iso_150: all
+
+7bit: OPT_DEFS += -DLAYOUT_7BIT
+7bit: all
diff --git a/keyboard/phantom/README.md b/keyboard/phantom/README.md
new file mode 100644
index 0000000000..368ae97e85
--- /dev/null
+++ b/keyboard/phantom/README.md
@@ -0,0 +1,248 @@
+Phantom keyboard firmware
+======================
+DIY keyboard developed by Geekhack and Deskthority communities.
+The PCB was engineered by bpiphany from the original idea of HaveANiceDay.
+
+## Wiki on Deskthority.net
+- [Info](http://deskthority.net/wiki/Phantom)
+- [Assembly Instructions](http://deskthority.net/wiki/Phantom)
+
+
+Build
+-----
+Move to this directory then just run `make` like:
+
+ $ make -f Makefile.[pjrc|lufa] [ansi|ansi_150|iso|iso_150|7bit]
+
+Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack.
+
+
+LEDs
+----
+It is possible to configure the LEDs in 2 different ways.
+
+### 1. LED Brightness
+The brightness of the LEDs can be controlled by software.
+
+To select brightness edit [config.h](config.h) and set `LED_BRIGHTNESS` to a value
+between 0 and 255:
+
+ #define LED_BRIGHTNESS 250
+
+
+### 2. Sleep LED
+It is possible to have the LEDs fade in and out when the computer is suspended.
+
+To enable this feature, uncomment the `SLEEP_LED_ENABLE` line in the makefile you are using:
+
+ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+
+*Note that this will set the LEDs to full brightness as this feature can't be combined with the brightness control.*
+
+
+Keymap
+------
+The PCB supports multiple physical layouts.
+Each layout have their own keymap file.
+
+*Note that only the ANSI keymap is tested on actual hardware.*
+
+To customize a keymap:
+
+1. Edit the file that corresponds to your layout.
+2. Specify your layout when building.
+
+See [keymap.c](keymap.c) to define your own custom layout.
+
+
+### 1. ANSI
+This is the default keymap.
+
+See [keymap_ansi.h](keymap_ansi.h) for detail.
+
+#### 1.0. ANSI Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 1.1. ANSI Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 2. ANSI 150
+Layout with 1.5 unit modifiers.
+
+See [keymap_ansi_150.h](keymap_ansi_150.h) for detail.
+
+#### 2.0. ANSI 150 Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
+ |-----------------------------------------------------------| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '|Return |
+ |-----------------------------------------------------------| ,---.
+ |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl |Gui|Alt | Space |Alt |Gui|Ctl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 2.1. ANSI 150 Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| '-----------'
+ | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 3. ISO
+ISO layout.
+
+See [keymap_iso.h](keymap_iso.h) for detail.
+
+#### 3.0. ISO Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del|End|PgD|
+ |------------------------------------------------------` Ret| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| #| |
+ |-----------------------------------------------------------| ,---.
+ |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 3.1. ISO Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt| | | | | |
+ |------------------------------------------------------` Med| '-----------'
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 4. ISO 150
+ISO layout with 1.5 unit modifiers.
+
+See [keymap_iso_150.h](keymap_iso_150.h) for detail.
+
+#### 4.0. ISO 150 Default Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del|End|PgD|
+ |------------------------------------------------------` Ret| '-----------'
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| #| |
+ |-----------------------------------------------------------| ,---.
+ |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
+ |-----------------------------------------------------------| ,-----------.
+ |Ctl |Gui|Alt | Space |Alt |Gui|Ctl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 4.1. ISO 150 Media Layer
+ ,---. ,---------------. ,---------------. ,---------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | | |Slp|
+ `---' `---------------' `---------------' `---------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt| | | | | |
+ |------------------------------------------------------` Med| '-----------'
+ | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| ,---.
+ | | | | |Clc| | | | | | | |Caps | | |
+ |-----------------------------------------------------------| ,-----------.
+ | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
+
+
+### 5. 7bit
+Layout using all the available keys on the PCB.
+
+This keymap is only provided as an example of what can be done using this layout.
+No real thought has been put into this keymap.
+
+See [keymap_7bit.h](keymap_7bit.h) for detail.
+
+#### 5.0. 7bit Default Layer
+ ,-----------------------------------------------------------. ,-----------.
+ |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|V- |V+ | |PrS|ScL|Pau|
+ `-----------------------------------------------------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| (| )| |Ins|Hom|PgU|
+ |-----------------------------------------------------------| |-----------|
+ |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| |Del|End|PgD|
+ |-----------------------------------------------------------| |-----------|
+ |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| \| Ret| |Stp|Ply|Med|
+ |-----------------------------------------------------------| |-----------|
+ |Cap|Shif| Z| X| C| V| B| N| M| ,| .| /|Shift |Cap| |Prv|Up |Nxt|
+ |-----------------------------------------------------------| |-----------|
+ |Ctrl |Gui|Alt |Spc |Bspc |Del|Ret |Alt |Gui |App|Ctrl | |Lef|Dow|Rig|
+ `-----------------------------------------------------------' `-----------'
+
+#### 5.1. 7bit Media Layer
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | | | | | | | | | |Slp|
+ `-----------------------------------------------------------' `-----------'
+ ,-----------------------------------------------------------. ,-----------.
+ | | | | | | | | | | |Mut|V- |V+ | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | |Stp|Ply|Prv|Nxt|Media| | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | | | | |
+ |-----------------------------------------------------------| |-----------|
+ | | | | | | | | | | | | | | | |
+ `-----------------------------------------------------------' `-----------'
diff --git a/keyboard/phantom/config.h b/keyboard/phantom/config.h
new file mode 100644
index 0000000000..6f5389336e
--- /dev/null
+++ b/keyboard/phantom/config.h
@@ -0,0 +1,51 @@
+/*
+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
+
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6057
+#define DEVICE_VER 0x0001
+#define MANUFACTURER t.m.k.
+#define PRODUCT Phantom
+
+/* message strings */
+#define DESCRIPTION t.m.k. keyboard firmware for Phantom
+
+/* matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 17
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* Set 0 if need no debouncing */
+#define DEBOUNCE 7
+
+/* Set LED brightness 0-255.
+ * This have no effect if sleep LED is enabled. */
+#define LED_BRIGHTNESS 250
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#endif
diff --git a/keyboard/phantom/keymap.c b/keyboard/phantom/keymap.c
new file mode 100644
index 0000000000..a040434f24
--- /dev/null
+++ b/keyboard/phantom/keymap.c
@@ -0,0 +1,151 @@
+/*
+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/>.
+*/
+
+/*
+ * Keymap for Phantom controller
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/pgmspace.h>
+#include "keycode.h"
+#include "action.h"
+#include "action_macro.h"
+#include "report.h"
+#include "host.h"
+#include "debug.h"
+#include "keymap.h"
+
+// Convert physical keyboard layout to matrix array.
+// This is a macro to define keymap easily in keyboard layout form.
+#define KEYMAP( \
+ K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, K2P, K2Q, K2R, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, K1P, K1Q, K1R, \
+ K0A, K0B, K0C, K0D, K0F, K0G, K0H, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) { \
+/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ \
+/* 5 */ { KC_##K5A, KC_##K4A, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F, KC_##K5H, KC_##K5I, KC_##K5J, KC_##K5K, KC_##K5L, KC_##K5M, KC_##K5N, KC_##K5O, KC_##K5P, KC_##K5Q, KC_##K5R}, \
+/* 4 */ { KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F, KC_##K4G, KC_##K4H, KC_##K4I, KC_##K4J, KC_##K4K, KC_##K4L, KC_##K4M, KC_##K4N, KC_##K4O, KC_##K4P, KC_##K4Q, KC_##K4R}, \
+/* 3 */ { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F, KC_##K3G, KC_##K3H, KC_##K3I, KC_##K3J, KC_##K3K, KC_##K3L, KC_##K3M, KC_##K3N, KC_##K3P, KC_##K3Q, KC_##K3R}, \
+/* 2 */ { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F, KC_##K2G, KC_##K2H, KC_##K2I, KC_##K2J, KC_##K2K, KC_##K2L, KC_##K2M, KC_##K2N, KC_##K2P, KC_##K2Q, KC_##K2R}, \
+/* 1 */ { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F, KC_##K1G, KC_##K1H, KC_##K1I, KC_##K1J, KC_##K1K, KC_##K1L, KC_##K1M, KC_##K1N, KC_##K1P, KC_##K1Q, KC_##K1R}, \
+/* 0 */ { KC_##K0A, KC_##K0B, KC_##K0C, KC_##K5B, KC_##K0D, KC_##K0F, KC_##K5G, KC_##K0G, KC_##K0H, KC_NO, KC_##K0K, KC_##K0L, KC_##K0M, KC_##K0N, KC_##K0P, KC_##K0Q, KC_##K0R} \
+}
+
+#define KEYMAP_ANSI( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, NO, NO, NO, \
+ K1A, NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ANSI_150( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2N, \
+ K1A, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, NO, K2N, NO, NO, NO, \
+ K1A, NO, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, NO, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ISO( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, NO, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, NO, NO, NO, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, K0K, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#define KEYMAP_ISO_150( \
+ K5A, K5C, K5D, K5E, K5F, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1N, K1Q, \
+ K0A, K0B, K0C, K0G, K0L, K0M, K0N, K0P, K0Q, K0R \
+) KEYMAP( \
+ K5A, NO, K5C, K5D, K5E, K5F, NO, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, K5Q, K5R, \
+ K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, NO, K4O, K4P, K4Q, K4R, \
+ K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, NO, K3P, K3Q, K3R, \
+ K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, NO, NO, NO, \
+ K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, NO, K1N, NO, K1Q, NO, \
+ K0A, K0B, K0C, NO, NO, K0G, NO, NO, K0L, K0M, K0N, K0P, K0Q, K0R \
+)
+
+#if defined(LAYOUT_7BIT)
+ #include "keymap_7bit.h"
+#elif defined(LAYOUT_ISO_150)
+ #include "keymap_iso_150.h"
+#elif defined(LAYOUT_ISO)
+ #include "keymap_iso.h"
+#elif defined(LAYOUT_ANSI_150)
+ #include "keymap_ansi_150.h"
+#else
+ #include "keymap_ansi.h"
+#endif
+
+#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
+#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
+
+/* translates key to keycode */
+uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
+{
+ if (layer < KEYMAPS_SIZE) {
+ return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
+ } else {
+ // fall back to layer 0
+ return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
+ }
+}
+
+/* translates Fn keycode to action */
+action_t keymap_fn_to_action(uint8_t keycode)
+{
+ action_t action;
+ if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
+ action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ } else {
+ action.code = ACTION_NO;
+ }
+ return action;
+}
diff --git a/keyboard/phantom/keymap_7bit.h b/keyboard/phantom/keymap_7bit.h
new file mode 100644
index 0000000000..e6c4eabb22
--- /dev/null
+++ b/keyboard/phantom/keymap_7bit.h
@@ -0,0 +1,42 @@
+// Phantom 7bit
+/*
+ * 7bit:
+ *
+ * ,-----------------------------------------------------------. ,-----------.
+ * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|V- |V+ | |PrS|ScL|Pau|
+ * `-----------------------------------------------------------' `-----------'
+ * ,-----------------------------------------------------------. ,-----------.
+ * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| (| )| |Ins|Hom|PgU|
+ * |-----------------------------------------------------------| |-----------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs| |Del|End|PgD|
+ * |-----------------------------------------------------------| |-----------|
+ * |Fn0 | A| S| D| F| G| H| J| K| L| ;| '| \| Ret| |MSt|Ply|Med|
+ * |-----------------------------------------------------------| |-----------|
+ * |Cap|Shif| Z| X| C| V| B| N| M| ,| .| /|Shift |Cap| |Prv|Up |Nxt|
+ * |-----------------------------------------------------------| |-----------|
+ * |Ctrl |Gui|Alt |Spc |Bspc |Del|Ret |Alt |Gui |App|Ctrl | |Lef|Dow|Rig|
+ * `-----------------------------------------------------------' `-----------'
+ */
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty + a few media keys */
+ KEYMAP(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, VOLD,VOLU, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, FN1, FN2, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS,ENT, MSTP,MPLY,MSEL, \
+ CAPS,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,CAPS, MPRV,UP, MNXT, \
+ LCTL,LGUI,LALT,SPC, BSPC,DEL, ENT, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP(\
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1),
+ [1] = ACTION_MODS_KEY(MOD_LSFT, KC_9),
+ [2] = ACTION_MODS_KEY(MOD_LSFT, KC_0)
+};
diff --git a/keyboard/phantom/keymap_ansi.h b/keyboard/phantom/keymap_ansi.h
new file mode 100644
index 0000000000..96a4c9dfb3
--- /dev/null
+++ b/keyboard/phantom/keymap_ansi.h
@@ -0,0 +1,22 @@
+// Phantom ANSI
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP_ANSI(\
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/phantom/keymap_ansi_150.h b/keyboard/phantom/keymap_ansi_150.h
new file mode 100644
index 0000000000..7fdb9eb19a
--- /dev/null
+++ b/keyboard/phantom/keymap_ansi_150.h
@@ -0,0 +1,22 @@
+// Phantom ANSI 150
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ANSI_150(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
+ LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP_ANSI_150(\
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
+ TRNS, TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/phantom/keymap_iso.h b/keyboard/phantom/keymap_iso.h
new file mode 100644
index 0000000000..970f622eee
--- /dev/null
+++ b/keyboard/phantom/keymap_iso.h
@@ -0,0 +1,22 @@
+// Phantom ISO
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ISO(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS,ENT, \
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP_ISO(\
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/phantom/keymap_iso_150.h b/keyboard/phantom/keymap_iso_150.h
new file mode 100644
index 0000000000..ab9acda1c0
--- /dev/null
+++ b/keyboard/phantom/keymap_iso_150.h
@@ -0,0 +1,22 @@
+// Phantom ISO 150
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: qwerty */
+ KEYMAP_ISO_150(\
+ ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, \
+ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, \
+ FN0, A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS,ENT, \
+ LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, \
+ LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL, LEFT,DOWN,RGHT),
+ /* 1: media keys */
+ KEYMAP_ISO_150(\
+ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
+ TRNS,TRNS,TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \
+ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS)
+};
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(1)
+};
diff --git a/keyboard/phantom/led.c b/keyboard/phantom/led.c
new file mode 100644
index 0000000000..41582b6aaf
--- /dev/null
+++ b/keyboard/phantom/led.c
@@ -0,0 +1,49 @@
+/*
+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/>.
+*/
+
+#include <avr/io.h>
+#include "led.h"
+
+
+void led_set(uint8_t usb_led)
+{
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ // Output high.
+ DDRB |= (1<<6);
+ PORTB |= (1<<6);
+ }
+ else
+ {
+ // Output low.
+ DDRB &= ~(1<<6);
+ PORTB &= ~(1<<6);
+ }
+
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ {
+ // Output high.
+ DDRB |= (1<<7);
+ PORTB |= (1<<7);
+ }
+ else
+ {
+ // Output low.
+ DDRB &= ~(1<<7);
+ PORTB &= ~(1<<7);
+ }
+}
diff --git a/keyboard/phantom/matrix.c b/keyboard/phantom/matrix.c
new file mode 100644
index 0000000000..6c3ae49c3a
--- /dev/null
+++ b/keyboard/phantom/matrix.c
@@ -0,0 +1,274 @@
+/* Copyright 2012 Jun Wako <wakojun@gmail.com>
+ *
+ * This is heavily based on phantom/board.{c|h}.
+ * https://github.com/BathroomEpiphanies/AVR-Keyboard
+ *
+ * Copyright (c) 2012 Fredrik Atmer, Bathroom Epiphanies Inc
+ * http://bathroomepiphanies.com
+ *
+ * As for liscensing consult with the original files or its author.
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 0
+#endif
+static uint8_t debouncing = DEBOUNCE;
+
+// bit array of key state(1:on, 0:off)
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static uint8_t read_rows(void);
+static void init_rows(void);
+static void unselect_cols(void);
+static void select_col(uint8_t col);
+
+#ifndef SLEEP_LED_ENABLE
+/* LEDs are on output compare pins OC1B OC1C
+ This activates fast PWM mode on them.
+ Prescaler 256 and 8-bit counter results in
+ 16000000/256/256 = 244 Hz blink frequency.
+ LED_A: Caps Lock
+ LED_B: Scroll Lock */
+/* Output on PWM pins are turned off when the timer
+ reaches the value in the output compare register,
+ and are turned on when it reaches TOP (=256). */
+static
+void setup_leds(void)
+{
+ TCCR1A |= // Timer control register 1A
+ (1<<WGM10) | // Fast PWM 8-bit
+ (1<<COM1B1)| // Clear OC1B on match, set at TOP
+ (1<<COM1C1); // Clear OC1C on match, set at TOP
+ TCCR1B |= // Timer control register 1B
+ (1<<WGM12) | // Fast PWM 8-bit
+ (1<<CS12); // Prescaler 256
+ OCR1B = LED_BRIGHTNESS; // Output compare register 1B
+ OCR1C = LED_BRIGHTNESS; // Output compare register 1C
+ // LEDs: LED_A -> PORTB6, LED_B -> PORTB7
+ DDRB |= (1<<6) | (1<<7);
+ PORTB &= ~((1<<6) | (1<<7));
+}
+#endif
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
+ MCUCR |= (1<<JTD);
+ MCUCR |= (1<<JTD);
+
+ // initialize row and col
+ unselect_cols();
+ init_rows();
+#ifndef SLEEP_LED_ENABLE
+ setup_leds();
+#endif
+
+ // initialize matrix state: all keys off
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-16
+ select_col(col);
+ _delay_us(3); // without this wait it won't read stable value.
+ uint8_t rows = read_rows();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-5
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
+ if (debouncing) {
+ dprint("bounce!: "); dprintf("%02X", debouncing); dprintln();
+ }
+ debouncing = DEBOUNCE;
+ }
+ }
+ unselect_cols();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ xprintf("%02X: %032lb\n", row, bitrev32(matrix_get_row(row)));
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop32(matrix[i]);
+ }
+ return count;
+}
+
+/* Row pin configuration
+ * row: 0 1 2 3 4 5
+ * pin: B5 B4 B3 B2 B1 B0
+ */
+static void init_rows(void)
+{
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRB &= ~0b00111111;
+ PORTB |= 0b00111111;
+}
+
+static uint8_t read_rows(void)
+{
+ return (PINB&(1<<5) ? 0 : (1<<0)) |
+ (PINB&(1<<4) ? 0 : (1<<1)) |
+ (PINB&(1<<3) ? 0 : (1<<2)) |
+ (PINB&(1<<2) ? 0 : (1<<3)) |
+ (PINB&(1<<1) ? 0 : (1<<4)) |
+ (PINB&(1<<0) ? 0 : (1<<5));
+}
+
+/* Column pin configuration
+ * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+ * pin: D5 C7 C6 D4 D0 E6 F0 F1 F4 F5 F6 F7 D7 D6 D1 D2 D3
+ */
+static void unselect_cols(void)
+{
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRC |= 0b11000000; // PC: 7 6
+ PORTC |= 0b11000000;
+ DDRD |= 0b11111111; // PD: 7 6 5 4 3 2 1 0
+ PORTD |= 0b11111111;
+ DDRE |= 0b01000000; // PE: 6
+ PORTE |= 0b01000000;
+ DDRF |= 0b11110011; // PF: 7 6 5 4 1 0
+ PORTF |= 0b11110011;
+}
+
+static void select_col(uint8_t col)
+{
+ // Output low(DDR:1, PORT:0) to select
+ switch (col) {
+ case 0:
+ DDRD |= (1<<5);
+ PORTD &= ~(1<<5);
+ break;
+ case 1:
+ DDRC |= (1<<7);
+ PORTC &= ~(1<<7);
+ break;
+ case 2:
+ DDRC |= (1<<6);
+ PORTC &= ~(1<<6);
+ break;
+ case 3:
+ DDRD |= (1<<4);
+ PORTD &= ~(1<<4);
+ break;
+ case 4:
+ DDRD |= (1<<0);
+ PORTD &= ~(1<<0);
+ break;
+ case 5:
+ DDRE |= (1<<6);
+ PORTE &= ~(1<<6);
+ break;
+ case 6:
+ DDRF |= (1<<0);
+ PORTF &= ~(1<<0);
+ break;
+ case 7:
+ DDRF |= (1<<1);
+ PORTF &= ~(1<<1);
+ break;
+ case 8:
+ DDRF |= (1<<4);
+ PORTF &= ~(1<<4);
+ break;
+ case 9:
+ DDRF |= (1<<5);
+ PORTF &= ~(1<<5);
+ break;
+ case 10:
+ DDRF |= (1<<6);
+ PORTF &= ~(1<<6);
+ break;
+ case 11:
+ DDRF |= (1<<7);
+ PORTF &= ~(1<<7);
+ break;
+ case 12:
+ DDRD |= (1<<7);
+ PORTD &= ~(1<<7);
+ break;
+ case 13:
+ DDRD |= (1<<6);
+ PORTD &= ~(1<<6);
+ break;
+ case 14:
+ DDRD |= (1<<1);
+ PORTD &= ~(1<<1);
+ break;
+ case 15:
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<2);
+ break;
+ case 16:
+ DDRD |= (1<<3);
+ PORTD &= ~(1<<3);
+ break;
+ }
+}
diff --git a/tmk_core/.gitignore b/tmk_core/.gitignore
new file mode 100644
index 0000000000..f3f46872a0
--- /dev/null
+++ b/tmk_core/.gitignore
@@ -0,0 +1,13 @@
+.dep
+*.o
+*.eep
+*.elf
+*.hex
+*.lss
+*.lst
+*.map
+*.sym
+tags
+*~
+build/
+*.bak
diff --git a/tmk_core/.gitmodules b/tmk_core/.gitmodules
new file mode 100644
index 0000000000..e21f449613
--- /dev/null
+++ b/tmk_core/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "protocol/lufa/LUFA-git"]
+ path = protocol/lufa/LUFA-git
+ url = https://github.com/abcminiuser/lufa.git
+[submodule "protocol/usb_hid/USB_Host_Shield_2.0"]
+ path = protocol/usb_hid/USB_Host_Shield_2.0
+ url = https://github.com/felis/USB_Host_Shield_2.0.git
diff --git a/tmk_core/README.md b/tmk_core/README.md
new file mode 100644
index 0000000000..6b6714a6a2
--- /dev/null
+++ b/tmk_core/README.md
@@ -0,0 +1,146 @@
+TMK Keyboard Firmware Core Library
+==================================
+This is a keyboard firmware library with some useful features for Atmel AVR and Cortex-M.
+
+Source code is available here: <https://github.com/tmk/tmk_keyboard/tree/core>
+
+
+Features
+--------
+These features can be used in your keyboard.
+
+* Multi-layer Keymap - Multiple keyboard layouts with layer switching
+* Mouse key - Mouse control with keyboard
+* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up
+* Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc
+* USB NKRO - 120 keys(+ 8 modifiers) simultaneously
+* PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device
+* Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols
+* User Function - Customizable function of key with writing code
+* Macro - Very primitive at this time
+* Keyboard Tricks - Oneshot modifier and modifier with tapping feature
+* Debug Console - Messages for debug and interaction with firmware
+* Virtual DIP Switch - Configurations stored EEPROM(Boot Magic)
+* Locking CapsLock - Mechanical switch support for CapsLock
+* Breathing Sleep LED - Sleep indicator with charm during USB suspend
+* Backlight - Control backlight levels
+
+
+
+Updates
+-------
+2015/04/22 separated with TMK Keyboard Firmware Collection
+
+
+
+TMK Keyboard Firmware Collection
+--------------------------------
+Complete firmwares for various keyboards and protocol converters.
+
+<https://github.com/tmk/tmk_keyboard>
+
+
+
+License
+-------
+**GPLv2** or later. Some protocol files are under **Modified BSD License**.
+LUFA, PJRC and V-USB stack have their own license respectively.
+
+
+
+Build Firmware and Program Controller
+-------------------------------------
+See [doc/build.md](doc/build.md).
+
+
+
+Start Your Own Project
+-----------------------
+**TBD**
+### Config.h Options
+#### 1. USB vendor/product ID and device description
+ #define VENDOR_ID 0xFEED
+ #define PRODUCT_ID 0xBEEF
+ #define MANUFACTURER t.m.k.
+ #define PRODUCT Macway mod
+ #define DESCRIPTION t.m.k. keyboard firmware for Macway mod
+
+#### 2. Keyboard matrix configuration
+ #define MATRIX_ROWS 8
+ #define MATRIX_COLS 8
+ #define MATRIX_HAS_GHOST
+
+
+
+Architecture
+------------
+ Architecture Diagram
+ +---------------+---------------+-------------+
+ | Host | Keyboard | Matrix, LED |
+ ___________ |-----------+-+ +-------------+ | +-----------|
+ / /| Keys/Mouse | Protocol |d| | Action | | | Protocol |
+ /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix |
+ |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________
+ || || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /|
+ || Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
+ ||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / /
+ `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ /
+ |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/
+ +---------------------------------------------+ Keyboard
+
+
+
+Debugging
+--------
+Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
+
+You can use xprintf() to display debug info on `hid_listen`, see `common/xprintf.h`.
+
+
+
+Files and Directories
+-------------------
+### Top
+* common/ - common codes
+* protocol/ - keyboard protocol support
+* doc/ - documents
+* common.mk - Makefile for common
+* protocol.mk - Makefile for protocol
+* rules.mk - Makefile for build rules
+
+### Common
+* host.h
+* host_driver.h
+* keyboard.h
+* command.h
+* keymap.h
+* action.h
+* keycode.h
+* matrix.h
+* led.h
+* mousekey.h
+* report.h
+* debug.h
+* print.h
+* bootloader.h
+* sendchar.h
+* timer.h
+* util.h
+
+### Keyboard Protocols
+* lufa/ - LUFA USB stack
+* pjrc/ - PJRC USB stack
+* vusb/ - Objective Development V-USB
+* iwrap/ - Bluetooth HID for Bluegiga iWRAP
+* ps2.c - PS/2 protocol
+* adb.c - Apple Desktop Bus protocol
+* m0110.c - Macintosh 128K/512K/Plus keyboard protocol
+* news.c - Sony NEWS keyboard protocol
+* x68k.c - Sharp X68000 keyboard protocol
+* serial_soft.c - Asynchronous Serial protocol implemented by software
+
+
+
+Coding Style
+-------------
+- Doesn't use Tab to indent, use 4-spaces instead.
diff --git a/common.mk b/tmk_core/common.mk
index d22adff519..d22adff519 100644
--- a/common.mk
+++ b/tmk_core/common.mk
diff --git a/common/action.c b/tmk_core/common/action.c
index ec8eeae7bc..ec8eeae7bc 100644
--- a/common/action.c
+++ b/tmk_core/common/action.c
diff --git a/common/action.h b/tmk_core/common/action.h
index 8a4736d7bc..8a4736d7bc 100644
--- a/common/action.h
+++ b/tmk_core/common/action.h
diff --git a/common/action_code.h b/tmk_core/common/action_code.h
index bc40e2c6fb..bc40e2c6fb 100644
--- a/common/action_code.h
+++ b/tmk_core/common/action_code.h
diff --git a/common/action_layer.c b/tmk_core/common/action_layer.c
index c535615f44..c535615f44 100644
--- a/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
diff --git a/common/action_layer.h b/tmk_core/common/action_layer.h
index b6da353cfd..b6da353cfd 100644
--- a/common/action_layer.h
+++ b/tmk_core/common/action_layer.h
diff --git a/common/action_macro.c b/tmk_core/common/action_macro.c
index ba93fc8b23..ba93fc8b23 100644
--- a/common/action_macro.c
+++ b/tmk_core/common/action_macro.c
diff --git a/common/action_macro.h b/tmk_core/common/action_macro.h
index aedc32ec6b..aedc32ec6b 100644
--- a/common/action_macro.h
+++ b/tmk_core/common/action_macro.h
diff --git a/common/action_tapping.c b/tmk_core/common/action_tapping.c
index 826c233096..826c233096 100644
--- a/common/action_tapping.c
+++ b/tmk_core/common/action_tapping.c
diff --git a/common/action_tapping.h b/tmk_core/common/action_tapping.h
index 9b42d50dc3..9b42d50dc3 100644
--- a/common/action_tapping.h
+++ b/tmk_core/common/action_tapping.h
diff --git a/common/action_util.c b/tmk_core/common/action_util.c
index dbee630d18..dbee630d18 100644
--- a/common/action_util.c
+++ b/tmk_core/common/action_util.c
diff --git a/common/action_util.h b/tmk_core/common/action_util.h
index a955638b46..a955638b46 100644
--- a/common/action_util.h
+++ b/tmk_core/common/action_util.h
diff --git a/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index cda295b181..cda295b181 100644
--- a/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
diff --git a/common/avr/eeconfig.c b/tmk_core/common/avr/eeconfig.c
index 5bd47dc6ad..5bd47dc6ad 100644
--- a/common/avr/eeconfig.c
+++ b/tmk_core/common/avr/eeconfig.c
diff --git a/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 80243f02bc..80243f02bc 100644
--- a/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
diff --git a/common/avr/suspend_avr.h b/tmk_core/common/avr/suspend_avr.h
index 357102da44..357102da44 100644
--- a/common/avr/suspend_avr.h
+++ b/tmk_core/common/avr/suspend_avr.h
diff --git a/common/avr/timer.c b/tmk_core/common/avr/timer.c
index 292b41c3a6..292b41c3a6 100644
--- a/common/avr/timer.c
+++ b/tmk_core/common/avr/timer.c
diff --git a/common/avr/timer_avr.h b/tmk_core/common/avr/timer_avr.h
index 0e85eb1017..0e85eb1017 100644
--- a/common/avr/timer_avr.h
+++ b/tmk_core/common/avr/timer_avr.h
diff --git a/common/avr/xprintf.S b/tmk_core/common/avr/xprintf.S
index 0cec70ce22..0cec70ce22 100644
--- a/common/avr/xprintf.S
+++ b/tmk_core/common/avr/xprintf.S
diff --git a/common/avr/xprintf.h b/tmk_core/common/avr/xprintf.h
index 59c6f25312..59c6f25312 100644
--- a/common/avr/xprintf.h
+++ b/tmk_core/common/avr/xprintf.h
diff --git a/common/backlight.c b/tmk_core/common/backlight.c
index 558ad9b014..558ad9b014 100644
--- a/common/backlight.c
+++ b/tmk_core/common/backlight.c
diff --git a/common/backlight.h b/tmk_core/common/backlight.h
index 525ec8bbef..525ec8bbef 100644
--- a/common/backlight.h
+++ b/tmk_core/common/backlight.h
diff --git a/common/bootloader.h b/tmk_core/common/bootloader.h
index 44775039d5..44775039d5 100644
--- a/common/bootloader.h
+++ b/tmk_core/common/bootloader.h
diff --git a/common/bootmagic.c b/tmk_core/common/bootmagic.c
index b002a58562..b002a58562 100644
--- a/common/bootmagic.c
+++ b/tmk_core/common/bootmagic.c
diff --git a/common/bootmagic.h b/tmk_core/common/bootmagic.h
index 8f6618f4bd..8f6618f4bd 100644
--- a/common/bootmagic.h
+++ b/tmk_core/common/bootmagic.h
diff --git a/common/command.c b/tmk_core/common/command.c
index fbaa9f2d75..fbaa9f2d75 100644
--- a/common/command.c
+++ b/tmk_core/common/command.c
diff --git a/common/command.h b/tmk_core/common/command.h
index b57a6c1ced..b57a6c1ced 100644
--- a/common/command.h
+++ b/tmk_core/common/command.h
diff --git a/common/debug.c b/tmk_core/common/debug.c
index 18613fc28b..18613fc28b 100644
--- a/common/debug.c
+++ b/tmk_core/common/debug.c
diff --git a/common/debug.h b/tmk_core/common/debug.h
index 3cbe2092d1..3cbe2092d1 100644
--- a/common/debug.h
+++ b/tmk_core/common/debug.h
diff --git a/common/eeconfig.h b/tmk_core/common/eeconfig.h
index 3cd1a174f6..3cd1a174f6 100644
--- a/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
diff --git a/common/host.c b/tmk_core/common/host.c
index e9b7916706..e9b7916706 100644
--- a/common/host.c
+++ b/tmk_core/common/host.c
diff --git a/common/host.h b/tmk_core/common/host.h
index 918af69e8f..918af69e8f 100644
--- a/common/host.h
+++ b/tmk_core/common/host.h
diff --git a/common/host_driver.h b/tmk_core/common/host_driver.h
index edb9e5dd9c..edb9e5dd9c 100644
--- a/common/host_driver.h
+++ b/tmk_core/common/host_driver.h
diff --git a/common/keyboard.c b/tmk_core/common/keyboard.c
index 1e3fb510a4..1e3fb510a4 100644
--- a/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
diff --git a/common/keyboard.h b/tmk_core/common/keyboard.h
index 6442716fc7..6442716fc7 100644
--- a/common/keyboard.h
+++ b/tmk_core/common/keyboard.h
diff --git a/common/keycode.h b/tmk_core/common/keycode.h
index ac4ef00db6..ac4ef00db6 100644
--- a/common/keycode.h
+++ b/tmk_core/common/keycode.h
diff --git a/common/keymap.c b/tmk_core/common/keymap.c
index 4c0b61b8c1..4c0b61b8c1 100644
--- a/common/keymap.c
+++ b/tmk_core/common/keymap.c
diff --git a/common/keymap.h b/tmk_core/common/keymap.h
index e1a6f992e6..e1a6f992e6 100644
--- a/common/keymap.h
+++ b/tmk_core/common/keymap.h
diff --git a/common/led.h b/tmk_core/common/led.h
index 402a247b9a..402a247b9a 100644
--- a/common/led.h
+++ b/tmk_core/common/led.h
diff --git a/common/matrix.h b/tmk_core/common/matrix.h
index 107ee72653..107ee72653 100644
--- a/common/matrix.h
+++ b/tmk_core/common/matrix.h
diff --git a/common/mbed/bootloader.c b/tmk_core/common/mbed/bootloader.c
index b51e83943a..b51e83943a 100644
--- a/common/mbed/bootloader.c
+++ b/tmk_core/common/mbed/bootloader.c
diff --git a/common/mbed/suspend.c b/tmk_core/common/mbed/suspend.c
index 32651574f8..32651574f8 100644
--- a/common/mbed/suspend.c
+++ b/tmk_core/common/mbed/suspend.c
diff --git a/common/mbed/timer.c b/tmk_core/common/mbed/timer.c
index c357ceb786..c357ceb786 100644
--- a/common/mbed/timer.c
+++ b/tmk_core/common/mbed/timer.c
diff --git a/common/mbed/xprintf.cpp b/tmk_core/common/mbed/xprintf.cpp
index 3647ece751..3647ece751 100644
--- a/common/mbed/xprintf.cpp
+++ b/tmk_core/common/mbed/xprintf.cpp
diff --git a/common/mbed/xprintf.h b/tmk_core/common/mbed/xprintf.h
index 26bc529e5b..26bc529e5b 100644
--- a/common/mbed/xprintf.h
+++ b/tmk_core/common/mbed/xprintf.h
diff --git a/common/mousekey.c b/tmk_core/common/mousekey.c
index 23469476e2..23469476e2 100644
--- a/common/mousekey.c
+++ b/tmk_core/common/mousekey.c
diff --git a/common/mousekey.h b/tmk_core/common/mousekey.h
index 6eede06b44..6eede06b44 100644
--- a/common/mousekey.h
+++ b/tmk_core/common/mousekey.h
diff --git a/common/nodebug.h b/tmk_core/common/nodebug.h
index 93309ada47..93309ada47 100644
--- a/common/nodebug.h
+++ b/tmk_core/common/nodebug.h
diff --git a/common/print.c b/tmk_core/common/print.c
index ca94e1e5d6..ca94e1e5d6 100644
--- a/common/print.c
+++ b/tmk_core/common/print.c
diff --git a/common/print.h b/tmk_core/common/print.h
index c0e9e14309..c0e9e14309 100644
--- a/common/print.h
+++ b/tmk_core/common/print.h
diff --git a/common/progmem.h b/tmk_core/common/progmem.h
index 199b1bedfe..199b1bedfe 100644
--- a/common/progmem.h
+++ b/tmk_core/common/progmem.h
diff --git a/common/report.h b/tmk_core/common/report.h
index f6c0a315de..f6c0a315de 100644
--- a/common/report.h
+++ b/tmk_core/common/report.h
diff --git a/common/sendchar.h b/tmk_core/common/sendchar.h
index 7a64d00c7f..7a64d00c7f 100644
--- a/common/sendchar.h
+++ b/tmk_core/common/sendchar.h
diff --git a/common/sendchar_null.c b/tmk_core/common/sendchar_null.c
index 2933306228..2933306228 100644
--- a/common/sendchar_null.c
+++ b/tmk_core/common/sendchar_null.c
diff --git a/common/sendchar_uart.c b/tmk_core/common/sendchar_uart.c
index 0241859eb7..0241859eb7 100644
--- a/common/sendchar_uart.c
+++ b/tmk_core/common/sendchar_uart.c
diff --git a/common/sleep_led.c b/tmk_core/common/sleep_led.c
index dab3eb0f3c..dab3eb0f3c 100644
--- a/common/sleep_led.c
+++ b/tmk_core/common/sleep_led.c
diff --git a/common/sleep_led.h b/tmk_core/common/sleep_led.h
index 6bdcf558a4..6bdcf558a4 100644
--- a/common/sleep_led.h
+++ b/tmk_core/common/sleep_led.h
diff --git a/common/suspend.h b/tmk_core/common/suspend.h
index 80617a8244..80617a8244 100644
--- a/common/suspend.h
+++ b/tmk_core/common/suspend.h
diff --git a/common/timer.h b/tmk_core/common/timer.h
index fe23f87aec..fe23f87aec 100644
--- a/common/timer.h
+++ b/tmk_core/common/timer.h
diff --git a/common/uart.c b/tmk_core/common/uart.c
index c17649b082..c17649b082 100644
--- a/common/uart.c
+++ b/tmk_core/common/uart.c
diff --git a/common/uart.h b/tmk_core/common/uart.h
index 41136a396f..41136a396f 100644
--- a/common/uart.h
+++ b/tmk_core/common/uart.h
diff --git a/common/util.c b/tmk_core/common/util.c
index 7e0d542993..7e0d542993 100644
--- a/common/util.c
+++ b/tmk_core/common/util.c
diff --git a/common/util.h b/tmk_core/common/util.h
index 7451cc084d..7451cc084d 100644
--- a/common/util.h
+++ b/tmk_core/common/util.h
diff --git a/common/wait.h b/tmk_core/common/wait.h
index 40d00b0c75..40d00b0c75 100644
--- a/common/wait.h
+++ b/tmk_core/common/wait.h
diff --git a/tmk_core/doc/COPYING.GPLv2 b/tmk_core/doc/COPYING.GPLv2
new file mode 100644
index 0000000000..d159169d10
--- /dev/null
+++ b/tmk_core/doc/COPYING.GPLv2
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/tmk_core/doc/COPYING.GPLv3 b/tmk_core/doc/COPYING.GPLv3
new file mode 100644
index 0000000000..94a9ed024d
--- /dev/null
+++ b/tmk_core/doc/COPYING.GPLv3
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 3 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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/tmk_core/doc/FUSE.txt b/tmk_core/doc/FUSE.txt
new file mode 100644
index 0000000000..40055e5ab1
--- /dev/null
+++ b/tmk_core/doc/FUSE.txt
@@ -0,0 +1,40 @@
+ATMega168P Fuse/Lock Bits
+=========================
+This configuration is from usbasploader's Makefile.
+
+ HFUSE 0xD6
+ LFUSE 0xDF
+ EFUSE 0x00
+ LOCK 0x3F(intact)
+
+#---------------------------------------------------------------------
+# ATMega168P
+#---------------------------------------------------------------------
+# Fuse extended byte:
+# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800)
+# \+/
+# +------- BOOTSZ (00 = 2k bytes)
+# Fuse high byte:
+# 0xd6 = 1 1 0 1 0 1 1 0
+# ^ ^ ^ ^ ^ \-+-/
+# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
+# | | | | + --------- EESAVE (preserve EEPROM over chip erase)
+# | | | +-------------- WDTON (if 0: watchdog always on)
+# | | +---------------- SPIEN (allow serial programming)
+# | +------------------ DWEN (debug wire enable)
+# +-------------------- RSTDISBL (reset pin is enabled)
+# Fuse low byte:
+# 0xdf = 1 1 0 1 1 1 1 1
+# ^ ^ \ / \--+--/
+# | | | +------- CKSEL 3..0 (external >8M crystal)
+# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
+# | +------------------ CKOUT (if 0: Clock output enabled)
+# +-------------------- CKDIV8 (if 0: divide by 8)
+
+
+# Lock Bits
+# 0x3f = - - 1 1 1 1 1 1
+# \ / \-/ \-/
+# | | +----- LB 2..1 (No memory lock features enabled)
+# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section)
+# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section)
diff --git a/tmk_core/doc/POWER.txt b/tmk_core/doc/POWER.txt
new file mode 100644
index 0000000000..0abbbe48e8
--- /dev/null
+++ b/tmk_core/doc/POWER.txt
@@ -0,0 +1,62 @@
+Time to Sleep
+=============
+USB suspend no activity on USB line for 3ms
+No Interaction no user interaction
+ matrix has no change
+ matrix has no switch on
+
+
+AVR Power Management
+====================
+
+V-USB suspend
+ USB suspend
+ http://vusb.wikidot.com/examples
+
+MCUSR MCU Status Register
+ WDRF Watchdog Reset Flag
+ BORF
+ EXTRF
+ PORF Power-on Reset Flag
+
+SMCR Sleep Mode Control Register
+ SE Sleep Enable
+ SM2:0
+ #define set_sleep_mode(mode) \
+ #define SLEEP_MODE_IDLE (0)
+ #define SLEEP_MODE_ADC _BV(SM0)
+ #define SLEEP_MODE_PWR_DOWN _BV(SM1)
+ #define SLEEP_MODE_PWR_SAVE (_BV(SM0) | _BV(SM1))
+ #define SLEEP_MODE_STANDBY (_BV(SM1) | _BV(SM2))
+ #define SLEEP_MODE_EXT_STANDBY (_BV(SM0) | _BV(SM1) | _BV(SM2))
+
+
+ACSR Analog Comparator Control and Status Register
+ To disable Analog Comparator
+ ACSR = 0x80;
+ or
+ ACSR &= ~_BV(ACIE);
+ ACSR |= _BV(ACD);
+
+ ACD: Analog Comparator Disable
+ When this bit is written logic one, the power to the Analog Comparator is
+ switched off. This bit can be set at any time to turn off the Analog
+ Comparator. This will reduce power consumption in Active and Idle mode.
+ When changing the ACD bit, the Analog Comparator Interrupt must be disabled
+ by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when
+ the bit is changed.
+
+DIDR1 Digital Input Disable Register 1
+ AIN1D
+ AIN0D
+ When this bit is written logic one, the digital input buffer on the AIN1/0 pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer.
+
+
+PRR Power Reduction Register
+ PRTWI
+ PRTIM2
+ PRTIM0
+ PRTIM1
+ PRSPI
+ PRUSART0
+ PRADC
diff --git a/tmk_core/doc/USB_NKRO.txt b/tmk_core/doc/USB_NKRO.txt
new file mode 100644
index 0000000000..d9f1d12292
--- /dev/null
+++ b/tmk_core/doc/USB_NKRO.txt
@@ -0,0 +1,160 @@
+USB NKRO MEMO
+=============
+2010/12/09
+
+
+References
+----------
+USB - boot mode, NKRO, compatibility, etc...
+ http://geekhack.org/showthread.php?t=13162
+NKey Rollover - Overview, Testing Methodology, and Results
+ http://geekhack.org/showwiki.php?title=NKey+Rollover+-+Overview+Testing+Methodology+and+Results
+dfj's NKRO(2010/06)
+ http://geekhack.org/showpost.php?p=191195&postcount=251
+ http://geekhack.org/showthread.php?p=204389#post204389
+
+
+Terminology
+---------
+NKRO
+ghost
+matrix
+mechanical with diodes
+membrane
+
+
+OS Support Status
+-----------------
+USB NKRO is possible *without* a custom driver.
+At least following OS's supports.
+ Windows7 64bit
+ WindowsXP
+ Windows2000 SP4
+ Ubuntu10.4(Linux 2.6)
+ MacOSX(To be tested)
+
+
+Custom Driver for USB NKRO
+--------------------------
+NOT NEEDED
+at least when using following report formats on Windows, Linux or MacOSX.
+
+
+USB NKRO methods
+----------------
+1. Virtual keyboards
+ Keyboard can increase its KRO by using virtual keyboards with Standard or Extended report.
+ If the keyboard has 2 virtual keyboard with Standard report(6KRO), it gets 12KRO.
+ Using this method means the keyboard is a composite device.
+
+2. Extended report
+ It needs large report size for this method to achieve NKRO.
+ If a keyboard has 101keys, it needs 103byte report. It seems to be inefficient.
+
+3. Bitmap report
+ If the keyboard has less than 128keys, 16byte report will be enough for NKRO.
+ The 16byte report seems to be reasonable cost to get NKRO.
+
+
+Report Format
+-------------
+Other report formats than followings are possible, though these format are typical one.
+
+1. Standard 8bytes
+ modifiers(bitmap) 1byte
+ reserved 1byte(not used)
+ keys(array) 1byte*6
+Standard report can send 6keys plus 8modifiers simultaneously.
+Standard report is used by most keyboards in the marketplace.
+Standard report is identical to boot protocol report.
+Standard report is hard to suffer from compatibility problems.
+
+2. Extended standard 16,32,64bytes
+ modifiers(bitmap) 1byte
+ reserved 1byte(not used)
+ keys(array) 1byte*(14,32,62)
+Extended report can send N-keys by using N+2bytes.
+Extended report is expected to be compatible with boot protocol.
+
+3. Bitmap 16,32,64bytes
+ keys(bitmap) (16,32)bytes
+Bitmap report can send at most 128keys by 16bytes and 256keys by 32bytes.
+Bitmap report can achieve USB NKRO efficiently in terms of report size.
+Bitmap report needs a deliberation for boot protocol implementation.
+Bitmap report descriptor sample:
+ 0x05, 0x01, // Usage Page (Generic Desktop),
+ 0x09, 0x06, // Usage (Keyboard),
+ 0xA1, 0x01, // Collection (Application),
+ // bitmap of modifiers
+ 0x75, 0x01, // Report Size (1),
+ 0x95, 0x08, // Report Count (8),
+ 0x05, 0x07, // Usage Page (Key Codes),
+ 0x19, 0xE0, // Usage Minimum (224),
+ 0x29, 0xE7, // Usage Maximum (231),
+ 0x15, 0x00, // Logical Minimum (0),
+ 0x25, 0x01, // Logical Maximum (1),
+ 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte
+ // LED output report
+ 0x95, 0x05, // Report Count (5),
+ 0x75, 0x01, // Report Size (1),
+ 0x05, 0x08, // Usage Page (LEDs),
+ 0x19, 0x01, // Usage Minimum (1),
+ 0x29, 0x05, // Usage Maximum (5),
+ 0x91, 0x02, // Output (Data, Variable, Absolute),
+ 0x95, 0x01, // Report Count (1),
+ 0x75, 0x03, // Report Size (3),
+ 0x91, 0x03, // Output (Constant),
+ // bitmap of keys
+ 0x95, (REPORT_BYTES-1)*8, // Report Count (),
+ 0x75, 0x01, // Report Size (1),
+ 0x15, 0x00, // Logical Minimum (0),
+ 0x25, 0x01, // Logical Maximum(1),
+ 0x05, 0x07, // Usage Page (Key Codes),
+ 0x19, 0x00, // Usage Minimum (0),
+ 0x29, (REPORT_BYTES-1)*8-1, // Usage Maximum (),
+ 0x81, 0x02, // Input (Data, Variable, Absolute),
+ 0xc0 // End Collection
+where REPORT_BYTES is a report size in bytes.
+
+
+Considerations
+--------------
+Compatibility
+ boot protocol
+ minor/old system
+ Some BIOS doesn't send SET_PROTOCOL request, a keyboard can't switch to boot protocol mode.
+ This may cause a problem on a keyboard which uses other report than Standard.
+Reactivity
+ USB polling time
+ OS/Driver processing time
+
+
+Windows Problem
+---------------
+1. Windows accepts only 6keys in case of Standard report.
+ It should be able to send 6keys plus 8modifiers.
+2. Windows accepts only 10keys in case of 16bytes Extended report.
+ It should be able to send 14keys plus 8modifiers.
+3. Windows accepts only 18keys in case of 32bytes Extended report.
+ It should be able to send 30keys plus 8modifiers.
+If keys are pressed in excess of the number, wrong keys are registered on Windows.
+
+This problem will be reportedly fixed soon.(2010/12/05)
+ http://forums.anandtech.com/showpost.php?p=30873364&postcount=17
+
+
+Tools for testing NKRO
+----------------------
+Browser App:
+http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx
+http://random.xem.us/rollover.html
+
+Windows:
+AquaKeyTest.exe http://geekhack.org/showthread.php?t=6643
+
+Linux:
+xkeycaps
+xev
+showkeys
+
+EOF
diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md
new file mode 100644
index 0000000000..20702e94c9
--- /dev/null
+++ b/tmk_core/doc/build.md
@@ -0,0 +1,186 @@
+Build Firmware and Program Controller
+=====================================
+
+
+Download and Install
+--------------------
+### 1. Install Tools
+
+1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager.
+
+2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog].
+
+3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver.
+
+If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader].
+
+
+### 2. Download source
+You can find firmware source at github:
+
+- <https://github.com/tmk/tmk_keyboard>
+
+If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from:
+
+- <https://github.com/tmk/tmk_keyboard/archive/master.zip>
+
+
+Build firmware
+--------------
+### 1. Open terminal
+Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up.
+
+### 2. Change directory
+Move to project directory in the firmware source.
+
+ cd tmk_keyboard/{'keyboard' or 'converter'}/<project>
+
+### 3. Make
+Build firmware using GNU `make` command. You'll see `<project>_<variant>.hex` file in that directory unless something unexpected occurs in build process.
+
+
+ make -f Makefile.<variant> clean
+ make -f Makefile.<variant>
+
+
+
+
+Program Controller
+------------------
+Now you have **hex** file to program on current directory. This **hex** is only needed to program your controller, other files are used for development and you may leave and forget them.
+
+### 1. Start bootloader
+How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual.
+
+### 2. Program with DFU bootloader
+Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows.
+
+To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`.
+If you have a proper program command in `Makefile` just type this.
+
+`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below.
+To use command line tool run this command. Note that you need to set PATH variable properly.
+
+ $ make -f Makefile.<variant> flip
+
+Or to program with `dfu-programmer` run:
+
+ $ make -f Makefile.<variant> dfu
+
+#### FLIP GUI tutorial
+1. On menu bar click Device -> Select, then. `ATmega32u4`.
+2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog.
+At this point you'll see grey-outed widgets on the app get colored and ready.
+
+3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog.
+4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected.
+5. Re-plug USB cord or click 'Start Application' button to restart your controller.
+Done.
+
+See also these instructions if you need.
+
+- <http://code.google.com/p/micropendous/wiki/LoadingFirmwareWithFLIP>
+- <http://www.atmel.com/Images/doc7769.pdf>
+
+
+### 3. Program with Teensy Loader
+If you have PJRC Teensy see instruction of `Teensy Loader`.
+
+- <http://www.pjrc.com/teensy/loader.html>
+
+Or use this command if you have command line version of Teensy Loader installed.
+
+ $ make -f Makefile.<variant> teensy
+
+
+### 4. Program with Other programmer
+You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile.
+
+ $ make -f Makefile.<variant> program
+
+
+[cygwin]: https://www.cygwin.com/
+[mingw]: http://www.mingw.org/
+[mhv]: https://infernoembedded.com/products/avr-tools
+[winavr]: http://winavr.sourceforge.net/
+[crosspack]: http://www.obdev.at/products/crosspack/index.html
+[flip]: http://www.atmel.com/tools/FLIP.aspx
+[dfu-prog]: http://dfu-programmer.sourceforge.net/
+[teensy-loader]:http://www.pjrc.com/teensy/loader.html
+
+
+
+Makefile Options
+----------------
+### 1. MCU and Frequency.
+
+ MCU = atmega32u4 # Teensy 2.0
+ #MCU = at90usb1286 # Teensy++ 2.0
+ F_CPU = 16000000
+
+Set your MCU and its clock in Hz.
+
+ # Boot Section Size in *bytes*
+ # Teensy halfKay 512
+ # Atmel DFU loader 4096
+ # LUFA bootloader 4096
+ OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+If you are using PJRC Teensy use `512` for `BOOTLOADER_SIZE`, otherwise use `4096` unless you are sure.
+
+### 2. Features
+Optional. Note that ***comment out*** with `#` to disable them.
+
+ 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
+ SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+ #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
+ #BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+
+### 3. Programmer
+Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`.
+
+ # avrdude with AVRISPmkII
+ PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex
+
+ # avrdude with USBaspLoader
+ PROGRAM_CMD = avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex
+
+ # avrdude with arduino
+ PROGRAM_CMD = avrdude -p $(MCU) -c arduino -P COM1 -b 57600 -U flash:w:$(TARGET).hex
+
+
+
+Config.h Options
+----------------
+### 1. Magic command key combination
+
+ #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
+
+### 2. Mechanical Locking Support for CapsLock
+
+ /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */
+ #define CAPSLOCK_LOCKING_ENABLE
+ /* Locking CapsLock re-synchronize hack */
+ #define CAPSLOCK_LOCKING_RESYNC_ENABLE
+
+### 3. Disable Debug and Print
+
+ /* disable debug print */
+ #define NO_DEBUG
+
+ /* disable print */
+ #define NO_PRINT
+
+### 4. Disable Action Features
+
+ #define NO_ACTION_LAYER
+ #define NO_ACTION_TAPPING
+ #define NO_ACTION_ONESHOT
+ #define NO_ACTION_MACRO
+ #define NO_ACTION_FUNCTION
+
+***TBD***
diff --git a/tmk_core/doc/keycode.txt b/tmk_core/doc/keycode.txt
new file mode 100644
index 0000000000..760c726e3b
--- /dev/null
+++ b/tmk_core/doc/keycode.txt
@@ -0,0 +1,261 @@
+Keycode Symbol Table
+====================
+Keycodes are defined in `common/keycode.h`.
+Range of 00-A4 and E0-E7 are identical with HID Usage:
+<http://www.usb.org/developers/devclass_docs/Hut1_11.pdf>
+Virtual keycodes are defined out of above range to support special actions.
+
+
+Keycode Symbol Short name Description
+--------------------------------------------------------------------------------
+KC_NO 00 Reserved (no event indicated)
+KC_ROLL_OVER 01 Keyboard ErrorRollOver
+KC_POST_FAIL 02 Keyboard POSTFail
+KC_UNDEFINED 03 Keyboard ErrorUndefined
+KC_A 04 Keyboard a and A
+KC_B 05 Keyboard b and B
+KC_C 06 Keyboard c and C
+KC_D 07 Keyboard d and D
+KC_E 08 Keyboard e and E
+KC_F 09 Keyboard f and F
+KC_G 0A Keyboard g and G
+KC_H 0B Keyboard h and H
+KC_I 0C Keyboard i and I
+KC_J 0D Keyboard j and J
+KC_K 0E Keyboard k and K
+KC_L 0F Keyboard l and L
+KC_M 10 Keyboard m and M
+KC_N 11 Keyboard n and N
+KC_O 12 Keyboard o and O
+KC_P 13 Keyboard p and P
+KC_Q 14 Keyboard q and Q
+KC_R 15 Keyboard r and R
+KC_S 16 Keyboard s and S
+KC_T 17 Keyboard t and T
+KC_U 18 Keyboard u and U
+KC_V 19 Keyboard v and V
+KC_W 1A Keyboard w and W
+KC_X 1B Keyboard x and X
+KC_Y 1C Keyboard y and Y
+KC_Z 1D Keyboard z and Z
+KC_1 1E Keyboard 1 and !
+KC_2 1F Keyboard 2 and @
+KC_3 20 Keyboard 3 and #
+KC_4 21 Keyboard 4 and $
+KC_5 22 Keyboard 5 and %
+KC_6 23 Keyboard 6 and ^
+KC_7 24 Keyboard 7 and &
+KC_8 25 Keyboard 8 and *
+KC_9 26 Keyboard 9 and (
+KC_0 27 Keyboard 0 and )
+KC_ENTER KC_ENT 28 Keyboard Return (ENTER)
+KC_ESCAPE KC_ESC 29 Keyboard ESCAPE
+KC_BSPACE KC_BSPC 2A Keyboard DELETE (Backspace)
+KC_TAB 2B Keyboard Tab
+KC_SPACE KC_SPC 2C Keyboard Spacebar
+KC_MINUS KC_MINS 2D Keyboard - and (underscore)
+KC_EQUAL KC_EQL 2E Keyboard = and +
+KC_LBRACKET KC_LBRC 2F Keyboard [ and {
+KC_RBRACKET KC_RBRC 30 Keyboard ] and }
+KC_BSLASH KC_BSLS 31 Keyboard \ and |
+KC_NONUS_HASH KC_NUHS 32 Keyboard Non-US # and ~
+KC_SCOLON KC_SCLN 33 Keyboard ; and :
+KC_QUOTE KC_QUOT 34 Keyboard ‘ and “
+KC_GRAVE KC_GRV 35 Keyboard Grave Accent and Tilde
+KC_COMMA KC_COMM 36 Keyboard, and <
+KC_DOT 37 Keyboard . and >
+KC_SLASH KC_SLSH 38 Keyboard / and ?
+KC_CAPSLOCK KC_CAPS 39 Keyboard Caps Lock
+KC_F1 3A Keyboard F1
+KC_F2 3B Keyboard F2
+KC_F3 3C Keyboard F3
+KC_F4 3D Keyboard F4
+KC_F5 3E Keyboard F5
+KC_F6 3F Keyboard F6
+KC_F7 40 Keyboard F7
+KC_F8 41 Keyboard F8
+KC_F9 42 Keyboard F9
+KC_F10 43 Keyboard F10
+KC_F11 44 Keyboard F11
+KC_F12 45 Keyboard F12
+KC_PSCREEN KC_PSCR 46 Keyboard PrintScreen1
+KC_SCKLOCK KC_SLCK 47 Keyboard Scroll Lock11
+KC_PAUSE KC_PAUS 48 Keyboard Pause1
+KC_INSERT KC_INS 49 Keyboard Insert1
+KC_HOME 4A Keyboard Home1
+KC_PGUP 4B Keyboard PageUp1
+KC_DELETE KC_DELETE 4C Keyboard Delete Forward
+KC_END 4D Keyboard End1
+KC_PGDOWN KC_PGDN 4E Keyboard PageDown1
+KC_RIGHT KC_RGHT 4F Keyboard RightArrow1
+KC_LEFT 50 Keyboard LeftArrow1
+KC_DOWN 51 Keyboard DownArrow1
+KC_UP 52 Keyboard UpArrow1
+KC_NUMLOCK KC_NLCK 53 Keypad Num Lock and Clear11
+KC_KP_SLASH KC_PSLS 54 Keypad /1
+KC_KP_ASTERISK KC_PAST 55 Keypad *
+KC_KP_MINUS KC_PMNS 56 Keypad -
+KC_KP_PLUS KC_PPLS 57 Keypad +
+KC_KP_ENTER KC_PENT 58 Keypad ENTER5
+KC_KP_1 KC_P1 59 Keypad 1 and End
+KC_KP_2 KC_P2 5A Keypad 2 and Down Arrow
+KC_KP_3 KC_P3 5B Keypad 3 and PageDn
+KC_KP_4 KC_P4 5C Keypad 4 and Left Arrow
+KC_KP_5 KC_P5 5D Keypad 5
+KC_KP_6 KC_P6 5E Keypad 6 and Right Arrow
+KC_KP_7 KC_P7 5F Keypad 7 and Home
+KC_KP_8 KC_P8 60 Keypad 8 and Up Arrow
+KC_KP_9 KC_P9 61 Keypad 9 and PageUp
+KC_KP_0 KC_P0 62 Keypad 0 and Insert
+KC_KP_DOT KC_PDOT 63 Keypad . and Delete
+KC_NONUS_BSLASH KC_NUBS 64 Keyboard Non-US \ and |
+KC_APPLICATION KC_APP 65 Keyboard Application10
+KC_POWER 66 Keyboard Power9
+KC_KP_EQUAL KC_PEQL 67 Keypad =
+KC_F13 68 Keyboard F13
+KC_F14 69 Keyboard F14
+KC_F15 6A Keyboard F15
+KC_F16 6B Keyboard F16
+KC_F17 6C Keyboard F17
+KC_F18 6D Keyboard F18
+KC_F19 6E Keyboard F19
+KC_F20 6F Keyboard F20
+KC_F21 70 Keyboard F21
+KC_F22 71 Keyboard F22
+KC_F23 72 Keyboard F23
+KC_F24 73 Keyboard F24
+KC_EXECUTE 74 Keyboard Execute
+KC_HELP 75 Keyboard Help
+KC_MENU 76 Keyboard Menu
+KC_SELECT 77 Keyboard Select
+KC_STOP 78 Keyboard Stop
+KC_AGAIN 79 Keyboard Again
+KC_UNDO 7A Keyboard Undo
+KC_CUT 7B Keyboard Cut
+KC_COPY 7C Keyboard Copy
+KC_PASTE 7D Keyboard Paste
+KC_FIND 7E Keyboard Find
+KC__MUTE 7F Keyboard Mute
+KC__VOLUP 80 Keyboard Volume Up
+KC__VOLDOWN 81 Keyboard Volume Down
+KC_LOCKING_CAPS 82 Keyboard Locking Caps Lock12
+KC_LOCKING_NUM 83 Keyboard Locking Num Lock12
+KC_LOCKING_SCROLL 84 Keyboard Locking Scroll Lock12
+KC_KP_COMMA KC_PCMM 85 Keypad Comma27
+KC_KP_EQUAL_AS400 86 Keypad Equal Sign29
+KC_INT1 KC_RO 87 Keyboard International115,28
+KC_INT2 KC_KANA 88 Keyboard International216
+KC_INT3 KC_JYEN 89 Keyboard International317
+KC_INT4 KC_HENK 8A Keyboard International418
+KC_INT5 KC_MHEN 8B Keyboard International519
+KC_INT6 8C Keyboard International620
+KC_INT7 8D Keyboard International721
+KC_INT8 8E Keyboard International822
+KC_INT9 8F Keyboard International922
+KC_LANG1 90 Keyboard LANG125
+KC_LANG2 91 Keyboard LANG226
+KC_LANG3 92 Keyboard LANG330
+KC_LANG4 93 Keyboard LANG431
+KC_LANG5 94 Keyboard LANG532
+KC_LANG6 95 Keyboard LANG68
+KC_LANG7 96 Keyboard LANG78
+KC_LANG8 97 Keyboard LANG88
+KC_LANG9 98 Keyboard LANG98
+KC_ALT_ERASE 99 Keyboard Alternate Erase7
+KC_SYSREQ 9A Keyboard SysReq/Attention1
+KC_CANCEL 9B Keyboard Cancel
+KC_CLEAR 9C Keyboard Clear
+KC_PRIOR 9D Keyboard Prior
+KC_RETURN 9E Keyboard Return
+KC_SEPARATOR 9F Keyboard Separator
+KC_OUT A0 Keyboard Out
+KC_OPER A1 Keyboard Oper
+KC_CLEAR_AGAIN A2 Keyboard Clear/Again
+KC_CRSEL A3 Keyboard CrSel/Props
+KC_EXSEL A4 Keyboard ExSel
+/* Modifiers */
+KC_LCTRL KC_LCTRL E0 Keyboard LeftControl
+KC_LSHIFT KC_LSFT E1 Keyboard LeftShift
+KC_LALT E2 Keyboard LeftAlt
+KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key)
+KC_RCTRL KC_RCTL E4 Keyboard RightControl
+KC_RSHIFT KC_RSFT E5 Keyboard RightShift
+KC_RALT E6 Keyboard RightAlt
+KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key)
+
+/*
+ * Virtual keycodes
+ */
+/* System Control */
+KC_SYSTEM_POWER KC_PWR System Power Down
+KC_SYSTEM_SLEEP KC_SLEP System Sleep
+KC_SYSTEM_WAKE KC_WAKE System Wake
+/* Consumer Page */
+KC_AUDIO_MUTE KC_MUTE
+KC_AUDIO_VOL_UP KC_VOLU
+KC_AUDIO_VOL_DOWN KC_VOLD
+KC_MEDIA_NEXT_TRACK KC_MNXT
+KC_MEDIA_PREV_TRACK KC_MPRV
+KC_MEDIA_STOP KC_MSTP
+KC_MEDIA_PLAY_PAUSE KC_MPLY
+KC_MEDIA_SELECT KC_MSEL
+KC_MAIL KC_MAIL
+KC_CALCULATOR KC_CALC
+KC_MY_COMPUTER KC_MYCM
+KC_WWW_SEARCH KC_WSCH
+KC_WWW_HOME KC_WHOM
+KC_WWW_BACK KC_WBAK
+KC_WWW_FORWARD KC_WFWD
+KC_WWW_STOP KC_WSTP
+KC_WWW_REFRESH KC_WREF
+KC_WWW_FAVORITES KC_WFAV
+/* Mousekey */
+KC_MS_UP KC_MS_U Mouse Cursor Up
+KC_MS_DOWN KC_MS_D Mouse Cursor Down
+KC_MS_LEFT KC_MS_L Mouse Cursor Left
+KC_MS_RIGHT KC_MS_R Mouse Cursor Right
+KC_MS_BTN1 KC_BTN1 Mouse Button 1
+KC_MS_BTN2 KC_BTN2 Mouse Button 2
+KC_MS_BTN3 KC_BTN3 Mouse Button 3
+KC_MS_BTN4 KC_BTN4 Mouse Button 4
+KC_MS_BTN5 KC_BTN5 Mouse Button 5
+KC_MS_WH_UP KC_WH_U Mouse Wheel Up
+KC_MS_WH_DOWN KC_WH_D Mouse Wheel Down
+KC_MS_WH_LEFT KC_WH_L Mouse Wheel Left
+KC_MS_WH_RIGHT KC_WH_R Mouse Wheel Right
+KC_MS_ACCEL0 KC_ACL0 Mouse Acceleration 0
+KC_MS_ACCEL1 KC_ACL1 Mouse Acceleration 1
+KC_MS_ACCEL2 KC_ACL2 Mouse Acceleration 2
+/* Fn key */
+KC_FN0
+KC_FN1
+KC_FN2
+KC_FN3
+KC_FN4
+KC_FN5
+KC_FN6
+KC_FN7
+KC_FN8
+KC_FN9
+KC_FN10
+KC_FN11
+KC_FN12
+KC_FN13
+KC_FN14
+KC_FN15
+KC_FN16
+KC_FN17
+KC_FN18
+KC_FN19
+KC_FN20
+KC_FN21
+KC_FN22
+KC_FN23
+KC_FN24
+KC_FN25
+KC_FN26
+KC_FN27
+KC_FN28
+KC_FN29
+KC_FN30
+KC_FN31
diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md
new file mode 100644
index 0000000000..9d986a8c51
--- /dev/null
+++ b/tmk_core/doc/keymap.md
@@ -0,0 +1,593 @@
+Keymap framework - how to define your keymap
+============================================
+***NOTE: This is not final version, may be inconsistent with source code and changed occasionally for a while.***
+
+## 0. Keymap and layers
+**Keymap** is comprised of multiple layers of key layout, you can define **32 layers** at most.
+**Layer** is an array of **keycodes** to define **actions** for each physical keys.
+respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence.
+
+ Keymap: 32 Layers Layer: Keycode matrix
+ ----------------- ---------------------
+ stack of layers array_of_keycode[row][column]
+ ____________ precedence _______________________
+ / / | high / ESC / F1 / F2 / F3 ....
+ 31 /___________// | /-----/-----/-----/-----
+ 30 /___________// | / TAB / Q / W / E ....
+ 29 /___________/ | /-----/-----/-----/-----
+ : _:_:_:_:_:__ | : /LCtrl/ A / S / D ....
+ : / : : : : : / | : / : : : :
+ 2 /___________// | 2 `--------------------------
+ 1 /___________// | 1 `--------------------------
+ 0 /___________/ V low 0 `--------------------------
+
+
+
+### 0.1 Keymap status
+Keymap has its state in two parameters:
+**`default_layer`** indicates a base keymap layer(0-31) which is always valid and to be referred, **`keymap_stat`** is 16bit variable which has current on/off status of layers on its each bit.
+
+Keymap layer '0' is usually `default_layer` and which is the only valid layer and other layers is initially off after boot up firmware, though, you can configured them in `config.h`.
+To change `default_layer` will be useful when you switch key layout completely, say you want Colmak instead of Qwerty.
+
+ Initial state of Keymap Change base layout
+ ----------------------- ------------------
+
+ 31 31
+ 30 30
+ 29 29
+ : :
+ : : ____________
+ 2 ____________ 2 / /
+ 1 / / ,->1 /___________/
+ ,->0 /___________/ | 0
+ | |
+ `--- default_layer = 0 `--- default_layer = 1
+ layer_state = 0x00000001 layer_state = 0x00000002
+
+On the other hand, you shall change `layer_state` to overlay base layer with some layers for feature such as navigation keys, function key(F1-F12), media keys or special actions.
+
+ Overlay feature layer
+ --------------------- bit|status
+ ____________ ---+------
+ 31 / / 31 | 0
+ 30 /___________// -----> 30 | 1
+ 29 /___________/ -----> 29 | 1
+ : : | :
+ : ____________ : | :
+ 2 / / 2 | 0
+ ,->1 /___________/ -----> 1 | 1
+ | 0 0 | 0
+ | +
+ `--- default_layer = 1 |
+ layer_state = 0x60000002 <-'
+
+
+
+### 0.2 Layer Precedence and Transparency
+Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred.
+
+You can place `KC_TRNS` on overlay layer changes just part of layout to fall back on lower or base layer.
+Key with `KC_TRANS` doesn't has its own keycode and refers to lower valid layers for keycode, instead.
+See example below.
+
+
+### 0.3 Keymap Example
+Keymap is **`keymaps[]`** C array in fact and you can define layers in it with **`KEYMAP()`** C macro and keycodes. To use complex actions you need to define `Fn` keycode in **`fn_actions[]`** array.
+
+This is a keymap example for [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard.
+This example has three layers, 'Qwerty' as base layer, 'Cursor' and 'Mousekey'.
+In this example,
+
+ `Fn0` is a **momentary layer switching** key, you can use keys on Cursor layer while holding the key.
+
+ `Fn1` is a momentary layer switching key with tapping feature, you can get semicolon **';'** with taping the key and switch layers while holding the key. The word **'tap'** or **'tapping'** mean to press and release a key quickly.
+
+ `Fn2` is a **toggle layer switch** key, you can stay switched layer after releasing the key unlike momentary switching.
+
+You can find other keymap definitions in file `keymap.c` located on project directories.
+
+ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* 0: Qwerty
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| A| S| D| F| G| H| J| K| L|Fn1| '|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
+ * `-----------------------------------------------------------'
+ * |Gui|Alt |Space |Alt |Fn2|
+ * `-------------------------------------------'
+ */
+ KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
+ TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
+ LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,ENT, \
+ LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
+ LGUI,LALT, SPC, RALT,FN2),
+ /* 1: Cursor(HHKB mode)
+ * ,-----------------------------------------------------------.
+ * |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | | | +| -|End|PgD|Dow|Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt |Space |Alt |Gui|
+ * `--------------------------------------------'
+ */
+ KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS,BSPC, \
+ LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
+ LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \
+ LGUI,LALT, SPC, RALT,RGUI),
+ /* 2: Mousekey
+ * ,-----------------------------------------------------------.
+ * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
+ * |-----------------------------------------------------------|
+ * |Tab | | | | | |MwL|MwD|MwU|MwR| | | |Backs|
+ * |-----------------------------------------------------------|
+ * |Contro| | | | | |McL|McD|McU|McR| | |Return |
+ * |-----------------------------------------------------------|
+ * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
+ * `-----------------------------------------------------------'
+ * |Gui |Alt |Mb1 |Alt | |
+ * `--------------------------------------------'
+ * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
+ */
+ KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
+ TAB, TRNS,TRNS,TRNS,TRNS,TRNS,WH_L,WH_D,WH_U,WH_R,TRNS,TRNS,TRNS,BSPC, \
+ LCTL,TRNS,ACL0,ACL1,ACL2,TRNS,MS_L,MS_D,MS_U,MS_R,TRNS,QUOT,ENT, \
+ LSFT,TRNS,TRNS,TRNS,TRNS,BTN3,BTN2,BTN1,BTN4,BTN5,SLSH,RSFT,TRNS, \
+ LGUI,LALT, BTN1, RALT,TRNS),
+ };
+
+ static const uint16_t PROGMEM fn_actions[] = {
+ ACTION_LAYER_MOMENTARY(1), // FN0
+ ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1
+ ACTION_LAYER_TOGGLE(2), // FN2
+ };
+
+
+
+
+## 1. Keycode
+See [`common/keycode.h`](../common/keycode.h) or keycode table below for the detail. Keycode is internal **8bit code** to indicate action performed on key in keymap. Keycode has `KC_` prefixed symbol respectively. Most of keycodes like `KC_A` have simple action registers key to host on press and unregister on release, while some of other keycodes has some special actions like `Fn` keys, Media control keys, System control keys and Mousekeys.
+
+ ***In `KEYMAP()` macro you should omit prefix part `KC_` of keycode to keep keymap compact.*** For example, just use `A` instead you place `KC_A` in `KEYMAP()`. Some keycodes has 4-letter **short name** in addition to descriptive name, you'll prefer short one in `KEYMAP()`.
+
+### 1.0 Other key
+- `KC_NO` for no action
+- `KC_TRNS` for layer transparency (See above)
+
+### 1.1 Normal key
+- `KC_A` to `KC_Z`, `KC_1` to `KC_0` for alpha numeric key
+- `KC_MINS`, `KC_EQL`, `KC_GRV`, `KC_RBRC`, `KC_LBRC`, `KC_COMM`, `KC_DOT`, `KC_BSLS`, `KC_SLSH`, `KC_SCLN`, `KC_QUOT`
+- `KC_ESC`, `KC_TAB`, `KC_SPC`, `KC_BSPC`, `KC_ENT`, `KC_DEL`, `KC_INS`
+- `KC_UP`, `KC_DOWN`, `KC_RGHT`, `KC_LEFT`, `KC_PGUP`, `KC_PGDN`, `KC_HOME`, `KC_END`
+- `KC_CAPS`, `KC_NLCK`, `KC_SLCK`, `KC_PSCR`, `KC_PAUS`, `KC_APP`, `KC_F1` to `KC_F24`
+- `KC_P1` to `KC_P0`, `KC_PDOT`, `KC_PCMM`, `KC_PSLS`, `KC_PAST`, `KC_PMNS`, `KC_PPLS`, `KC_PEQL`, `KC_PENT` for keypad.
+
+### 1.2 Modifier
+There are 8 modifiers which has discrimination between left and right.
+
+- `KC_LCTL` and `KC_RCTL` for Control
+- `KC_LSFT` and `KC_RSFT` for Shift
+- `KC_LALT` and `KC_RALT` for Alt
+- `KC_LGUI` and `KC_RGUI` for Windows key or Command key in Mac
+
+### 1.3 Mousekey
+- `KC_MS_U`, `KC_MS_D`, `KC_MS_L`, `KC_MS_R` for mouse cursor
+- `KC_WH_U`, `KC_WH_D`, `KC_WH_L`, `KC_WH_R` for mouse wheel
+- `KC_BTN1`, `KC_BTN2`, `KC_BTN3`, `KC_BTN4`, `KC_BTN5` for mouse buttons
+
+### 1.4 System & Media key
+- `KC_PWR`, `KC_SLEP`, `KC_WAKE` for Power, Sleep, Wake
+- `KC_MUTE`, `KC_VOLU`, `KC_VOLD` for audio volume control
+- `KC_MNXT`, `KC_MPRV`, `KC_MSTP`, `KC_MPLY`, `KC_MSEL` for media control
+- `KC_MAIL`, `KC_CALC`, `KC_MYCM` for application launch
+- `KC_WSCH`, `KC_WHOM`, `KC_WBAK`, `KC_WFWD`, `KC_WSTP`, `KC_WREF`, `KC_WFAV` for web browser operation
+
+### 1.5 Fn key
+`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***32 `Fn` keys can be defined at most.***
+
+### 1.6 Keycode Table
+ See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes.
+
+ In regard to implementation side most of keycodes are identical with [HID usage][HID_usage](pdf) sent to host for real and some virtual keycodes are defined to support special actions.
+[HID_usage]: http://www.usb.org/developers/devclass_docs/Hut1_11.pdf
+
+
+
+## 2. Action
+See [`common/action_code.h`](../common/action_code.h). Action is a **16bit code** and defines function to perform on events of a key like press, release, holding and tapping.
+
+Most of keys just register 8bit scancode to host, but to support other complex features needs 16bit extended action codes internally. However, using 16bit action codes in keymap results in double size in memory compared to using just keycodes. To avoid this waste 8bit keycodes are used in `KEYMAP()` instead of action codes.
+
+***You can just use keycodes of `Normal key`, `Modifier`, `Mousekey` and `System & Media key` in keymap*** to indicate corresponding actions instead of using action codes. While ***to use other special actions you should use keycode of `Fn` key defined in `fn_actions[]`.***
+
+
+### 2.1 Key Action
+This is a simple action that registers scancodes(HID usage in fact) to host on press event of key and unregister on release.
+
+#### Parameters
++ **mods**: { ` MOD_LCTL`, ` MOD_LSFT`, ` MOD_LALT`, ` MOD_LGUI`,
+ ` MOD_RCTL`, ` MOD_RSFT`, ` MOD_RALT`, ` MOD_RGUI` }
++ **key**: keycode
+
+
+#### 2.1.1 Normal key and Modifier
+***This action usually won't be used expressly in keymap*** because you can just use keycodes in `KEYMAP()` instead.
+
+You can define these actions on *'A'* key and *'left shift'* modifier with:
+
+ ACTION_KEY(KC_A)
+ ACTION_KEY(KC_LSFT)
+
+#### 2.1.2 Modified key
+This action is comprised of strokes of modifiers and a key. `Macro` action is needed if you want more complex key strokes.
+
+Say you want to assign a key to `Shift + 1` to get character *'!'* or `Alt + Tab` to switch application windows.
+
+ ACTION_MODS_KEY(MOD_LSFT, KC_1)
+ ACTION_MODS_KEY(MOD_LALT, KC_TAB)
+
+Or `Alt,Shift + Tab` can be defined. `ACTION_MODS_KEY(mods, key)` requires **4-bit modifier state** and a **keycode** as arguments. See `keycode.h` for `MOD_BIT()` macro.
+
+ ACTION_MODS_KEY(MOD_LALT | MOD_LSFT, KC_TAB)
+
+#### 2.1.3 Multiple Modifiers
+Registers multiple modifiers with pressing a key. To specify multiple modifiers use `|`.
+
+ ACTION_MODS(MOD_ALT | MOD_LSFT)
+
+#### 2.1.3 Modifier with Tap key([Dual role][dual_role])
+Works as a modifier key while holding, but registers a key on tap(press and release quickly).
+
+
+ ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT)
+
+
+
+### 2.2 Layer Action
+These actions operate layers of keymap.
+
+#### Parameters
+You can specify a **target layer** of action and **when the action is executed**. Some actions take a **bit value** for bitwise operation.
+
+
++ **layer**: `0`-`31`
++ **on**: { `ON_PRESS` | `ON_RELEASE` | `ON_BOTH` }
++ **bits**: 4-bit value and 1-bit mask bit
+
+
+#### 2.2.1 Default Layer
+Default Layer is a layer which always is valid and referred to when actions is not defined on other overlay layers.
+
+This sets Default Layer to given parameter `layer` and activate it.
+
+ ACTION_DEFAULT_LAYER_SET(layer)
+
+
+#### 2.2.2 Momentary
+Turns on `layer` momentarily while holding, in other words it activates when key is pressed and deactivate when released.
+
+ ACTION_LAYER_MOMENTARY(layer)
+
+
+#### 2.2.3 Toggle Switch
+Turns on `layer` with first type(press and release) and turns off with next.
+
+ ACTION_LAYER_TOGGLE(layer)
+
+
+#### 2.2.4 Momentary Switch with tap key
+Turns on `layer` momentary while holding, but registers key on tap(press and release quickly).
+
+ ACTION_LAYER_TAP_KEY(layer, key)
+
+
+#### 2.2.5 Momentary Switch with tap toggle
+Turns on `layer` momentary while holding and toggles it with serial taps.
+
+ ACTION_LAYER_TAP_TOGGLE(layer)
+
+
+#### 2.2.6 Invert state of layer
+Inverts current state of `layer`. If the layer is on it becomes off with this action.
+
+ ACTION_LAYER_INVERT(layer, on)
+
+
+#### 2.2.7 Turn On layer
+Turns on layer state.
+
+ ACTION_LAYER_ON(layer, on)
+
+Turns on layer state on press and turns off on release.
+
+ ACTION_LAYER_ON_OFF(layer)
+
+
+#### 2.2.8 Turn Off layer
+Turns off layer state.
+
+ ACTION_LAYER_OFF(layer, on)
+
+Turns off layer state on press and activates on release.
+
+ ACTION_LAYER_OFF_ON(layer)
+
+
+#### 2.2.9 Set layer
+Turn on layer only.
+`layer_state = (1<<layer) [layer: 0-31]`
+
+ ACTION_LAYER_SET(layer, on)
+
+Turns on layer only and clear all layer on release..
+
+ ACTION_LAYER_SET_CLEAR(layer)
+
+
+#### 2.2.10 Bitwise operation
+
+**part** indicates which part of 32bit layer state(0-7). **bits** is 5-bit value. **on** indicates when the action is executed.
+
+ ACTION_LAYER_BIT_AND(part, bits, on)
+ ACTION_LAYER_BIT_OR(part, bits, on)
+ ACTION_LAYER_BIT_XOR(part, bits, on)
+ ACTION_LAYER_BIT_SET(part, bits, on)
+
+These actions works with parameters as following code.
+
+ uint8_t shift = part*4;
+ uint32_t mask = (bits&0x10) ? ~(0xf<<shift) : 0;
+ uint32_t layer_state = layer_state <bitop> ((bits<<shift)|mask);
+
+
+Default Layer also has bitwise operations, they are executed when key is released.
+
+ ACTION_DEFAULT_LAYER_BIT_AND(part, bits)
+ ACTION_DEFAULT_LAYER_BIT_OR(part, bits)
+ ACTION_DEFAULT_LAYER_BIT_XOR(part, bits)
+ ACTION_DEFAULT_LAYER_BIT_SET(part, bits)
+
+
+
+### 2.3 Macro action
+***TBD***
+
+`Macro` action indicates complex key strokes.
+
+ MACRO( D(LSHIFT), D(D), END )
+ MACRO( U(D), U(LSHIFT), END )
+ MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END )
+
+#### 2.3.1 Macro Commands
+- **I()** change interval of stroke.
+- **D()** press key
+- **U()** release key
+- **T()** type key(press and release)
+- **W()** wait
+- **END** end mark
+
+#### 2.3.2 Examples
+
+***TODO: sample implementation***
+See `keyboard/hhkb/keymap.c` for sample.
+
+
+
+### 2.4 Function action
+***TBD***
+
+There are two type of action, normal `Function` and tappable `Function`.
+These actions call user defined function with `id`, `opt`, and key event information as arguments.
+
+#### 2.4.1 Function
+To define normal `Function` action in keymap use this.
+
+ ACTION_FUNCTION(id, opt)
+
+#### 2.4.2 Function with tap
+To define tappable `Function` action in keymap use this.
+
+ ACTION_FUNCTION_TAP(id, opt)
+
+#### 2.4.3 Implement user function
+`Function` actions can be defined freely with C by user in callback function:
+
+ void keymap_call_function(keyrecord_t *event, uint8_t id, uint8_t opt)
+
+This C function is called every time key is operated, argument `id` selects action to be performed and `opt` can be used for option. Function `id` can be 0-255 and `opt` can be 0-15.
+
+ `keyrecord_t` is comprised of key event and tap count. `keyevent_t` indicates which and when key is pressed or released. From `tap_count` you can know tap state, 0 means no tap. These information will be used in user function to decide how action of key is performed.
+
+ typedef struct {
+ keyevent_t event;
+ uint8_t tap_count;
+ } keyrecord_t;
+
+ typedef struct {
+ key_t key;
+ bool pressed;
+ uint16_t time;
+ } keyevent_t;
+
+ typedef struct {
+ uint8_t col;
+ uint8_t row;
+ } key_t;
+
+***TODO: sample implementation***
+See `keyboard/hhkb/keymap.c` for sample.
+
+
+
+### 2.5 Backlight Action
+These actions control the backlight.
+
+#### 2.5.1 Change backlight level
+Increase backlight level.
+
+ ACTION_BACKLIGHT_INCREASE()
+
+Decrease backlight level.
+
+ ACTION_BACKLIGHT_DECREASE()
+
+Step through backlight levels.
+
+ ACTION_BACKLIGHT_STEP()
+
+Turn a specific backlight level on or off.
+
+ ACTION_BACKLIGHT_LEVEL(1)
+
+#### 2.5.2 Turn on / off backlight
+Turn the backlight on and off without changing level.
+
+ ACTION_BACKLIGHT_TOGGLE()
+
+
+
+## 3. Layer switching Example
+There are some ways to switch layer with 'Layer' actions.
+
+### 3.1 Momentary switching
+Momentary switching changes layer only while holding Fn key.
+
+This action makes 'Layer 1' active(valid) on key press event and inactive on release event. Namely you can overlay a layer on lower layers or default layer temporarily with this action.
+
+ ACTION_LAYER_MOMENTARY(1)
+
+
+Note that after switching on press the actions on destination layer(Layer 1) are performed.
+***Thus you shall need to place an action to go back on destination layer***, or you will be stuck in destination layer without way to get back. Usually you need to place same action or 'KC_TRNS` on destination layer to get back.
+
+
+### 3.2 Toggle switching
+Toggle switching performed after releasing a key. With this action you can keep staying on the destination layer until you type the key again to return.
+
+This performs toggle switching action of 'Layer 2'.
+
+ ACTION_LAYER_TOGGLE(2)
+
+
+
+### 3.3 Momentary switching with Tap key
+These actions switch a layer only while holding a key but register the key on tap. **Tap** means to press and release a key quickly.
+
+ ACTION_LAYER_TAP_KEY(2, KC_SCLN)
+
+With this you can place a layer switching action on normal key like ';' without losing its original key register function. This action allows you to have layer switching action without necessity of a dedicated key. It means you can have it even on home row of keyboard.
+
+
+
+### 3.4 Momentary switching with Tap Toggle
+This switches layer only while holding a key but toggle layer with several taps. **Tap** means to press and release key quickly.
+
+ ACTION_LAYER_TAP_TOGGLE(1)
+
+Number of taps can be configured with `TAPPING_TOGGLE` in `config.h`, `5` by default.
+
+
+
+### 3.5 Momentary switching with Modifiers
+This registers modifier key(s) simultaneously with layer switching.
+
+ ACTION_LAYER_MODS(2, MOD_LSFT | MOD_LALT)
+
+
+
+## 4. Tapping
+Tapping is to press and release a key quickly. Tapping speed is determined with setting of `TAPPING_TERM`, which can be defined in `config.h`, 200ms by default.
+
+### 4.1 Tap Key
+This is a feature to assign normal key action and modifier including layer switching to just same one physical key. This is a kind of [Dual role key][dual_role]. It works as modifier when holding the key but registers normal key when tapping.
+
+Modifier with tap key:
+
+ ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV)
+
+Layer switching with tap key:
+
+ ACTION_LAYER_TAP_KEY(2, KC_SCLN)
+
+[dual_role]: http://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
+
+
+### 4.2 Tap Toggle
+This is a feature to assign both toggle layer and momentary switch layer action to just same one physical key. It works as momentary layer switch when holding a key but toggle switch with several taps.
+
+ ACTION_LAYER_TAP_TOGGLE(1)
+
+
+### 4.3 Oneshot Modifier
+This runs onetime effects which modify only on just one following key. It works as normal modifier key when holding down while oneshot modifier when tapping.
+
+ ACTION_MODS_ONESHOT(MOD_LSFT)
+
+Say you want to type 'The', you have to push and hold Shift key before type 't' then release it before type 'h' and 'e', otherwise you'll get 'THe' or 'the' unintentionally. With Oneshot Modifier you can tap Shift then type 't', 'h' and 'e' normally, you don't need to holding Shift key properly here. This mean you can release Shift before 't' is pressed down.
+
+Oneshot effect is cancel unless following key is pressed down within `ONESHOT_TIMEOUT` of `config.h`. No timeout when it is `0` or not defined.
+
+
+### 4.4 Tap Toggle Mods
+Similar to layer tap toggle, this works as a momentary modifier when holding, but toggles on with several taps. A single tap will 'unstick' the modifier again.
+
+ ACTION_MODS_TAP_TOGGLE(MOD_LSFT)
+
+
+
+
+## 5. Legacy Keymap
+This was used in prior version and still works due to legacy support code in `common/keymap.c`. Legacy keymap doesn't support many of features that new keymap offers. ***It is not recommended to use Legacy Keymap for new project.***
+
+To enable Legacy Keymap support define this macro in `config.h`.
+
+ #define USE_LEGACY_KEYMAP
+
+Legacy Keymap uses two arrays `fn_layer[]` and `fn_keycode[]` to define Fn key. The index of arrays corresponds with postfix number of `Fn` key. Array `fn_layer[]` indicates destination layer to switch and `fn_keycode[]` has keycodes to send when tapping `Fn` key.
+
+In following setting example, `Fn0`, `Fn1` and `Fn2` switch layer to 1, 2 and 2 respectively. `Fn2` registers `Space` key when tapping while `Fn0` and `Fn1` doesn't send any key.
+
+ static const uint8_t PROGMEM fn_layer[] = {
+ 1, // Fn0
+ 2, // Fn1
+ 2, // Fn2
+ };
+
+ static const uint8_t PROGMEM fn_keycode[] = {
+ KC_NO, // Fn0
+ KC_NO, // Fn1
+ KC_SPC, // Fn2
+ };
+
+
+## 6. Terminology
+***TBD***
+### keymap
+is comprised of multiple layers.
+### layer
+is matrix of keycodes.
+### key
+is physical button on keyboard or logical switch on software.
+### keycode
+is codes used on firmware.
+### action
+is a function assigned on a key.
+### layer transparency
+Using transparent keycode one layer can refer key definition on other lower layer.
+### layer precedence
+Top layer has higher precedence than lower layers.
+### tapping
+is to press and release a key quickly.
+### Fn key
+is key which executes a special action like layer switching, mouse key, macro or etc.
+### dual role key
+<http://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys>
diff --git a/tmk_core/doc/other_projects.md b/tmk_core/doc/other_projects.md
new file mode 100644
index 0000000000..bf980b0a9e
--- /dev/null
+++ b/tmk_core/doc/other_projects.md
@@ -0,0 +1,62 @@
+Other Keyboard Firmware Projects
+================================
+## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR]
+- <http://www.pjrc.com/teensy/usb_keyboard.html>
+- <http://www.pjrc.com/teensy/usb_mouse.html>
+
+## kbupgrade[USB][V-USB][AVR]
+- <http://github.com/rhomann/kbupgrade>
+- <http://geekhack.org/showwiki.php?title=Island:8406>
+
+## c64key[USB][V-USB][AVR]
+- <http://symlink.dk/projects/c64key/>
+
+## rump[USB][V-USB][AVR]
+- <http://mg8.org/rump/>
+- <http://github.com/clee/rump>
+
+## dulcimer[USB][V-USB][AVR]
+- <http://www.schatenseite.de/dulcimer.html>
+
+## humblehacker-keyboard[USB][LUFA][AVR][Ergo]
+- <http://github.com/humblehacker>
+- <http://www.humblehacker.com/keyboard/>
+- <http://geekhack.org/showwiki.php?title=Island:6292>
+
+## ps2avr[PS/2][AVR]
+- <http://sourceforge.net/projects/ps2avr/>
+
+## ErgoDox[Ergo][Split][USB][AVR]
+- <http://geekhack.org/index.php?topic=22780.0>
+- <https://github.com/benblazak/ergodox-firmware>
+- <https://github.com/cub-uanic/tmk_keyboard>
+
+## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR]
+- <http://deskthority.net/workshop-f7/my-diy-keyboard-collection-or-how-i-became-a-kb-geek-t2534.html>
+- <https://github.com/frobiac/adnw>
+
+## bpiphany's AVR-Keyboard[PJRC][AVR][USB]
+- <https://github.com/BathroomEpiphanies/AVR-Keyboard>
+- <http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions>
+- <http://deskthority.net/wiki/Phantom>
+
+## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino]
+- <http://forum.colemak.com/viewtopic.php?pid=10837>
+- <https://github.com/darkytoothpaste/keymapper>
+
+## USB-USB converter threads[converter][USB-USB]
+- <http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html>
+- <http://geekhack.org/index.php?topic=19458.0>
+
+## kbdbabel.org[converter][vintage][protocol][8051]
+Great resource of vintage keyboard protocol information and code
+
+- <http://www.kbdbabel.org/>
+
+## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex]
+A lots of vintage keyboard protocol supports
+
+- <http://gitorious.org/kiibohd-controller>
+
+## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo]
+- <https://github.com/chrisandreae/kinesis-firmware>
diff --git a/ldscript_keymap_avr5.x b/tmk_core/ldscript_keymap_avr5.x
index c09693e514..c09693e514 100644
--- a/ldscript_keymap_avr5.x
+++ b/tmk_core/ldscript_keymap_avr5.x
diff --git a/protocol.mk b/tmk_core/protocol.mk
index 726f658a04..726f658a04 100644
--- a/protocol.mk
+++ b/tmk_core/protocol.mk
diff --git a/protocol/adb.c b/tmk_core/protocol/adb.c
index bbff66df03..bbff66df03 100644
--- a/protocol/adb.c
+++ b/tmk_core/protocol/adb.c
diff --git a/protocol/adb.h b/tmk_core/protocol/adb.h
index bfe598bbf1..bfe598bbf1 100644
--- a/protocol/adb.h
+++ b/tmk_core/protocol/adb.h
diff --git a/protocol/bluefruit.mk b/tmk_core/protocol/bluefruit.mk
index e1c5fff77f..e1c5fff77f 100644
--- a/protocol/bluefruit.mk
+++ b/tmk_core/protocol/bluefruit.mk
diff --git a/protocol/bluefruit/bluefruit.c b/tmk_core/protocol/bluefruit/bluefruit.c
index cf26b83dff..cf26b83dff 100644
--- a/protocol/bluefruit/bluefruit.c
+++ b/tmk_core/protocol/bluefruit/bluefruit.c
diff --git a/protocol/bluefruit/bluefruit.h b/tmk_core/protocol/bluefruit/bluefruit.h
index 4f9b58836d..4f9b58836d 100644
--- a/protocol/bluefruit/bluefruit.h
+++ b/tmk_core/protocol/bluefruit/bluefruit.h
diff --git a/protocol/bluefruit/main.c b/tmk_core/protocol/bluefruit/main.c
index 871062ab11..871062ab11 100644
--- a/protocol/bluefruit/main.c
+++ b/tmk_core/protocol/bluefruit/main.c
diff --git a/protocol/ibm4704.c b/tmk_core/protocol/ibm4704.c
index 10e229fd15..10e229fd15 100644
--- a/protocol/ibm4704.c
+++ b/tmk_core/protocol/ibm4704.c
diff --git a/protocol/ibm4704.h b/tmk_core/protocol/ibm4704.h
index 618cce6be0..618cce6be0 100644
--- a/protocol/ibm4704.h
+++ b/tmk_core/protocol/ibm4704.h
diff --git a/protocol/iwrap.mk b/tmk_core/protocol/iwrap.mk
index eeedd83af2..eeedd83af2 100644
--- a/protocol/iwrap.mk
+++ b/tmk_core/protocol/iwrap.mk
diff --git a/protocol/iwrap/iWRAP4.txt b/tmk_core/protocol/iwrap/iWRAP4.txt
index 2a062d9d98..2a062d9d98 100644
--- a/protocol/iwrap/iWRAP4.txt
+++ b/tmk_core/protocol/iwrap/iWRAP4.txt
diff --git a/protocol/iwrap/iWRAP5.txt b/tmk_core/protocol/iwrap/iWRAP5.txt
index ce3310f1bf..ce3310f1bf 100644
--- a/protocol/iwrap/iWRAP5.txt
+++ b/tmk_core/protocol/iwrap/iWRAP5.txt
diff --git a/protocol/iwrap/iwrap.c b/tmk_core/protocol/iwrap/iwrap.c
index 6a404116a1..6a404116a1 100644
--- a/protocol/iwrap/iwrap.c
+++ b/tmk_core/protocol/iwrap/iwrap.c
diff --git a/protocol/iwrap/iwrap.h b/tmk_core/protocol/iwrap/iwrap.h
index ffaad9395d..ffaad9395d 100644
--- a/protocol/iwrap/iwrap.h
+++ b/tmk_core/protocol/iwrap/iwrap.h
diff --git a/protocol/iwrap/main.c b/tmk_core/protocol/iwrap/main.c
index 3abdce8dfc..3abdce8dfc 100644
--- a/protocol/iwrap/main.c
+++ b/tmk_core/protocol/iwrap/main.c
diff --git a/protocol/iwrap/mux_exit.rb b/tmk_core/protocol/iwrap/mux_exit.rb
index 1f6be48afd..1f6be48afd 100644
--- a/protocol/iwrap/mux_exit.rb
+++ b/tmk_core/protocol/iwrap/mux_exit.rb
diff --git a/protocol/iwrap/suart.S b/tmk_core/protocol/iwrap/suart.S
index 1b02909638..1b02909638 100644
--- a/protocol/iwrap/suart.S
+++ b/tmk_core/protocol/iwrap/suart.S
diff --git a/tmk_core/protocol/iwrap/suart.h b/tmk_core/protocol/iwrap/suart.h
new file mode 100644
index 0000000000..72725b998f
--- /dev/null
+++ b/tmk_core/protocol/iwrap/suart.h
@@ -0,0 +1,8 @@
+#ifndef SUART
+#define SUART
+
+void xmit(uint8_t);
+uint8_t rcvr(void);
+uint8_t recv(void);
+
+#endif /* SUART */
diff --git a/protocol/iwrap/wd.h b/tmk_core/protocol/iwrap/wd.h
index 99058f0331..99058f0331 100644
--- a/protocol/iwrap/wd.h
+++ b/tmk_core/protocol/iwrap/wd.h
diff --git a/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 2575e89dfa..2575e89dfa 100644
--- a/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c
index 600469fa1c..600469fa1c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile
index f6dcbea677..f6dcbea677 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/makefile
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk
index 4e15e3997a..4e15e3997a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_atprogram.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk
index 839362528c..839362528c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_avrdude.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk
index 8788606270..8788606270 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_build.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk
index bde1e11c96..bde1e11c96 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_core.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk
index 1e3604c7d8..1e3604c7d8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_cppcheck.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk
index 6bfe979428..6bfe979428 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_dfu.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk
index 87427fd277..87427fd277 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_doxygen.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk
index b8f6f26822..b8f6f26822 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_hid.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk
index 663c930244..663c930244 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Build/lufa_sources.mk
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h
index ca4c7a5eb5..ca4c7a5eb5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h
index d397f77edb..d397f77edb 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h
index 31c79d9ebc..31c79d9ebc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h
index d485346328..d485346328 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/DriverStubs/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h
index 6c98d03a44..6c98d03a44 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/LUFAConfig.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template
index ae6cfd3e25..ae6cfd3e25 100644
--- a/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/CodeTemplates/makefile_template
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h
index 1e09edf29b..1e09edf29b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/ArchitectureSpecific.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h
index 8941f7c0c7..8941f7c0c7 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Architectures.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h
index fce75d0ed2..fce75d0ed2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Attributes.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h
index 4c152dab29..4c152dab29 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/BoardTypes.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Common.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Common.h
index cf1f49b9da..cf1f49b9da 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/Common.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Common.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h
index 22afe940b3..22afe940b3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/CompilerSpecific.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h
index d0812e4e3b..d0812e4e3b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Common/Endianness.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf
index 89b2a33274..89b2a33274 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Doxygen.conf
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt
index c30a88bb4d..c30a88bb4d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildSystem.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt
index ff5fdc5230..ff5fdc5230 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/BuildingLinkableLibraries.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt
index 51786b9bee..51786b9bee 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ChangeLog.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt
index 966ddd0fe4..966ddd0fe4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompileTimeTokens.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt
index 85912b56ee..85912b56ee 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/CompilingApps.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt
index f126e69bbd..f126e69bbd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ConfiguringApps.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt
index becd58e542..becd58e542 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DevelopingWithLUFA.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt
index 18e808f4d5..18e808f4d5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DeviceSupport.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt
index b042246776..b042246776 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/DirectorySummaries.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt
index 7e947c2a2c..7e947c2a2c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Donating.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt
index 65d7fc9236..65d7fc9236 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ExportingLibrary.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt
index 9660a473a2..9660a473a2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/FutureChanges.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt
index b62a7cae18..b62a7cae18 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/GettingStarted.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt
index 3a3509d3fd..3a3509d3fd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Groups.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png
index 4f0c26f374..4f0c26f374 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step1.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png
index 6e309ae415..6e309ae415 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step2.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png
index 8192c9ae8a..8192c9ae8a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step3.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png
index 2bb8f5fc8f..2bb8f5fc8f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step4.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png
index f3a49ba9c4..f3a49ba9c4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_1.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png
index 078f4ec8d7..078f4ec8d7 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_2.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png
index 8a8571bd86..8a8571bd86 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/AS5_AS6_Import/AS5_AS6_Import_Step5_3.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg
index e8f5541a0e..e8f5541a0e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/Author.jpg
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png
index 54fa1a6643..54fa1a6643 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png
index efa5386778..efa5386778 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Images/LUFA_thumb.png
Binary files differ
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt
index 0d63a03d0c..0d63a03d0c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/KnownIssues.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt
index c3bf3db9df..c3bf3db9df 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LUFAPoweredProjects.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt
index a85d59c164..a85d59c164 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LibraryResources.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt
index 091ce94316..091ce94316 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/LicenseInfo.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt
index ce351ad3e0..ce351ad3e0 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MainPage.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt
index 7a08ad23c7..7a08ad23c7 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/MigrationInformation.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt
index 6ff1856766..6ff1856766 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/ProgrammingApps.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt
index 328466103d..328466103d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/SoftwareBootloaderJump.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm
index c6de4e64dd..c6de4e64dd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Footer.htm
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css
index b0b8464beb..b0b8464beb 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/Style/Style.css
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt
index ae9c7d44b3..ae9c7d44b3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/VIDAndPIDValues.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt
index 1b33269071..1b33269071 100644
--- a/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/DoxygenPages/WritingBoardDrivers.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
index c18054f823..c18054f823 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ADAFRUITU4/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h
index 3470890b6a..3470890b6a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
index 17b427155c..17b427155c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/ATAVRUSBRF01/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h
index cecaca07ef..cecaca07ef 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
index dc3d85df20..dc3d85df20 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BENITO/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
index d003680da5..d003680da5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BIGMULTIO/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
index 778bc321e1..778bc321e1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BLACKCAT/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
index cc0c01c8ba..cc0c01c8ba 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUI/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h
index 96d1eee6dc..96d1eee6dc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h
index 92c7a2e72f..92c7a2e72f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
index dff0697858..dff0697858 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/BUMBLEB/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h
index 6f6933b0d8..6f6933b0d8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
index 86700d1471..86700d1471 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/CULV3/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
index 0d31b481c4..0d31b481c4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/DUCE/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h
index 82cb204eb6..82cb204eb6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
index 53af741860..53af741860 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h
index 266b14907f..266b14907f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
index 58483a9ba5..58483a9ba5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/EVK527/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h
index 67783ca2bd..67783ca2bd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
index d64cdad6d9..d64cdad6d9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/JMDBU2/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
index 932bfa14a1..932bfa14a1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MAXIMUS/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h
index 36a7bebe9a..36a7bebe9a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
index eeb337711f..eeb337711f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROPENDOUS/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h
index 01366a71a5..01366a71a5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
index 3507036439..3507036439 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MICROSIN162/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h
index 3f1b592d3f..3f1b592d3f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
index 4889722bdc..4889722bdc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MINIMUS/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
index 9da569271e..9da569271e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/MULTIO/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h
index 9f02729cc6..9f02729cc6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
index 0e35eae4ab..0e35eae4ab 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX162/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h
index 4ae89acee2..4ae89acee2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
index 38dde2c740..38dde2c740 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEX32U4/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h
index 70b2467bbc..70b2467bbc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h
index a1b8825dad..a1b8825dad 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXISPMK2/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h
index c779c55785..c779c55785 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
index b3e4c701d1..b3e4c701d1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/OLIMEXT32U4/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
index a440b6f000..a440b6f000 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/RZUSBSTICK/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
index 39267055e0..39267055e0 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/SPARKFUN8U2/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h
index dcca4d0216..dcca4d0216 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
index 1e24c5263c..1e24c5263c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h
index dfa86acaab..dfa86acaab 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
index 48ac4860cd..48ac4860cd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK525/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h
index ec5a7e0e67..ec5a7e0e67 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
index 07d44b146b..07d44b146b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h
index bc5f489ed1..bc5f489ed1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
index d9bb3b99b8..d9bb3b99b8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/STK526/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
index 8f0cfafb26..8f0cfafb26 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TEENSY/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h
index a8e1041280..a8e1041280 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
index 494396bfcd..494396bfcd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/TUL/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h
index 3e0bede075..3e0bede075 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
index 1cff6fc694..1cff6fc694 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UDIP/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
index c7e09d4cbc..c7e09d4cbc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/UNO/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h
index 3775e5c845..3775e5c845 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
index b8d2db01d5..b8d2db01d5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USB2AX/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h
index 876939cb74..876939cb74 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
index 7d093df18e..7d093df18e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBFOO/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h
index 63a3ae274d..63a3ae274d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
index c47cfa9c22..c47cfa9c22 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h
index 9e9320ea08..9e9320ea08 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
index 77cab1ecf8..77cab1ecf8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBKEY/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h
index 29e73b7b53..29e73b7b53 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
index 0e6192ee36..0e6192ee36 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/USBTINYMKII/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
index ef428b0dc4..ef428b0dc4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
index c7d74591d4..c7d74591d4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/AVR8/XPLAIN/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h
index c5c09bedb8..c5c09bedb8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h
index 944ea5ffe4..944ea5ffe4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h
index 640939a936..640939a936 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h
index 96438d0dae..96438d0dae 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c
index 94843115fe..94843115fe 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h
index ed3aa7bd8b..ed3aa7bd8b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/Temperature.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h
index f0f596e84a..f0f596e84a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h
index adc6aea626..adc6aea626 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h
index 3e5ab85160..3e5ab85160 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1100/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h
index 40f8aecf33..40f8aecf33 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h
index d61c52e335..d61c52e335 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/Joystick.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h
index 1f1960d1f2..1f1960d1f2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1101/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h
index 1c6bdd0d41..1c6bdd0d41 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h
index 145955174a..145955174a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/UC3/EVK1104/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
index ebe24a74f9..ebe24a74f9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
index 34f8ce121d..34f8ce121d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
index f930844c88..f930844c88 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/A3BU_XPLAINED/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h
index ae5445a1f8..ae5445a1f8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Buttons.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
index 2f58c48406..2f58c48406 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/Dataflash.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h
index b4b743214a..b4b743214a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Board/XMEGA/B1_XPLAINED/LEDs.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h
index 5c6780f332..5c6780f332 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB321C.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h
index cbd15d63ff..cbd15d63ff 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/AT45DB642D.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h
index 6d0f60ffa8..6d0f60ffa8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/RingBuffer.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h
index 2f71a84b2a..2f71a84b2a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Misc/TerminalCodes.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h
index ebce11b330..ebce11b330 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/ADC.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h
index c002f79f7b..c002f79f7b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h
index dde3ec5a7c..dde3ec5a7c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SPI_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
index 9a122f501e..9a122f501e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/SerialSPI_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c
index a1f64b022e..a1f64b022e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h
index 8416082f59..8416082f59 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/Serial_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c
index 3cc3f0b6d3..3cc3f0b6d3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h
index 92c7389a69..92c7389a69 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/AVR8/TWI_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h
index 1fab22b68f..1fab22b68f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SPI.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h
index 0db13ba472..0db13ba472 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/Serial.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h
index f5eede842b..f5eede842b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/SerialSPI.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h
index 34012fda65..34012fda65 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/TWI.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h
index 25fb73d16f..25fb73d16f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SPI_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
index 6d0ea11153..6d0ea11153 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/SerialSPI_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c
index 51a4d049e5..51a4d049e5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h
index 35b60d1502..35b60d1502 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/Peripheral/XMEGA/Serial_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h
index 2f2fa5bc77..2f2fa5bc77 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h
index 91aa22f3bb..91aa22f3bb 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/AudioClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h
index 6bfd384887..6bfd384887 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/CDCClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h
index db97f4888f..db97f4888f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h
index f33fef68aa..f33fef68aa 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h
index f14a766cde..f14a766cde 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h
index bc5cb46520..bc5cb46520 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c
index f57d97b568..f57d97b568 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h
index dd14bea435..dd14bea435 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDParser.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h
index 719739a5ff..719739a5ff 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/HIDReportData.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h
index e0b77eca86..e0b77eca86 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h
index 38167f64e3..38167f64e3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h
index eea39297c8..eea39297c8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h
index bc4112189f..bc4112189f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h
index a3388e2e76..a3388e2e76 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c
index 3fb350a119..3fb350a119 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h
index 09a8328086..09a8328086 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c
index e77aa280be..e77aa280be 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
index a4528d1ddd..a4528d1ddd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c
index a56747b084..a56747b084 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h
index ea21257722..ea21257722 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c
index 3ff339c06a..3ff339c06a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h
index c5b01be5db..c5b01be5db 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c
index 735437e461..735437e461 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h
index b9bc832e1f..b9bc832e1f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c
index 80aa723c1a..80aa723c1a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h
index 4d1a4cff8b..4d1a4cff8b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h
index 288559c757..288559c757 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/HIDClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c
index 67a1352b34..67a1352b34 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h
index f55cd340ae..f55cd340ae 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c
index 1e869e830d..1e869e830d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h
index 6cb78a6210..6cb78a6210 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/AudioClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c
index dd48da1d8e..dd48da1d8e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h
index f5faab9357..f5faab9357 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/CDCClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
index ae2395bc7a..ae2395bc7a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h
index 5d617b92ff..5d617b92ff 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/HIDClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c
index 29a6696db8..29a6696db8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h
index 15b9e4fc16..15b9e4fc16 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MIDIClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c
index 91e2ef022f..91e2ef022f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h
index 2e78431849..2e78431849 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/MassStorageClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c
index 1ecf19115a..1ecf19115a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h
index 64494b1f67..64494b1f67 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/PrinterClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c
index 1e23f8e7c6..1e23f8e7c6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h
index bac6d5c2e8..bac6d5c2e8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/RNDISClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c
index a6137b1918..a6137b1918 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h
index acfbd7d617..acfbd7d617 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/Host/StillImageClassHost.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h
index e3b8e2f5ef..e3b8e2f5ef 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MIDIClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h
index a5af1496b9..a5af1496b9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/MassStorageClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h
index 181d6931e6..181d6931e6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/PrinterClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h
index e270629e21..e270629e21 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/RNDISClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h
index e8c28b441f..e8c28b441f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Class/StillImageClass.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c
index 09d6f3775c..09d6f3775c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
index 318ff87200..318ff87200 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c
index 7563ed35ab..7563ed35ab 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h
index 77c9c82fe3..77c9c82fe3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c
index 0002a256d5..0002a256d5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
index 08944babc4..08944babc4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
index d932683374..d932683374 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
index f8d92f81f6..f8d92f81f6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
index 5296beb6aa..5296beb6aa 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c
index e71a7bd327..e71a7bd327 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h
index 8307ab4973..8307ab4973 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
index bf3ff003cd..bf3ff003cd 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
index 24c7b36cb5..24c7b36cb5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c
index ab69536b06..ab69536b06 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_R.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c
index c2d171db06..c2d171db06 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_Control_W.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c
index 02ad97867e..02ad97867e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Endpoint_RW.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c
index 05846bb614..05846bb614 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/Template/Template_Pipe_RW.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
index 37b106ab62..37b106ab62 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
index e479d7a1ad..e479d7a1ad 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c
index 3bff19f2e2..3bff19f2e2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h
index 9e9210ec2e..9e9210ec2e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c
index 71cced874e..71cced874e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h
index 0de5982303..0de5982303 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/ConfigDescriptors.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h
index 995b9208e8..995b9208e8 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Device.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c
index c4ae647129..c4ae647129 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h
index dfaa1662e9..dfaa1662e9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/DeviceStandardReq.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h
index a6ca64dd2b..a6ca64dd2b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h
index 89df381ae9..89df381ae9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/EndpointStream.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c
index 5f50430607..5f50430607 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h
index 33db543d45..33db543d45 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Events.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h
index bf2225f31e..bf2225f31e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Host.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c
index 3242822f76..3242822f76 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h
index cdfb35470e..cdfb35470e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/HostStandardReq.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h
index ccd7cc1be4..ccd7cc1be4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/OTG.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h
index ce2be5492a..ce2be5492a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Pipe.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h
index 002d6ff1ee..002d6ff1ee 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/PipeStream.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h
index 012399e966..012399e966 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdDescriptors.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h
index a841f8f3ad..a841f8f3ad 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/StdRequestType.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c
index b7c186e80d..b7c186e80d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
index 7139d51f08..7139d51f08 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c
index cc4206cae9..cc4206cae9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h
index b360b4da40..b360b4da40 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
index 235ddde591..235ddde591 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
index 356c9c3cb9..356c9c3cb9 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
index 24e2136e4f..24e2136e4f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
index 07559cd3fc..07559cd3fc 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c
index 20c8bf1e6d..20c8bf1e6d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h
index 34c82ad296..34c82ad296 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
index 6128869b04..6128869b04 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
index 6de574e9c1..6de574e9c1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c
index ab69536b06..ab69536b06 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_R.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c
index c2d171db06..c2d171db06 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_Control_W.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c
index 02ad97867e..02ad97867e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Endpoint_RW.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c
index 05846bb614..05846bb614 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/Template/Template_Pipe_RW.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
index 8ee63318f5..8ee63318f5 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
index bcae49bd46..bcae49bd46 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c
index e11a4b642c..e11a4b642c 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h
index 625e3f7824..625e3f7824 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h
index 9b1f0a9a60..9b1f0a9a60 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBController.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h
index 583860262b..583860262b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBInterrupt.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h
index 8a52b092b4..8a52b092b4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c
index e0a99150a4..e0a99150a4 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h
index 531fa6dcac..531fa6dcac 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBTask.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
index 47c345900d..47c345900d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
index aec693a3ce..aec693a3ce 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
index 0a1a775052..0a1a775052 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h
index 4d2a9f573d..4d2a9f573d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c
index b105e18c36..b105e18c36 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index a4118889be..a4118889be 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c
index 39d920afe1..39d920afe1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c
index 39d920afe1..39d920afe1 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c
index 6106cb5813..6106cb5813 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c
index 35776410e2..35776410e2 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c
index ed2d2d9b75..ed2d2d9b75 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c
index 02ad97867e..02ad97867e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index 3899278db6..3899278db6 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
index bb37905aba..bb37905aba 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c
index 9bba25ae96..9bba25ae96 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
index 5eef7121ee..5eef7121ee 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h
index 66f0fd3c0a..66f0fd3c0a 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Drivers/USB/USB.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/License.txt b/tmk_core/protocol/lufa/LUFA-120730/LUFA/License.txt
index 9e27adfb2b..9e27adfb2b 100644
--- a/protocol/lufa/LUFA-120730/LUFA/License.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/License.txt
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h
index 9bd29f5c00..9bd29f5c00 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/Platform.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h
index fb62fdcc9e..fb62fdcc9e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/ClockManagement.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S
index 1666323e5f..1666323e5f 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/Exception.S
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c
index 84e16ba205..84e16ba205 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.c
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h
index b0e1e3ec1e..b0e1e3ec1e 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/UC3/InterruptManagement.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h
index cd9c5f49e3..cd9c5f49e3 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Platform/XMEGA/ClockManagement.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/Version.h b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Version.h
index 29b5020f6d..29b5020f6d 100644
--- a/protocol/lufa/LUFA-120730/LUFA/Version.h
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/Version.h
diff --git a/protocol/lufa/LUFA-120730/LUFA/makefile b/tmk_core/protocol/lufa/LUFA-120730/LUFA/makefile
index fcf46bf687..fcf46bf687 100644
--- a/protocol/lufa/LUFA-120730/LUFA/makefile
+++ b/tmk_core/protocol/lufa/LUFA-120730/LUFA/makefile
diff --git a/protocol/lufa/LUFA-120730/README.txt b/tmk_core/protocol/lufa/LUFA-120730/README.txt
index aacb4af9ae..aacb4af9ae 100644
--- a/protocol/lufa/LUFA-120730/README.txt
+++ b/tmk_core/protocol/lufa/LUFA-120730/README.txt
diff --git a/protocol/lufa/LUFA-git b/tmk_core/protocol/lufa/LUFA-git
-Subproject b6c18b2a7c544653efbe12a1d4e8ba65e7d83c3
+Subproject b6c18b2a7c544653efbe12a1d4e8ba65e7d83c3
diff --git a/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c
index c13a81bda8..c13a81bda8 100644
--- a/protocol/lufa/descriptor.c
+++ b/tmk_core/protocol/lufa/descriptor.c
diff --git a/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h
index 42af07917c..42af07917c 100644
--- a/protocol/lufa/descriptor.h
+++ b/tmk_core/protocol/lufa/descriptor.h
diff --git a/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index cdfc7bc6ad..cdfc7bc6ad 100644
--- a/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
diff --git a/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h
index 195123c0f9..195123c0f9 100644
--- a/protocol/lufa/lufa.h
+++ b/tmk_core/protocol/lufa/lufa.h
diff --git a/protocol/m0110.c b/tmk_core/protocol/m0110.c
index 0d3a5aaa42..0d3a5aaa42 100644
--- a/protocol/m0110.c
+++ b/tmk_core/protocol/m0110.c
diff --git a/protocol/m0110.h b/tmk_core/protocol/m0110.h
index 2b95ed34d5..2b95ed34d5 100644
--- a/protocol/m0110.h
+++ b/tmk_core/protocol/m0110.h
diff --git a/protocol/mbed/HIDKeyboard.cpp b/tmk_core/protocol/mbed/HIDKeyboard.cpp
index 947077cd24..947077cd24 100644
--- a/protocol/mbed/HIDKeyboard.cpp
+++ b/tmk_core/protocol/mbed/HIDKeyboard.cpp
diff --git a/protocol/mbed/HIDKeyboard.h b/tmk_core/protocol/mbed/HIDKeyboard.h
index c537e5ecee..c537e5ecee 100644
--- a/protocol/mbed/HIDKeyboard.h
+++ b/tmk_core/protocol/mbed/HIDKeyboard.h
diff --git a/protocol/mbed/mbed_driver.cpp b/tmk_core/protocol/mbed/mbed_driver.cpp
index 6c7b16e23d..6c7b16e23d 100644
--- a/protocol/mbed/mbed_driver.cpp
+++ b/tmk_core/protocol/mbed/mbed_driver.cpp
diff --git a/protocol/mbed/mbed_driver.h b/tmk_core/protocol/mbed/mbed_driver.h
index dd1153b43a..dd1153b43a 100644
--- a/protocol/mbed/mbed_driver.h
+++ b/tmk_core/protocol/mbed/mbed_driver.h
diff --git a/protocol/news.c b/tmk_core/protocol/news.c
index 00755a5e2e..00755a5e2e 100644
--- a/protocol/news.c
+++ b/tmk_core/protocol/news.c
diff --git a/protocol/news.h b/tmk_core/protocol/news.h
index 35e09c4d20..35e09c4d20 100644
--- a/protocol/news.h
+++ b/tmk_core/protocol/news.h
diff --git a/protocol/next_kbd.c b/tmk_core/protocol/next_kbd.c
index a5a07a7a85..a5a07a7a85 100644
--- a/protocol/next_kbd.c
+++ b/tmk_core/protocol/next_kbd.c
diff --git a/protocol/next_kbd.h b/tmk_core/protocol/next_kbd.h
index 6d455d4fab..6d455d4fab 100644
--- a/protocol/next_kbd.h
+++ b/tmk_core/protocol/next_kbd.h
diff --git a/protocol/pjrc.mk b/tmk_core/protocol/pjrc.mk
index 36585de7df..36585de7df 100644
--- a/protocol/pjrc.mk
+++ b/tmk_core/protocol/pjrc.mk
diff --git a/protocol/pjrc/MEMO.txt b/tmk_core/protocol/pjrc/MEMO.txt
index b0f0598313..b0f0598313 100644
--- a/protocol/pjrc/MEMO.txt
+++ b/tmk_core/protocol/pjrc/MEMO.txt
diff --git a/protocol/pjrc/main.c b/tmk_core/protocol/pjrc/main.c
index e7bdcc059a..e7bdcc059a 100644
--- a/protocol/pjrc/main.c
+++ b/tmk_core/protocol/pjrc/main.c
diff --git a/protocol/pjrc/pjrc.c b/tmk_core/protocol/pjrc/pjrc.c
index 0562a12ffa..0562a12ffa 100644
--- a/protocol/pjrc/pjrc.c
+++ b/tmk_core/protocol/pjrc/pjrc.c
diff --git a/protocol/pjrc/pjrc.h b/tmk_core/protocol/pjrc/pjrc.h
index 06e79626fc..06e79626fc 100644
--- a/protocol/pjrc/pjrc.h
+++ b/tmk_core/protocol/pjrc/pjrc.h
diff --git a/protocol/pjrc/usb.c b/tmk_core/protocol/pjrc/usb.c
index 1e6ba8719a..1e6ba8719a 100644
--- a/protocol/pjrc/usb.c
+++ b/tmk_core/protocol/pjrc/usb.c
diff --git a/protocol/pjrc/usb.h b/tmk_core/protocol/pjrc/usb.h
index a195b671d0..a195b671d0 100644
--- a/protocol/pjrc/usb.h
+++ b/tmk_core/protocol/pjrc/usb.h
diff --git a/protocol/pjrc/usb_debug.c b/tmk_core/protocol/pjrc/usb_debug.c
index c1e6f6544b..c1e6f6544b 100644
--- a/protocol/pjrc/usb_debug.c
+++ b/tmk_core/protocol/pjrc/usb_debug.c
diff --git a/protocol/pjrc/usb_debug.h b/tmk_core/protocol/pjrc/usb_debug.h
index e70f4ca3a7..e70f4ca3a7 100644
--- a/protocol/pjrc/usb_debug.h
+++ b/tmk_core/protocol/pjrc/usb_debug.h
diff --git a/protocol/pjrc/usb_extra.c b/tmk_core/protocol/pjrc/usb_extra.c
index fe1f422c0d..fe1f422c0d 100644
--- a/protocol/pjrc/usb_extra.c
+++ b/tmk_core/protocol/pjrc/usb_extra.c
diff --git a/protocol/pjrc/usb_extra.h b/tmk_core/protocol/pjrc/usb_extra.h
index 042ac48373..042ac48373 100644
--- a/protocol/pjrc/usb_extra.h
+++ b/tmk_core/protocol/pjrc/usb_extra.h
diff --git a/protocol/pjrc/usb_keyboard.c b/tmk_core/protocol/pjrc/usb_keyboard.c
index 4b87b5d7b5..4b87b5d7b5 100644
--- a/protocol/pjrc/usb_keyboard.c
+++ b/tmk_core/protocol/pjrc/usb_keyboard.c
diff --git a/protocol/pjrc/usb_keyboard.h b/tmk_core/protocol/pjrc/usb_keyboard.h
index 9b798e9a86..9b798e9a86 100644
--- a/protocol/pjrc/usb_keyboard.h
+++ b/tmk_core/protocol/pjrc/usb_keyboard.h
diff --git a/protocol/pjrc/usb_mouse.c b/tmk_core/protocol/pjrc/usb_mouse.c
index d81db756f3..d81db756f3 100644
--- a/protocol/pjrc/usb_mouse.c
+++ b/tmk_core/protocol/pjrc/usb_mouse.c
diff --git a/protocol/pjrc/usb_mouse.h b/tmk_core/protocol/pjrc/usb_mouse.h
index ce26887c9b..ce26887c9b 100644
--- a/protocol/pjrc/usb_mouse.h
+++ b/tmk_core/protocol/pjrc/usb_mouse.h
diff --git a/protocol/ps2.h b/tmk_core/protocol/ps2.h
index acde679cf4..acde679cf4 100644
--- a/protocol/ps2.h
+++ b/tmk_core/protocol/ps2.h
diff --git a/protocol/ps2_busywait.c b/tmk_core/protocol/ps2_busywait.c
index a64933219e..a64933219e 100644
--- a/protocol/ps2_busywait.c
+++ b/tmk_core/protocol/ps2_busywait.c
diff --git a/protocol/ps2_interrupt.c b/tmk_core/protocol/ps2_interrupt.c
index 8114442bac..8114442bac 100644
--- a/protocol/ps2_interrupt.c
+++ b/tmk_core/protocol/ps2_interrupt.c
diff --git a/protocol/ps2_io.h b/tmk_core/protocol/ps2_io.h
index a46a358e7c..a46a358e7c 100644
--- a/protocol/ps2_io.h
+++ b/tmk_core/protocol/ps2_io.h
diff --git a/protocol/ps2_io_avr.c b/tmk_core/protocol/ps2_io_avr.c
index ed462345ba..ed462345ba 100644
--- a/protocol/ps2_io_avr.c
+++ b/tmk_core/protocol/ps2_io_avr.c
diff --git a/protocol/ps2_io_mbed.c b/tmk_core/protocol/ps2_io_mbed.c
index 83bdcef7f5..83bdcef7f5 100644
--- a/protocol/ps2_io_mbed.c
+++ b/tmk_core/protocol/ps2_io_mbed.c
diff --git a/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c
index c3e8b3c1c3..c3e8b3c1c3 100644
--- a/protocol/ps2_mouse.c
+++ b/tmk_core/protocol/ps2_mouse.c
diff --git a/protocol/ps2_mouse.h b/tmk_core/protocol/ps2_mouse.h
index 27d9790d43..27d9790d43 100644
--- a/protocol/ps2_mouse.h
+++ b/tmk_core/protocol/ps2_mouse.h
diff --git a/protocol/ps2_usart.c b/tmk_core/protocol/ps2_usart.c
index 6936ca7b88..6936ca7b88 100644
--- a/protocol/ps2_usart.c
+++ b/tmk_core/protocol/ps2_usart.c
diff --git a/protocol/serial.h b/tmk_core/protocol/serial.h
index 96913c8675..96913c8675 100644
--- a/protocol/serial.h
+++ b/tmk_core/protocol/serial.h
diff --git a/protocol/serial_mouse.h b/tmk_core/protocol/serial_mouse.h
index 226314fc0e..226314fc0e 100644
--- a/protocol/serial_mouse.h
+++ b/tmk_core/protocol/serial_mouse.h
diff --git a/protocol/serial_mouse_microsoft.c b/tmk_core/protocol/serial_mouse_microsoft.c
index ab74b7cdd3..ab74b7cdd3 100644
--- a/protocol/serial_mouse_microsoft.c
+++ b/tmk_core/protocol/serial_mouse_microsoft.c
diff --git a/protocol/serial_mouse_mousesystems.c b/tmk_core/protocol/serial_mouse_mousesystems.c
index cfe8996216..cfe8996216 100644
--- a/protocol/serial_mouse_mousesystems.c
+++ b/tmk_core/protocol/serial_mouse_mousesystems.c
diff --git a/protocol/serial_soft.c b/tmk_core/protocol/serial_soft.c
index 44822b7e43..44822b7e43 100644
--- a/protocol/serial_soft.c
+++ b/tmk_core/protocol/serial_soft.c
diff --git a/protocol/serial_uart.c b/tmk_core/protocol/serial_uart.c
index 35df27fd6e..35df27fd6e 100644
--- a/protocol/serial_uart.c
+++ b/tmk_core/protocol/serial_uart.c
diff --git a/protocol/usb_hid.mk b/tmk_core/protocol/usb_hid.mk
index 1f79bda3bd..1f79bda3bd 100644
--- a/protocol/usb_hid.mk
+++ b/tmk_core/protocol/usb_hid.mk
diff --git a/protocol/usb_hid/README b/tmk_core/protocol/usb_hid/README
index 0d2efc2aa2..0d2efc2aa2 100644
--- a/protocol/usb_hid/README
+++ b/tmk_core/protocol/usb_hid/README
diff --git a/protocol/usb_hid/USB_Host_Shield_2.0 b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0
-Subproject 7c2e6c1bcdcc22cfdbd82edd9d8fc4c4276ead4
+Subproject 7c2e6c1bcdcc22cfdbd82edd9d8fc4c4276ead4
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h
index 830c9952fb..830c9952fb 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Arduino.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp
index 1ee3a488a5..1ee3a488a5 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/CDC.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h
index ea134838a2..ea134838a2 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Client.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp
index ac63608449..ac63608449 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HID.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp
index f40ddee060..f40ddee060 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h
index bf4924c6d4..bf4924c6d4 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/HardwareSerial.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp
index fe3deb77a2..fe3deb77a2 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h
index 2585aec0e4..2585aec0e4 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/IPAddress.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h
index 8b8f742771..8b8f742771 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Platform.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp
index e541a6ce71..e541a6ce71 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h
index 1af6b723fc..1af6b723fc 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Print.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h
index d03c9af62c..d03c9af62c 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Printable.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h
index 9674c76269..9674c76269 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Server.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp
index aafb7fcf97..aafb7fcf97 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h
index 58bbf752f3..58bbf752f3 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Stream.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp
index 20eed3f483..20eed3f483 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Tone.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h
index d5abdb690d..d5abdb690d 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBAPI.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp
index 6766be61ab..6766be61ab 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h
index 8d13806896..8d13806896 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBCore.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h
index 900713e0f9..900713e0f9 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/USBDesc.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h
index dc5644b9df..dc5644b9df 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/Udp.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h
index 79733b50a5..79733b50a5 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WCharacter.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c
index 8f3ec847f1..8f3ec847f1 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WInterrupts.c
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp
index 2120c4cc10..2120c4cc10 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WMath.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp
index c6839fc0d9..c6839fc0d9 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h
index 947325e5f5..947325e5f5 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/WString.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h
index af1498033a..af1498033a 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/binary.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp
index 3d4e079d2a..3d4e079d2a 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/main.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp
index 0f6d4220ef..0f6d4220ef 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.cpp
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h
index cd940ce8b2..cd940ce8b2 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/new.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c
index ac8bb6f9b4..ac8bb6f9b4 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring.c
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c
index 0e9881f6ac..0e9881f6ac 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_analog.c
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c
index be323b1dfe..be323b1dfe 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_digital.c
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h
index f0ceb0cc4d..f0ceb0cc4d 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_private.h
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c
index 0d968865d2..0d968865d2 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_pulse.c
diff --git a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c
index cfe786758c..cfe786758c 100644
--- a/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/cores/arduino/wiring_shift.c
diff --git a/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h
index 52b37efc40..52b37efc40 100644
--- a/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/eightanaloginputs/pins_arduino.h
diff --git a/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h
index 9f770d6cec..9f770d6cec 100644
--- a/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/leonardo/pins_arduino.h
diff --git a/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h
index 5a9b4cb09b..5a9b4cb09b 100644
--- a/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/mega/pins_arduino.h
diff --git a/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h
index 30b4266306..30b4266306 100644
--- a/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h
+++ b/tmk_core/protocol/usb_hid/arduino-1.0.1/variants/standard/pins_arduino.h
diff --git a/protocol/usb_hid/leonardo_led.h b/tmk_core/protocol/usb_hid/leonardo_led.h
index 6f67a88f5b..6f67a88f5b 100644
--- a/protocol/usb_hid/leonardo_led.h
+++ b/tmk_core/protocol/usb_hid/leonardo_led.h
diff --git a/protocol/usb_hid/override_Serial.cpp b/tmk_core/protocol/usb_hid/override_Serial.cpp
index e1755a5dc7..e1755a5dc7 100644
--- a/protocol/usb_hid/override_Serial.cpp
+++ b/tmk_core/protocol/usb_hid/override_Serial.cpp
diff --git a/protocol/usb_hid/override_wiring.c b/tmk_core/protocol/usb_hid/override_wiring.c
index 1e9a94ce26..1e9a94ce26 100644
--- a/protocol/usb_hid/override_wiring.c
+++ b/tmk_core/protocol/usb_hid/override_wiring.c
diff --git a/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp
index 28151f9d59..28151f9d59 100644
--- a/protocol/usb_hid/parser.cpp
+++ b/tmk_core/protocol/usb_hid/parser.cpp
diff --git a/protocol/usb_hid/parser.h b/tmk_core/protocol/usb_hid/parser.h
index 703eb1ed4c..703eb1ed4c 100644
--- a/protocol/usb_hid/parser.h
+++ b/tmk_core/protocol/usb_hid/parser.h
diff --git a/protocol/usb_hid/test/Makefile b/tmk_core/protocol/usb_hid/test/Makefile
index 83bf2aed67..83bf2aed67 100644
--- a/protocol/usb_hid/test/Makefile
+++ b/tmk_core/protocol/usb_hid/test/Makefile
diff --git a/protocol/usb_hid/test/config.h b/tmk_core/protocol/usb_hid/test/config.h
index c2230fb570..c2230fb570 100644
--- a/protocol/usb_hid/test/config.h
+++ b/tmk_core/protocol/usb_hid/test/config.h
diff --git a/protocol/usb_hid/test/test.cpp b/tmk_core/protocol/usb_hid/test/test.cpp
index 4958f0c619..4958f0c619 100644
--- a/protocol/usb_hid/test/test.cpp
+++ b/tmk_core/protocol/usb_hid/test/test.cpp
diff --git a/protocol/usb_hid/usb_hid.h b/tmk_core/protocol/usb_hid/usb_hid.h
index 083b68d1f5..083b68d1f5 100644
--- a/protocol/usb_hid/usb_hid.h
+++ b/tmk_core/protocol/usb_hid/usb_hid.h
diff --git a/protocol/vusb.mk b/tmk_core/protocol/vusb.mk
index 3cba3f71a3..3cba3f71a3 100644
--- a/protocol/vusb.mk
+++ b/tmk_core/protocol/vusb.mk
diff --git a/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c
index 8e4a266e9b..8e4a266e9b 100644
--- a/protocol/vusb/main.c
+++ b/tmk_core/protocol/vusb/main.c
diff --git a/protocol/vusb/sendchar_usart.c b/tmk_core/protocol/vusb/sendchar_usart.c
index 8d24f87d1e..8d24f87d1e 100644
--- a/protocol/vusb/sendchar_usart.c
+++ b/tmk_core/protocol/vusb/sendchar_usart.c
diff --git a/protocol/vusb/usbdrv/Changelog.txt b/tmk_core/protocol/vusb/usbdrv/Changelog.txt
index 5c6354ab1e..5c6354ab1e 100644
--- a/protocol/vusb/usbdrv/Changelog.txt
+++ b/tmk_core/protocol/vusb/usbdrv/Changelog.txt
diff --git a/protocol/vusb/usbdrv/CommercialLicense.txt b/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt
index 11d07d9df0..11d07d9df0 100644
--- a/protocol/vusb/usbdrv/CommercialLicense.txt
+++ b/tmk_core/protocol/vusb/usbdrv/CommercialLicense.txt
diff --git a/protocol/vusb/usbdrv/License.txt b/tmk_core/protocol/vusb/usbdrv/License.txt
index 4460cfbae0..4460cfbae0 100644
--- a/protocol/vusb/usbdrv/License.txt
+++ b/tmk_core/protocol/vusb/usbdrv/License.txt
diff --git a/protocol/vusb/usbdrv/Readme.txt b/tmk_core/protocol/vusb/usbdrv/Readme.txt
index 970dc66b2f..970dc66b2f 100644
--- a/protocol/vusb/usbdrv/Readme.txt
+++ b/tmk_core/protocol/vusb/usbdrv/Readme.txt
diff --git a/protocol/vusb/usbdrv/USB-ID-FAQ.txt b/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt
index d1de8fb618..d1de8fb618 100644
--- a/protocol/vusb/usbdrv/USB-ID-FAQ.txt
+++ b/tmk_core/protocol/vusb/usbdrv/USB-ID-FAQ.txt
diff --git a/protocol/vusb/usbdrv/USB-IDs-for-free.txt b/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt
index 2f4d59ad18..2f4d59ad18 100644
--- a/protocol/vusb/usbdrv/USB-IDs-for-free.txt
+++ b/tmk_core/protocol/vusb/usbdrv/USB-IDs-for-free.txt
diff --git a/protocol/vusb/usbdrv/asmcommon.inc b/tmk_core/protocol/vusb/usbdrv/asmcommon.inc
index 07d692be3b..07d692be3b 100644
--- a/protocol/vusb/usbdrv/asmcommon.inc
+++ b/tmk_core/protocol/vusb/usbdrv/asmcommon.inc
diff --git a/protocol/vusb/usbdrv/oddebug.c b/tmk_core/protocol/vusb/usbdrv/oddebug.c
index 945457c1f4..945457c1f4 100644
--- a/protocol/vusb/usbdrv/oddebug.c
+++ b/tmk_core/protocol/vusb/usbdrv/oddebug.c
diff --git a/protocol/vusb/usbdrv/oddebug.h b/tmk_core/protocol/vusb/usbdrv/oddebug.h
index d61309daac..d61309daac 100644
--- a/protocol/vusb/usbdrv/oddebug.h
+++ b/tmk_core/protocol/vusb/usbdrv/oddebug.h
diff --git a/protocol/vusb/usbdrv/usbconfig-prototype.h b/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h
index 847710e2a0..847710e2a0 100644
--- a/protocol/vusb/usbdrv/usbconfig-prototype.h
+++ b/tmk_core/protocol/vusb/usbdrv/usbconfig-prototype.h
diff --git a/protocol/vusb/usbdrv/usbdrv.c b/tmk_core/protocol/vusb/usbdrv/usbdrv.c
index 2e8dd8756b..2e8dd8756b 100644
--- a/protocol/vusb/usbdrv/usbdrv.c
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrv.c
diff --git a/protocol/vusb/usbdrv/usbdrv.h b/tmk_core/protocol/vusb/usbdrv/usbdrv.h
index 42fe163720..42fe163720 100644
--- a/protocol/vusb/usbdrv/usbdrv.h
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrv.h
diff --git a/protocol/vusb/usbdrv/usbdrvasm.S b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S
index 45fcf18315..45fcf18315 100644
--- a/protocol/vusb/usbdrv/usbdrvasm.S
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.S
diff --git a/protocol/vusb/usbdrv/usbdrvasm.asm b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm
index 9cc4e4d739..9cc4e4d739 100644
--- a/protocol/vusb/usbdrv/usbdrvasm.asm
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm.asm
diff --git a/protocol/vusb/usbdrv/usbdrvasm12.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc
index c1167584cb..c1167584cb 100644
--- a/protocol/vusb/usbdrv/usbdrvasm12.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm12.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm128.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc
index bcd6621cc2..bcd6621cc2 100644
--- a/protocol/vusb/usbdrv/usbdrvasm128.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm128.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm15.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc
index 401b7f8fff..401b7f8fff 100644
--- a/protocol/vusb/usbdrv/usbdrvasm15.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm15.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm16.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc
index 207b6e48a1..207b6e48a1 100644
--- a/protocol/vusb/usbdrv/usbdrvasm16.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm16.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm165.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc
index 79b3c61cf8..79b3c61cf8 100644
--- a/protocol/vusb/usbdrv/usbdrvasm165.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm165.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm18-crc.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc
index f83347df7f..f83347df7f 100644
--- a/protocol/vusb/usbdrv/usbdrvasm18-crc.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm18-crc.inc
diff --git a/protocol/vusb/usbdrv/usbdrvasm20.inc b/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc
index 303abaf64c..303abaf64c 100644
--- a/protocol/vusb/usbdrv/usbdrvasm20.inc
+++ b/tmk_core/protocol/vusb/usbdrv/usbdrvasm20.inc
diff --git a/protocol/vusb/usbdrv/usbportability.h b/tmk_core/protocol/vusb/usbdrv/usbportability.h
index 476184dc68..476184dc68 100644
--- a/protocol/vusb/usbdrv/usbportability.h
+++ b/tmk_core/protocol/vusb/usbdrv/usbportability.h
diff --git a/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 7d0292ed17..7d0292ed17 100644
--- a/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
diff --git a/protocol/vusb/vusb.h b/tmk_core/protocol/vusb/vusb.h
index 5accf233be..5accf233be 100644
--- a/protocol/vusb/vusb.h
+++ b/tmk_core/protocol/vusb/vusb.h
diff --git a/rules.mk b/tmk_core/rules.mk
index d06756638c..d06756638c 100644
--- a/rules.mk
+++ b/tmk_core/rules.mk
diff --git a/tool/mbed/common.mk b/tmk_core/tool/mbed/common.mk
index 77bf7c3e49..77bf7c3e49 100644
--- a/tool/mbed/common.mk
+++ b/tmk_core/tool/mbed/common.mk
diff --git a/tool/mbed/gcc.mk b/tmk_core/tool/mbed/gcc.mk
index b8c7336b45..b8c7336b45 100644
--- a/tool/mbed/gcc.mk
+++ b/tmk_core/tool/mbed/gcc.mk
diff --git a/tool/mbed/lpc-vector-checksum.c b/tmk_core/tool/mbed/lpc-vector-checksum.c
index 316a1253a0..316a1253a0 100644
--- a/tool/mbed/lpc-vector-checksum.c
+++ b/tmk_core/tool/mbed/lpc-vector-checksum.c
diff --git a/tool/mbed/lpc11u35_501.mk b/tmk_core/tool/mbed/lpc11u35_501.mk
index 328d03d66a..328d03d66a 100644
--- a/tool/mbed/lpc11u35_501.mk
+++ b/tmk_core/tool/mbed/lpc11u35_501.mk
diff --git a/tool/mbed/mbed.mk b/tmk_core/tool/mbed/mbed.mk
index 2657a0fd37..2657a0fd37 100644
--- a/tool/mbed/mbed.mk
+++ b/tmk_core/tool/mbed/mbed.mk