Component: Touch Screen (XPT2046) (Displays: Graphical)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.3 (Release)
Category Displays: Graphical


Image 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.

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

Downloadable macro reference

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

Parameters

This macro has no parameters


Return value

BYTE


ReadCoord

Reads a coordinate returned from the Sample Sensor macro.

Coordinate is scaled to the X/Y Pixel bounds specified.

Parameters

BYTE Coordinate
0 = X, 1 = Y, 2 = Pressure


Return value

UINT


Initialise

Activates the SPI peripheral and claims control over the I/O pins.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

GetConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

Parameters

This macro has no parameters


Return value

HANDLE



Property reference

SPI Channel

This property is of type Fixed list of ints and can be referenced with the variable name CHANNEL.

SPI peripher onboard the target microcontroller to use.

Prescale

This property is of type Fixed list of ints and can be referenced with the variable name PR_SCALE.

Rate by which the master oscillator is reduced before clocking the SPI peripheral.

CS

This property is of type Single digital pin and can be referenced with the variable name CS_Pin.

DAC enable pin - only used with the EB013 SPI E-block

MOSI (SDO)

This property is of type Single digital pin and can be referenced with the variable name MOSI.

Data Out Pin - Micro Out Serial In

MISO (SDI)

This property is of type Single digital pin and can be referenced with the variable name MISO.

Data In Pin - Micro In Serial Out

CLK

This property is of type Single digital pin and can be referenced with the variable name CLK.

Clock Pin

Analogue Mode

This property is of type Fixed list of ints and can be referenced with the variable name AnMode.

No additional information


X Pixel

This property is of type Unsigned integer and can be referenced with the variable name Xpix.

No additional information


Y Pixel

This property is of type Unsigned integer and can be referenced with the variable name Ypix.

No additional information


Flip X

This property is of type True or false and can be referenced with the variable name FlipX.

No additional information


Flip Y

This property is of type True or false and can be referenced with the variable name FlipY.

No additional information


Label

This property is of type Line of text and can be referenced with the variable name label.

Label used to identify the component on the panel.

Scope Traces

This property is of type True or false and can be referenced with the variable name ScopeTraces.

Selects if the scope traces are automatically generated or not

Console Data

This property is of type True or false and can be referenced with the variable name ConsoleData.

Selects if the console data is automatically generated or not

Injector

This property is of type Fixed list of ints and can be referenced with the variable name Injector.

Injector component to allow the data in simulation to be passed to something meaningful.