78fd5a71 |
1 | TMK Keyboard Firmware Collection |
2 | ================================ |
3 | This is a keyboard firmware with some useful features for Atmel AVR controller. |
afb08462 |
4 | |
5 | Source code is available here: <http://github.com/tmk/tmk_keyboard> |
6 | |
7 | |
8 | Features |
9 | -------- |
78fd5a71 |
10 | These 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 | |
29 | Projects |
30 | -------- |
083c7581 |
31 | You 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] |
784c6e39 |
57 | |
afb08462 |
58 | [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 |
59 | [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 |
60 | [GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618 |
61 | [GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290 |
62 | [GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851 |
63 | [GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965 |
81706d11 |
64 | [GH_news]: http://geekhack.org/showwiki.php?title=Island:25759 |
afb08462 |
65 | [GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272 |
66 | [GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060 |
81706d11 |
67 | [GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483 |
428b2364 |
68 | [GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0 |
74ecdd15 |
69 | [HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions |
78fd5a71 |
70 | [Phantom]: http://geekhack.org/index.php?topic=26742 |
74ecdd15 |
71 | [GH60]: http://geekhack.org/index.php?topic=34959 |
78fd5a71 |
72 | [GH60_proto]: http://geekhack.org/index.php?topic=37570.0 |
633d9aa5 |
73 | [PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 |
74 | [Sun]: http://en.wikipedia.org/wiki/Sun-3 |
75 | [IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS |
d0fefb76 |
76 | [Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit |
afb08462 |
77 | |
78 | |
79 | |
78fd5a71 |
80 | License |
81 | ------- |
82 | **GPLv2** or later. Some protocol files are under **Modified BSD License**. |
83 | LUFA, PJRC and V-USB stack have their own license respectively. |
74ecdd15 |
84 | |
afb08462 |
85 | |
784c6e39 |
86 | |
78fd5a71 |
87 | Build Firmware and Program Controller |
88 | ------------------------------------- |
89 | See [doc/build.md](doc/build.md). |
afb08462 |
90 | |
afb08462 |
91 | |
92 | |
083c7581 |
93 | Change your keymap |
94 | ------------------ |
78fd5a71 |
95 | See [doc/keymap.md](doc/keymap.md). |
afb08462 |
96 | |
97 | |
74ecdd15 |
98 | |
22bd315b |
99 | Magic Commands |
74ecdd15 |
100 | -------------- |
101 | To see help press `Magic` + `H`. |
102 | |
103 | `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. |
104 | |
105 | Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed. |
106 | |
107 | ----- Command Help ----- |
108 | c: enter console mode |
109 | d: toggle debug enable |
110 | x: toggle matrix debug |
111 | k: toggle keyboard debug |
112 | m: toggle mouse debug |
74ecdd15 |
113 | v: print device version & info |
114 | t: print timer count |
115 | s: print status |
4e93b3fa |
116 | e: print eeprom config |
117 | n: toggle NKRO |
74ecdd15 |
118 | 0/F10: switch to Layer0 |
119 | 1/F1: switch to Layer1 |
120 | 2/F2: switch to Layer2 |
121 | 3/F3: switch to Layer3 |
122 | 4/F4: switch to Layer4 |
123 | PScr: power down/remote wake-up |
124 | Caps: Lock Keyboard(Child Proof) |
125 | Paus: jump to bootloader |
126 | |
8b9bd51d |
127 | **TBD** |
39d09333 |
128 | |
4e93b3fa |
129 | ### Boot Magic Configuration - Virtual DIP Switch |
22bd315b |
130 | Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable. |
4e93b3fa |
131 | 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. |
39d09333 |
132 | |
05225dd9 |
133 | 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). |
134 | |
dad9dab9 |
135 | #### General |
136 | - Skip reading EEPROM to start with default configuration(`ESC`) |
137 | - Clear configuration stored in EEPROM to reset configuration(`Backspace`) |
4e93b3fa |
138 | |
139 | #### Bootloader |
8b9bd51d |
140 | - Kick up Bootloader(`B`) |
4e93b3fa |
141 | |
142 | #### Debug |
8b9bd51d |
143 | - Debug enable(`D`) |
4e93b3fa |
144 | - Debug matrix enable(`D`+`X`) |
145 | - Debug keyboard enable(`D`+`K`) |
146 | - Debug mouse enable(`D`+`M`) |
147 | |
148 | #### Keymap |
8b9bd51d |
149 | - Swap Control and CapsLock(`Left Control`) |
22bd315b |
150 | - Change CapsLock to Control(`Caps Lock`) |
8b9bd51d |
151 | - Swap LeftAlt and Gui(`Left Alt`) |
152 | - Swap RightAlt and Gui(`Right Alt`) |
153 | - Disable Gui(`Left Gui`) |
154 | - Swap Grave and Escape(`Grave`) |
155 | - Swap BackSlash and BackSpace(`Back Slash`) |
e5bafff7 |
156 | - Enable NKRO on boot(`N`) |
39d09333 |
157 | |
4e93b3fa |
158 | #### Default Layer |
159 | - Set Default Layer to 0(`0`) |
dad9dab9 |
160 | - Set Default Layer to 1(`1`) |
161 | - Set Default Layer to 2(`2`) |
162 | - Set Default Layer to 3(`3`) |
9de9d719 |
163 | - Set Default Layer to 4(`4`) |
164 | - Set Default Layer to 5(`5`) |
165 | - Set Default Layer to 6(`6`) |
166 | - Set Default Layer to 7(`7`) |
167 | |
168 | #### Caution |
169 | Unintentional use of this feature will cause user confusion. |
170 | |
171 | TODO: Magic key combination to avoid unintentional press during plug in |
4e93b3fa |
172 | |
8b9bd51d |
173 | **TBD** |
39d09333 |
174 | |
74ecdd15 |
175 | |
27210220 |
176 | Mechanical Locking support |
177 | -------------------------- |
178 | 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. |
c0137b4b |
179 | |
27210220 |
180 | #define LOCKING_SUPPORT_ENABLE |
181 | #define LOCKING_RESYNC_ENABLE |
c0137b4b |
182 | |
74ecdd15 |
183 | |
184 | Start Your Own Project |
afb08462 |
185 | ----------------------- |
0142e20b |
186 | **TBD** |
41bf9204 |
187 | ### Config.h Options |
188 | #### 1. USB vendor/product ID and device description |
189 | #define VENDOR_ID 0xFEED |
190 | #define PRODUCT_ID 0xBEEF |
41bf9204 |
191 | #define MANUFACTURER t.m.k. |
192 | #define PRODUCT Macway mod |
193 | #define DESCRIPTION t.m.k. keyboard firmware for Macway mod |
194 | |
195 | #### 2. Keyboard matrix configuration |
196 | #define MATRIX_ROWS 8 |
197 | #define MATRIX_COLS 8 |
198 | #define MATRIX_HAS_GHOST |
199 | |
afb08462 |
200 | |
afb08462 |
201 | |
78fd5a71 |
202 | Architecture |
203 | ------------ |
204 | Architecture Diagram |
205 | +---------------+---------------+-------------+ |
206 | | Host | Keyboard | Matrix, LED | |
207 | ___________ |-----------+-+ +-------------+ | +-----------| |
208 | / /| Keys/Mouse | Protocol |d| | Action | | | Protocol | |
209 | /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix | |
210 | |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________ |
211 | || || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /| |
212 | || Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / / |
213 | ||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / / |
214 | `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ / |
215 | |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/ |
216 | +---------------------------------------------+ Keyboard |
217 | |
218 | |
219 | |
22bd315b |
220 | Debugging |
78fd5a71 |
221 | -------- |
222 | Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack. |
afb08462 |
223 | |
adbd15d5 |
224 | You can use xprintf() to display debug info on `hid_listen`, see `common/xprintf.h`. |
78fd5a71 |
225 | |
226 | |
227 | |
228 | Files and Directories |
74ecdd15 |
229 | ------------------- |
230 | ### Top |
231 | * common/ - common codes |
232 | * protocol/ - keyboard protocol support |
233 | * keyboard/ - keyboard projects |
234 | * converter/ - protocol converter projects |
235 | * doc/ - documents |
236 | * common.mk - Makefile for common |
22bd315b |
237 | * protocol.mk - Makefile for protocol |
74ecdd15 |
238 | * rules.mk - Makefile for build rules |
239 | |
240 | ### Common |
78fd5a71 |
241 | * host.h |
0be309cc |
242 | * host_driver.h |
78fd5a71 |
243 | * keyboard.h |
244 | * command.h |
245 | * keymap.h |
246 | * action.h |
0be309cc |
247 | * keycode.h |
0be309cc |
248 | * matrix.h |
78fd5a71 |
249 | * led.h |
250 | * mousekey.h |
0be309cc |
251 | * report.h |
78fd5a71 |
252 | * debug.h |
253 | * print.h |
254 | * bootloader.h |
0be309cc |
255 | * sendchar.h |
78fd5a71 |
256 | * timer.h |
257 | * util.h |
74ecdd15 |
258 | |
259 | ### Keyboard Protocols |
260 | * lufa/ - LUFA USB stack |
261 | * pjrc/ - PJRC USB stack |
262 | * vusb/ - Objective Development V-USB |
263 | * iwrap/ - Bluetooth HID for Bluegiga iWRAP |
264 | * ps2.c - PS/2 protocol |
265 | * adb.c - Apple Desktop Bus protocol |
266 | * m0110.c - Macintosh 128K/512K/Plus keyboard protocol |
267 | * news.c - Sony NEWS keyboard protocol |
268 | * x68k.c - Sharp X68000 keyboard protocol |
269 | * serial_soft.c - Asynchronous Serial protocol implemented by software |
afb08462 |
270 | |
afb08462 |
271 | |
afb08462 |
272 | |
22bd315b |
273 | Coding Style |
de7b46cd |
274 | ------------- |
275 | - Doesn't use Tab to indent, use 4-spaces instead. |
276 | |
277 | |
278 | |
78fd5a71 |
279 | Other Keyboard Firmware Projects |
280 | ------------------ |
281 | See [doc/other_projects.md](doc/other_projects.md). |