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 |
afb08462 |
26 | |
27 | |
28 | Projects |
29 | -------- |
083c7581 |
30 | You can find some keyboard specific projects under `converter` and `keyboard` directory. |
31 | |
afb08462 |
32 | ### converter |
1aa067e5 |
33 | * [ps2_usb](converter/ps2_usb/) - [PS/2 keyboard to USB][GH_ps2] |
34 | * [adb_usb](converter/adb_usb/) - [ADB keyboard to USB][GH_adb] |
35 | * [m0110_usb](converter/m0110_usb) - [Machintosh 128K/512K/Plus keyboard to USB][GH_m0110] |
36 | * [terminal_usb](converter/terminal_usb/) - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal] |
37 | * [news_usb](converter/news_usb/) - [Sony NEWS keyboard to USB][GH_news] |
38 | * [x68k_usb](converter/x68k_usb/) - [Sharp X68000 keyboard to USB][GH_x68k] |
633d9aa5 |
39 | * [sun_usb](converter/sun_usb/) - [Sun] to USB(type4, 5 and 3?) |
40 | * [pc98_usb](converter/pc98_usb/) - [PC98] to USB |
1aa067e5 |
41 | * [usb_usb](converter/usb_usb/) - USB to USB(experimental) |
afb08462 |
42 | |
43 | ### keyboard |
78fd5a71 |
44 | * [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] **my main board** |
45 | * [gh60](keyboard/gh60/) - [GH60] DIY 60% keyboard [prototype][GH60_proto] **my second board** |
46 | * [hbkb](keyboard/hbkb/) - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod) |
47 | * [hid_liber](keyboard/hid_liber/) - [HID liberation][HID_liber] controller (by alaricljs) |
48 | * [phantom](keyboard/phantom/) - [Phantom] keyboard (by Tranquilite) |
5808317b |
49 | * [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung) |
78fd5a71 |
50 | * [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired] |
784c6e39 |
51 | |
afb08462 |
52 | [GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 |
53 | [GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 |
54 | [GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618 |
55 | [GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290 |
56 | [GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851 |
57 | [GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965 |
81706d11 |
58 | [GH_news]: http://geekhack.org/showwiki.php?title=Island:25759 |
afb08462 |
59 | [GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272 |
60 | [GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060 |
81706d11 |
61 | [GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483 |
74ecdd15 |
62 | [HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions |
78fd5a71 |
63 | [Phantom]: http://geekhack.org/index.php?topic=26742 |
74ecdd15 |
64 | [GH60]: http://geekhack.org/index.php?topic=34959 |
78fd5a71 |
65 | [GH60_proto]: http://geekhack.org/index.php?topic=37570.0 |
633d9aa5 |
66 | [PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 |
67 | [Sun]: http://en.wikipedia.org/wiki/Sun-3 |
68 | [IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS |
afb08462 |
69 | |
70 | |
71 | |
78fd5a71 |
72 | License |
73 | ------- |
74 | **GPLv2** or later. Some protocol files are under **Modified BSD License**. |
75 | LUFA, PJRC and V-USB stack have their own license respectively. |
74ecdd15 |
76 | |
afb08462 |
77 | |
784c6e39 |
78 | |
78fd5a71 |
79 | Build Firmware and Program Controller |
80 | ------------------------------------- |
81 | See [doc/build.md](doc/build.md). |
afb08462 |
82 | |
afb08462 |
83 | |
84 | |
083c7581 |
85 | Change your keymap |
86 | ------------------ |
78fd5a71 |
87 | See [doc/keymap.md](doc/keymap.md). |
afb08462 |
88 | |
89 | |
74ecdd15 |
90 | |
91 | Magic Comannds |
92 | -------------- |
93 | To see help press `Magic` + `H`. |
94 | |
95 | `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. |
96 | |
97 | Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed. |
98 | |
99 | ----- Command Help ----- |
100 | c: enter console mode |
101 | d: toggle debug enable |
102 | x: toggle matrix debug |
103 | k: toggle keyboard debug |
104 | m: toggle mouse debug |
105 | p: toggle print enable |
106 | v: print device version & info |
107 | t: print timer count |
108 | s: print status |
4e93b3fa |
109 | e: print eeprom config |
110 | n: toggle NKRO |
74ecdd15 |
111 | 0/F10: switch to Layer0 |
112 | 1/F1: switch to Layer1 |
113 | 2/F2: switch to Layer2 |
114 | 3/F3: switch to Layer3 |
115 | 4/F4: switch to Layer4 |
116 | PScr: power down/remote wake-up |
117 | Caps: Lock Keyboard(Child Proof) |
118 | Paus: jump to bootloader |
119 | |
8b9bd51d |
120 | **TBD** |
39d09333 |
121 | |
4e93b3fa |
122 | ### Boot Magic Configuration - Virtual DIP Switch |
8b9bd51d |
123 | Boot Magic are executed during boot up time. Press Magic key below then pulgin keyboard cable. |
4e93b3fa |
124 | 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 |
125 | |
4e93b3fa |
126 | #### EEPROM |
127 | - Skip reading EEPROM(`ESC`) |
8b9bd51d |
128 | - Clear configuration stored in EEPROM(`Backspace`) |
4e93b3fa |
129 | |
130 | #### Bootloader |
8b9bd51d |
131 | - Kick up Bootloader(`B`) |
4e93b3fa |
132 | |
133 | #### Debug |
8b9bd51d |
134 | - Debug enable(`D`) |
4e93b3fa |
135 | - Debug matrix enable(`D`+`X`) |
136 | - Debug keyboard enable(`D`+`K`) |
137 | - Debug mouse enable(`D`+`M`) |
138 | |
139 | #### Keymap |
8b9bd51d |
140 | - Swap Control and CapsLock(`Left Control`) |
141 | - Change CapsLock to Control(`Casp Lock`) |
142 | - Swap LeftAlt and Gui(`Left Alt`) |
143 | - Swap RightAlt and Gui(`Right Alt`) |
144 | - Disable Gui(`Left Gui`) |
145 | - Swap Grave and Escape(`Grave`) |
146 | - Swap BackSlash and BackSpace(`Back Slash`) |
39d09333 |
147 | |
4e93b3fa |
148 | #### Default Layer |
149 | - Set Default Layer to 0(`0`) |
150 | - Set Default Layer to 0(`1`) |
151 | - Set Default Layer to 0(`2`) |
152 | - Set Default Layer to 0(`3`) |
153 | |
8b9bd51d |
154 | **TBD** |
39d09333 |
155 | |
74ecdd15 |
156 | |
c0137b4b |
157 | Mechanical Locking support for CapsLock |
158 | --------------------------------------- |
159 | To enable this feature define these two macros in `config.h` and use `KC_LCAP` for locking CapsLock in keymap instead of normal `KC_CAPS`. Resync option tries to keep lock switch state consistent with keyboard LED state. |
160 | |
161 | #define CAPSLOCK_LOCKING_ENABLE |
162 | #define CAPSLOCK_LOCKING_RESYNC_ENABLE |
163 | |
74ecdd15 |
164 | |
165 | Start Your Own Project |
afb08462 |
166 | ----------------------- |
0142e20b |
167 | **TBD** |
41bf9204 |
168 | ### Config.h Options |
169 | #### 1. USB vendor/product ID and device description |
170 | #define VENDOR_ID 0xFEED |
171 | #define PRODUCT_ID 0xBEEF |
41bf9204 |
172 | #define MANUFACTURER t.m.k. |
173 | #define PRODUCT Macway mod |
174 | #define DESCRIPTION t.m.k. keyboard firmware for Macway mod |
175 | |
176 | #### 2. Keyboard matrix configuration |
177 | #define MATRIX_ROWS 8 |
178 | #define MATRIX_COLS 8 |
179 | #define MATRIX_HAS_GHOST |
180 | |
afb08462 |
181 | |
afb08462 |
182 | |
78fd5a71 |
183 | Architecture |
184 | ------------ |
185 | Architecture Diagram |
186 | +---------------+---------------+-------------+ |
187 | | Host | Keyboard | Matrix, LED | |
188 | ___________ |-----------+-+ +-------------+ | +-----------| |
189 | / /| Keys/Mouse | Protocol |d| | Action | | | Protocol | |
190 | /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix | |
191 | |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________ |
192 | || || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /| |
193 | || Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / / |
194 | ||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / / |
195 | `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ / |
196 | |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/ |
197 | +---------------------------------------------+ Keyboard |
198 | |
199 | |
200 | |
201 | Debuging |
202 | -------- |
203 | Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack. |
afb08462 |
204 | |
78fd5a71 |
205 | You will see output from firmware like this. |
206 | |
207 | r/c 01234567 |
208 | 00: 00000000 |
209 | 01: 00000000 |
210 | 02: 00000000 |
211 | 03: 00000000 |
212 | 04: 00000000 |
213 | 05: 00000000 |
214 | 06: 00000000 |
215 | 07: 00000000 |
216 | |
217 | ---- action_exec: start ----- |
218 | EVENT: 0307u(22511) |
219 | Tapping: Tap release(2) |
220 | ACTION: ACT_LAYER[5:2C] |
221 | LAYER_PRESSED: Tap: unregister_code |
222 | TAPPING_KEY=0307u(22511):2 |
223 | processed: 0307u(22511):2 |
224 | |
225 | Tapping: End(Timeout after releasing last tap): FFFFu(22715) |
226 | TAPPING_KEY=0000u(0):0 |
227 | |
228 | |
229 | |
230 | |
231 | Files and Directories |
74ecdd15 |
232 | ------------------- |
233 | ### Top |
234 | * common/ - common codes |
235 | * protocol/ - keyboard protocol support |
236 | * keyboard/ - keyboard projects |
237 | * converter/ - protocol converter projects |
238 | * doc/ - documents |
239 | * common.mk - Makefile for common |
240 | * protoco.mk - Makefile for protocol |
241 | * rules.mk - Makefile for build rules |
242 | |
243 | ### Common |
78fd5a71 |
244 | * host.h |
0be309cc |
245 | * host_driver.h |
78fd5a71 |
246 | * keyboard.h |
247 | * command.h |
248 | * keymap.h |
249 | * action.h |
0be309cc |
250 | * keycode.h |
0be309cc |
251 | * matrix.h |
78fd5a71 |
252 | * led.h |
253 | * mousekey.h |
0be309cc |
254 | * report.h |
78fd5a71 |
255 | * debug.h |
256 | * print.h |
257 | * bootloader.h |
0be309cc |
258 | * sendchar.h |
78fd5a71 |
259 | * timer.h |
260 | * util.h |
74ecdd15 |
261 | |
262 | ### Keyboard Protocols |
263 | * lufa/ - LUFA USB stack |
264 | * pjrc/ - PJRC USB stack |
265 | * vusb/ - Objective Development V-USB |
266 | * iwrap/ - Bluetooth HID for Bluegiga iWRAP |
267 | * ps2.c - PS/2 protocol |
268 | * adb.c - Apple Desktop Bus protocol |
269 | * m0110.c - Macintosh 128K/512K/Plus keyboard protocol |
270 | * news.c - Sony NEWS keyboard protocol |
271 | * x68k.c - Sharp X68000 keyboard protocol |
272 | * serial_soft.c - Asynchronous Serial protocol implemented by software |
afb08462 |
273 | |
afb08462 |
274 | |
afb08462 |
275 | |
78fd5a71 |
276 | Other Keyboard Firmware Projects |
277 | ------------------ |
278 | See [doc/other_projects.md](doc/other_projects.md). |