Component: Touch Screen (GT911) (Graphical Library)

From Flowcode Help
Revision as of 14:43, 30 August 2024 by Wiki bot (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
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

Fc9-comp-macro.png Initialise
Activates the SPI peripheral and claims control over the I/O pins. Returns 1 if device found and communicating. 
Fc9-bool-icon.png - BOOL 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 = PointSize, 3= TrackID 
Fc9-u8-icon.png - BYTE Index
Touch Index Range: 0 - 4 
Fc9-u16-icon.png - UINT Return


ReadXBytes

Fc9-comp-macro.png ReadXBytes
Reads the specified number of bytes starting at the specified address 
Fc9-u16-icon.png - UINT Address
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u8-icon.png - BYTE NumBytes
 
Fc9-bool-icon.png - BOOL 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 = Single touch detected, 2 = Two touch points detected 
Fc9-u8-icon.png - BYTE Return


SetOrientation

Fc9-comp-macro.png SetOrientation
Allows the orientation to be overridden. 
Fc9-u8-icon.png - BYTE Orientation
Range: 0 - 3 
Fc9-void-icon.png - VOID Return


WriteXBytes

Fc9-comp-macro.png WriteXBytes
Writes the specified number of bytes starting at the specified address 
Fc9-u16-icon.png - UINT Address
 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u8-icon.png - BYTE NumBytes
 
Fc9-void-icon.png - VOID 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
Channel selection 
Fc9-type-16-icon.png Baud Select
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
Baud rate to be used 
Fc9-type-7-icon.png 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.  
Fc9-type-16-icon.png Device Address
The device address is set using the INT pin on power up. Low = 0x5D / High = 0x14 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png SDA
Pin used for SDA (data signal) 
Fc9-type-5-icon.png SCL
Pin used for SCL (clock signal) 
Fc9-type-5-icon.png Reset Pin
Pin used to reset the touch module 
Fc9-type-5-icon.png INT Pin
Pin used to set the I2C address and check for new touch data. 
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
 
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 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