User manual

Code Mercenaries
19
II
II
OO
OO
--
--
WW
WW
aa
aa
rr
rr
rr
rr
ii
ii
oo
oo
rr
rr
5.10.7 Switch Matrix Mode (IOW40 only)
IO-Warrior40 can read a matrix of 8x8 or 16x8
switches or keys. Other than with a typical
keyboard controller it is possible to read out all
possible combinations of closed switches. Since
the switch status is reported as a bitmap there is no
limitation to the number of switches that can be
closed at the same time (diodes are required in the
matrix though).
To enable the switch matrix function a report with
ID $18 is sent to interface 1:
enable = $00 disables the function
enable = $01 enables the 8x8 switch matrix
enable = $02 enables the 16x8 switch matrix
The status of the matrix is returned when ever there
is a change of status or it can be requested
immediately by sending a report with ID $19:
Since the status of the matrix is 8 or 16 bytes long
but the data payload of a report on the second
endpoint can be only 7 bytes the status is returned
in two or four parts.
Switches on X0..7 driven by Y0..3 are returned in
an input report with ID $19, those driven by Y4..7
are returned in a report with ID $1A:
When using the 16x8 matrix size the switches on
X8..15 will be returned in reports with IDs $1B
and $1C:
On status change or request always all two or four
reports will be returned.
The switch matrix function is present in IOW40
since chip revision V1.0.2.0, however the first
implementation had a bug that sometimes caused
IOW40 to send only one of the two status reports.
The problem has been fixed in V1.0.2.1.
The option to use a 16x8 matrix has been added
with V1.0.2.6.
ReportID
$18 out
12
enable $00
34
$00 $00
56
$00 $00
7
$00
ReportID
$19 out
12
$00 $00
34
$00 $00
56
$00 $00
7
$00
ReportID
$19 in
12
Y0 Y1
34
Y2 Y3
56
$00 $00
7
$00
ReportID
$1A in
12
Y4 Y5
34
Y6 Y7
56
$00 $00
7
$00
ReportID
$1B in
12
Y0 Y1
34
Y2 Y3
56
$00 $00
7
$00
ReportID
$1C in
12
Y4 Y5
34
Y6 Y7
56
$00 $00
7
$00
V 1.1.0, December 2nd 2013, for chip revision V1.0.3.0 and up