Keyboard firmwares for Atmel AVR and Cortex-M
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

HHKB.txt 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Internal of HHKB pro
  2. =====================
  3. HHKB pro has MCU and some chips on separate two PCBs.
  4. Controller PCB
  5. --------------
  6. M38K07M4 Renesas MCU with USB function
  7. http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
  8. (HHKB_controller.jpg)
  9. Keyswitch PCB
  10. -------------
  11. HC4051 Analog Multiplexer: select a row line.
  12. http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
  13. LS145 BCD Decoder: select a column line.
  14. http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
  15. BU9831 Non-volatile electronic potentiometer: for calibration?
  16. http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
  17. TP1683/4 Capacitive Sensing controller: no datasheet available.
  18. (HHKB_keyswitch.jpg)
  19. Topre original chip?
  20. (HHKB_TP1684.jpg)
  21. Connector Cable
  22. ---------------
  23. Two PCBs are connected by 15 lines(13 in case of Pro2).
  24. Vcc and GND use 3(2) lines each, other 9 lines are for keyboard signaling.
  25. Keyswitch PCB connector Teensy++ pins
  26. -------------------------------------------------------------------------------
  27. 1 Vcc(5V) Not exist on Pro2 5V
  28. 2 Vcc(5V) 5V
  29. 3 Vcc(5V) 5V
  30. 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
  31. 5 TP1684 KEY_PREV: assert previous key state??? PE7 output
  32. 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
  33. 7 HC4051 B(bit1) PB1 output
  34. 8 HC4051 C(bit2) PB2 output
  35. 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
  36. 10 LS145 B(bit1) PB4 output
  37. 11 LS145 C(bit2) PB5 output
  38. 12 LS145 D(enable) Low(0) enable selected column PB6 output
  39. 13 GND GND
  40. 14 GND GND
  41. 15 GND Not exist on Pro2 GND
  42. NOTE: guessing pin5(KEY_PREV) may work for hysteresis of capacitive sensing.
  43. (HHKB_connector.jpg)
  44. Keyswitch matrix
  45. ----------------
  46. 60 keyswitches in 8*8 matrix. It is ghost-free and bounce-free.
  47. COL 0 1 2 3 4 5 6 7
  48. ROW ---------------------------------------------------------------
  49. 0| 2 q w s a z x c
  50. 1| 3 4 r e d f v b
  51. 2| 5 6 y t g h n _NONE_
  52. 3| 1 Esc Tab Control LShift LAlt LMeta Space
  53. 4| 7 8 u i k j m _NONE_
  54. 5| \ ` Delete Return Fn RShift RAlt RMeta
  55. 6| 9 0 o p ; l , _NONE_
  56. 7| - + ] [ ' / . _NONE_
  57. Matrix diagram:
  58. +-------------------------+-+-+-+-+-+-+-+ Vcc
  59. |bias control? - - - - - - - - ---
  60. | 3.9K*8 R R R R R R R R |
  61. +--------^+ +--------+ - - - - - - - - |
  62. | 2| | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
  63. | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
  64. | TP1684 |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
  65. | 11<------| <3-------|-|-|-|-|-|-|-|--|R|-+
  66. | | | <4-------|-|-|-|-|-|-|-|--|R|-+
  67. | | | <5-------|-|-|-|-|-|-|-|--|R|-+
  68. | <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+
  69. | 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+
  70. +---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
  71. KEY PREV | A B C +-----------------+
  72. | | +-^----+ | | | | LS145 |
  73. Vcc | | |BU9831| | | | +-^--^--^--^------+
  74. --- | | +------+ | | | A B C D +------+
  75. | | | | | | | | | | | |
  76. 1-3 4 5 6 7 8 9 10 11 12 13-15 |
  77. +--------------------------------------------------+ |
  78. | connector | ---
  79. +--------------------------------------------------+ GND
  80. to controller
  81. Signals charts
  82. --------------
  83. While pressing space bar, watched HHKB original controller signals by logic analyzer.
  84. Row and column is looping between 0-7 each for selecting a key.
  85. A key is scaned every about 15ms, so scan rate is 66Hz.
  86. (HHKB_chart1.jpg)
  87. Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
  88. Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
  89. Usage of TP1684(5) is not clear. Controller seemed to output previous key state on this line.
  90. However key state can be read without using this signal.
  91. (HHKB_chart2.jpg)
  92. Matrix scan pseudo code
  93. -----------------------
  94. for (row: 0-7) {
  95. SELECT_ROW(row); // set HC4051(A,B,C)
  96. for (col: 0-7) {
  97. SELECT_COL(col); // set LS145(A,B,C)
  98. _delay_us(40);
  99. if (prev_key_state(row, col)) {
  100. KEY_PREV_ON;
  101. }
  102. _delay_us(7);
  103. ENALBLE_COL(); // set LS145(D) to low
  104. _delay_us(10);
  105. if (KEY == 0) { // read TP1684(KEY)
  106. // key pressed
  107. } else {
  108. // not pressed
  109. }
  110. KEY_PREV_OFF;
  111. UNALBLE_COL(); // set LS145(D) to high
  112. _delay_us(150);
  113. }
  114. }
  115. EOF