Difference between revisions of "Component: Touch Screen (XPT2046) (Graphical Library)"

From Flowcode Help
Jump to navigationJump to search
Line 17: Line 17:
 
==Component Source Code==
 
==Component Source Code==
  
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_TouchScreen_XPT2046.fcfx FC_Comp_Source_TouchScreen_XPT2046.fcfx]
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx]
  
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_TouchScreen_XPT2046.fcfx FC_Comp_Source_TouchScreen_XPT2046.fcfx]
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx]
  
 
==Detailed description==
 
==Detailed description==
Line 80: Line 80:
 
Example using the XPT2046 touchscreen driver IC with a 7" TFT Display using the SSD1963 Graphical LCD Controller.
 
Example using the XPT2046 touchscreen driver IC with a 7" TFT Display using the SSD1963 Graphical LCD Controller.
 
{{Fcfile|GLCD7_Touch.fcfx|GLCD 7 Touch}}
 
{{Fcfile|GLCD7_Touch.fcfx|GLCD 7 Touch}}
 +
 +
  
  
Line 87: Line 89:
 
==Macro reference==
 
==Macro reference==
  
===SampleSensor===
+
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
|-
| colspan="2" | Reads the touch controller and returns true if there is currently a touch in progress. The touch coordinates can be read using the ReadCoord macro. Return 0 = No Touch, 1 = Touch in progress 
+
| colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
Line 120: Line 122:
  
  
===Initialise===
+
===SampleSensor===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
 
|-
 
|-
| colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. 
+
| colspan="2" | Reads the touch controller and returns true if there is currently a touch in progress. The touch coordinates can be read using the ReadCoord macro. Return 0 = No Touch, 1 = Touch in progress 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}

Revision as of 12:03, 3 February 2023

Author Matrix Ltd
Version 2.0
Category Graphical Library


Touch Screen (XPT2046) component

Low level routines for controlling or interacting with the XPT2046 touch screen controller IC found on a lot of common low cost resistive touch screen products.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/TouchScreen_XPT2046.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Example using the XPT2046 touchscreen driver IC with a 4.3" TFT Display using the SSD1963 Graphical LCD Controller. FC6 Icon.png GLCD 4.3 Touch Example using the XPT2046 touchscreen driver IC with a 7" TFT Display using the SSD1963 Graphical LCD Controller. FC6 Icon.png GLCD 7 Touch




Macro reference

Initialise

Fc9-comp-macro.png Initialise
Activates the SPI peripheral and claims control over the I/O pins. 
Fc9-void-icon.png - VOID Return


ReadCoord

Fc9-comp-macro.png ReadCoord
Reads a coordinate returned from the Sample Sensor macro. Coordinate is scaled to the X/Y Pixel bounds specified. 
Fc9-u8-icon.png - BYTE Coordinate
0 = X, 1 = Y, 2 = Pressure 
Fc9-u16-icon.png - UINT Return


SampleSensor

Fc9-comp-macro.png SampleSensor
Reads the touch controller and returns true if there is currently a touch in progress. The touch coordinates can be read using the ReadCoord macro. Return 0 = No Touch, 1 = Touch in progress 
Fc9-u8-icon.png - BYTE Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png LinkTo
 
Fc9-conn-icon.png Bus Settings
Fc9-type-16-icon.png Channel
SPI Channel selector 
Fc9-type-16-icon.png Prescale
Prescale option selector 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
Fc9-type-5-icon.png MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
Fc9-type-5-icon.png CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Fc9-type-5-icon.png CS / SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Fc9-conn-icon.png Configuration
Fc9-type-16-icon.png Analogue Mode
 
Fc9-type-21-icon.png X Pixel
 
Fc9-type-21-icon.png Y Pixel
 
Fc9-type-7-icon.png Flip X
 
Fc9-type-7-icon.png Flip Y
 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
Label used to identify the component on the panel. 
Fc9-type-7-icon.png Enable Interrupt
Allows the simulated display to fire an interrupt to allow you to action inputs as they happen. 
Fc9-type-22-icon.png Interrupt Macro
Macro called when the simulated display fires an interrupt. 
Fc9-type-7-icon.png Simulate Comms
Allows the SPI communications to be simulated and piped through an API to real world hardware.