Library 10- STMPE811 Touch screen driver for STM32F429 Discovery board

STM32F429 Discovery board has LCD with ILI9341 controller and resistive touch screen with STMPE811 controller from STMicroelectonics.

STM32F429 Discovery board with STMPE811 touch driverThe STMPE811 is a 4-wire resistive touch screen controller with a GPIO (general purpose input/output) port expander able to interface a microcontroller or a main digital ASIC via I2C or SPI serial interface. The STMPE811 offers great flexibility, as each I/O can be configured as input, output or specific functions. The touch screen controller is enhanced with a movement tracking algorithm to avoid excessive data, 128 x 32 bit buffer and a programmable active window feature.

We will communicate with STMPE811 via I2C at Fast Mode of 100kbit/s. On Discovery board, driver is connected to pins:

STMPE811 I2C pins
function pin I2Cx PInspack
SCL PA8 I2C3 1
SDA PC9 I2C3 1

STMPE811 support High speed I2C mode, so this give us clock frequency up to 400kb/s.

Library dependencies

To run STMPE811 Library, you need some other libraries:

  • TM DELAY
  • TM I2C

Initialization

First you have to initialize STMPE811. You can do this with

Then, make an instance of touch data structure:

and pass your touch screen orientation:

That is used to synchronize X and Y coordinates with ILI9341 LCD coordinates. Other possible configurations are:

Read XY coordinates

You can read coordinates with

First you have to read, if touch has been pressed. Do this with

or

 Example

 Project available on Github, download library below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...