aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-04-06 00:01:04 +0900
committertmk <nobody@nowhere>2013-04-06 00:01:04 +0900
commit78fd5a715464e72df08bcf683ca45b63c2df490f (patch)
tree98658ec58f6a53925461f873869b91af62fde8fd /README.md
parentc26a5eb2ac64892f2102e66477fa7f794e9dfe3f (diff)
downloadqmk_firmware-78fd5a715464e72df08bcf683ca45b63c2df490f.tar.gz
qmk_firmware-78fd5a715464e72df08bcf683ca45b63c2df490f.zip
Add doc/build.md and doc/other_projects.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md302
1 files changed, 84 insertions, 218 deletions
diff --git a/README.md b/README.md
index 39abe7180..998d99a00 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,14 @@
1t.m.k. Keyboard Firmware Collection 1TMK Keyboard Firmware Collection
2==================================== 2================================
3This is a keyboard firmware with some features for Atmel AVR controller. 3This is a keyboard firmware with some useful features for Atmel AVR controller.
4 4
5Source code is available here: <http://github.com/tmk/tmk_keyboard> 5Source code is available here: <http://github.com/tmk/tmk_keyboard>
6 6
7 7
8Features 8Features
9-------- 9--------
10These features can be used in your keyboard.
11
10* Multi-layer Keymap - Multiple keyboard layouts with layer switching 12* Multi-layer Keymap - Multiple keyboard layouts with layer switching
11* Mouse key - Mouse control with keyboard 13* Mouse key - Mouse control with keyboard
12* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up 14* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up
@@ -39,13 +41,13 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
39* [usb_usb](converter/usb_usb/) - USB to USB(experimental) 41* [usb_usb](converter/usb_usb/) - USB to USB(experimental)
40 42
41### keyboard 43### keyboard
42* [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard professional][GH_hhkb] 44* [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] **my main board**
43* [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] 45* [gh60](keyboard/gh60/) - [GH60] DIY 60% keyboard [prototype][GH60_proto] **my second board**
44* [hbkb](keyboard/hbkb/) - [Happy Buckling sprint keyboard(IBM Model M mod)][GH_hbkb] 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)
45* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung) 49* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung)
46* [hid_liber](keyboard/hid_liber/) - [HID liberation controller][HID_liber](by alaricljs) 50* [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired]
47* [phantom](keyboard/phantom/) - [Phantom keyboard][PHANTOM] (by Tranquilite)
48* [gh60](keyboard/gh60/) - [GH60 keyboard][GH60]
49 51
50[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930 52[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
51[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047 53[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
@@ -58,207 +60,31 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
58[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060 60[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
59[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483 61[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
60[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions 62[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
61[PHANTOM]: http://geekhack.org/index.php?topic=26742 63[Phantom]: http://geekhack.org/index.php?topic=26742
62[GH60]: http://geekhack.org/index.php?topic=34959 64[GH60]: http://geekhack.org/index.php?topic=34959
65[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
63[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801 66[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
64[Sun]: http://en.wikipedia.org/wiki/Sun-3 67[Sun]: http://en.wikipedia.org/wiki/Sun-3
65[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS 68[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
66 69
67 70
68 71
69Download and Install 72License
70-------------------- 73-------
71### 1. Install Tools 74**GPLv2** or later. Some protocol files are under **Modified BSD License**.
72First, you need tools to build firmware and program your controller. I assume you are on Windows here. 75LUFA, PJRC and V-USB stack have their own license respectively.
73
741. **Toolchain** Install [WinAVR][winavr]. This is old but works well for this purpose. `WinAVR` is a tool set to build firmware including C compiler(gcc) and make commands. You can use [CrossPack][crosspack] instead if you are on Mac.
75
762. **Programmer** Install [Atmel FLIP][flip]. `FLIP` is a tool to program(load) firmware into AVR controller via DFU bootloader. AVR USB chips including ATmega32U4 has DFU bootloader by factory default. You can also use [dfu-programmer][dfu-prog] instead if you are on Mac or Linux.
77
783. **Driver** At first time you start DFU bootloader on Chip 'Found New Hardware Wizard' will come up on Windows. 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\. If you use `dfu-programmer` install its driver.
79
80If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader].
81
82
83### 2. Download source
84You can find firmware source at github:
85
86- <https://github.com/tmk/tmk_keyboard>
87
88If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from:
89
90- <https://github.com/tmk/tmk_keyboard/archive/master.zip>
91
92
93Build firmware
94--------------
95### 1. Open terminal
96Open terminal window to get access to commands. You can use `cmd` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up.
97
98### 2. Change directory
99Move to project directory in the firmware source.
100
101 cd tmk_keyboard/{'keyboard' or 'converter'}/<project>
102
103### 3. Make
104Build firmware using GNU `make` command. You'll see `<project>_<variant>.hex` file in that directory unless something unexpected occurs in build process.
105
106
107 mkae -f Makefile.<variant> clean
108 make -f Makefile.<variant>
109
110
111
112
113Program Controller
114------------------
115Now 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.
116
117### 1. Start bootloader
118How 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.
119
120### 2. Program with DFU bootloader
121Stock 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.
122
123To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`.
124If you have a proper program command in `Makefile` just type this.
125
126`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below.
127To use command line tool run this command. Note that you need to set PATH variable properly.
128
129 $ make -f Makefile.<variant> flip
130
131Or to program with `dfu-programmer` run:
132
133 $ make -f Makefile.<variant> dfu
134
135#### FLIP GUI tutorial
1361. On menu bar click Device -> Select, then. `ATmega32u4`.
1372. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog.
138At this point you'll see greyouted widgets on the app get colored and ready.
139
1403. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog.
1414. 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.
1425. Re-plug USB cord or click 'Start Application' button to restart your controller.
143Done.
144
145See also these instaructions if you need.
146
147- <http://code.google.com/p/micropendous/wiki/LoadingFirmwareWithFLIP>
148- <http://www.atmel.com/Images/doc7769.pdf>
149
150
151### 3. Program with Teensy Loader
152If you have PJRC Teensy see instruction of `Teensy Loader`.
153
154- <http://www.pjrc.com/teensy/loader.html>
155
156Or use this command if you have command line version of Teensy Loader installed.
157
158 $ make -f Makefile.<variant> teensy
159
160
161### 4. Program with Other programmer
162You may want to use other programmer like `avrdude` with AVRISPmkII, Aruduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile.
163
164 $ make -f Makefile.<variant> program
165
166
167[winavr]: http://winavr.sourceforge.net/
168[crosspack]: http://www.obdev.at/products/crosspack/index.html
169[flip]: http://www.atmel.com/tools/FLIP.aspx
170[dfu-prog]: http://dfu-programmer.sourceforge.net/
171[teensy-loader]:http://www.pjrc.com/teensy/loader.html
172
173
174
175Makefile Options
176----------------
177### 1. MCU and Frequency.
178
179 MCU = atmega32u4 # Teensy 2.0
180 #MCU = at90usb1286 # Teensy++ 2.0
181 F_CPU = 16000000
182
183 # Boot Section Size in *bytes*
184 # Teensy halfKay 512
185 # Atmel DFU loader 4096
186 # LUFA bootloader 4096
187 OPT_DEFS += -DBOOTLOADER_SIZE=4096
188
189### 2. Features
190Optional. Note that ***comment out*** to disable them.
191
192 BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
193 MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
194 EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
195 CONSOLE_ENABLE = yes # Console for debug(+400)
196 COMMAND_ENABLE = yes # Commands for debug and configuration
197 SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
198 #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
199
200### 3. Programmer
201Optional. 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 `Teesy Loader`.
202
203 # avrdude with AVRISPmkII
204 PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex
205
206 # avrdude with USBaspLoader
207 PROGRAM_CMD = avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex
208
209 # avrdude with arduino
210 PROGRAM_CMD = avrdude -p $(MCU) -c arduino -P COM1 -b 57600 -U flash:w:$(TARGET).hex
211
212
213 76
214Config.h Options
215----------------
216### 1. Magic command key combination
217 77
218 #define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
219 78
220### 2. Mechanical Locking Support for CapsLock 79Build Firmware and Program Controller
80-------------------------------------
81See [doc/build.md](doc/build.md).
221 82
222 /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */
223 #define CAPSLOCK_LOCKING_ENABLE
224 /* Locking CapsLock resynchronize hack */
225 #define CAPSLOCK_LOCKING_RESYNC_ENABLE
226 83
227 84
228Change your keymap 85Change your keymap
229------------------ 86------------------
230[keymap.md](doc/keymap.md) 87See [doc/keymap.md](doc/keymap.md).
231
232
233
234
235Debuging
236--------
237Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
238
239You will see output from firmware like this.
240
241 r/c 01234567
242 00: 00000000
243 01: 00000000
244 02: 00000000
245 03: 00000000
246 04: 00000000
247 05: 00000000
248 06: 00000000
249 07: 00000000
250
251 ---- action_exec: start -----
252 EVENT: 0307u(22511)
253 Tapping: Tap release(2)
254 ACTION: ACT_LAYER[5:2C]
255 LAYER_PRESSED: Tap: unregister_code
256 TAPPING_KEY=0307u(22511):2
257 processed: 0307u(22511):2
258
259 Tapping: End(Timeout after releasing last tap): FFFFu(22715)
260 TAPPING_KEY=0000u(0):0
261
262 88
263 89
264 90
@@ -324,7 +150,6 @@ Start Your Own Project
324#### 1. USB vendor/product ID and device description 150#### 1. USB vendor/product ID and device description
325 #define VENDOR_ID 0xFEED 151 #define VENDOR_ID 0xFEED
326 #define PRODUCT_ID 0xBEEF 152 #define PRODUCT_ID 0xBEEF
327 /* device description */
328 #define MANUFACTURER t.m.k. 153 #define MANUFACTURER t.m.k.
329 #define PRODUCT Macway mod 154 #define PRODUCT Macway mod
330 #define DESCRIPTION t.m.k. keyboard firmware for Macway mod 155 #define DESCRIPTION t.m.k. keyboard firmware for Macway mod
@@ -336,8 +161,55 @@ Start Your Own Project
336 161
337 162
338 163
164Architecture
165------------
166 Architecture Diagram
167 +---------------+---------------+-------------+
168 | Host | Keyboard | Matrix, LED |
169 ___________ |-----------+-+ +-------------+ | +-----------|
170 / /| Keys/Mouse | Protocol |d| | Action | | | Protocol |
171 /__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix |
172 |.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________
173 || || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /|
174 || Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / /
175 ||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / /
176 `_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ /
177 |_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/
178 +---------------------------------------------+ Keyboard
179
180
181
182Debuging
183--------
184Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
339 185
340Files & Directories 186You will see output from firmware like this.
187
188 r/c 01234567
189 00: 00000000
190 01: 00000000
191 02: 00000000
192 03: 00000000
193 04: 00000000
194 05: 00000000
195 06: 00000000
196 07: 00000000
197
198 ---- action_exec: start -----
199 EVENT: 0307u(22511)
200 Tapping: Tap release(2)
201 ACTION: ACT_LAYER[5:2C]
202 LAYER_PRESSED: Tap: unregister_code
203 TAPPING_KEY=0307u(22511):2
204 processed: 0307u(22511):2
205
206 Tapping: End(Timeout after releasing last tap): FFFFu(22715)
207 TAPPING_KEY=0000u(0):0
208
209
210
211
212Files and Directories
341------------------- 213-------------------
342### Top 214### Top
343* common/ - common codes 215* common/ - common codes
@@ -350,28 +222,23 @@ Files & Directories
350* rules.mk - Makefile for build rules 222* rules.mk - Makefile for build rules
351 223
352### Common 224### Common
353* action.[ch] 225* host.h
354* action_macro.[ch]
355* bootloader.[ch]
356* command.[ch]
357* controller_teensy.h
358* debug.[ch]
359* host.[ch]
360* host_driver.h 226* host_driver.h
361* keyboard.[ch] 227* keyboard.h
228* command.h
229* keymap.h
230* action.h
362* keycode.h 231* keycode.h
363* keymap.[ch]
364* led.h
365* matrix.h 232* matrix.h
366* mousekey.[ch] 233* led.h
367* print.[ch] 234* mousekey.h
368* report.h 235* report.h
236* debug.h
237* print.h
238* bootloader.h
369* sendchar.h 239* sendchar.h
370* sendchar_null.c 240* timer.h
371* sendchar_uart.c 241* util.h
372* timer.[ch]
373* uart.[ch]
374* util.[ch]
375 242
376### Keyboard Protocols 243### Keyboard Protocols
377* lufa/ - LUFA USB stack 244* lufa/ - LUFA USB stack
@@ -387,7 +254,6 @@ Files & Directories
387 254
388 255
389 256
390License 257Other Keyboard Firmware Projects
391------- 258------------------
392Under `GPL` 2 or later. Some protocol files are under `Modified BSD License`. 259See [doc/other_projects.md](doc/other_projects.md).
393LUFA, PJRC and V-USB stack have their own license respectively.