Firmware-75 Function-119

From I-CubeX Wiki
Jump to: navigation, search

SWIPE3D (119, 77h)

The Swipe3D function enables output of the Swipe3D sensor data in both host and stand-alone mode. In host mode the sensor data is output in I2C DATA messages. In stand-alone mode the sensor data is output according to the stand-alone mode settings of the input number that equals the I2C port number. There are the following methods to select, using the FUNCTION command’s method/parameter FP:

Swipe3D v1.0

FP Data output in host mode Data output in stand-alone mode
default Gesture detected [0..6]: an unsigned 8-bit value, representing [none, up, down, left, right, near, far] gestures, sent as nibbles in two bytes (MSB, LSB) Gesture detected [0, 32, 96] or [0, 4096, 12288]; an unsigned 7-bit or 14-bit value, representing [none, up, down] gestures, sent as one or two bytes (LSB, MSB)
Gesture detected [0, 32, 96] or [0, 4096, 12288]; an unsigned 7-bit or 14-bit value, representing [none, left, right] gestures, sent as one or two bytes (LSB, MSB)
Gesture detected [0, 32, 96] or [0, 4096, 12288]; an unsigned 7-bit or 14-bit value, representing [none, near, far] gestures, sent as one or two bytes (LSB, MSB)
1..6 No output Gesture detected [0, 64] or [0, 8192]; an unsigned 7-bit or 14-bit value, representing [no, yes] detection of the gesture corresponding with the method number (FP), where [1..6] corresponds with [up, down, left, right, near, far] gestures, sent as one or two bytes (LSB, MSB)
10 Proximity [0..255]; an unsigned 8-bit value, representing object proximity, sent as nibbles in two bytes (MSB, LSB) Proximity [0..127] or [0..16383]; an unsigned 7-bit or 14-bit value, representing object proximity, sent as one or two bytes (LSB, MSB)
20 Ambient light level [0..65535]; an unsigned 16-bit value, representing ambient light level, sent as nibbles in four bytes (MSB .. LSB) Ambient light level [0..127] or [0..16383]; an unsigned 7-bit or 14-bit value, representing ambient light level, sent as one or two bytes (LSB, MSB)
Red light level [0..65535]; an unsigned 16-bit value, representing red light level, sent as nibbles in four bytes (MSB .. LSB) Red light level [0..127] or [0..16383]; an unsigned 7-bit or 14-bit value, representing red light level, sent as one or two bytes (LSB, MSB)
Green light level [0..65535]; an unsigned 16-bit value, representing green light level, sent as nibbles in four bytes (MSB .. LSB) Green light level [0..127] or [0..16383]; an unsigned 7-bit or 14-bit value, representing green light level, sent as one or two bytes (LSB, MSB)
Blue light level [0..65535]; an unsigned 16-bit value, representing blue light level, sent as nibbles in four bytes (MSB .. LSB) Blue light level [0..127] or [0..16383]; an unsigned 7-bit or 14-bit value, representing blue light level, sent as one or two bytes (LSB, MSB)

Example:

In order to enable the Swipe3D function to output the detection of a gesture by a Swipe3D sensor with I2C device address 57 (default Swipe3D I2C device address) connected to the 7th I2C port, the following message is sent:

240, 125, 0 {DEV}, 8 {FUNCTION}, 6 {yyy = 6}, 57 {device address}, 119 {Swipe3D function}, 0 {Gesture detected method}, 247 (F0h, 7Dh, 00h, 08h, 06h, 39h, 77h, 00h, F7h)

In host mode raw sensor data will be output immediately in I2C DATA messages. In stand-alone mode a suitable configuration has to be set using the EDIT CONFIG command before any MIDI messages will be output.

Other settings of the Swipe3D sensor can be effectuated by using I2C commands such as I2C WRITE and I2C READ. See also the datasheet linked from the Swipe3D v1.0 webpage.