I’m using EVE’s touch tag features in my new In-Home Display for smart meters. How do I stop the tags being applied to every object?

Touch screens normally report x and y coordinates corresponding to the position of the touch on the screen (via I2C for capacitive touch and via resistance values for resistive). Traditionally, the process of decoding touch coordinates reported by the panel, transforming them to match the screen dimensions and alignment, and then working out which (if any) item on the screen is within the area being touched can be complex and time-consuming for the main MCU controlling the display.

EVE is integrating an innovative touch engine which does all this hard work, making it much easier to add resistive or capacitive touch control to your application. One key feature, which helps to reduce the workload of both the MCU itself and of the application developer, is Touch Tagging. Instead of manually comparing the coordinates to those of items on the screen, you can simply assign tag values when creating your screen layout as a display/co-processor list. Items drawn on the screen are assigned a tag number based on the last specified tag before them in the display list. Then, the MCU can simply read EVE’s REG_TOUCH_TAG register (either by polling or in response to an Interrupt from EVE) to determine which item is being touched.

However, there may also be items on the screen that you do not want to tag. For example, a bitmap or shape behind a group of tagged buttons/icons or text labels beside the buttons. You can use the TAG_MASK instruction to stop items being tagged. We illustrate this here with a simple example.

The tag buffer (which has a value for each pixel) is cleared to a default or specified value when you clear the screen (in the example below we set Clear_Tag as 128).

  • Tag_Mask = 1 enables tagging: When you draw an object, the tag buffer in the area of the object (button, text etc.) will be updated with the last tag set above in the display list
  • Tag_Mask = 0 disables tagging: When you draw an object, the tag buffer is not updated with a new tag value

The simplified code example below shows the actual tag number which will be read back from REG_TOUCH_TAG when each object is touched

  • No touch on the screen:                           REG_TOUCH_TAG = 0
  • Touching the buttons or text:                    See the comments for each line of code
  • Touching any other area of the screen:            REG_TOUCH_TAG = 128  (as set by CLEAR_TAG)


 

Note that the REG_TOUCH_TAG register is updated once the pixels for a given frame are fully scanned out. We use buttons and text here but the same applies to other objects such as shapes and images. The capacitive versions of EVE support up to 5 simultaneous touches and so have 5 different REG_TOUCH_TAG registers allowing the tag for each touch to be read.