Merge commit 'a20ef7052c6e937d2f7672dd59456e55a5c08296' into master_ng
[tmk_keyboard.git] / README.md
CommitLineData
78fd5a71 1TMK Keyboard Firmware Collection
2================================
3This is a keyboard firmware with some useful features for Atmel AVR controller.
afb08462 4
5Source code is available here: <http://github.com/tmk/tmk_keyboard>
6
7
8Features
9--------
78fd5a71 10These features can be used in your keyboard.
11
633d9aa5 12* Multi-layer Keymap - Multiple keyboard layouts with layer switching
74ecdd15 13* Mouse key - Mouse control with keyboard
14* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up
15* Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc
16* USB NKRO - 120 keys(+ 8 modifiers) simultaneously
17* PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device
18* Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols
19* User Function - Customizable function of key with writing code
20* Macro - Very primitive at this time
21* Keyboard Tricks - Oneshot modifier and modifier with tapping feature
22* Debug Console - Messages for debug and interaction with firmware
8b9bd51d 23* Virtual DIP Switch - Configurations stored EEPROM(Boot Magic)
c0137b4b 24* Locking CapsLock - Mechanical switch support for CapsLock
0142e20b 25* Breathing Sleep LED - Sleep indicator with charm during USB suspend
1eb8523e 26* Backlight - Control backlight levels
afb08462 27
28
29Projects
30--------
083c7581 31You can find some keyboard specific projects under `converter` and `keyboard` directory.
32
afb08462 33### converter
1aa067e5 34* [ps2_usb](converter/ps2_usb/) - [PS/2 keyboard to USB][GH_ps2]
35* [adb_usb](converter/adb_usb/) - [ADB keyboard to USB][GH_adb]
22bd315b 36* [m0110_usb](converter/m0110_usb) - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
1aa067e5 37* [terminal_usb](converter/terminal_usb/) - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
38* [news_usb](converter/news_usb/) - [Sony NEWS keyboard to USB][GH_news]
39* [x68k_usb](converter/x68k_usb/) - [Sharp X68000 keyboard to USB][GH_x68k]
633d9aa5 40* [sun_usb](converter/sun_usb/) - [Sun] to USB(type4, 5 and 3?)
41* [pc98_usb](converter/pc98_usb/) - [PC98] to USB
1aa067e5 42* [usb_usb](converter/usb_usb/) - USB to USB(experimental)
92cda14f 43* [ascii_usb](converter/ascii_usb/) - ASCII(Serial console terminal) to USB
428b2364 44* [ibm4704_usb](converter/ibm4704_usb) - [IBM 4704 keyboard Converter][GH_ibm4704]
afb08462 45
46### keyboard
78fd5a71 47* [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] **my main board**
48* [gh60](keyboard/gh60/) - [GH60] DIY 60% keyboard [prototype][GH60_proto] **my second board**
49* [hbkb](keyboard/hbkb/) - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
50* [hid_liber](keyboard/hid_liber/) - [HID liberation][HID_liber] controller (by alaricljs)
51* [phantom](keyboard/phantom/) - [Phantom] keyboard (by Tranquilite)
5808317b 52* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung)
78fd5a71 53* [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired]
43e5ca60 54* [KMAC](keyboard/kmac/) - Korean custom keyboard
498ea75d 55* [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard
d0fefb76 56* [Infinity](keyboard/infinity/) - Massdrop [Infinity keyboard][Infinity]
d9b5f511 57* [NerD](keyboard/nerd/) - Korean custom keyboard
e0f32742 58* [KittenPaw](keyboard/kitten_paw) - Custom Majestouch controller
07b54cb5 59* [Lightpad](keyboard/lightpad) - Korean custom keypad
a6d33e2c 60* [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt]
784c6e39 61
771347c4 62### Extenal projects using tmk_keyboard
63* [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org]
64* [mcdox][mcdox_tmk] - [mcdox][mcdox]
65
66
afb08462 67[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
68[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
69[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
70[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
71[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
72[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
81706d11 73[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
afb08462 74[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
75[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
81706d11 76[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
428b2364 77[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
74ecdd15 78[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
78fd5a71 79[Phantom]: http://geekhack.org/index.php?topic=26742
74ecdd15 80[GH60]: http://geekhack.org/index.php?topic=34959
78fd5a71 81[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
633d9aa5 82[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
83[Sun]: http://en.wikipedia.org/wiki/Sun-3
84[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
d0fefb76 85[Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit
a6d33e2c
VO
86[ghost_squid]: http://deskthority.net/wiki/Costar_replacement_controllers#The_Ghost_Squid
87[cmxt]: http://gaming.coolermaster.com/en/products/keyboards/quickfirext/
771347c4 88[ergodox_org]: http://ergodox.org/
89[cub-uanic]: https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox
90[mcdox]: https://github.com/DavidMcEwan/mcdox
91[mcdox_tmk]: https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox
afb08462 92
93
94
78fd5a71 95License
96-------
97**GPLv2** or later. Some protocol files are under **Modified BSD License**.
98LUFA, PJRC and V-USB stack have their own license respectively.
74ecdd15 99
afb08462 100
784c6e39 101
78fd5a71 102Build Firmware and Program Controller
103-------------------------------------
104See [doc/build.md](doc/build.md).
afb08462 105
afb08462 106
107
083c7581 108Change your keymap
109------------------
78fd5a71 110See [doc/keymap.md](doc/keymap.md).
afb08462 111
112
74ecdd15 113
22bd315b 114Magic Commands
74ecdd15 115--------------
116To see help press `Magic` + `H`.
117
118 `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.
119
120Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed.
121
122 ----- Command Help -----
123 c: enter console mode
124 d: toggle debug enable
125 x: toggle matrix debug
126 k: toggle keyboard debug
127 m: toggle mouse debug
74ecdd15 128 v: print device version & info
129 t: print timer count
130 s: print status
4e93b3fa 131 e: print eeprom config
132 n: toggle NKRO
74ecdd15 133 0/F10: switch to Layer0
134 1/F1: switch to Layer1
135 2/F2: switch to Layer2
136 3/F3: switch to Layer3
137 4/F4: switch to Layer4
138 PScr: power down/remote wake-up
139 Caps: Lock Keyboard(Child Proof)
140 Paus: jump to bootloader
141
8b9bd51d 142**TBD**
39d09333 143
4e93b3fa 144### Boot Magic Configuration - Virtual DIP Switch
22bd315b 145Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
4e93b3fa 146Note 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.
39d09333 147
05225dd9 148To 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).
149
dad9dab9 150#### General
151- Skip reading EEPROM to start with default configuration(`ESC`)
152- Clear configuration stored in EEPROM to reset configuration(`Backspace`)
4e93b3fa 153
154#### Bootloader
8b9bd51d 155- Kick up Bootloader(`B`)
4e93b3fa 156
157#### Debug
8b9bd51d 158- Debug enable(`D`)
4e93b3fa 159- Debug matrix enable(`D`+`X`)
160- Debug keyboard enable(`D`+`K`)
161- Debug mouse enable(`D`+`M`)
162
163#### Keymap
8b9bd51d 164- Swap Control and CapsLock(`Left Control`)
22bd315b 165- Change CapsLock to Control(`Caps Lock`)
8b9bd51d 166- Swap LeftAlt and Gui(`Left Alt`)
167- Swap RightAlt and Gui(`Right Alt`)
168- Disable Gui(`Left Gui`)
169- Swap Grave and Escape(`Grave`)
170- Swap BackSlash and BackSpace(`Back Slash`)
e5bafff7 171- Enable NKRO on boot(`N`)
39d09333 172
4e93b3fa 173#### Default Layer
174- Set Default Layer to 0(`0`)
dad9dab9 175- Set Default Layer to 1(`1`)
176- Set Default Layer to 2(`2`)
177- Set Default Layer to 3(`3`)
9de9d719 178- Set Default Layer to 4(`4`)
179- Set Default Layer to 5(`5`)
180- Set Default Layer to 6(`6`)
181- Set Default Layer to 7(`7`)
182
183#### Caution
184Unintentional use of this feature will cause user confusion.
185
186TODO: Magic key combination to avoid unintentional press during plug in
4e93b3fa 187
8b9bd51d 188**TBD**
39d09333 189
74ecdd15 190
27210220 191Mechanical Locking support
192--------------------------
193This 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.
c0137b4b 194
27210220 195 #define LOCKING_SUPPORT_ENABLE
196 #define LOCKING_RESYNC_ENABLE
c0137b4b 197
74ecdd15 198
199Start Your Own Project
afb08462 200-----------------------
0142e20b 201**TBD**
41bf9204 202### Config.h Options
203#### 1. USB vendor/product ID and device description
204 #define VENDOR_ID 0xFEED
205 #define PRODUCT_ID 0xBEEF
41bf9204 206 #define MANUFACTURER t.m.k.
207 #define PRODUCT Macway mod
208 #define DESCRIPTION t.m.k. keyboard firmware for Macway mod
209
210#### 2. Keyboard matrix configuration
211 #define MATRIX_ROWS 8
212 #define MATRIX_COLS 8
213 #define MATRIX_HAS_GHOST
214
afb08462 215
afb08462 216
78fd5a71 217Architecture
218------------
219 Architecture Diagram
220 +---------------+---------------+-------------+
221 | Host | Keyboard | Matrix, LED |
222 ___________ |-----------+-+ +-------------+ | +-----------|
223 / /| Keys/Mouse | Protocol |d| | Action | | | Protocol |
224 /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix |
225 |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________
226 || || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /|
227 || Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
228 ||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / /
229 `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ /
230 |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/
231 +---------------------------------------------+ Keyboard
232
233
234
22bd315b 235Debugging
78fd5a71 236--------
237Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
afb08462 238
adbd15d5 239You can use xprintf() to display debug info on `hid_listen`, see `common/xprintf.h`.
78fd5a71 240
241
242
243Files and Directories
74ecdd15 244-------------------
245### Top
246* common/ - common codes
247* protocol/ - keyboard protocol support
248* keyboard/ - keyboard projects
249* converter/ - protocol converter projects
250* doc/ - documents
251* common.mk - Makefile for common
22bd315b 252* protocol.mk - Makefile for protocol
74ecdd15 253* rules.mk - Makefile for build rules
254
255### Common
78fd5a71 256* host.h
0be309cc 257* host_driver.h
78fd5a71 258* keyboard.h
259* command.h
260* keymap.h
261* action.h
0be309cc 262* keycode.h
0be309cc 263* matrix.h
78fd5a71 264* led.h
265* mousekey.h
0be309cc 266* report.h
78fd5a71 267* debug.h
268* print.h
269* bootloader.h
0be309cc 270* sendchar.h
78fd5a71 271* timer.h
272* util.h
74ecdd15 273
274### Keyboard Protocols
275* lufa/ - LUFA USB stack
276* pjrc/ - PJRC USB stack
277* vusb/ - Objective Development V-USB
278* iwrap/ - Bluetooth HID for Bluegiga iWRAP
279* ps2.c - PS/2 protocol
280* adb.c - Apple Desktop Bus protocol
281* m0110.c - Macintosh 128K/512K/Plus keyboard protocol
282* news.c - Sony NEWS keyboard protocol
283* x68k.c - Sharp X68000 keyboard protocol
284* serial_soft.c - Asynchronous Serial protocol implemented by software
afb08462 285
afb08462 286
afb08462 287
22bd315b 288Coding Style
de7b46cd 289-------------
290- Doesn't use Tab to indent, use 4-spaces instead.
291
292
293
78fd5a71 294Other Keyboard Firmware Projects
295------------------
771347c4 296You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](doc/other_projects.md).
Imprint / Impressum