The Concept of iLCD's Touch Fields
To allow maximum flexibility and easy use of touch fields without using any resources of the application's controller, the following concept was implemented:
You may define up to 64 touch fields with any rectangle size and where fields may overlap each other. The maximum field size is the pixel screen size used by the current iLCD. Any touch field may have a key assigned which is reported to the application when the touch field is pressed and released. In addition, any touch field may have assigned a text message, a make and/or a break macro which are automatically executed when the field is pressed/released.
When using multiple screens, note that touch fields are created at the screen index of the currently active draw screen. On the other hand, only touch fields on the activated view screen get evaluated and reported.
PCAP Touch Screen
Projected capacitive (PCAP) touch screens support up to 5 simultaneously evaluated touch points. The sensitivity is determined by values stored in the EEPROM (refer to EEPROM Related Commands).
Make/Break Events and Macros
The iLCD Controller automatically checks in the order of field indices if the touch panel is pressed within one of the previously defined fields. If the touch pressure is within the bounds of a touch field, the make key sequence (Touch Field Press/Release) is reported to the application if a key is assigned to this field. This key sequence is exactly the same sequence as used for a keyboard (refer to Key Press/Release).
After the key has been reported, the make macro assigned to the field is executed as long as automatic execution is not disabled via the Enable/Disable Automatic Touch Macro Executing command. Before execution of this macro starts, the iLCD Controller sets the ‘current touch field index’ accordingly and the cursor to the upper/left corner of the touch field, allowing the execution of all necessary drawing stuff within the make macro (usually painting the touch field in a "pressed" state).
After the make macro has been fully executed (or an Allow Keyboard/Touch Events to be Processed command has been found), the iLCD Controller checks if the touch screen has been released or waits for release. On release, the corresponding break key sequence is sent to the application and the break macro is executed. If there are any new touch events while the make macro is still running, the break event is ignored. Touch macros do not send an extra [ACK] after execution is finished. They do however send a [NACK] if one of the macro commands fail.
Touch Macros are NOT Aborted by Touch Events
Please keep in mind, that any touch events happening during execution of a make or break macro are ignored unless the command Allow Keyboard/Touch Events to be Processed is executed withing the running touch macro.
Current Touch Field Index and Synchronization
The iLCD Controller also keeps track of which touch field has been pressed using an internal variable known as the ‘current touch field index’. This value is automatically set when a touch field is created, pressed or released, but the user can also set it manually by using Set Current Touch Field Index.
This can be useful when using touch macros and synchronizing with a controlling application at the same time. To realize this behaviour, make and break macros are assigned to touch fields but automatic execution is disabled using Enable/Disable Automatic Touch Macro Executing. After the key sequence of the pressed/released touch field is reported to the application, the according make/break macro can be started using the ‘current touch field index’ (parameter 0xFF) with the command Execute Touch Make Macro resp. Execute Touch Break Macro. This way, the controlling application receives acknowledgements when macro execution is finished.
Reuse Macros for Similar Touch Fields
One make/break macro can be used for any number of different touch fields on different locations, as the cursor is automatically set to the upper/left corner of the touch field before the macro starts (either automatically or with the command Execute Touch Make Macro resp. Execute Touch Break Macro). Painting individual touch field texts can be done via Draw Touch Field Text Message using the ‘current touch field index’. Cursor movements within make/break macros can be done relative to the current cursor position via the Increment/Decrement Column Address and Increment/Decrement Row Address to allow the use of the macro for different touch fields on different cursor positions. Using the Cursor Memory Related Commands can further help you to simplify the field drawing routines and to increase the usability of macros by multiple touch fields.
Find following commands in this chapter as well as in the corresponding category when using the parameter completion feature of iLCD Manager XE:
Copyright © demmel products gmbh. All rights reserved.