Keyboard firmwares for Atmel AVR and Cortex-M
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.

HHKB.txt 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. Alternative Controller for HHKB pro
  2. ===================================
  3. I want to add vi cursor and mouse keys to HHKB. Original HHKB controller is not programmable and
  4. firmware source code is not open. So, customizing HHKB needs to replace original controller with programmable one.
  5. I used Teensy++ as alternative controller. Though a Teensy has enough ports to drive HHKB,
  6. Teensy++ has clean pinout and it makes programing and wiring easier.
  7. This is just a proof of concept for replacing controller of HHKB, not a complete firmware.
  8. My prototype firmware source tree is here:
  9. branch: hhkb(http://github.com/tmk/tmk_keyboard/tree/hhkb)
  10. This firmware is a port of my previous project:
  11. HHKB style Mod(http://geekhack.org/showwiki.php?title=Island:11930)
  12. PJRC:
  13. Teensy++/Teensy(http://www.pjrc.com/teensy/)
  14. Pros:
  15. * without pattern cutting, case mod and soldering
  16. * can keep original controller intact
  17. * can change HHKB behaviour as you like(by C programming)
  18. Cons:
  19. * void your warranty
  20. * unavailability of Teensy++/Teensy(because of PS3 cracking boom?)
  21. Features:
  22. * customized keymap
  23. * more keymap layers
  24. * mouse keys for minimum mouse operation(never comfortable for normal use)
  25. * and more...(in the future)
  26. Any suggestions or ideas are welcome.
  27. NOTE:
  28. My HHKB is just "Professional". This means followings may not be applied to "Professional2".
  29. DISCLAIMER:
  30. I'm not a professional for electronics and MCU programming. This may damage your HHKB.
  31. And my English writing is poor, I'm not sure I can convey my notions accurately.
  32. Teensy++ installation
  33. ---------------------
  34. Angled USB mini B adapter is used to install Teensy++ laterally.
  35. (teensy_install.jpg)
  36. Bread baord cables used for connect Teensy++.
  37. (teensy_wiring.jpg)
  38. (connector_contact.jpg)
  39. HHKB internal
  40. -------------
  41. HHKB pro has two PCBs and some chips.
  42. Controller PCB:
  43. M38K07M4 Renesas MCU with USB function
  44. http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
  45. (HHKB_controller.jpg)
  46. Keyswitch PCB:
  47. HC4051 Analog Multiplexer: select a row line.
  48. http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
  49. LS145 BCD Decoder: select a column line.
  50. http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
  51. BU9831 Non-volatile electronic potentiometer: for calibration?
  52. http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
  53. TP1684 Capacitive Sensing controller: no datasheet available.
  54. (HHKB_keyswitch.jpg)
  55. Topre original chip?
  56. (HHKB_TP1684.jpg)
  57. Two PCBs are connected by 15 lines. Vcc/GND uses 3 lines each, 9lines for keyboard signaling.
  58. Keyswitch PCB connector Teensy++ pins
  59. -------------------------------------------------------------------------------
  60. 1 Vcc(5V) 5V
  61. 2 Vcc(5V)
  62. 3 Vcc(5V)
  63. 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
  64. 5 TP1684 unknown:how to use PE7 input(with pullup)
  65. 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
  66. 7 HC4051 B(bit1) PB1 output
  67. 8 HC4051 C(bit2) PB2 output
  68. 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
  69. 10 LS145 B(bit1) PB4 output
  70. 11 LS145 C(bit2) PB5 output
  71. 12 LS145 D(enable) Low(0) enable selected column PB6 output
  72. 13 GND
  73. 14 GND
  74. 15 GND GND
  75. (HHKB_connector.jpg)
  76. Keyswitch matrix
  77. ----------------
  78. 60 keyswitches in 8*8 matrix. ghost free. bounce free.
  79. COL 0 1 2 3 4 5 6 7
  80. ROW ---------------------------------------------------------------
  81. 0| 2 q w s a z x c
  82. 1| 3 4 r e d f v b
  83. 2| 5 6 y t g h n _NONE_
  84. 3| 1 Esc Tab Control LShift LAlt LMeta Space
  85. 4| 7 8 u i k j m _NONE_
  86. 5| \ ` Delete Return Fn RShift RAlt RMeta
  87. 6| 9 0 o p ; l , _NONE_
  88. 7| - + ] [ ' / . _NONE_
  89. Matrix diagram:
  90. +-------------------------+-+-+-+-+-+-+-+ Vcc
  91. |bias control? - - - - - - - - ---
  92. | 3.9K*8 R R R R R R R R |
  93. +--------^+ +--------+ - - - - - - - - |
  94. | TP 1684 | | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
  95. | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
  96. | |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
  97. | <------| <3-------|-|-|-|-|-|-|-|--|R|-+
  98. | | | <4-------|-|-|-|-|-|-|-|--|R|-+
  99. | | | <5-------|-|-|-|-|-|-|-|--|R|-+
  100. | |calib.| <6-------|-|-|-|-|-|-|-|--|R|-+
  101. | <-+? | <7-------|-|-|-|-|-|-|-|--|R|-+
  102. +---V-----+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
  103. KEY ??? | A B C +-----------------+
  104. | | +-^----+ | | | | LS145 |
  105. Vcc | | |BU9831| | | | +-^--^--^--^------+
  106. --- | | +------+ | | | A B C D +------+
  107. | | | | | | | | | | | |
  108. 1-3 4 5 6 7 8 9 10 11 12 13-15 |
  109. +--------------------------------------------------+ |
  110. | connector | ---
  111. +--------------------------------------------------+ GND
  112. to controller
  113. Signals charts:
  114. While pressing space bar, watched HHKB original controller signals by logic analyzer.
  115. Row and column is looping between 0-7 each for selecting a key.
  116. A key is scaned every about 15ms, so scan rate is 66Hz.
  117. (HHKB_chart1.jpg)
  118. Space bar locate at ROW:3 COL:7. Key are selected by HC4051(C,B,A) and LS145(C,B,A).
  119. Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
  120. Usage of TP1684(5) is unknown. Key state can be read without using this signal.
  121. (HHKB_chart2.jpg)
  122. Matrix scan pseudo code:
  123. for (row: 0-7) {
  124. SELECT_ROW(row); // set HC4051(A,B,C)
  125. for (col: 0-7) {
  126. SELECT_COL(col); // set LS145(A,B,C)
  127. _delay_us(50);
  128. ENALBLE_COL(); // set LS145(D) to low
  129. _delay_us(10);
  130. if (KEY == 0) { // read TP1684(KEY)
  131. // key pressed
  132. } else {
  133. // not pressed
  134. }
  135. }
  136. }
  137. Keymap layers
  138. -------------
  139. Followings are added layers with additional Fn keys. They are not final decision.
  140. see keymap_hhkb.c
  141. EOF