AN3311
Multi-input embedded GUI library
Doc ID 18209 Rev 1
9/58
3
Multi-input embedded GUI library
3.1 Description
This solution enables users, comfortable with the use of standard microcontrollers, to create
higher-end “look and feel” human interfaces by replacing conventional electromechanical
switches with touch-sensing controls.
Users can combine touch-sensing functions using multiple configurations (touchscreen,
joystick, and keys) with traditional MCU features (communication, beeper, LCD control, etc.).
The E-multi-input graphic library is part of the application firmware.
The graphic objects are a set of controls that can be printed on the screen and associated to
an action when pressed.
The library has been developed and tested on an LCD panel of QWGA resolution (320x240)
which is the default, but the library is independent of the LCD resolution, although it has not
been tested with others.
The library supports touchscreen features and includes a low level driver which handles the
analog input (for 12-bit ADC), and a function for the touchscreen calibration based on an
algorithm that uses 5 points.
The multi-input embedded GUI firmware library is fully developed in 'ANSI-C' following an
OOP approach. This means that the final application uses instances of page and graphic
objects according to their public methods and properties. In the end, the PageObj is a
structure containing public properties (data fields) and methods (functions pointers). The
OOP encapsulation feature is assured. The library has been developed and tested on the
“STM3210C” STMicroelectronics demonstration board.
The library can be included in the final application as a library file (multi-input embedded
GUI library.a) and used as a black box through its exported public API, or can be included in
the final application as source files (.c and .h), if the user wants to debug the library itself, or
to change the HAL functions in order to port the library on a different LCD (in model and
resolution) from the one attached to STM3210C-EVAL.
For more information on the graphic library see the AN3128, rev. 2, application note.
The calibration process is part of the post-processing layer. The touchscreen must be
calibrated at first power-on and/or upon user request.
Once the calibration is done, final adjustments on future power-on of the board are not
necessary because the calibration parameters are saved on the Flash memory.
The touchscreen and the joystick are controlled by the STMPE811 devices.
The STMPE811 has a simple 2-wire I
2
C digital serial interface which allows the user to
access the data in the touchscreen controller register at any time. It communicates via the
serial interface with a master controller.
shows how the STM32F10xxx microcontroller (master device) must be connected
to the STMPE811 device.
Refer to the STMPE811 datasheet for more information on the register concerning the data
of the touched points on the touchscreen.