KeyMatrixAnalyzer for TrackPoint Keyboard USB English 0B47190

Dependencies:   mbed

output

esc 0 0
f1 2 3
f2 1 3
f3 1 1
f4 1 0
f5 10 0
f6 6 0
f7 7 1
f8 7 3
f9 10 3
f10 10 5
f11 11 5
f12 13 5
home 11 3
end 14 5
ins 15 5
del 15 3
~ 0 3
1 0 5
2 2 5
3 1 5
4 4 5
5 4 3
6 5 3
7 5 5
8 6 5
9 7 5
0 8 5
- 8 3
= 6 3
bs 10 1
tab 0 1
q 0 2
w 2 2
e 1 2
r 4 2
t 4 1
y 5 1
u 5 2
i 6 2
o 7 2
p 8 2
[ 8 1
] 6 1
\ 10 4
caps 2 1
a 0 4
s 2 4
d 1 4
f 4 4
g 4 0
h 5 0
j 5 4
k 6 4
l 7 4
; 8 4
' 8 0
enter 10 6
shift 9 1
z 0 6
x 2 6
c 1 6
v 4 6
b 4 7
n 5 7
m 5 6
, 6 6
. 7 6
/ 8 7
rshift 9 6
fn 14 4
ctrl 3 3
win 13 1
alt 12 0
sp 10 7
ralt 12 7
prtsc 15 4
rctrl 3 6
pgup 15 6
up 14 0
pgdn 15 7
left 14 7
down 11 7
right 13 7

output data to key matrix

#!/usr/bin/awk -f
{
	key = $1;
	col = $2;
	row = $3;
	matrix[row, col] = key;
}
END {
	printf("|  ");
	for (col = 0; col < 16; col++) {
		printf("|S%d", col);
	}
	printf("|\n");
	for (row = 0; row < 8; row++) {
		printf("|R%d", row);
		for (col = 0; col < 16; col++) {
			printf("| %s ", matrix[row, col]);
		}
		printf("|\n");
	}
}

output data to key matrix in HTML table

#!/usr/bin/awk -f
{
	key = $1;
	col = $2;
	row = $3;
	matrix[row, col] = key;
}
END {
	printf("<table><tr><th></th>");
	for (col = 0; col < 16; col++) {
		printf("<th>S%d</th>", col);
	}
	printf("</tr>\n");
	for (row = 0; row < 8; row++) {
		printf("<tr><th>R%d</th>", row);
		for (col = 0; col < 16; col++) {
			printf("<td>%s</td>", matrix[row, col]);
		}
		printf("</tr>\n");
	}
	printf("</table>\n");
}

key matrix

S0S1S2S3S4S5S6S7S8S9S10S11S12S13S14S15
R0escf4ghf6'f5altup
R1tabf3capsty]f7[shiftbswin
R2qewruiop
R3~f2f1ctrl56=f8-f9homedel
R4adsfjkl;\fnprtsc
R513247890f10f11f12endins
R6zcxrctrlvm,.rshiftenterpgup
R7bn/spdownraltrightleftpgdn
Committer:
deton
Date:
Sat Mar 18 07:47:31 2017 +0000
Revision:
1:00109a338de8
Parent:
0:9ae9d1744fe4
Remove obsolete comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
deton 0:9ae9d1744fe4 1 // KeyMatrixAnalyzer for TrackPoint Keyboard USB English 0B47190
deton 0:9ae9d1744fe4 2 #include "mbed.h"
deton 0:9ae9d1744fe4 3
deton 0:9ae9d1744fe4 4 // R1 R7 R6 S9 R4 R5 S0 R2 R3 S5 S1 R0 S2 S4 S7 S8 S6 S3 S12 S13 S14 S11 S10 S15 M0 ML MM MR
deton 0:9ae9d1744fe4 5 const int RPINLEN = 8;
deton 0:9ae9d1744fe4 6 const int SPINLEN = 16;
deton 0:9ae9d1744fe4 7 DigitalIn rpin[RPINLEN] = {p12, p20, p14, p22, p18, p15, p19, p17};
deton 0:9ae9d1744fe4 8 DigitalOut spin[SPINLEN] = {p21, p23, p24, p9, p11, p13, p26, p25, p10, p16, p29, p7, p27, p8, p28, p6};
deton 0:9ae9d1744fe4 9
deton 0:9ae9d1744fe4 10 Serial pc(USBTX, USBRX);
deton 0:9ae9d1744fe4 11
deton 0:9ae9d1744fe4 12 int prevs = -1;
deton 0:9ae9d1744fe4 13 int prevr = -1;
deton 0:9ae9d1744fe4 14
deton 0:9ae9d1744fe4 15 void loop() {
deton 0:9ae9d1744fe4 16 for (int s = 0; s < SPINLEN; s++) {
deton 0:9ae9d1744fe4 17 spin[s] = 0;
deton 0:9ae9d1744fe4 18 wait_ms(5);
deton 0:9ae9d1744fe4 19 for (int r = 0; r < RPINLEN; r++) {
deton 0:9ae9d1744fe4 20 if (rpin[r] == 0) {
deton 0:9ae9d1744fe4 21 if (prevs == s && prevr == r) {
deton 0:9ae9d1744fe4 22 continue;
deton 0:9ae9d1744fe4 23 }
deton 0:9ae9d1744fe4 24 prevs = s;
deton 0:9ae9d1744fe4 25 prevr = r;
deton 0:9ae9d1744fe4 26 pc.printf(" %d %d\r\n", s, r);
deton 0:9ae9d1744fe4 27 }
deton 0:9ae9d1744fe4 28 }
deton 0:9ae9d1744fe4 29 spin[s] = 1;
deton 0:9ae9d1744fe4 30 }
deton 0:9ae9d1744fe4 31 }
deton 0:9ae9d1744fe4 32
deton 0:9ae9d1744fe4 33 int main() {
deton 0:9ae9d1744fe4 34 for (int r = 0; r < RPINLEN; r++) {
deton 0:9ae9d1744fe4 35 rpin[r].mode(PullUp);
deton 0:9ae9d1744fe4 36 }
deton 0:9ae9d1744fe4 37 for (int s = 0; s < SPINLEN; s++) {
deton 0:9ae9d1744fe4 38 spin[s] = 1;
deton 0:9ae9d1744fe4 39 }
deton 0:9ae9d1744fe4 40
deton 0:9ae9d1744fe4 41 while (true) {
deton 0:9ae9d1744fe4 42 loop();
deton 0:9ae9d1744fe4 43 }
deton 0:9ae9d1744fe4 44 }