You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
11 KiB

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