The Touch Sensor Module communicates with messages that are serialized according to the zForce serialization protocol. Here is a quick introduction to the messages you need to send to get started and also how you interpret received messages. 

Encoding Integers

ASN.1 encoded integers, for example values representing scanning frequency or touch active area size, are represented by one or more bytes:

  • If the integer is between 0 and 127, it is represented by one byte (00 to 7F).
  • If the integer is between 128 and 32767, it is represented by two bytes (00 80 to  7F FF).

The length of the message therefore varies depending on parameter values.

Enabling Touch Sensor Modules

Do the following to enable a Touch Sensor Module, that is, tell the module to start sending touch notifications. 

  1. Enable the sensor module by sending a request with an Enable command:

    EE 09 40 02 02 00 65 03 81 01 00

    This enables the sensor module to send touch notifications.

  2. Read the response. The response should be:

    EF 09 40 02 02 00 65 03 81 01 00
  3. The Touch Sensor Module is now Enabled. After this, wait for the sensor module to indicate it has something to send, which means that the device will send a Touch Notification or a BootComplete. A BootComplete indicates that the device has restarted for some reason, so rerun the initialization and enable the sensor module to start receiving touch notifications again.

Disabling Touch Sensor Modules

Do the following to disable a Touch Sensor Module, that is, tell the module to stop sending touch notifications. 

  1. Disable the sensor module by sending a request with the following command:

    EE 08 40 02 02 00 65 02 80 00

    This disables the sensor module to send touch notifications.

  2. Read the response. The response should be:

    EF 08 40 02 02 00 65 02 80 00
  3. The Touch Sensor Module is now Disabled. 

Click on Touch

Click on Touch is created

Default C-o-t message here 100/100
PartDescription
EE XXID for request followed by length of total payload (0xXX = YY bytes)
40 02 02 00Device address (always the same for Neonode Touch Sensor Modules)

ID for Touch Mode followed by payload length

ID for clickOnTouch followed by payload length

ID for clickOnTouchTime followed by payload length and an integer value

ID for clickOnTouchRadius followed by payload length and an integer value


Device Configuration

Device configuration is a command that includes different settings for the sensor module, for example the Touch Active Area. When sending a device configuration message, all of the settings specified are not required to be sent, however the response from the sensor module will include the full device configuration message.

This is an example message that changes the touch active area using the Device Configuration command:

EE 1A 40 02 02 00 73 14 A2 12 80 02 00 B5 81 01 43 82 02 06 98 83 02 04 34 85 01 FF

The message is explained in the table below:

PartDescription
EE 1AID for request followed by length of total payload (0x1A = 26 bytes)
40 02 02 00Device address (always the same for Neonode Touch Sensor Modules)
73 14ID for Device Configuration followed by the length of the total Device Configuration payload (20 bytes)
A2 12ID for Sub Touch Active Area followed by the length of Sub Touch Active Area payload
80 02 00 B5ID for xMin followed by payload length and an integer value (0x00B5 = 181)
81 01 43

ID for yMin followed by payload length and an integer value (0x43 = 67)

82 02 06 98

ID for xMax followed by payload length and an integer value (0x0698 = 1688)

83 02 04 34ID for yMax followed by payload length and an integer value (0x0434 = 1076)
85 01 FFID for "Invert y axis" followed by length of payload and a Boolean (0xFF= True)

The response from the sensor module to the above message will contain the full device configuration message, also the parts not set in the request.

Setting the Touch Active Area should be done before enabling the sensor module with the ENABLE request.

Reflective Edge Filter

In the Device Configuration command there is something called Reflective Edge filter (from firmware version 1.45 and later). This setting is useful if there is a highly reflective material, right outside of the Touch Active Area. If such conditions are present, enabling this feature could increase the touch performance.

Command to Enable Reflective Edge Filter
EE 0A 40 02 02 00 73 04 85 02 00 80
Command to Disable Reflective Edge Filter
EE 09 40 02 02 00 73 03 85 01 00

Setting Frequency

To set the finger frequency to 200 Hz and idle frequency to 63 Hz use a request with the following command:

EE 0D 40 02 00 00 68 07 80 02 00 C8 82 01 3F

Neonode Touch Sensor Module does not support Stylus mode, and setting the stylus frequency does not do anything.

Decoding Touch Notifications

Each Touch Notification packet contains from one up to 10 touches and starting from FW version 2.0 a timestamp. 

The timestamp is a 32-bit integer and can be represented as 1 to 4 bytes. The ASN.1 timestamp format is <58><number of bytes> <timestamp value>. Older versions of the NTSMF do not include timestamps and this part (<58><number of bytes> <timestamp value>) is missing.

For One touch (below), F0 15 in the beginning will be F0 11 and A0 0F in the middle will be A0 0B. The same bytes are decreased by 4 for Two and Three touches.

One Touch with a timestamp

From FW version 2.0 Touch Notifications appear with timestamps. A packet that contains one touch and a timestamp looks like:

F0 15 40 02 02 00 A0 0F 42 09 II VV XX XX YY YY GG GG JJ 58 02 TT TT

where the data is defined as follows:

SyntaxMeaning
II

ID of this specific touch object. More than one can be tracked simultaneously.

VV

Event:

00 = DOWN (new object). 01 = MOVE (existing object has moved). 02 = UP (existing object is no longer being tracked).

XX XXX Coordinate of the object. This is in Network Byte Order / Big Endian / Motorola Endian.
YY YYY Coordinate of the object. See above.
GG GGSize of object on the X Axis.
JJThis value should be ignored.
58Indicated that a timestamp is present. 
02Length of timestamp value in bytes. Can be 01, 02, 03 or 04 (in this case it is 02).
TT TT

Timestamp value. Can be 1 to 4 bytes long (TT => TT TT TT TT)


Two Touches

A packet that contains two Touches will look like:

F0 20 40 02 02 00 A0 1A 42 09 II VV XX XX YY YY GG GG JJ 42 09 II VV XX XX YY YY GG GG JJ 58 02 TT TT

where the first "II" and the following bytes up to and including "JJ" are from the first touch, and the second "II" and the following bytes up to and including "JJ" are from the second touch.

Three Touches

A packet that contains three Touches will look like:

F0 2B 40 02 02 00 A0 25 42 09 II VV XX XX YY YY GG GG JJ 42 09 II VV XX XX YY YY GG GG JJ 42 09 II VV XX XX YY YY GG GG JJ 58 02 TT TT


For a more thorough explanation of the serialization protocol, refer to Understanding the zForce ASN.1 Serialization Protocol.

  • No labels