Version 1
AdjustableDpi
Overview
This feature handles the resolution on motion sensors (mainly optical for mice, but could be 3D)
Functions and Events
[0] getSensorCount() → sensorCount
Returns the number of "motion" sensors in the device.
Parameters
None
Returns
- sensorCount
-
Number of sensors in device
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorCount |
[1] getSensorDpiList(sensorIdx) → sensorIdx, dpiList
Returns the list of resolution levels supported by the sensor on this device from lowest to highest. List ends when invalid resolution level 0x0000 is reached
Parameters
- sensorIdx
-
The index of the sensor
For example, if getSensorCount() returns 2, valid index are 0 and 1
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
Returns
- sensorIdx
-
Index of the sensor (echo)
- dpiList
-
Array of supported resolutions, variable length, terminated by a 0 value
A DPI value is coded on 16bit (high byte first), as following:
Bits 15..13: 000 .. 110 = values, 111 = hyphen Values: 0 = End-of-list 1-57343 (0xdfff) = 1 DPI -> 57343 DPI (by step of 1 DPI) 57344 (0xe000) = Unused 57345-65535 (0xe001 - 0xffff) = Hyphen 1 DPI -> 8191 DPI (by step of 1 DPI)
Response possibilities:
-
List
List of all supported DPI, from lowest to highest. Each DPI value is in the range 1 - 57343, and the end of list is 0x0000; so possible to report up to 6 DPI values
Example: A device supporting only 3 levels: 400dpi, 800dpi and 1600dpi
dpiList1 = 0x0190 ( 400) dpiList2 = 0x0320 ( 800) dpiList3 = 0x0640 (1600) dpiList4 = 0x0000 ( 0)
-
Range
First value is the low dpi. Next value is a hyphen value which is the dpi step. The third and last value is the high dpi value.
Example: A device supporting 10 levels: from 400dpi, to 1300dpi, in steps of 100dpi
dpiList1 = 0x0190 ( 400) dpiList2 = 0xe064 ( -) step 100 dpiList3 = 0x0514 (1300) dpiList4 = 0x0000 ( 0)
-
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
|||||||
1 |
dpiList1 MSB |
|||||||
2 |
dpiList1 LSB |
|||||||
3 |
dpiList2 MSB |
|||||||
4 |
dpiList2 LSB |
|||||||
5 |
dpiList3 MSB |
|||||||
6 |
dpiList3 LSB |
|||||||
7 |
dpiList4 MSB |
|||||||
8 |
dpiList4 LSB |
|||||||
9 |
dpiList5 MSB |
|||||||
10 |
dpiList5 LSB |
|||||||
11 |
dpiList6 MSB |
|||||||
12 |
dpiList6 LSB |
|||||||
13 |
0 |
|||||||
14 |
0 |
[2] getSensorDpi(sensorIdx) → sensorIdx, dpi, defaultDpi
Returns the current sensor resolution and its default resolution.
Parameters
- sensorIdx
-
The index of the sensor
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
Returns
- sensorIdx
-
Index of the sensor (echo)
- dpi
-
The current dpi numeric value (1 - 57343)
- defaultDpi
-
The default dpi numeric value
NoteVersion 0 does not report default DPI, returning 0 in its place.
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
|||||||
1 |
dpi MSB |
|||||||
2 |
dpi LSB |
|||||||
3 |
defaultDpi MSB |
|||||||
4 |
defaultDpi LSB |
[3] setSensorDpi(sensorIdx, dpi) → sensorIdx, dpi
Set the sensor resolution.
Parameters
- sensorIdx
-
The index of the sensor
- dpi
-
The new dpi numeric value (1 - 57343)
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
|||||||
1 |
dpi MSB |
|||||||
2 |
dpi LSB |
Returns
The parameters are echoed as the response.
Note
|
Version 0 does not echo the parameters. |
- sensorIdx
-
The index of the sensor (echo)
- dpi
-
The new dpi numeric value (echo)
byte \ bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
0 |
sensorIdx |
|||||||
1 |
dpi MSB |
|||||||
2 |
dpi LSB |
ChangeLog
-
Version 1: Added returning of default DPI value in getSensorDpi
-
Version 0: Initial version