Kiibohd Controller
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

README 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. The Kiibohd Controller
  2. ----------------------
  3. TODO, write some insightful/informative :P
  4. Please give authors credit for modules used if you use in a distributed product :D
  5. ----------------------
  6. Dependencies
  7. ----------------------
  8. Below listed are the Arch Linux pacman names, AUR packages may be required.
  9. These depend a bit on which targets you are trying to build, but the general one:
  10. - cmake (2.8 and higher)
  11. - Teensy Loader (http://pjrc.com/teensy/loader.html)
  12. AVR Specific (Teensy 1.0/++,2.0/++) (try to use something recent, suggested versions below)
  13. - avr-gcc (4.8.0)
  14. - avr-binutils (2.23.2)
  15. - avr-libc (1.8.0)
  16. ARM Specific (Teensy 3.0) (Sourcery CodeBench Lite for ARM EABI
  17. (http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/)
  18. - arm-none-eabi
  19. - TODO?
  20. ----------------------
  21. Selecting Architecture
  22. ----------------------
  23. This is where you choose which architecture you want to build for.
  24. The options are:
  25. - Teensy 1.0 (Not tested)
  26. - Teensy 1.0++ (Not tested)
  27. - Teensy 2.0
  28. - Teensy 2.0++
  29. - Teensy 3.0
  30. Open up CMakeLists.txt in your favourite text editor.
  31. You are looking for:
  32. ###
  33. Compiler Family
  34. #
  35. #| Specify the compiler family to use
  36. #| Currently only supports AVR and ARM
  37. #| "avr" # Teensy 1.0
  38. #| "avr" # Teensy 2.0
  39. #| "avr" # Teensy++ 1.0
  40. #| "avr" # Teensy++ 2.0
  41. #| "arm" # Teensy 3.0
  42. set( COMPILER_FAMILY "avr" )
  43. Just change the COMPILER_FAMILY variable to whatever you are trying to build for.
  44. NOTE: If you change this option, you will *may* to delete the build directory that is created in the Building sections below.
  45. ----------------------
  46. Selecting Microcontroller
  47. ----------------------
  48. Even if you selected the "avr" family of microcontroller architectures, you will still need to specify a target microcontroller (or once more ARM microcontrollers are supported).
  49. Open up avr.cmake (or arm.cmake) in your favourite text editor.
  50. You are looking for:
  51. ###
  52. # Atmel Defines and Linker Options
  53. #
  54. #| MCU Name
  55. #| You _MUST_ set this to match the board you are using
  56. #| type "make clean" after changing this, so all files will be rebuilt
  57. #|
  58. #| "at90usb162" # Teensy 1.0
  59. #| "atmega32u4" # Teensy 2.0
  60. #| "at90usb646" # Teensy++ 1.0
  61. #| "at90usb1286" # Teensy++ 2.0
  62. set( MCU "at90usb1286" )
  63. *OR*
  64. ###
  65. # ARM Defines and Linker Options
  66. #
  67. #| Chip Name (Linker)
  68. #| You _MUST_ set this to match the board you are using
  69. #| type "make clean" after changing this, so all files will be rebuilt
  70. #|
  71. #| "mk20dx128" # Teensy 3.0
  72. set( CHIP "mk20dx128" )
  73. Just change the CHIP variable to the microcontroller you are trying to build for.
  74. NOTE: If you change this option, you will *need* to delete the build directory that is created in the Building sections below.
  75. ----------------------
  76. Selecting Modules
  77. ----------------------
  78. WARNING: Not all modules are compatible, and some modules may have dependencies on other modules.
  79. This is where the options start getting interesting.
  80. The Kiibohd Controller is designed around a set of 4 types of modules that correspond to different functionality:
  81. - Scan Module
  82. - Macro Module
  83. - USB Module
  84. - Debug Module
  85. The Scan Module is where the most interesting stuff happens. These modules take in "keypress data".
  86. A converter Scan Module will interpret a protocol into key press/releases.
  87. A matrix Scan Module may inherit from the matrix module to scan keypress from a matrix
  88. This module just has to give press/release codes, but does have some callback control to other modules depending on the lifecycle for press/release codes (this can be very complicated depending on the protocol).
  89. Each Scan Module has it's own default keymap/modifier map. (TODO recommend keymap changing in the Macro Module).
  90. The Macro Module takes care of the mapping of the key press/release code into a USB scan code.
  91. Any layering, macros, keypress intelligence/reaction is done here.
  92. The USB Module is the output module of the microcontroller. Currently USB is the only output protocol.
  93. Different USB output implementations are available, pjrc being the safest/least featureful one.
  94. Debug capabilities may depend on the module selected.
  95. The Debug Module enables various things like the Teensy LED on errors, debug terminal output.
  96. (TODO get true UART working in avr, not just arm)
  97. Open up setup.cmake in your favourite text editor.
  98. Look for:
  99. ###
  100. # Project Modules
  101. #
  102. #| Note: This is the only section you probably want to modify
  103. #| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
  104. #| All of the modules must be specified, as they generate the sources list of files to compile
  105. #| Any modifications to this file will cause a complete rebuild of the project
  106. #| Please look at the {Scan,Macro,USB,Debug}/module.txt for information on the modules and how to create new ones
  107. ##| Deals with acquiring the keypress information and turning it into a key index
  108. set( ScanModule "avr-capsense" )
  109. ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
  110. set( MacroModule "buffer" )
  111. ##| Sends the current list of usb key codes through USB HID
  112. set( USBModule "pjrc" )
  113. ##| Debugging source to use, each module has it's own set of defines that it sets
  114. set( DebugModule "full" )
  115. Look at each module individually for it's requirements. There is chip/architecture dependency checking but some permutations of modules may not be tested/compile.
  116. There are also CMake options for temporarily selecting modules. But it's easier to just edit the file.
  117. e.g. cmake -DScanModuleOverride=<module name>
  118. ----------------------
  119. Linux Building
  120. ----------------------
  121. From this directory.
  122. mkdir build
  123. cd build
  124. cmake ..
  125. make
  126. Example output:
  127. [master]: cmake .. [...sy/avr-capsense-haata/build](hyatt@901Mas:pts/4)
  128. -- Compiler Family:
  129. avr
  130. -- MCU Selected:
  131. at90usb1286
  132. -- Detected Scan Module Source Files:
  133. Scan/avr-capsense/scan_loop.c
  134. -- Detected Macro Module Source Files:
  135. Macro/buffer/macro.c
  136. -- Detected USB Module Source Files:
  137. USB/pjrc/usb_com.c;USB/pjrc/avr/usb_keyboard_debug.c
  138. -- Detected Debug Module Source Files:
  139. Debug/full/../led/led.c;Debug/full/../print/print.c
  140. -- Configuring done
  141. -- Generating done
  142. -- Build files have been written to: /home/hyatt/Source/Teensy/avr-capsense-haata/build
  143. [master]: make [...sy/avr-capsense-haata/build](hyatt@901Mas:pts/4)
  144. Scanning dependencies of target kiibohd.elf
  145. [ 12%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
  146. [ 25%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/avr-capsense/scan_loop.c.o
  147. [ 37%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/buffer/macro.c.o
  148. [ 50%] Building C object CMakeFiles/kiibohd.elf.dir/USB/pjrc/usb_com.c.o
  149. [ 62%] Building C object CMakeFiles/kiibohd.elf.dir/USB/pjrc/avr/usb_keyboard_debug.c.o
  150. [ 75%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.o
  151. [ 87%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.o
  152. Linking C executable kiibohd.elf
  153. Creating load file for Flash: kiibohd.hex
  154. Creating Extended Listing: kiibohd.lss
  155. Creating Symbol Table: kiibohd.sym
  156. [ 87%] Built target kiibohd.elf
  157. Scanning dependencies of target SizeAfter
  158. [100%] Size after generation:
  159. text data bss dec hex filename
  160. 0 6112 0 6112 17e0 kiibohd.hex
  161. 5792 320 852 6964 1b34 kiibohd.elf
  162. [100%] Built target SizeAfter
  163. ----------------------
  164. Linux Loading Firmware
  165. ----------------------
  166. The 'load' script that is created during the build can load the firmware over USB.
  167. It uses sudo, so make sure you have the priviledges.
  168. (TODO, not complete, avr and arm are different currently, need to be unified)
  169. ./load
  170. ----------------------
  171. Windows Building
  172. ----------------------
  173. TODO
  174. ----------------------
  175. Windows Loading Firmware
  176. ----------------------
  177. TODO
  178. ----------------------
  179. Mac OS X Building
  180. ----------------------
  181. TODO
  182. ----------------------
  183. Mac OS X Loading Firmware
  184. ----------------------
  185. TODO
  186. ----------------------
  187. Debugging
  188. ----------------------
  189. TODO