Difference between revisions of "Unit FT5x06Touch"

From Ultibo.org
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 21: Line 21:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FT5x06 specific constants''' <code> FT5X06_TOUCH_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>FT5X06_TOUCH_DESCRIPTION = 'EDT FocalTech FT5x06 Touch Controller';</code>
 +
| style="width: 50%;"|Description of FT5x06 Touch device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FT5x06 I2C clock rate''' <code> FT5X06_I2C_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>FT5X06_I2C_RATE = 400000;</code>
 +
| style="width: 50%;"|Default I2C clock rate
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FT5x06 registers''' <code> FT5X06_*_REGISTER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_THRESHOLD = $00;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_REPORT_RATE = $08;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_GAIN = $30;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_OFFSET = $31;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_NUM_X = $33;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_NUM_Y = $34;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_PMOD_REGISTER_ACTIVE = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_PMOD_REGISTER_HIBERNATE = $03;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_M09_REGISTER_THRESHOLD = $80;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_M09_REGISTER_GAIN = $92;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_M09_REGISTER_OFFSET = $93;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_M09_REGISTER_NUM_X = $94;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_M09_REGISTER_NUM_Y = $95;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_EV_REGISTER_THRESHOLD = $40;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EV_REGISTER_GAIN = $41;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EV_REGISTER_OFFSET_Y = $45;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EV_REGISTER_OFFSET_X = $46;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_NO_REGISTER = $ff;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_WORK_REGISTER_OPMODE = $3c;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_FACTORY_REGISTER_OPMODE = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_PMOD_REGISTER_OPMODE = $a5;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_TOUCH_EVENT_DOWN = $00;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_TOUCH_EVENT_UP = $01;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_TOUCH_EVENT_ON = $02;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_TOUCH_EVENT_RESERVED = $03;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_EDT_NAME_LEN = 23;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EDT_SWITCH_MODE_RETRIES = 10;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EDT_SWITCH_MODE_DELAY = 5;</code>
 +
| msec
 +
|-
 +
| <code>FT5X06_EDT_RAW_DATA_RETRIES = 100;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EDT_RAW_DATA_DELAY = 1000;</code>
 +
| usec
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FT5X06_POLL_INTERVAL_MS = 17;</code>
 +
| 17ms = 60fps
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''FT5x06 version''' <code> FT5X06_EDT_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>FT5X06_EDT_M06 = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>FT5X06_EDT_M09 = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EDT_M12 = 2;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_EV_FT = 3;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FT5X06_GENERIC_FT = 4;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''FT5x06 registers'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFT5X06Registers = ^TFT5X06Registers;</code>
 +
 
 +
<code>TFT5X06Registers = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Threshold:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>ReportRate:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Gain:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Offset:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>OffsetX:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>OffsetY:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>NumX:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>NumY:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FT5x06 parameters'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFT5X06Parameters = ^TFT5X06Parameters;</code>
 +
 
 +
<code>TFT5X06Parameters = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Threshold:Byte;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>ReportRate:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Gain:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Offset:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>OffsetX:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>OffsetY:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>NumX:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>NumY:Byte;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''FT5x06 touch'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PFT5X06Touch = ^TFT5X06Touch;</code>
 +
 
 +
<code>TFT5X06Touch = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Touch Properties''
 +
|-
 +
| <code>Touch:TTouchDevice;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|''I2C Properties''
 +
|-
 +
| <code>I2C:PI2CDevice;</code>
 +
| The I2C device this device is connected to
 +
|-
 +
| <code>Address:Word;</code>
 +
| The I2C address of the device
 +
|-
 +
|colspan="2"|''General Properties''
 +
|-
 +
| <code>IRQ:TGPIOInfo;</code>
 +
| The GPIO information for the IRQ line (Optional)
 +
|-
 +
| <code>RST:TGPIOInfo;</code>
 +
| The GPIO information for the Reset line (Optional)
 +
|-
 +
| <code>Timer:TTimerHandle;</code>
 +
| Handle for touch polling timer
 +
|-
 +
| <code>MaxX:Word;</code>
 +
| Maximum X value from current configuration
 +
|-
 +
| <code>MaxY:Word;</code>
 +
| Maximum Y value from current configuration
 +
|-
 +
| <code>Width:Word;</code>
 +
| Screen width value supplied during create
 +
|-
 +
| <code>Height:Word;</code>
 +
| Screen height value supplied during create
 +
|-
 +
| <code>MaxPoints:LongWord;</code>
 +
| Maximum touch points for this device
 +
|-
 +
| <code>LastPoints:LongWord;</code>
 +
| Points reported in last input report
 +
|-
 +
|colspan="2"|''FT5x06 Properties''
 +
|-
 +
| <code>Version:LongWord;</code>
 +
| Version constant for this device (eg FT5X06_EDT_M06)
 +
|-
 +
| <code>ModelName:String;</code>
 +
| Model name string for this device
 +
|-
 +
| <code>FirmwareVersion:String;</code>
 +
| Firmware version string for this device
 +
|-
 +
| <code>Registers:TFT5X06Registers;</code>
 +
| Register addresses for this device
 +
|-
 +
| <code>Parameters:TFT5X06Parameters;</code>
 +
| Configuration parameters for this device
 +
|-
 +
| <code>SwapReportXY:Boolean;</code>
 +
| If True swap the X and Y values in the input report
 +
|-
 +
| <code>InvertReportX:Boolean;</code>
 +
| If True invert the X value in the input report
 +
|-
 +
| <code>InvertReportY:Boolean;</code>
 +
| If True invert the Y value in the input report
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''FT5x06 specific variables'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_GAIN:Byte;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_OFFSET:Byte;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_OFFSET_X:Byte;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_OFFSET_Y:Byte;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_THRESHOLD:Byte;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_SWAP_REPORT_XY:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_INVERT_REPORT_X:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_INVERT_REPORT_Y:Boolean;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>FT5X06_MAX_TOUCH_POINTS:LongWord = 2;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===

Latest revision as of 02:18, 11 November 2022

Return to Unit Reference


Description


EDT FocalTech FT5x06 I2C Touchscreen Driver unit

The EDT FocalTech FT5x06 I2C controllers are a range of capacitive touchscreen controllers that include multipoint touch support and are used by a variety of small LCD displays. The exact features and capability of each device can be found by checking the datasheets which can be obtained online.

This driver is compatible with the following devices:

 edt,edt-ft5206       (5 touch points)
 edt,edt-ft5306       (5 touch points)
 edt,edt-ft5406       (5 touch points)
 edt,edt-ft5506       (10 touch points)
 evervision,ev-ft5726 (10 touch points)
 focaltech,ft6236     (2 touch points)

Constants



FT5x06 specific constants FT5X06_TOUCH_*
FT5X06_TOUCH_DESCRIPTION = 'EDT FocalTech FT5x06 Touch Controller'; Description of FT5x06 Touch device


FT5x06 I2C clock rate FT5X06_I2C_*
FT5X06_I2C_RATE = 400000; Default I2C clock rate


FT5x06 registers FT5X06_*_REGISTER_*
FT5X06_WORK_REGISTER_THRESHOLD = $00;  
FT5X06_WORK_REGISTER_REPORT_RATE = $08;  
FT5X06_WORK_REGISTER_GAIN = $30;  
FT5X06_WORK_REGISTER_OFFSET = $31;  
FT5X06_WORK_REGISTER_NUM_X = $33;  
FT5X06_WORK_REGISTER_NUM_Y = $34;  
 
FT5X06_PMOD_REGISTER_ACTIVE = $00;  
FT5X06_PMOD_REGISTER_HIBERNATE = $03;  
 
FT5X06_M09_REGISTER_THRESHOLD = $80;  
FT5X06_M09_REGISTER_GAIN = $92;  
FT5X06_M09_REGISTER_OFFSET = $93;  
FT5X06_M09_REGISTER_NUM_X = $94;  
FT5X06_M09_REGISTER_NUM_Y = $95;  
 
FT5X06_EV_REGISTER_THRESHOLD = $40;  
FT5X06_EV_REGISTER_GAIN = $41;  
FT5X06_EV_REGISTER_OFFSET_Y = $45;  
FT5X06_EV_REGISTER_OFFSET_X = $46;  
 
FT5X06_NO_REGISTER = $ff;  
 
FT5X06_WORK_REGISTER_OPMODE = $3c;  
FT5X06_FACTORY_REGISTER_OPMODE = $01;  
FT5X06_PMOD_REGISTER_OPMODE = $a5;  
 
FT5X06_TOUCH_EVENT_DOWN = $00;  
FT5X06_TOUCH_EVENT_UP = $01;  
FT5X06_TOUCH_EVENT_ON = $02;  
FT5X06_TOUCH_EVENT_RESERVED = $03;  
 
FT5X06_EDT_NAME_LEN = 23;  
FT5X06_EDT_SWITCH_MODE_RETRIES = 10;  
FT5X06_EDT_SWITCH_MODE_DELAY = 5; msec
FT5X06_EDT_RAW_DATA_RETRIES = 100;  
FT5X06_EDT_RAW_DATA_DELAY = 1000; usec
 
FT5X06_POLL_INTERVAL_MS = 17; 17ms = 60fps


FT5x06 version FT5X06_EDT_*
FT5X06_EDT_M06 = 0;  
FT5X06_EDT_M09 = 1;  
FT5X06_EDT_M12 = 2;  
FT5X06_EV_FT = 3;  
FT5X06_GENERIC_FT = 4;  


Type definitions



FT5x06 registers

PFT5X06Registers = ^TFT5X06Registers;

TFT5X06Registers = record

Threshold:Byte;  
ReportRate:Byte;  
Gain:Byte;  
Offset:Byte;  
OffsetX:Byte;  
OffsetY:Byte;  
NumX:Byte;  
NumY:Byte;  

FT5x06 parameters

PFT5X06Parameters = ^TFT5X06Parameters;

TFT5X06Parameters = record

Threshold:Byte;  
ReportRate:Byte;  
Gain:Byte;  
Offset:Byte;  
OffsetX:Byte;  
OffsetY:Byte;  
NumX:Byte;  
NumY:Byte;  

FT5x06 touch

PFT5X06Touch = ^TFT5X06Touch;

TFT5X06Touch = record

Touch Properties
Touch:TTouchDevice;  
I2C Properties
I2C:PI2CDevice; The I2C device this device is connected to
Address:Word; The I2C address of the device
General Properties
IRQ:TGPIOInfo; The GPIO information for the IRQ line (Optional)
RST:TGPIOInfo; The GPIO information for the Reset line (Optional)
Timer:TTimerHandle; Handle for touch polling timer
MaxX:Word; Maximum X value from current configuration
MaxY:Word; Maximum Y value from current configuration
Width:Word; Screen width value supplied during create
Height:Word; Screen height value supplied during create
MaxPoints:LongWord; Maximum touch points for this device
LastPoints:LongWord; Points reported in last input report
FT5x06 Properties
Version:LongWord; Version constant for this device (eg FT5X06_EDT_M06)
ModelName:String; Model name string for this device
FirmwareVersion:String; Firmware version string for this device
Registers:TFT5X06Registers; Register addresses for this device
Parameters:TFT5X06Parameters; Configuration parameters for this device
SwapReportXY:Boolean; If True swap the X and Y values in the input report
InvertReportX:Boolean; If True invert the X value in the input report
InvertReportY:Boolean; If True invert the Y value in the input report


Public variables



FT5x06 specific variables

FT5X06_GAIN:Byte;
FT5X06_OFFSET:Byte;
FT5X06_OFFSET_X:Byte;
FT5X06_OFFSET_Y:Byte;
FT5X06_THRESHOLD:Byte;
FT5X06_SWAP_REPORT_XY:Boolean;
FT5X06_INVERT_REPORT_X:Boolean;
FT5X06_INVERT_REPORT_Y:Boolean;
FT5X06_MAX_TOUCH_POINTS:LongWord = 2;


Function declarations



Initialization functions

procedure FT5X06Init;
Description: Initialize the FT5x06 Touch unit and parameters
Note Called internally by other functions


FT5x06 functions

function FT5X06TouchCreate(I2C:PI2CDevice; Address:Word; Width,Height:LongWord; IRQ,RST:PGPIOInfo):PTouchDevice;
Description: Create, register and start a new FT5x06 Touch device connected to the specified I2C device
I2C The I2C device this FT5x06 Touch device is connected to
Address The I2C address for this FT5x06 Touch device
Width The width of the screen in pixels (When set at TOUCH_ROTATION_0)
Height The height of the screen in pixels (When set at TOUCH_ROTATION_0)
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new Touch device or nil on failure


function FT5X06TouchDestroy(Touch:PTouchDevice):LongWord;
Description: Stop, deregister and destroy a FT5x06 Touch device created by this driver
Touch The Touch device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


FT5x06 touch functions

function FT5X06TouchStart(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceStart API for FT5x06 Touch device
Note Not intended to be called directly by applications, use TouchDeviceStart instead.


function FT5X06TouchStop(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceStop API for FT5x06 Touch device
Note Not intended to be called directly by applications, use TouchDeviceStop instead.


function FT5X06TouchUpdate(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceUpdate API for FT5x06 Touch device
Note Not intended to be called directly by applications, use TouchDeviceUpdate instead.


procedure FT5X06TouchTimer(Touch:PFT5X06Touch);
Description: Touch device timer event handler for FT5x06 Touch device
Note Not intended to be called directly by applications


procedure FT5X06TouchCallback(Touch:PFT5X06Touch; Pin,Trigger:LongWord);
Description: Touch device event callback (Interrupt) handler for FT5x06 Touch device
Note Not intended to be called directly by applications


Return to Unit Reference