Resistive Touch, Trizeps VIII

The Kinetis MCU default firmware of the Trizeps VIII (Mini) includes a code to act as a touch controller.

Config

TOUCHSCREEN_KUK_TR8MCU

Source

/linux_imx/drivers/input/touchscreen/kuk_tr8mcu_touch.c

How to modify Settings

$ cd /sys/bus/i2c/devices/2-0010 /sys/bus/i2c/devices/2-0010$ ls average modalias power swapxy x xraw ymax yscale driver name settle threshold xmax xscale ymin zraw input of_node subsystem uevent xmin y yraw

Get a setting or touch value; ie. get the last measured raw x value:

/sys/bus/i2c/devices/2-0010$ cat xraw 41

Change a setting; ie. swap x and y axis and invert the x-axis:

/sys/bus/i2c/devices/2-0010$ echo 3 > swapxy

Value

I2C-Register

Description

Value

I2C-Register

Description

xscale

TOUCH_XSCALE_LSB/MSB

The max. value „xraw“ is scaled „x“ to. Typ.: screen-width

yscale

TOUCH_YSCALE_LSB/MSB

The max. value „yraw“ is scaled „y“ to. Typ.: screen-height

xmin

TOUCH_XMIN_LSB/MSB

xraw value, when left edge of screen is touched

xmax

TOUCH_XMAX_LSB/MSB

xraw value, when right edge of screen is touched

ymin

TOUCH_YMIN_LSB/MSB

yraw value, when top edge of screen is touched

ymax

TOUCH_YMAX_LSB/MSB

yraw value, when bottom edge of screen is touched

threshold

TOUCH_CONFIG

Defines trigger level at which a touch-press is detected 0..63

settle

TOUCH_WAITTIME

Time in ms to wait between before measurements

average

TOUCH_AVERAGE

Number of samples to average for each point

swapxy

-

0x0: no change, 0x1: swap x and y axis, 0x2: invert x-axis, 0x4: Invert y-axis

x

TOUCH_XSCALE_LSB/MSB

scaled x value of last measurement (Bitmask 0x8000: no touch press)

y

TOUCH_YSCALE_LSB/MSB

scaled y value of last measurement (Bitmask 0x8000: no touch press)

xraw

TOUCH_XMIN_LSB/MSB

last raw x value

yraw

TOUCH_YMIN_LSB/MSB

last raw y value

zraw

TOUCH_XMAX_Z_LSB/MSB

last raw z value. Z-measurement must be enabled

Device-Tree for resistive Touch-Controller

Example:

&iomuxc { pinctrl_restouch: restouchgrp { fsl,pins = < MX8MM_IOMUXC_SD2_WP_GPIO2_IO20 0x16 /* MCU Interrupt */ >; }; } &i2c3 { touch: kuk_tr8mcu_touch@10 { compatible = "kuk,kuk-tr8mcu-touch"; reg = <0x10>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_restouch>; interrupts-extended = <&gpio2 20 IRQ_TYPE_LEVEL_LOW>; xscale = <800>; yscale = <480>; xmin = <306>; xmax = <3781>; ymin = <692>; ymax = <3459>; settle = <10>; average = <25>; yreverse = "true" ; linux,wakeup; }; }

For a description of the settings see table above.
The swapxy is split into 3 values for the device-tree:

swapxy

Swap x and y axis

xreserve

Invert x axis

yreserve

Invert y axis