| Tipro API Communicate with Tipro devices

FwDefines.h
1 /****************************************************************************/
2 /* Firmware commands/addresses */
3 /****************************************************************************/
4 //
5 // Supports only newer firmware versions with HIDAPI support
6 //
7
8 /****************************************************************************/
9 /* Module addresses */
10 /****************************************************************************/
11
12 #define I2C_ADR_BROADCAST 0x00 // Broadcase addr.
13 #define I2C_ADR_MASTER 0x02 // Master module addr.
14 #define I2C_ADR_NONE 0x3F // impossible/undefined addr.
15
16 #define I2C_ADR_SLAVE_01 0x04 // Slave 1
17 #define I2C_ADR_SLAVE_02 0x06 // Slave 2
18 #define I2C_ADR_SLAVE_03 0x08 // Slave 3
19 #define I2C_ADR_SLAVE_04 0x0A // Slave 4
20 #define I2C_ADR_SLAVE_05 0x0C // Slave 5
21 #define I2C_ADR_SLAVE_06 0x0E // Slave 6
22 #define I2C_ADR_SLAVE_07 0x10 // Slave 7
23 #define I2C_ADR_SLAVE_08 0x12 // Slave 8
24 #define I2C_ADR_SLAVE_09 0x14 // Slave 9
25 #define I2C_ADR_SLAVE_10 0x16 // Slave 10
26 #define I2C_ADR_SLAVE_11 0x18 // Slave 11
27 #define I2C_ADR_SLAVE_12 0x1A // Slave 12
28 #define I2C_ADR_SLAVE_13 0x1C // Slave 13
29 #define I2C_ADR_SLAVE_14 0x1E // Slave 14
30
31 #define I2C_ADR_EXE 0x02 // EXE sub-module addr.
32 #define I2C_ADR_DUMMY 0x20 // dummy addr.
33 #define I2C_ADR_TBM 0x30 // TBM sub-module addr.
34 #define I2C_ADR_PS2 0x32 // PS2 sub-module addr.
35 #define I2C_ADR_SPS 0x34 // SPS sub-module addr.
36 #define I2C_ADR_V24 0x36 // V24 sub-module addr.
37 #define I2C_ADR_MPS 0x38 // MPS sub-module addr.
38 #define I2C_ADR_SPK 0x3A // SPK sub-module addr.
39 #define I2C_ADR_USB 0x3C // USB sub-module addr.
40
41 #define I2C_ADR_ANSWER_FLAG 0x80 // answer is expected
42
43 /****************************************************************************/
44 /* I2C common comands */
45 /****************************************************************************/
46
47 #define I2C_CMD_RESET_DEVICE 0xF1 // Reset device
48 #define I2C_CMD_ENABLE_EVENTS 0xF2 // Enable events
49 #define I2C_CMD_DISABLE_EVENTS 0xF3 // Disable events
50 #define I2C_CMD_RESUME_PENDING 0xF4 // Resume pending
51 #define I2C_CMD_CANCEL_PENDING 0xF5 // Cancel pending
52 #define I2C_CMD_SET_DEFAULTS 0xF6 // Set device defaults
53 #define I2C_CMD_GETVER 0xF7 // Get module version
54 #define I2C_CMD_REPORT_STATUS 0xF8 // Report device status
55 #define I2C_CMD_READ_EEPROM 0xF9 // Read from module EEPROM
56 #define I2C_CMD_WRITE_EEPROM 0xFA // Write to module EEPROM
57 #define I2C_CMD_DEFAULT_DISABLE 0xFB // Device default disable
58
59 // 2-byte command (added Apr-08 for speakerbox module)
60 #define I2C_CMD_EXTENDED 0xF0 // 2-byte command
61 #define I2C_CMD_NULL 0x00 // 2-byte raw command
62
63 /****************************************************************************/
64 /* LCD commands */
65 /****************************************************************************/
66
67 #define LCD_CMD_SET_BACKLIGHT 0x40 /* Set LCD backlight. */
68 #define LCD_CMD_CLEAR_TEXT 0x41 /* Clear text on LCD. */
69 #define LCD_CMD_DISPLAY_TEXT 0x42 /* Display text on LCD. */
70 #define LCD_CMD_MOVE_CURSOR 0x43 /* Move cursor on specified position on LCD. */
71 #define LCD_CMD_GET_TYPE 0x44 /* Get LCD type (Rows, Columns, Backlight). */
72 #define LCD_CMD_SET_DISP_MODE 0x45 /* Set LCD dispaly mode (display/cursor/blink). */
73 #define LCD_CMD_SHIFT_TEXT 0x46 /* Shiftss text on LCD. */
74 #define LCD_CMD_SET_WRITE_MODE 0x47 /* Set LCD write mode. */
75 #define LCD_CMD_SET_CUSTOM_CHAR 0x48 /* Set custom cahracter on LCD. */
76 #define LCD_CMD_SET_DEFAULTS 0x49 /* (SA)Set LCD defaults. */
77
78 /****************************************************************************/
79 /* MCR commands */
80 /****************************************************************************/
81
82 #define MCR_CMD_GET_MODE 0x50 /* Get MCR mode. */
83 #define MCR_CMD_SET_MODE 0x51 /* Set MCR mode. */
84 #define MCR_CMD_SCAN_ENABLE 0x52 /* (SA) MCR scan enable. */
85 #define MCR_CMD_REPORT_STATUS 0x53 /* (SA) MCR report status. */
86 #define MCR_CMD_DATA_READ 0x54 /* (SA) Read MCR data. */
87
88
89 /****************************************************************************/
90 /* Keylock commands */
91 /****************************************************************************/
92
93 #define KEYLOCK_CMD_READ_POSITION 0x60 /* Read current Keylock position. */
94 #define KEYLOCK_CMD_ENABLE_EVENTS 0x61 /* Enable Keylock events. */
95 #define KEYLOCK_CMD_DISABLE_EVENTS 0x62 /* Disable Keylock events. */
96
97
98 /****************************************************************************/
99 /* iButton commands */
100 /****************************************************************************/
101
102 #define IBUTTON_CMD_GET_MODE 0x80 /* Get iButton mode. */
103 #define IBUTTON_CMD_SET_MODE 0x81 /* Set iButton mode. */
104 #define IBUTTON_CMD_ENABLE_EVENTS 0x82 /* Enable iButton Events. */
105 #define IBUTTON_CMD_DISABLE_EVENTS 0x83 /* Disable iButton Events. */
106 #define IBUTTON_CMD_READ_ROM 0x84 /* Read block of data from iButton ROM. */
107 #define IBUTTON_CMD_WRITE_RAM 0x85 /* Write byte to iButton RAM. */
108 #define IBUTTON_CMD_READ_RAM 0x86 /* Read byte from iButton RAM. */
109
110
111 /****************************************************************************/
112 /* Bcr commands */
113 /****************************************************************************/
114
115 #define BCR_CMD_GET_MODE 0x90 /* Get BCR mode. */
116 #define BCR_CMD_SET_MODE 0x91 /* Set BCR mode. */
117
118 /****************************************************************************/
119 /* Chameleon commands */
120 /****************************************************************************/
121
122 #define CHM_CMD_WRITE_FLASH 0x95
123 #define CHM_CMD_READ_FLASH 0x96
124 #define CHM_CMD_GO_ONLINE 0xA0
125 #define CHM_CMD_DISPLAY_ICON 0xA2
126 #define CHM_CMD_DISPLAY_BITMAP 0xA3
127 #define CHM_CMD_CHANGE_BACKLIGHTING 0xA4
128 #define CHM_CMD_GO_TO_PAGE 0x92
129 #define CHM_CMD_GET_PAGE_NUMBER 0x93
130
131 /****************************************************************************/
132 /* Speakerbox commands (EXTENDED) */
133 /****************************************************************************/
134 #define SBX_EXTCMD_LED_CTRL 0x00
135 #define SBX_EXTCMD_MIC_SEL 0x01
136 #define SBX_EXTCMD_MIC_ATT 0x02
137 #define SBX_EXTCMD_MIC_COMP 0x03
138 #define SBX_EXTCMD_MIC_THRS 0x04
139 #define SBX_EXTCMD_MONO_SPK_SEL 0x05
140 #define SBX_EXTCMD_STERO_SPK_SEL 0x06
141 #define SBX_EXTCMD_MONO_SEL 0x07
142 #define SBX_EXTCMD_MONO_SPK_AMP 0x08
143 #define SBX_EXTCMD_A_MIC_FLASH 0x09
144 #define SBX_EXTCMD_MAN_XXX_SEL 0x0A
145 #define SBX_EXTCMD_MONO_SIDETONE 0x0B
146 #define SBX_EXTCMD_HS_STATUS 0x0C
147 #define SBX_EXTCMD_STEREO_SPK_MUTE 0x0D
148 #define SBX_EXTCMD_KEY_CTRL 0x0E
149
150 #if 1 /* NEW FW */
151 #define SBX_EXTCMD_MIC_RANGE 0x0F
152 #endif
153
154 /****************************************************************************/
155 /* Speakerbox 104 commands */
156 /****************************************************************************/
157 #define SBX104_EXTCMD_LED_CTRL 0x00
158 #define SBX104_EXTCMD_MIC_SEL 0x01
159 #define SBX104_EXTCMD_MIC_ATT 0x02
160 #define SBX104_EXTCMD_MIC_COMP 0x03
161 #define SBX104_EXTCMD_MIC_THRS 0x04
162 #define SBX104_EXTCMD_AOUT_AMP 0x08
163 #define SBX104_EXTCMD_SPK_MUTE 0x0D
164 #define SBX104_EXTCMD_MIC_BUF_GAIN 0x0F
165
166 /****************************************************************************/
167 /* New Handset commands (EXTENDED) */
168 /****************************************************************************/
169 /* derived from speakerbox */
170
171 #define HXX_EXTCMD_MIC_ATT 0x02
172 #define HXX_EXTCMD_MIC_COMP 0x03
173 #define HXX_EXTCMD_MIC_THRS 0x04
174 #define HXX_EXTCMD_SPK_AMP 0x08
175
176
177 /****************************************************************************/
178 /* Vu-meter commands (EXTENDED) */
179 /****************************************************************************/
180 #define SBX_VUM_EXTCMD_SPK_ATT 0x10
181
182 /****************************************************************************/
183 /* BF10_SBX commands (EXTENDED) */
184 /****************************************************************************/
185 #define BF10_SBX_EXTCMD_LED_LUMINANCE 0x10
186 #define BF10_SBX_EXTCMD_PTT_LED_CTRL 0x11
187 #define BF10_SBX_EXTCMD_MB_LINE_OUT 0x12
188 #define BF10_SBX_EXTCMD_FW_COM 0x13
189 #define BF10_SBX_EXTCMD_LED_LUMINANCE_SYNC 0x14
190
191 /****************************************************************************/
192 /* BeFreeV3 commands (EXTENDED) */
193 /****************************************************************************/
194 #define BF3_CMD_TOUCH_DISABLE 0x00
195 #define BF3_CMD_LCD_LUMINANCE 0x01
196 #define BF3_CMD_FAN_STATUS 0x02
197 #define BF3_CMD_STATE_LED 0x03
198 #define BF3_CMD_PWR_INT 0x04
199 #define BF3_CMD_PWR_EXT 0x05
200 #define BF3_CMD_LCD_BL 0x06
201
202 #define BF3_LUMINANCE_MIN 0x00
203 #define BF3_LUMINANCE_MAX 0x14
204
205 /****************************************************************************/
206 /* Powered Add-on commands (EXTENDED) */
207 /****************************************************************************/
208 #define PAO_CMD_FUSE_12V 0x00
209 #define PAO_CMD_DCDC_24V 0x01
210 #define PAO_CMD_COM1 0x02
211 #define PAO_CMD_COM2 0x03
212 #define PAO_CMD_USB1 0x04
213 #define PAO_CMD_USB2 0x05
214 #define PAO_CMD_CD_OPEN 0x06
215 #define PAO_CMD_CD_SECURITY 0x07
216
217 /****************************************************************************/
218 /* BeFree07 new commands (EXTENDED) */
219 /****************************************************************************/
220 #define BF07_CMD_TOUCH_DISABLE 0x16
221
222 /****************************************************************************/
223 /* MID master PACKET commands */
224 /****************************************************************************/
225
226 /* Download commands via packets. */
227 #define CMD_FLASH_READ_PACKET 0xB0; //-Reads master flash.
228 #define CMD_FLASH_WRITE_ENABLE 0xB1; //-Write flash enable. {NO RESPONSE}
229 #define CMD_FLASH_WRITE_DISABLE 0xB2; //-Write flash disable. {NO RESPONSE}
230 #define CMD_FLASH_WRITE_PACKET 0xB3; //-Write master flash. {NO RESPONSE}
231
232 /****************************************************************************/
233 /* ATMEGA MID master commands */
234 /****************************************************************************/
235
236 /* data-indications (msg-data always included): */
237
238 #define MID_MSGT_IND_NULL 0x00 /* NULL data (uncoded) */
239 #define MID_MSGT_IND_STATUS 0x01 /* status data */
240 #define MID_MSGT_IND_RAW 0x02 /* raw data */
241 #define MID_MSGT_IND_ASCII 0x03 /* ASCII data */
242 #define MID_MSGT_IND_PRGKEY 0x04 /* programmable key data */
243 #define MID_MSGT_IND_EXTPRG 0x05 /* extended PRGKEY */
244 #define MID_MSGT_IND_IBMKEY 0x06 /* IBM key data (MF1,2,3) */
245 #define MID_MSGT_IND_USBKEY1 0x07 /* USB key (use: 0-7F, make flag: bit7) */
246 #define MID_MSGT_IND_USBKEY2 0x08 /* USB key (use: 0-FE, make prefix: FF) */
247 #define MID_MSGT_IND_MAX 0x0F /* max type # for indicatons */
248
249 /* EXE (master) commands; (-) obligatory, (*) optional parameter: */
250
251 #define MID_MSGT_CMD_EXE_ROLLOVER 0x10 /* play a rollover-indication */
252
253 #define MID_MSGT_CMD_EXE_RD_CONFIG 0x11 /* read MID (ext) configuration */
254
255 #define MID_MSGT_CMD_EXE_RD_MEM 0x16 /* read from specified memory */
256 /* - buf[0,1]: coded-addr L,H */
257 /* - buf[2]: read-length */
258
259 #define MID_MSGT_CMD_EXE_WR_MEM 0x17 /* write to specified memory */
260 /* - buf[0,1]: coded-addr L,H */
261 /* - buf[2-33]: 32-byte block */
262
263 #define MID_MSGT_CMD_EXE_SOUND 0x18 /* play sounds (even # pars): */
264 /* - buf[0]: note/scale (coded) */
265 /* - buf[1]: sound duration */
266 /* - ... */
268 /* - buf[0]: (TspkBgCmd) cmd */
269 /* - buf[1]: note/scale (coded) */
270 /* - buf[2]: sound duration */
271
272 #define MID_MSGT_CMD_EXE_KEYCLICK 0x19 /* play a key-klick tone: */
273 /* - buf[0]: note/scale (coded) */
274 /* - buf[1]: tone duration */
275
276 #define MID_MSGT_CMD_EXE_DELAY 0x1A /* delay EXE-processing: */
277 /* - buf[0]: delay [x 20ms] */
278
279 #define MID_MSGT_CMD_EXE_LED_LAYOUT 0x1B /* LED-layout mode: */
280 /* * buf[0]: mode */
281 /* * buf[1]: timeout [x 20ms] */
282 /* * none: restore to default */
283
284 #define MID_MSGT_CMD_EXE_LAYER_OP 0x1C /* key-layer operation: */
285 /* - buf[0]: operation-code */
286 /* * buf[1]: operation-value */
287
288 #define MID_MSGT_CMD_EXE_PAGE_OP 0x1D /* key-page operation: */
289 /* - buf[0]: operation-code */
290 /* * buf[1]: operation-value */
291
292 #define MID_MSGT_CMD_EXE_KEYCLICK_MODE 0x1E /* set key-klick mode: */
293 /* - buf[0]: mode */
294
295 #define MID_MSGT_CMD_EXE_KSEQ_REPEAT 0x1F /* set key-seq. repeat-pars: */
296 /* - buf[0]: delay [x 20ms] */
297 /* - buf[1]: rate [x 20ms] */
298
299 #define MID_MSGT_CMD_EXE_IF_SELECT 0x20 /* msg interface select: */
300 /* - buf[0]: destination addr. */
301 /* - none: deselect IF */
303 /* - buf[0]: select USB-IF */
304 /* - none: deselect USB-IF */
305
306 #define MID_MSGT_CMD_EXE_LED_LOCK 0x21 /* LED-lock mode: */
307 /* * buf[0]: mode */
308 /* * buf[1]: blink/running rate */
309 /* * buf[2]: timeout [x 20ms] */
310 /* * none: restore to default */
311
312 #define MID_MSGT_CMD_EXE_SEC_PW_KEY 0x23 /* security log-on; key-PW */
313 /* - buf[0]: # of key-strokes */
314 /* * buf[1]: log-on tout [min] */
315
316 #define MID_MSGT_CMD_EXE_SEC_PW_ASCII 0x24 /* security log-on; ASCII-PW */
317 /* - buf[0]: # of ACSII chars */
318 /* * buf[1]: log-on tout [min] */
319
320 #define MID_MSGT_CMD_EXE_SEC_DEFAULT 0x25 /* restore default security */
321 /* * buf[0]: restore-level */
322 /* * buf[0]: restore-layout */
323 /* * none: default res-level */
324
325 #define MID_MSGT_CMD_EXE_LOCK_OP 0x26 /* lock-keys operation: */
326 /* - buf[0]: operation-code */
327
328
330 // USB common comands
331 //
332
333 #define USB_CMD_RESET 0xF1 // Reset device
334 #define USB_CMD_ENABLE 0xF2 // Enable events
335 #define USB_CMD_DISABLE 0xF3 // Disable events
336 #define USB_CMD_RESUME 0xF4 // Resume pending
337 #define USB_CMD_DEFAULT 0xF6 // Set defaults
338 #define USB_CMD_VERSION 0xF7 // Get module version
339 #define USB_CMD_STATUS 0xF8 // Report device status
340 #define USB_CMD_RD_EEPROM 0xF9 // Read module mem (EEPROM)
341 #define USB_CMD_WR_EEPROM 0xFA // Write module mem (EEPROM)
342 #define USB_CMD_CONFIG 0xFF // Config
343
345 // USB controller comands
346 //
347
348 #define USB_CMD_ROLLOVER 0x10 // Rollover command
349 #define USB_CMD_RD_CONFIG 0x11 // Read configuration
350 #define USB_CMD_RD_MEM 0x16 // Read memory
351 #define USB_CMD_WR_MEM 0x17 // Write memory
352 #define USB_CMD_SOUND 0x18 // Play a sound
353 #define USB_CMD_KEYCLICK 0x19 // Play a key-click tone
354 #define USB_CMD_DELAY 0x1A // Delay (x 20ms)
355 #define USB_CMD_LAYER_OP 0x1C // Layer operation
356 #define USB_CMD_PAGE_OP 0x1D // Page operation
357 #define USB_CMD_KEYCLICK_MODE 0x1E // Set Key-click mode
358 #define USB_CMD_KSEQ_REPEAT 0x1F // Set key-seq. repeat param
359 #define USB_CMD_IF_SELECT 0x20 // Select interface
360 #define USB_CMD_SEC_PW_KEY 0x23 // Security log-on Key
361 #define USB_CMD_SEC_PW_ASCII 0x24 // Security log-on ASCII
362 #define USB_CMD_SEC_DEFAULT 0x25 // Restore to default security
363 #define USB_CMD_LOCK_OP 0x26 // Lock keys operation
364 #define USB_CMD_OVERRIDE_INDICATORS 0x1B // Override indicators
365 #define USB_CMD_EXE_LED_LOCK 0x21 // LED-lock mode