]> git.gir.st - tmk_keyboard.git/blob - HHKB/HHKB.txt
add HHKB docs and pics.
[tmk_keyboard.git] / HHKB / 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 branch: hhkb(http://github.com/tmk/tmk_keyboard/tree/hhkb)
12 This firmware is a port of my previous project:
13 HHKB style Mod(http://geekhack.org/showwiki.php?title=Island:11930)
14 PJRC(Teensy++/Teensy)
15 http://www.pjrc.com/teensy/
16
17
18 Pros:
19 * without pattern cuting, 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 DISCLAIMER:
39 I'm not a professional for electronics and MCU programming. This may damage your HHKB.
40 And my English writing is poor, I'm not sure I can convey my notions accurately.
41
42
43 Teensy++ installation
44 ---------------------
45 Angled USB mini B adapter is used to install Teensy++ laterally.
46 (teensy_install.jpg)
47
48 Bread baord cables used for connect Teensy++.
49 (teensy_wiring.jpg)
50 (connector_contact.jpg)
51
52
53 HHKB internal
54 -------------
55 HHKB pro has two PCBs and some chips.
56
57 Controller PCB:
58 M38K07M4 Renesas MCU with USB function
59 http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
60 (HHKB_controller.jpg)
61
62 Keyswitch PCB:
63 HC4051 Analog Multiplexer: select a row line.
64 http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
65 LS145 BCD Decoder: select a column line.
66 http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
67 BU9831 Non-volatile electronic potentiometer: for calibration?
68 http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
69 TP1684 Capacitive Sensing controller: no datasheet available.
70 (HHKB_keyswitch.jpg)
71 Topre original chip?
72 (HHKB_TP1684.jpg)
73
74
75 Two PCBs are connected by 15 lines. Vcc/GND uses 3 lines each, 9lines for keyboard signaling.
76
77 Keyswitch PCB connector Teensy++ pins
78 -------------------------------------------------------------------------------
79 1 Vcc(5V) 5V
80 2 Vcc(5V)
81 3 Vcc(5V)
82 4 TP1684 KEY: Low(0) when key pressed PE6 input w/o pullup
83 5 TP1684 unknown:how to use PE7 input w/o pullup
84 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
85 7 HC4051 B(bit1) PB1 output
86 8 HC4051 C(bit2) PB2 output
87 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
88 10 LS145 B(bit1) PB4 output
89 11 LS145 C(bit2) PB5 output
90 12 LS145 D(enable) Low(0) enable selected column PB6 output
91 13 GND
92 14 GND
93 15 GND GND
94 (HHKB_connector.jpg)
95
96
97 Keyswitch matrix
98 ----------------
99 60 keyswitches in 8*8 matrix. ghost free. bounce free.
100
101 COL 0 1 2 3 4 5 6 7
102 ROW ---------------------------------------------------------------
103 0| 2 q w s a z x c
104 1| 3 4 r e d f v b
105 2| 5 6 y t g h n _NONE_
106 3| 1 Esc Tab Control LShift LAlt LMeta Space
107 4| 7 8 u i k j m _NONE_
108 5| \ ` Delete Return Fn RShift RAlt RMeta
109 6| 9 0 o p ; l , _NONE_
110 7| - + ] [ ' / . _NONE_
111
112
113 Matrix diagram:
114 +-------------------------+-+-+-+-+-+-+-+ Vcc
115 |bias control? - - - - - - - - ---
116 | 3.9K*8 R R R R R R R R |
117 +--------^+ +--------+ - - - - - - - - |
118 | TP 1684 | | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
119 | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
120 | |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
121 | <------| <3-------|-|-|-|-|-|-|-|--|R|-+
122 | | | <4-------|-|-|-|-|-|-|-|--|R|-+
123 | | | <5-------|-|-|-|-|-|-|-|--|R|-+
124 | |calib.| <6-------|-|-|-|-|-|-|-|--|R|-+
125 | <-+? | <7-------|-|-|-|-|-|-|-|--|R|-+
126 +---V-----+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
127 KEY ??? | A B C +-----------------+
128 | | +-^----+ | | | | LS145 |
129 Vcc | | |BU9831| | | | +-^--^--^--^------+
130 --- | | +------+ | | | A B C D +------+
131 | | | | | | | | | | | |
132 1-3 4 5 6 7 8 9 10 11 12 13-15 |
133 +--------------------------------------------------+ |
134 | connector | ---
135 +--------------------------------------------------+ GND
136 to controller
137
138
139 Signals charts:
140 While pressing space bar, watched HHKB original controller signals by logic analyzer.
141 Row and column is looping between 0-7 each for selecting a key.
142 A key is scaned every about 15ms, so scan rate is 66Hz.
143 (HHKB_chart1.jpg)
144
145 Space bar locate at ROW:3 COL:7. Key are selected by HC4051(C,B,A) and LS145(C,B,A).
146 Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
147 Usage of TP1684(5) is unknown. Key state can be read without using this signal.
148 (HHKB_chart2.jpg)
149
150
151 Matrix scan pseudo code:
152 for (row: 0-7) {
153 SELECT_ROW(row); // set HC4051(A,B,C)
154
155 for (col: 0-7) {
156 SELECT_COL(col); // set LS145(A,B,C)
157
158 _delay_us(50);
159
160 ENALBLE_COL(); // set LS145(D) to low
161
162 _delay_us(10);
163
164 if (KEY == 0) { // read TP1684(KEY)
165 // key pressed
166 } else {
167 // not pressed
168 }
169 }
170 }
171
172
173 Keymap layers
174 -------------
175 Followings are added layers with additional Fn keys. They are not final decision.
176
177 Layer0(Default Layer):
178 ,-----------------------------------------------------------.
179 |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
180 |-----------------------------------------------------------|
181 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs|
182 |-----------------------------------------------------------|
183 |Contro| A| S| D| F| G| H| J| K| L| ;| '|Return |
184 |-----------------------------------------------------------|
185 |Shift | Z| X| C| V| B| N| M| ,| .| /|Fn2 |Fn1|
186 `-----------------------------------------------------------'
187 |Gui|Alt |Space |Fn3 |Gui|
188 `-------------------------------------------'
189
190 Layer1(Fn1) HHKB mode:
191 ,-----------------------------------------------------------.
192 |Pow| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
193 |-----------------------------------------------------------|
194 |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
195 |-----------------------------------------------------------|
196 |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
197 |-----------------------------------------------------------|
198 |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
199 `-----------------------------------------------------------'
200 |Gui |Alt |Space |Alt |Gui|
201 `--------------------------------------------'
202
203 Layer2(Fn2) mouse mode:
204 ,-----------------------------------------------------------.
205 |Esc| | | | | | | | | | | | | | |
206 |-----------------------------------------------------------|
207 |Tab | | | | | | | | | | | | |Backs|
208 |-----------------------------------------------------------|
209 |Contro| | | | | | | |MwL|MwD|MwU|MwR|Return |
210 |-----------------------------------------------------------|
211 |Shift | | | | | | |McL|McD|McU|McR|xxxxxx| |
212 `-----------------------------------------------------------'
213 |Gui |Alt |Mb1 |Mb1 |Mb2|
214 `--------------------------------------------'
215
216 Layer3(Fn3) vi mode:
217 ,-----------------------------------------------------------.
218 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
219 |-----------------------------------------------------------|
220 |Tab | | | | | |Hom|PgD|PgUlEnd| |MwD|MwU|Backs|
221 |-----------------------------------------------------------|
222 |Contro| | | | | |Lef|Dow|Up |Rig| | |Return |
223 |-----------------------------------------------------------|
224 |Shift | | | | | | |McL|McD|McU|McR|Mb1 | |
225 `-----------------------------------------------------------'
226 |Gui|Alt |Mb1 |xxxxx|Mb2|
227 `-------------------------------------------'
228 Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
229
230 EOF
Imprint / Impressum