blob: 44963f58a2a185addafca44011cfc4ba40beb7b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
OUTGOING (commands sent by the controller):
===========================================
There are 3 possible sources for messages sent by the controller
- Keypad .. a key/button has been pressed or released (note offset 0x00)
- GPIO .. a GPI has changed its state (note offset 0x20)
- Analog .. the analog value of an input has changed (note offset 0x40)
Keypad:
-------
- the 16 buttons are numbered 0-15 (note 0x00-0x0F)
- a key press event sends the following command:
0x90 <key nr + 0x00> 0x7F
- a key release event sends the following command:
0x80 <key nr + 0x00> 0x00
Example:
Key 14 is pressed and released:
0x90 0x0D 0x7F
0x80 0x0D 0x00
GPIO:
-----
- the 4 inputs are numbered 0-3 (note 0x20-0x23)
- a low to high transition sends the following command:
0x90 <input nr + 0x20> 0x7F
- a high to low transition sends the following command:
0x80 <input nr + 0x20> 0x00
Example:
input 1 goes from low to high and back to low:
0x90 0x20 0x7F
0x80 0x20 0x00
Analog:
-------
- the 8 analog inputs are numbered 0-7 (note 0x40-0x47)
- by default all inputs are disabled. See below to find out how
to enable/disable analog inputs
- on every change of the value of the analog port the following command
is sent:
0xB0 <input nr + 0x40> <value>
(value is between 0x00 and 0x7F -> 0..127)
Example:
input 7 changes its value to 42:
0xB0 0x46 0x2A
INCOMING (commands understood by the controller):
=================================================
There are 3 possible sinks for messages sent to the controller
- Keypad .. controls the led of a key/button (note offset 0x00)
- GPIO .. sets or unsets a GPO (note offset 0x20)
- Analog .. enables or disables an analog input (note offset 0x40)
Keypad:
-------
- the 16 leds are numbered 0-15 (note 0x00-0x0F)
- all leds can be changed by the special address 0x1F
- switch a led on:
0x90 <key nr + 0x00> 0x00
- toggle a led:
0x90 <key nr + 0x00> 0x01
- led blinking:
0x90 <key nr + 0x00> 0x02..0x7F
the value controls the blinking speed. Smaller values correspond to
higher blinking frequencies.
- switch a led off
0x80 <key nr + 0x00> 0x00
Examples:
Turn led 3 on:
0x90 0x03 0x7F
Toggle led 5:
0x90 0x05 0x01
led 6 blinking fast:
0x90 0x06 0x03
led 14 blinking slow:
0x90 0x0D 0x40
turn all leds off:
0x80 0x1F 0x00
GPIO:
-----
- the 4 outputs are numbered 0-3 (note 0x20-0x23)
- all outputs can be controlled by the special address 0x3F
- for a low to high transition send the following command:
(this does nothing if the port is already high)
0x90 <output nr + 0x20> 0x00
- for a high to low transition send the following command:
(this does nothing if the port is already low)
0x80 <output nr + 0x20> 0x00
- for a state change send the following command:
0x90 <output nr + 0x20> 0x01
Example:
toggle the state of output 3:
0x90 0x22 0x01
set all outputs to high:
0x90 0x3F 0x00
Analog:
-------
- the 8 analog inputs are numbered 0-7 (note 0x40-0x47)
- all inputs can be controlled by the special address 0x5F
- after a reset all inputs are disabled.
- to enable an input send the following command:
0x90 <input nr + 0x40> 0x00
- to disable an input send the following command:
0x80 <input nr + 0x40> 0x00
Example:
enable input 2:
0x90 0x41 0x00
disable all inputs:
0x80 0x5F 0x00
|