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

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 2.0 (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

This component does not contain any simulation macros


Property reference

Channel

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

SPI Channel selector

Prescale

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

Prescale option selector

MOSI

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

SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.

MISO

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

SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.

CLK

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

SPI Clock Pin CLK - The Clock signal is driven by the SPI master.

CS / SS

This property is of type Single digital pin and can be referenced with the variable name cal_spi::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.

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 cal_spi::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 cal_spi::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 cal_spi::Injector.

No additional information