Tipro API
Communicate with Tipro devices
BF20_IntFn.h
1 #pragma once
2 
3 // BF20_IntFn.h :
5 
6 
8 // FW documentation
9 
10 
11 /* SBX, BF10, BF20 common commands */
12 /* MID_MSGT_XXX_SBX_LED_CTRL= 0x00 / * LED control (WR/RD) */ /* 0xF0 */
13 /* MID_MSGT_XXX_SBX_MIC_ATT= 0x02 / * MIC attenuation (WR/RD) */ /* 0xF0, 0x00 */
14 /* MID_MSGT_XXX_SBX_MIC_COMP= 0x03 / * MIC compression (WR/RD) */ /* 0xF0 */
15 /* MID_MSGT_XXX_SBX_MIC_THRS= 0x04 / * MIC noise threshold (WR/RD) */ /* 0xF0 */
16 /* MID_MSGT_XXX_SBX_MAN_XXX_SEL= 0x0A / * manual XXX selectors (WR/RD) */ /* 0xF0, 0x00 */
17 /* MID_MSGT_XXX_SBX_STEREO_SPK_MUTE= 0x0D / * stereo SPK mute (WR/RD) */ /* 0xF0, 0x00 */
18 /* MID_MSGT_XXX_SBX_KEY_STATUS= 0x0E / * SBX-keys status (RD) */ /* 0xF0, 0x00 */
19 /* MID_MSGT_XXX_SBX_LED_LUMINANCE= 0x10 / * LED luminance (WR/RD) */ /* 0xF0 */
20 /* MID_MSGT_XXX_SBX_PTT_LED_CTRL= 0x11 / * PTT-LED control (WR/RD) */ /* 0xF0 */
21 /* MID_MSGT_XXX_SBX_LED_LUMINANCE_SYNC= 0x14 / * LED luminance sync (set, update EEP, FW COM-data) */ /* 0xF0 */
22 
23 /* Changed commands (added EEPROM flags)*/
24 /* MID_MSGT_XXX_SBX_MIC_ATT= 0x02 / * MIC attenuation (WR/RD) */ /* 0xF0, 0x00 */
25 /* MID_MSGT_XXX_SBX_MIC_COMP= 0x03 / * MIC compression (WR/RD) */ /* 0xF0 */
26 /* MID_MSGT_XXX_SBX_MIC_THRS= 0x04 / * MIC noise threshold (WR/RD) */ /* 0xF0 */
27 /* quick note: 0x0X 0xAA 0xBB => 0xAA setting, 0xBB => 0x01-> handsfree, current, 0x81-> handsfree, eeprom*/
28 
29 /* Added functions to the first pre-release version 10.3.2016: */
30 /* MID_MSGT_PPC_PWR_BTN_EMU 0x08 / * power-BTN emulation (PPC) */ /* 0xF0 */
31 
32 
33 /* BF20 specific commands (HW_28) */
34 /* MID_MSGT_XXX_SBX_STEREO_SEL= 0x06 / * stereo selector (WR/RD) */ /* 0xF0, 0x00 */
35 /* Parameters:
36 
37  -- BYTE 1 --
38  * PCM A/B scenarios (bit 0,1) :
39 
40  SBX_STEREO_SEL1_PCM_AB_2_LR= xxxx xx00 (0x3C/0xBC)
41  L-SPK = L-PCM_A + R-PCM_A + (L-MB_LINE_OUT)
42  R-SPK = R-PCM_B + L-PCM_B + (R-MB_LINE_OUT)
43  SBX_STEREO_SEL1_PCM_LR_2_LR= xxxx xx01 (0x3D/0xBD)
44  L-SPK = L-PCM_A + L-PCM_B + (L-MB_LINE_OUT)
45  R-SPK = R-PCM_B + R-PCM_A + (R-MB_LINE_OUT)
46  SBX_STEREO_SEL1_PCM_VOID= xxxx xx11
47  Don't change this setting.
48 
49  * MIC-amplifier scenarios (bit 2,3):
50 
51  SBX_STEREO_SEL1_MIC_AMP_LOG= xxxx 00xx (0x33/0xB3)
52  MIC-amplifier, logarithmic
53  SBX_STEREO_SEL1_MIC_AMP_LIN= xxxx 01xx (0x37/0xB7)
54  MIC-amplifier, linear
55  SBX_STEREO_SEL1_MIC_AMP_VOID= xxxx 11xx
56  Don't change this setting.
57 
58  * volume-control, L/R/LF speakers (bit 4,5):
59 
60  SBX_STEREO_SEL1_VOL_LR= xx00 xxxx (0x0F/0x8F)
61  STEREO volume control (L&R)
62  SBX_STEREO_SEL1_VOL_MONO_R= xx01 xxxx (0x1F/0x9F)
63  MONO volume control (R)
64  SBX_STEREO_SEL1_VOL_VOID= xx11 xxxx
65 
66  * update EEPROM settings (bit 7):
67  Update settings= 1xxx xxxx
68  Don't update settings= 0xxx xxxx
69 
70  -- BYTE 2 --
71  * Low-Frequency (LF) speaker (bit 0,1):
72  SBX_STEREO_SEL2_LF_SPK_OFF= xxxx xx00 (0x3C/0xBC)
73  LF-speaker OFF
74  SBX_STEREO_SEL2_LF_SPK_ON= xxxx xx01 (0x3D/0xBD)
75  LF-speaker ON
76  SBX_STEREO_SEL2_LF_SPK_VOID= xxxx xx11
77  Don't change this setting.
78 
79  * VU-meters (A&B) scenarios (bit 2,3):
80  SBX_STEREO_SEL2_VU_AB_MIC_OFF= xxxx 00xx (0x33/0xB3)
81  VUM-AB, MIC-signal OFF
82  SBX_STEREO_SEL2_VU_AB_MIC_ON= xxxx 01xx (0x37/0xB7)
83  VUM-AB, MIC-signal ON
84  SBX_STEREO_SEL2_VU_AB_VOID= xxxx 11xx
85  Don't change this setting.
86 
87  * VU-meter-C scenarios (bit 4,5):
88  SBX_STEREO_SEL2_VU_C_LF_SPK= xx00 xxxx (0x0F/0x8F)
89  VUM-C, LF-speaker
90  SBX_STEREO_SEL2_VU_C_PCM_IN= xx01 xxxx (0x1F/0x9F)
91  VUM-C, PCM-IN (MIC)
92  SBX_STEREO_SEL2_VU_C_VOID= xx11 xxxx
93  Don't change this setting.
94 
95  * update EEPROM settings (bit 7):
96  Update settings= 1xxx xxxx
97  Don't update settings= 0xxx xxxx
98 
99  -- BYTE 3 --
100  * Frequency response for LF speaker (bit 0..6):
101  SBX_SPK_LF1_68Hz_0dB= 0x00
102  SBX_SPK_LF1_85Hz_m2dB= 0x01
103  SBX_SPK_LF1_107Hz_m4dB= 0x02
104  SBX_SPK_LF1_135Hz_m6dB= 0x03
105  SBX_SPK_LF1_170Hz_m8dB= 0x04
106  SBX_SPK_LF1_217Hz_m10dB= 0x05
107  SBX_SPK_LF1_271Hz_m12dB= 0x06
108  SBX_SPK_LF1_333Hz_m14dB= 0x07
109  SBX_SPK_LF1_433Hz_m16dB= 0x08
110  SBX_SPK_LF1_542Hz_m18dB= 0x09
111  SBX_SPK_LF1_667Hz_m20dB= 0x0A
112  SBX_SPK_LF1_VOID= 0x7F
113  * update EEPROM settings (bit 7):
114  Update settings= 1xxx xxxx
115  Don't update settings= 0xxx xxxx
116 
117  -- BYTE 4 --
118  * Gain at f0 for LF speaker (bit 0..6):
119  SBX_SPK_LF2_f0_TOTAL_m15dB= 0x00
120  SBX_SPK_LF2_f0_TOTAL_m12dB= 0x01
121  SBX_SPK_LF2_f0_TOTAL_m9dB= 0x02
122  SBX_SPK_LF2_f0_TOTAL_m6dB= 0x03
123  SBX_SPK_LF2_f0_TOTAL_m3dB= 0x04
124  SBX_SPK_LF2_f0_TOTAL_0dB= 0x05
125  SBX_SPK_LF2_f0_TOTAL_p3dB= 0x06
126  SBX_SPK_LF2_f0_TOTAL_p6dB= 0x07
127  SBX_SPK_LF2_f0_TOTAL_p9dB= 0x08
128  SBX_SPK_LF2_f0_TOTAL_p12dB= 0x09
129  SBX_SPK_LF2_f0_TOTAL_p15dB= 0x0A
130  SBX_SPK_LF2_VOID= 0x7F
131  * update EEPROM settings (bit 7):
132  Update settings= 1xxx xxxx
133  Don't update settings= 0xxx xxxx
134 
135  Return/Read Values:
136  data[0]= MID_MSGT_XXX_SBX_STEREO_SEL = 0x06;
137  data[1]= current settings in BYTE1;
138  data[2]= EEPROM (init) value of settings in BYTE1;
139  data[3]= current settings in BYTE2;
140  data[4]= EEPROM (init) value of settings in BYTE1;
141  data[5]= current frequency response (f0);
142  data[6]= EEPROM (init) value of frequency response (f0);
143  data[7]= current gain at f0;
144  data[8]= EEPROM (init) value of gain at f0;
145 */
146 
147 #define BF20_PCM_SCENARIO_AB 0x3C
148 #define BF20_PCM_SCENARIO_LR 0x3D
149 #define BF20_PCM_SCENARIO_VOID 0x3F
150 #define BF20_PCM_SCENARIO_MASK 0x03
151 
152 #define BF20_MICAMP_MODE_LOG 0x33
153 #define BF20_MICAMP_MODE_LIN 0x37
154 #define BF20_MICAMP_MODE_VOID 0x3F
155 #define BF20_MICAMP_MODE_MASK 0x0C
156 
157 #define BF20_VOL_CTRL_LR 0x0F
158 #define BF20_VOL_CTRL_MONO_R 0x1F
159 #define BF20_VOL_CTRL_VOID 0x3F
160 #define BF20_VOL_CTRL_MASK 0x30
161 
162 #define BF20_LF_SPK_OFF 0x3C
163 #define BF20_LF_SPK_ON 0x3D
164 #define BF20_LF_SPK_VOID 0x3F
165 #define BF20_LF_SPK_MASK 0x03
166 
167 #define BF20_VU_AB_MIC_OFF 0x33
168 #define BF20_VU_AB_MIC_ON 0x37
169 #define BF20_VU_AB_MIC_VOID 0x3F
170 #define BF20_VU_AB_MIC_MASK 0x0C
171 
172 #define BF20_VU_C_LF_SPK 0x0F
173 #define BF20_VU_C_PCM_IN 0x1F
174 #define BF20_VU_C_VOID 0x3F
175 #define BF20_VU_C_MASK 0x30
176 
177 // Frequency response for LF speaker
178 #define BF20_LF_SPK_F0_68Hz 0x00
179 #define BF20_LF_SPK_F0_85Hz 0x01
180 #define BF20_LF_SPK_F0_107Hz 0x02
181 #define BF20_LF_SPK_F0_135Hz 0x03
182 #define BF20_LF_SPK_F0_170Hz 0x04
183 #define BF20_LF_SPK_F0_217Hz 0x05
184 #define BF20_LF_SPK_F0_271Hz 0x06
185 #define BF20_LF_SPK_F0_333Hz 0x07
186 #define BF20_LF_SPK_F0_433Hz 0x08
187 #define BF20_LF_SPK_F0_542Hz 0x09
188 #define BF20_LF_SPK_F0_667Hz 0x0A
189 #define BF20_LF_SPK_F0_VOID 0x7F
190 // limits to check
191 #define BF20_LF_SPK_F0_MIN BF20_LF_SPK_F0_68Hz
192 #define BF20_LF_SPK_F0_MAX BF20_LF_SPK_F0_667Hz
193 
194 // Gain at f0 for LF speaker
195 #define BF20_LF_SPK_GAIN_m15dB 0x00
196 #define BF20_LF_SPK_GAIN_m12dB 0x01
197 #define BF20_LF_SPK_GAIN_m9dB 0x02
198 #define BF20_LF_SPK_GAIN_m6dB 0x03
199 #define BF20_LF_SPK_GAIN_m3dB 0x04
200 #define BF20_LF_SPK_GAIN_0dB 0x05
201 #define BF20_LF_SPK_GAIN_p3dB 0x06
202 #define BF20_LF_SPK_GAIN_p6dB 0x07
203 #define BF20_LF_SPK_GAIN_p9dB 0x08
204 #define BF20_LF_SPK_GAIN_p12dB 0x09
205 #define BF20_LF_SPK_GAIN_p15dB 0x0A
206 #define BF20_LF_SPK_GAIN_VOID 0x7F
207 // limits to check
208 #define BF20_LF_SPK_GAIN_MIN BF20_LF_SPK_GAIN_m15dB
209 #define BF20_LF_SPK_GAIN_MAX BF20_LF_SPK_GAIN_p15dB
210 
211 #if 1
212 /* Changed in FW on request before release 07.12.2015 */
213 /* MID_MSGT_XXX_SBX_MB_LINE_OUT= 0x12 / * MB-audio line-out (WR/RD) */ /* 0xF0 */
214 /* Parameters:
215 
216  -- BYTE 1 --
217  * MB-line out (bit 0..2):
218  SBX_MB_LINE_OUTL_F= xxxx xxxF (0x11)
219  LINE-OUT; L channel (SPK-L)
220  SBX_MB_LINE_OUTR_F= xxxx xxFx (0x12)
221  LINE-OUT; R channel (SPK-R)
222  SBX_MB_LINE_OUT_VOID_F= xxxx xFxx
223  no change for LINE-OUT
224 
225  * MB-line in (bit 3..4):
226  SBX_MB_LINE_IN_LR_F= xxxx Fxxx (0x0C)
227  LINE-OUT; L channel (SPK-L)
228  SBX_MB_LINE_IN_VOID_F= xxxF xxxx
229  no change for LINE-OUT/IN
230 
231  * update EEPROM settings (bit 7):
232  Update settings= 1xxx xxxx
233  Don't update settings= 0xxx xxxx
234 
235 
236  -- BYTE 2 --
237  * ECHO-ref scenarios (bit 0..3):
238  SBX_MB_LINE_EC_OFF= xxxx x000 (0x00/0x80)
239  ECHO-canceler (EC) off
240  SBX_MB_LINE_EC_STD_L= xxxx x001 (0x01/0x81)
241  standard EC, only SBX L-channel
242  SBX_MB_LINE_EC_STD_R= xxxx x010 (0x02/0x82)
243  standard EC, only SBX R-channel
244  SBX_MB_LINE_EC_ALT_ALL= xxxx x011 (0x03/0x83)
245  alternative EC, SBX + MB channels
246  SBX_MB_LINE_EC_VOID= xxxx x111
247  no change for ECHO scenario
248 
249  * update EEPROM settings (bit 7):
250  Update settings= 1xxx xxxx
251  Don't update settings= 0xxx xxxx
252 
253  Return/Read Values:
254  data[0]= MID_MSGT_XXX_SBX_MB_LINE_OUT = 0x12;
255  data[1]= current MBLineIn/MBLineOut settings in BYTE1;
256  data[2]= EEPROM (init) value of MBLineIn/MBLineOut settings in BYTE1;
257  data[3]= current Echo settings in BYTE2;
258  data[4]= EEPROM (init) value of Echo settings in BYTE2;
259 
260  Note:
261  Bit 6 indicates if ECHO HW is present (0) or not (1).
262 */
263 
264 #define BF20_LINE_OUT_OFF_SPK 0x10
265 #define BF20_LINE_OUT_ON_L_SPK 0x11
266 #define BF20_LINE_OUT_ON_R_SPK 0x12
267 #define BF20_LINE_OUT_ON_LR_SPK 0x13
268 #define BF20_LINE_OUT_VOID 0x14
269 #define BF20_LINE_OUT_MASK 0x03
270 
271 #define BF20_MIC_OFF_LINE_IN 0x04
272 #define BF20_MIC_ON_LINE_IN 0x0C
273 #define BF20_MIC_LINE_IN_VOID 0x14
274 #define BF20_MIC_LINE_IN_MASK 0x08
275 
276 #define BF20_EC_OFF 0x00
277 #define BF20_EC_ON_L 0x01
278 #define BF20_EC_ON_R 0x02
279 #define BF20_EC_ON_LR 0x03
280 #define BF20_EC_VOID 0x07
281 #define BF20_EC_MASK 0x03
282 
283 #else
284 /* MID_MSGT_XXX_SBX_MB_LINE_OUT= 0x12 / * MB-audio line-out (WR/RD) */ /* 0xF0 */
285 /* Parameters:
286 
287  -- BYTE 1 --
288  * MB-line out/in (bit 0..3):
289  SBX_MB_LINE_OUTL_F= xxxx xxxF (0x71)
290  LINE-OUT; L channel (SPK-L)
291  SBX_MB_LINE_OUTR_F= xxxx xxFx (0x72)
292  LINE-OUT; R channel (SPK-R)
293  SBX_MB_LINE_IN_F= xxxx xFxx (0x74)
294  LINE-IN; L+R channel (MIC)
295  SBX_MB_LINE_VOID_F = xxxx Fxxx (0x78)
296  no change for LINE-OUT/IN
297 
298  * ECHO-ref scenarios (bit 4..6):
299  SBX_MB_LINE_EC_OFF= x000 xxxx (0x08/0x88)
300  ECHO-canceller (EC) off
301  SBX_MB_LINE_EC_STD_L= x001 xxxx (0x18/0x98)
302  standard EC, only SBX L-channel
303  SBX_MB_LINE_EC_STD_R= x010 xxxx (0x28/0xA8)
304  standard EC, only SBX R-channel
305  SBX_MB_LINE_EC_ALT_ALL= x011 xxxx (0x38/0xB8)
306  alternative EC, SBX + MB channels
307  SBX_MB_LINE_EC_VOID= x111 xxxx
308  no change for ECHO scenario
309 
310  * update EEPROM settings (bit 7):
311  Update settings= 1xxx xxxx
312  Don't update settings= 0xxx xxxx
313 
314  Return/Read Values:
315  data[0]= MID_MSGT_XXX_SBX_MB_LINE_OUT = 0x12;
316  data[1]= current MBLine/Echo settings in BYTE1;
317  data[2]= EEPROM (init) value of MBLine/Echo settings in BYTE1;
318 */
319 
320 // line-in, line-out, echo "higher-level" scenarios (TBD!!)
321 
322 #define BF20_LINE_OUT_OFF_SPK 0x00
323 #define BF20_LINE_OUT_ON_LR_SPK 0x01
324 #define BF20_LINE_OUT_ON_L_SPK 0x02
325 #define BF20_LINE_OUT_ON_R_SPK 0x03
326 
327 #define BF20_MIC_OFF_LINE_IN 0x00
328 #define BF20_MIC_ON_LINE_IN 0x01
329 
330 #define BF20_EC_OFF 0x08
331 #define BF20_EC_ON_L 0x18
332 #define BF20_EC_ON_R 0x28
333 #define BF20_EC_ON_LR 0x38
334 
335 #endif
336 
337 /* MID_MSGT_XXX_SBX_COM= 0x13 / * forward COM-data */ /* 0xF0 */
338 /*
339  Parameters:
340 
341  * One BYTE sends it over internal COM connection to both A and B vu-meters
342  * Two BYTEs sends the first byte to A vu-meter and the second to B vu-meter
343 */
344 
345 
346 /* MID_MSGT_XXX_SBX_HFREE_MIC_BUF_GAIN= 0x0F / * handsfree MIC-buffer gain */ /* 0xF0, 0x00 */
347 #define MID_MSGT_XXX_SBX_HFREE_MIC_BUF_GAIN 0x0F
348 /*
349 
350  Parameters:
351 
352  -- BYTE 1 --
353  * Microphone pre-amplifier gain (bit 0..6) (echo off / echo on)
354  SBX_MIC_PREAMP_m6dB= 0x00 (-6dB/-18dB)
355  SBX_MIC_PREAMP_m4dB= 0x01 (-4dB/-16dB)
356  SBX_MIC_PREAMP_m2dB= 0x02 (-2dB/-14dB)
357  SBX_MIC_PREAMP_0dB= 0x03 ( 0dB/-12dB)
358  SBX_MIC_PREAMP_p2dB= 0x04 ( 2dB/-10dB)
359  SBX_MIC_PREAMP_p4dB= 0x05 ( 4dB/ -8dB)
360  SBX_MIC_PREAMP_p6dB= 0x06 ( 6dB/ -6dB)
361  SBX_MIC_PREAMP_p8dB= 0x07 ( 8dB/ -4dB)
362  SBX_MIC_PREAMP_p10dB= 0x08 (10dB/ -2dB)
363  SBX_MIC_PREAMP_p12B= 0x09 (12dB/ 0dB)
364  SBX_MIC_PREAMP_p14B= 0x0A (14dB/ 2dB)
365  * update EEPROM settings (bit 7):
366  Update settings= 1xxx xxxx
367  Don't update settings= 0xxx xxxx
368 
369  Note:
370  Bit 6 indicates if ECHO adjustment table is used (1) or not (0).
371 
372 
373 */
374 
375 
377 // BF20 internal functions
378 
379 // init values are combined, read other EEPROM values, before writing to EEPROM if bSetInit is true
380 // we might even need to store current values, and then reset them back to what they were
381 
382 /* MID_MSGT_XXX_SBX_STEREO_SEL */
383 #define MID_MSGT_XXX_SBX_STEREO_SEL 0x06 // command code
384 #define MID_MSGT_XXX_SBX_STEREO_SEL_PARAM_LEN 0x05 // (1 byte for CMD and 4 bytes for parameters)
385 #define MID_MSGT_XXX_SBX_STEREO_SEL_DEF_PARAMS {MID_MSGT_XXX_SBX_STEREO_SEL, 0x7F, 0x7F, 0x7F, 0x7F} // init value for array of parameters, all VOID
386 // command doesn't check for response buffer length, so to be future-proof we need to reserve a bit more space until the command is improved
387 #define MID_MSGT_XXX_SBX_STEREO_SEL_RESPONSE_LEN 0x09+0x7F // (1 byte for CMD and 8 bytes for parameters + 128 bytes just in case)
388 #define MID_MSGT_XXX_SBX_STEREO_SEL_PARAM_LEN_RESP 0x01 // Reading current/init parameters requires only command code to be sent
389 #define MID_MSGT_XXX_SBX_STEREO_SEL_DEF_PARAMS_RESP {MID_MSGT_XXX_SBX_STEREO_SEL}
390 /* BYTE 1 */
391 int intFn_BF20_SetPCMScenario(TiproHidDevice *device, int nAddress, int nScenario, bool bSetInit = false);
392 int intFn_BF20_GetPCMScenario(TiproHidDevice *device, int nAddress, int *nScenario, int *nInitScenario = nullptr);
393 
394 int intFn_BF20_SetMicAmpMode(TiproHidDevice *device, int nAddress, int nMicAmpMode, bool bSetInit = false);
395 int intFn_BF20_GetMicAmpMode(TiproHidDevice *device, int nAddress, int *nMicAmpMode, int *nInitMicAmpMode = nullptr);
396 
397 int intFn_BF20_SetVolCtrl(TiproHidDevice *device, int nAddress, int nVolCtrl, bool bSetInit = false);
398 int intFn_BF20_GetVolCtrl(TiproHidDevice *device, int nAddress, int *nVolCtrl, int *nInitVolCtrl = nullptr);
399 
400 /* BYTE 2 */
401 int intFn_BF20_SetLFSpeakerState(TiproHidDevice *device, int nAddress, int nState, bool bSetInit = false);
402 int intFn_BF20_GetLFSpeakerState(TiproHidDevice *device, int nAddress, int *nState, int *nInitState = nullptr);
403 
404 int intFn_BF20_SetMicOnVUState(TiproHidDevice *device, int nAddress, int nState, bool bSetInit = false);
405 int intFn_BF20_GetMicOnVUState(TiproHidDevice *device, int nAddress, int *nState, int *nInitState = nullptr);
406 
407 int intFn_BF20_SetVUCScenario(TiproHidDevice *device, int nAddress, int nScenario, bool bSetInit = false);
408 int intFn_BF20_GetVUCScenario(TiproHidDevice *device, int nAddress, int *nScenario, int *nInitScenario = nullptr);
409 
410 /* BYTE 3 */
411 int intFn_BF20_SetLFSpkFreqResponse(TiproHidDevice *device, int nAddress, int nFreqResponse, bool bSetInit = false);
412 int intFn_BF20_GetLFSpkFreqResponse(TiproHidDevice *device, int nAddress, int *nFreqResponse, int *nInitFreqResponse = nullptr);
413 
414 /* BYTE 4 */
415 int intFn_BF20_SetLFSpkGain(TiproHidDevice *device, int nAddress, int nGain, bool bSetInit = false);
416 int intFn_BF20_GetLFSpkGain(TiproHidDevice *device, int nAddress, int *nGain, int *nInitGain = nullptr);
417 
418 // global commands for StereoSel settings
419 int intFn_BF20_GetStereoSelByte1Init(TiproHidDevice *device, int nAddress, int *nInitValue);
420 int intFn_BF20_GetStereoSelByte2Init(TiproHidDevice *device, int nAddress, int *nInitValue);
421 
422 /* MID_MSGT_XXX_SBX_MB_LINE_OUT */
423 #define MID_MSGT_XXX_SBX_MB_LINE_OUT 0x12 // command code
424 #define MID_MSGT_XXX_SBX_MB_LINE_OUT_PARAM_LEN 0x03 // (1 byte for CMD and 2 bytes for parameter)
425 #define MID_MSGT_XXX_SBX_MB_LINE_OUT_DEF_PARAMS {MID_MSGT_XXX_SBX_MB_LINE_OUT, 0x14, 0x07 } // init value for array of parameters, all VOID
426 // command doesn't check for response buffer length, so to be future-proof we need to reserve a bit more space until the command is improved
427 #define MID_MSGT_XXX_SBX_MB_LINE_OUT_RESPONSE_LEN 0x05+0x7F // (1 byte for CMD and 2 bytes for parameters + 128 bytes just in case)
428 #define MID_MSGT_XXX_SBX_MB_LINE_OUT_PARAM_LEN_RESP 0x01 // Reading current/init parameters requires only command code to be sent
429 #define MID_MSGT_XXX_SBX_MB_LINE_OUT_DEF_PARAMS_RESP {MID_MSGT_XXX_SBX_MB_LINE_OUT}
430 
431 
432 /* BYTE 1 */
433 int intFn_BF20_SetMic2LineInState(TiproHidDevice *device, int nAddress, int nState, bool bSetInit = false);
434 int intFn_BF20_GetMic2LineInState(TiproHidDevice *device, int nAddress, int *nState, int *nInitState = nullptr);
435 
436 int intFn_BF20_SetLineOut2SpkMode(TiproHidDevice *device, int nAddress, int nMode, bool bSetInit = false);
437 int intFn_BF20_GetLineOut2SpkMode(TiproHidDevice *device, int nAddress, int *nMode, int *nInitMode = nullptr);
438 
439 /* BYTE 2 */
440 int intFn_BF20_SetEchoMode(TiproHidDevice *device, int nAddress, int nMode, bool bSetInit = false);
441 int intFn_BF20_GetEchoMode(TiproHidDevice *device, int nAddress, int *nMode, int *nInitMode = nullptr);
442 
443 /* MID_MSGT_XXX_SBX_COM */
444 int intFn_BF20_ShowOnVUMeter(TiproHidDevice *device, int nAddress, int VUMLeft, int VUMRight);
445 int intFn_BF20_ShowOnVUMeter(TiproHidDevice *device, int nAddress, int VUMBoth);
446 
447 /* MID_MSGT_XXX_SBX_HFREE_MIC_BUF_GAIN */
448 /* BYTE 1 */
449 //int intFn_BF20_SetMicPreAmp(int nAddress, int nGain, bool bSetInit = false);
450 // check for nullptr before returning EEPROM value
451 //int intFn_BF20_GetMicPreAmp(int nAddress, int *nGain, int *nInitGain = nullptr);
452 
453 //microphone
454 #define BF20_MIC_FLAG_SET_INIT 0x80
455 #define BF20_MIC_HANDSFREE_DEVICE 0x01
456 #define BF20_MIC_PARAM_LEN_RESP 0x01 // Reading current/init parameters requires only command code to be sent
457 #define BF20_MIC_RESPONSE_LEN 0x07
458 #define BF20_MIC_DISTANCE_FLAG_EC_ENABLED 0x40
459 #define BF20_MIC_DISTANCE_MASK 0x3F //
460 
461 //microphone level (attenuation)
462 #define BF20_MIC_LEVEL_P3 0x10
463 #define BF20_MIC_LEVEL_P2 0x11
464 #define BF20_MIC_LEVEL_P1 0x12
465 #define BF20_MIC_LEVEL_0 0x13
466 #define BF20_MIC_LEVEL_M1 0x14
467 #define BF20_MIC_LEVEL_M2 0x15
468 #define BF20_MIC_LEVEL_M3 0x16
469 #define BF20_MIC_LEVEL_M4 0x17
470 #define BF20_MIC_LEVEL_M5 0x18
471 #define BF20_MIC_LEVEL_M6 0x19
472 #define BF20_MIC_LEVEL_M7 0x1A
473 #define BF20_MIC_LEVEL_M8 0x1B
474 #define BF20_MIC_LEVEL_M9 0x1C
475 #define BF20_MIC_LEVEL_M10 0x1D
476 #define BF20_MIC_LEVEL_M11 0x1E
477 
478 #define BF20_MIC_LEVEL_MIN BF20_MIC_LEVEL_P3
479 #define BF20_MIC_LEVEL_MAX BF20_MIC_LEVEL_M11
480 
481 int intFn_BF20_SetMicrophoneLevel(TiproHidDevice *device, int nAddress, int nLevel, bool bSetInit = false);
482 int intFn_BF20_GetMicrophoneLevel(TiproHidDevice *device, int nAddress, int *nLevel, int *nInitLevel);
483 
484 //microphone optimal distance
485 #define BF20_MIC_DISTANCE_M2 0x0A
486 #define BF20_MIC_DISTANCE_M1 0x0B
487 #define BF20_MIC_DISTANCE_0 0x0C
488 #define BF20_MIC_DISTANCE_P1 0x0D
489 #define BF20_MIC_DISTANCE_P2 0x0E
490 #define BF20_MIC_DISTANCE_P3 0x0F
491 #define BF20_MIC_DISTANCE_P4 0x10
492 #define BF20_MIC_DISTANCE_P5 0x11
493 #define BF20_MIC_DISTANCE_P6 0x12
494 #define BF20_MIC_DISTANCE_P7 0x13
495 #define BF20_MIC_DISTANCE_P8 0x14
496 
497 #define BF20_MIC_DISTANCE_VERY_SHORT BF20_MIC_DISTANCE_0
498 #define BF20_MIC_DISTANCE_SHORT BF20_MIC_DISTANCE_P2
499 #define BF20_MIC_DISTANCE_MEDIUM BF20_MIC_DISTANCE_P4
500 #define BF20_MIC_DISTANCE_LONG BF20_MIC_DISTANCE_P6
501 
502 #define BF20_MIC_DISTANCE_MIN BF20_MIC_DISTANCE_M2
503 #define BF20_MIC_DISTANCE_MAX BF20_MIC_DISTANCE_P8
504 
505 int intFn_BF20_SetMicrophoneOptimalDistance(TiproHidDevice *device, int nAddress, int nDistance, bool bSetInit = false);
506 int intFn_BF20_GetMicrophoneOptimalDistance(TiproHidDevice *device, int nAddress, int *nDistance, int *nInitDistance);
507 
508 //microphone compression
509 #define BF20_MIC_COMPRESSION_OFF 0x10
510 #define BF20_MIC_COMPRESSION_ON 0x11
511 
512 #define BF20_MIC_COMPRESSION_MIN BF20_MIC_COMPRESSION_OFF
513 #define BF20_MIC_COMPRESSION_MAX BF20_MIC_COMPRESSION_ON
514 
515 int intFn_BF20_SetMicrophoneCompression(TiproHidDevice *device, int nAddress, int nCompression, bool bSetInit = false);
516 int intFn_BF20_GetMicrophoneCompression(TiproHidDevice *device, int nAddress, int *nCompression, int *nInitCompression);
517 
518 //microphone noise threshold
519 #define BF20_MIC_THRESHOLD_HIGH 0x10
520 #define BF20_MIC_THRESHOLD_MID 0x11
521 #define BF20_MIC_THRESHOLD_LOW 0x12
522 #define BF20_MIC_THRESHOLD_LOWER 0x13
523 #define BF20_MIC_THRESHOLD_VERY_LOW 0x14
524 
525 #define BF20_MIC_THRESHOLD_MIN BF20_MIC_THRESHOLD_HIGH
526 #define BF20_MIC_THRESHOLD_MAX BF20_MIC_THRESHOLD_VERY_LOW
527 
528 int intFn_BF20_SetMicrophoneThreshold(TiproHidDevice *device, int nAddress, int nThreshold, bool bSetInit = false);
529 int intFn_BF20_GetMicrophoneThreshold(TiproHidDevice *device, int nAddress, int *nThreshold, int *nInitThreshold);
530 
531 //luminance
532 #define BF20_LUMINANCE_MIN 0x00
533 #define BF20_LUMINANCE_MAX 0x14
534 
535 int intFn_BF20_SetLuminance(TiproHidDevice *device, int nAddressBF, int nAddressSbx, int nIndex);
536 int intFn_BF20_GetLuminance(TiproHidDevice *device, int nAddress, int *nIndex);
537 
538 
539 //tomaz20170511
540 int intFn_BF20_GetKeyState(TiproHidDevice *device, int nAddress, int nKey, int *nState);
541 
542 
543 /*
544 SBX_MIC_PREAMP_m36dB = 0,
545 SBX_MIC_PREAMP_m33dB = 1,
546 SBX_MIC_PREAMP_m30dB = 2,
547 SBX_MIC_PREAMP_m27dB = 3,
548 SBX_MIC_PREAMP_m24dB = 4,
549 SBX_MIC_PREAMP_m21dB = 5,
550 SBX_MIC_PREAMP_m18dB = 6,
551 SBX_MIC_PREAMP_m15dB = 7,
552 SBX_MIC_PREAMP_m12dB = 8,
553 SBX_MIC_PREAMP_m9dB = 9,
554 SBX_MIC_PREAMP_m6dB = 10,
555 SBX_MIC_PREAMP_m3dB = 11,
556 SBX_MIC_PREAMP_0dB = 12,
557 SBX_MIC_PREAMP_p3dB = 13,
558 SBX_MIC_PREAMP_p6dB = 14,
559 SBX_MIC_PREAMP_p9dB = 15,
560 SBX_MIC_PREAMP_p12dB = 16,
561 SBX_MIC_PREAMP_p15dB = 17,
562 SBX_MIC_PREAMP_p18dB = 18,
563 SBX_MIC_PREAMP_p21dB = 19,
564 SBX_MIC_PREAMP_p24dB = 20,
565 SBX_MIC_PREAMP_p27dB = 21,
566 SBX_MIC_PREAMP_p30dB = 22,
567 
568 SBX_MIC_PREAMP_MIN = SBX_MIC_PREAMP_m36dB,
569 SBX_MIC_PREAMP_MAX = SBX_MIC_PREAMP_p30dB,
570 SBX_MIC_PREAMP_CNT = SBX_MIC_PREAMP_MAX + 1,
571 */
Definition: TiproHidDevice.h:29