]> git.gir.st - tmk_keyboard.git/blob - hhkb/doc/HHKB.txt
Fixed Makefile to adjust new directories.
[tmk_keyboard.git] / hhkb / doc / HHKB.txt
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
8 This is just a proof of concept for replacing controller of HHKB, not a complete firmware.
9
10 My prototype firmware source tree is here:
11 github(http://github.com/tmk/tmk_keyboard)
12 This firmware is a port of my previous project:
13 HHKB style Mod(http://geekhack.org/showwiki.php?title=Island:11930)
14 PJRC:
15 Teensy++/Teensy(http://www.pjrc.com/teensy/)
16
17
18 Pros:
19 * without pattern cutting, case mod and soldering
20 * can keep original controller intact
21 * can change HHKB behaviour as you like(by C programming)
22
23 Cons:
24 * void your warranty
25 * unavailability of Teensy++/Teensy(because of PS3 cracking boom?)
26
27 Features:
28 * customized keymap
29 * more keymap layers
30 * mouse keys for minimum mouse operation(never comfortable for normal use)
31 * and more...(in the future)
32
33 Any suggestions or ideas are welcome.
34
35
36 NOTE:
37 My HHKB is just "Professional". This means followings may not be applied to "Professional2".
38
39 DISCLAIMER:
40 I'm not a professional for electronics and MCU programming. This may damage your HHKB.
41 And my English writing is poor, I'm not sure I can convey my notions accurately.
42
43
44 Teensy++ installation
45 ---------------------
46 Angled USB mini B adapter is used to install Teensy++ laterally.
47 (teensy_install.jpg)
48
49 Bread baord wires are used to connect Teensy++.
50 (teensy_wiring.jpg)
51 (connector_contact.jpg)
52
53
54 HHKB internal
55 -------------
56 HHKB pro has some chips on separate two PCBs.
57
58 Controller PCB:
59 M38K07M4 Renesas MCU with USB function
60 http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
61
62 (HHKB_controller.jpg)
63
64 Keyswitch PCB:
65 HC4051 Analog Multiplexer: select a row line.
66 http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
67 LS145 BCD Decoder: select a column line.
68 http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
69 BU9831 Non-volatile electronic potentiometer: for calibration?
70 http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
71 TP1683/4 Capacitive Sensing controller: no datasheet available.
72
73 (HHKB_keyswitch.jpg)
74
75 Topre original chip?
76 (HHKB_TP1684.jpg)
77
78
79 Two PCBs are connected by 15 lines. Vcc and GND use 3 lines each, other 9 lines are for keyboard signaling.
80
81 Keyswitch PCB connector Teensy++ pins
82 -------------------------------------------------------------------------------
83 1 Vcc(5V) 5V
84 2 Vcc(5V)
85 3 Vcc(5V)
86 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
87 5 TP1684 KEY_PREV: assert previous key state??? PE7 output
88 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
89 7 HC4051 B(bit1) PB1 output
90 8 HC4051 C(bit2) PB2 output
91 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
92 10 LS145 B(bit1) PB4 output
93 11 LS145 C(bit2) PB5 output
94 12 LS145 D(enable) Low(0) enable selected column PB6 output
95 13 GND
96 14 GND
97 15 GND GND
98
99 (HHKB_connector.jpg)
100
101
102 Keyswitch matrix
103 ----------------
104 60 keyswitches in 8*8 matrix. It is ghost-free and bounce-free.
105
106 COL 0 1 2 3 4 5 6 7
107 ROW ---------------------------------------------------------------
108 0| 2 q w s a z x c
109 1| 3 4 r e d f v b
110 2| 5 6 y t g h n _NONE_
111 3| 1 Esc Tab Control LShift LAlt LMeta Space
112 4| 7 8 u i k j m _NONE_
113 5| \ ` Delete Return Fn RShift RAlt RMeta
114 6| 9 0 o p ; l , _NONE_
115 7| - + ] [ ' / . _NONE_
116
117
118 Matrix diagram:
119 +-------------------------+-+-+-+-+-+-+-+ Vcc
120 |bias control? - - - - - - - - ---
121 | 3.9K*8 R R R R R R R R |
122 +--------^+ +--------+ - - - - - - - - |
123 | 2| | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
124 | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
125 | TP1684 |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
126 | 11<------| <3-------|-|-|-|-|-|-|-|--|R|-+
127 | | | <4-------|-|-|-|-|-|-|-|--|R|-+
128 | | | <5-------|-|-|-|-|-|-|-|--|R|-+
129 | <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+
130 | 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+
131 +---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
132 KEY PREV | A B C +-----------------+
133 | | +-^----+ | | | | LS145 |
134 Vcc | | |BU9831| | | | +-^--^--^--^------+
135 --- | | +------+ | | | A B C D +------+
136 | | | | | | | | | | | |
137 1-3 4 5 6 7 8 9 10 11 12 13-15 |
138 +--------------------------------------------------+ |
139 | connector | ---
140 +--------------------------------------------------+ GND
141 to controller
142
143
144 Signals charts:
145 While pressing space bar, watched HHKB original controller signals by logic analyzer.
146 Row and column is looping between 0-7 each for selecting a key.
147 A key is scaned every about 15ms, so scan rate is 66Hz.
148
149 (HHKB_chart1.jpg)
150
151 Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
152 Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
153
154 Usage of TP1684(5) is not clear. Controller seemed to output previous key state on this line.
155 However key state can be read without using this signal.
156
157 (HHKB_chart2.jpg)
158
159
160 Matrix scan pseudo code:
161 for (row: 0-7) {
162 SELECT_ROW(row); // set HC4051(A,B,C)
163
164 for (col: 0-7) {
165 SELECT_COL(col); // set LS145(A,B,C)
166
167 _delay_us(40);
168
169 if (prev_key_state(row, col)) {
170 KEY_PREV_ON;
171 }
172
173 _delay_us(7);
174
175 ENALBLE_COL(); // set LS145(D) to low
176
177 _delay_us(10);
178
179 if (KEY == 0) { // read TP1684(KEY)
180 // key pressed
181 } else {
182 // not pressed
183 }
184
185 KEY_PREV_OFF;
186 UNALBLE_COL(); // set LS145(D) to high
187
188 _delay_us(150);
189 }
190 }
191
192
193 Keymap layers
194 -------------
195 Followings are added layers with additional Fn keys.
196
197 see keymap.c
198
199 EOF
Imprint / Impressum