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

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!