SETUP(TOUCH)
Description
Setup The Touch settings for Resistive, Projective Capacitive or Immediate Touch

Projected Capacitive Touch - Suitable with glass (up to 4mm thick) and plastic (up to 1.5mm thick) overlay

Immediate Capacitive Touch - Direct Contact, Not suitable for glass or plastic overlay
Syntax/Parameters
setup(Touch){...}
Options
Resistive
Parameter 3.5 4.3 5.7 7.0 Notes
type res res res res  
enable y y y y enable touch keys globally with y or n
samples - 12 12 22 define the number of touch samples per interrupt.
debounce - 25 30 25 define the time period between each sampling period.
accuracy - 50 14 12 define the 0.25 pixel accuracy of the samples.
inactive 1000 1000 1000 1000 time in milliseconds (0=off)
To increase the sensitivity set samples = low number e.g. 3
This may only be suitable for buttons which are larger than 80x80 pixels
 
3.5 4.3 5.7 7.0
Code simple program to help test touch setup

Projective Capacitive
Parameter 4.3 5.7 7.0 Notes
type cap cap cap  
width 272 480 480 default to height of display
height 480 640 800 default to width of display
xnum 16 16 16 number of X electrodes
ynum 14 14 14 number of Y electrodes
gain 0 0 0 gain of ADC
threshold 25 25 25  
debounce 3 3 3  
address 75 75 75 I2C address of controller
inactive 1000 1000 1000 time in milliseconds (0=off)
filterlevel  1 1 1 level of filtering applied 0-15
filterlimit   4 4 4 maximum filter limit 0-7
filterenable Y Y Y enable filtering Y/N
switch          Y Y Y switch X and Y electrodes
invertx Y Y Y invert the order of the X electrodes
inverty N N N invert the order of the Y electrodes
enable Y Y Y enable touch keys globally with y or n
 
4.3 5.7 7.0
Code simple program to help test touch setup

v49.37 Added ability to specify mxt224 object data using Txx as the parameter name :- ie T9 = "15,00,02,11";
           Added separate setup code for all mxt224 variants (mxt224v1,mxt224v2,mxt224Ev1,mxt224Ev2)
           Added RESET(TOUCH); for projective capacitive touch

Immediate/Contact Capacitive
Parameter 7.0 Notes
type ICT
CCT
part number suffix of module
enable Y enable touch keys globally with y or n
inactive 1000 time in milliseconds (0=off)
Type= part number suffix of module ie TU800x480C-K612A1U-CCT would use type=cct;
 
Metallised - (works with firmware v49.56.5+)
Parameter 4.3 5.7 7.0 Notes
type cap_dbg cap_dbg cap_dbg  
width 480 620 800 default to width of display
height 272 460 480 default to height of display
xnum 16 15 19 number of X electrodes
ynum 14 14 14 number of Y electrodes
gain 2 2 2 gain of ADC
threshold 8 8 8 decrease value for thicker front panel
debounce 3 3 3 decrease for faster response
switch n n n switch X and Y electrodes
invertx y y y invert the order of the X electrodes
inverty n n n invert the order of the Y electrodes
ycorr - - 20  
ymid - - 200  
Firmware version v49.56.6+ only requires the type and threshold values all other parameters will be ignored
 
Example
setup(touch) // resistive touch
{
type = res; // default is 'res' for resistive touch
enable = y; // enable touch keys globally with y or n
samples = 20; // define the number of touch samples per interrupt. Defaults:4.3" = 12; 5.7" = 12; 7" = 22;
debounce = 10; // define the time period between each sampling period. Defaults: 4.3" = 25; 5.7" = 30; 7" = 25;
accuracy = 20; // define the 0.25 pixel accuracy of the samples. Defaults: 4.3" = 50; 5.7" = 14; 7" = 12;
inactive=1000; // time in milliseconds (0=off)

}

setup(touch)  // projective capacitive touch
{
type = cap; // default is 'res' for resistive touch
enable = y; // enable touch keys globally with y or n
width = 272; // default to height of display
height = 480; // default to width of display
xnum = 16; // number of X electrodes
ynum = 14; // number of Y electrodes
gain = 0; // gain of ADC
threshold = 25; 
debounce = 3;
address = 75; // I2C address of controller
inactive=1000; // time in milliseconds (0=off)
filterlevel=1;  //level of filtering applied 0-15,  default=1
filterlimit=4;   //maximum filter limit 0-7; default=4
filterenable=Y;  //enable filtering Y/N
switch=Y;          //switch X and Y electrodes
invertx=Y;        //invert the order of the X electrodes
inverty=N;        //invert the order of the Y electrodes

}

setup(touch) //immediate/contact capacitive touch
{
type = ict;  // other options are cct or cct2 depending on module part number suffix
enable = y; // enable touch keys globally with y or n
inactive=1000; // time in milliseconds (0=off)

}