Jump to content

Component: Touch Screen (GT911) (Graphical Library): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(7 intermediate revisions by 2 users not shown)
Line 15: Line 15:
Low level routines for controlling or interacting with the GT911 touch screen controller IC found on a lot of common capacitive touch screen products.
Low level routines for controlling or interacting with the GT911 touch screen controller IC found on a lot of common capacitive touch screen products.


==Component Source Code==
==Version information==
 
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_TouchScreen_GT911.fcfx FC_Comp_Source_TouchScreen_GT911.fcfx]


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_TouchScreen_GT911.fcfx FC_Comp_Source_TouchScreen_GT911.fcfx]
Library Version, Component Version, Date, Author, Info
6, 1.0, 26-07-24, BR, Removed ghost greay square connection line
7, 1.0, 29-08-24, BR, Fixed a problem where the I2C writes were corrupted
8, 1.0, 29-08-24, BR, Added Orientation support
9, 1.0, 29-08-24, BR, Improved Orientation support


==Detailed description==
==Detailed description==
Line 96: Line 98:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. Returns 1 if device found and communicating. 
| colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. Returns 1 if device found and communicating. 
Line 110: Line 112:


===ReadCoord===
===ReadCoord===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCoord'''
| width="90%" class="mtx-class-macrohead" | '''ReadCoord'''
|-
|-
| colspan="2" | Reads a coordinate returned from the Sample Sensor macro. Coordinate is scaled to the X/Y Pixel bounds specified. 
| colspan="2" | Reads a coordinate returned from the Sample Sensor macro. Coordinate is scaled to the X/Y Pixel bounds specified. 
Line 126: Line 128:
| width="90%" | Index
| width="90%" | Index
|-
|-
| colspan="2" | Touch Index Range: 0 - 1 
| colspan="2" | Touch Index Range: 0 - 4 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
Line 134: Line 136:


===ReadXBytes===
===ReadXBytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadXBytes'''
| width="90%" class="mtx-class-macrohead" | '''ReadXBytes'''
|-
|-
| colspan="2" | Reads the specified number of bytes starting at the specified address 
| colspan="2" | Reads the specified number of bytes starting at the specified address 
Line 163: Line 165:


===SampleSensor===
===SampleSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SampleSensor'''
| width="90%" class="mtx-class-macrohead" | '''SampleSensor'''
|-
|-
| 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 = Single touch detected, 2 = Two touch points detected 
| 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 = Single touch detected, 2 = Two touch points detected 
Line 172: Line 174:
|-
|-
| 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-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
===SetOrientation===
{| class="mtx-class-macrotable wikitable"
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetOrientation'''
|-
| colspan="2" | Allows the orientation to be overridden. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Orientation
|-
| colspan="2" | Range: 0 - 3 
|-
| 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 177: Line 198:


===WriteXBytes===
===WriteXBytes===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteXBytes'''
| width="90%" class="mtx-class-macrohead" | '''WriteXBytes'''
|-
|-
| colspan="2" | Writes the specified number of bytes starting at the specified address 
| colspan="2" | Writes the specified number of bytes starting at the specified address 
Line 207: Line 228:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 218: Line 239:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings
| width="90%" class="mtx-class-propfolder" | Bus Settings
|-
|-
|-
|-
Line 247: Line 268:
| colspan="2" | The device address is set using the INT pin on power up. Low = 0x5D / High = 0x14 
| colspan="2" | The device address is set using the INT pin on power up. Low = 0x5D / High = 0x14 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 271: Line 292:
| colspan="2" | Pin used to set the I2C address and check for new touch data. 
| colspan="2" | Pin used to set the I2C address and check for new touch data. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Configuration
| width="90%" class="mtx-class-propfolder" | Configuration
|-
|-
|-
|-
Line 300: Line 321:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-
Line 324: Line 345:
| colspan="2" | Allows the I2C communications to be simulated and piped through an API to real world hardware. 
| colspan="2" | Allows the I2C communications to be simulated and piped through an API to real world hardware. 
|}
|}
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_TouchScreen_GT911.fcfx FC_Comp_Source_TouchScreen_GT911.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_TouchScreen_GT911.fcfx FC_Comp_Source_TouchScreen_GT911.fcfx]

Latest revision as of 14:37, 13 July 2026

Author Matrix Ltd
Version 2.0
Category Graphical Library


Touch Screen (GT911) component

Low level routines for controlling or interacting with the GT911 touch screen controller IC found on a lot of common capacitive touch screen products.

Version information

Library Version, Component Version, Date, Author, Info
6, 1.0, 26-07-24, BR, Removed ghost greay square connection line
7, 1.0, 29-08-24, BR, Fixed a problem where the I2C writes were corrupted
8, 1.0, 29-08-24, BR, Added Orientation support
9, 1.0, 29-08-24, BR, Improved Orientation support

Detailed description

No detailed description exists yet for this component

Examples

Macro reference

Initialise

Initialise
Activates the SPI peripheral and claims control over the I/O pins. Returns 1 if device found and communicating. 
- BOOL Return


ReadCoord

ReadCoord
Reads a coordinate returned from the Sample Sensor macro. Coordinate is scaled to the X/Y Pixel bounds specified. 
- BYTE Coordinate
0 = X, 1 = Y, 2 = PointSize, 3= TrackID 
- BYTE Index
Touch Index Range: 0 - 4 
- UINT Return


ReadXBytes

ReadXBytes
Reads the specified number of bytes starting at the specified address 
- UINT Address
 
- BYTE Data
 
- BYTE NumBytes
 
- BOOL Return


SampleSensor

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 = Single touch detected, 2 = Two touch points detected 
- BYTE Return


SetOrientation

SetOrientation
Allows the orientation to be overridden. 
- BYTE Orientation
Range: 0 - 3 
- VOID Return


WriteXBytes

WriteXBytes
Writes the specified number of bytes starting at the specified address 
- UINT Address
 
- BYTE Data
 
- BYTE NumBytes
 
- VOID Return


Property reference

Properties
LinkTo
 
Bus Settings
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Device Address
The device address is set using the INT pin on power up. Low = 0x5D / High = 0x14 
Connections
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Reset Pin
Pin used to reset the touch module 
INT Pin
Pin used to set the I2C address and check for new touch data. 
Configuration
Analogue Mode
 
X Pixel
 
Y Pixel
 
Flip X
 
Flip Y
 
Simulation
Label
Label used to identify the component on the panel. 
Enable Interrupt
 
Interrupt Macro
Macro called when the simulated display fires an interrupt. 
Simulate Comms
Allows the I2C communications to be simulated and piped through an API to real world hardware. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_TouchScreen_GT911.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_TouchScreen_GT911.fcfx