This library is a firmware package which contains a collection of routines, data structures,
and macros covering the main features of a graphic library and supporting a HID device to
interact with the graphic objects (touchscreen, joystick, and pushbutton).
The library is general purpose and can be executed on any CPU, 8/16/32-bit, to guarantee
the maximum portability of any architecture or LCD controller, and it provides a graphical
user interface (GUI) for any application that operates with a graphical LCD.
While the firmware library functions with all currently available STM32 microcontrollers,
(STM32F10xxx, STM32L1xx and STM32F2xx series), this document describes the
firmware library through the implementation of a graphic library for embedded systems
based on the STM32F10xxx microcontroller family.
It can easily be used in the user application without an in-depth study of STM32 registers,
SPI, and I
significant time that would otherwise be spent in coding, while at the same time reducing the
application development and integration costs.
The firmware architecture is developed in separate layers and the HAL (hardware
abstraction layer) makes it independent from the microcontroller used in the final
application.
A set of fonts is included: 8x12 and 16x24.
Even though the firmware library source code is developed in 'ANSI-C', the code
architecture follows an OOP (object oriented programming) approach.
Section 1 describes the document and library rules.
Section 2 highlights the features of the STMPE811 and explains its hardware interface with
a device microcontroller (STM32 in this case).
Section 3 and 4 describe the library features, its architecture and its exported APIs
(application programming interfaces) in detail.
Section 5 contains an example application source code describing how to configure and use
the library.
Section 6 contains information about the embedded GUI resource editor application.
2
C read/write operation steps. As a result, using the firmware library saves
This document uses the conventions described in the sections below.
1.1 Acronyms
The following table lists the acronyms used in this document.
Table 1.List of acronyms
Acronym Meaning
API Application programming interface
HAL Hardware abstraction layer
MCU Microcontroller unit
I2C Inter-integrated circuit
SPISerial peripheral interface
OOP Object oriented programming
10/105Doc ID 16918 Rev 5
AN3128Touchscreen controller hardware description
2 Touchscreen controller hardware description
2.1 Description
In this section we describe an example device that could be used for the touchscreen
management. This device is present on both STM3210C-EVAL and STM32100E-EVAL
demonstration board. The STMPE811 is a GPIO (general purpose input/output) port
expander able to interface a main digital ASIC via the two-line bi-directional bus (I
separate GPIO expander is often used in mobile multimedia platforms to solve the problem
regarding the limited amount of GPIOs typically available on the digital engine.
The STMPE811 offers great flexibility, as each I/O can be configured as input, output, or
specific functions. The device has been designed with very low quiescent current and
includes a wake-up feature for each I/O, to optimize the power consumption of the device.
A 4-wire touchscreen controller is built into the STMPE811. The touchscreen controller is
enhanced with a movement tracking algorithm (to avoid excessive data), a 128 x 32-bit
buffer and programmable active window feature.
2.2 Features
2
C). A
●8 GPIOs
●1.8 - 3.3 V operating voltage
●Integrated 4-wire touchscreen controller
●Interrupt output pin
●Wake-up feature on each I/O
●SPI and I
●Up to 2 devices sharing the same bus in I
●8-input 12-bit ADC
●128-depth buffer touchscreen controller
●Touchscreen movement detection algorithm
●25 kV air-gap ESD protection (system level)
●4 kV HBM ESD protection (device level).
2
C interface
2.3 STMPE811 functional overview
The STMP811 consists of the following blocks:
2
●I
C and SPI interface
●Analog-to-digital converter (ADC)
●Touchscreen controller (TSC)
●Driver and switch control unit
●Temperature sensor
●GPIO controller.
2
C mode (1 address line)
Doc ID 16918 Rev 511/105
Touchscreen controller hardware descriptionAN3128
R
Figure 1.STMPE811 functional block diagram
).4
$ATAIN
!$ATAOUT
3#,+#,+
3$!4
#3
'.$
2.4 Touchscreen controller
The STMPE811 is integrated with a hard-wired touchscreen controller for a 4-wire resistive
type touchscreen. The touchscreen controller is able to operate completely autonomously,
and interrupts the connected CPU only when a pre-defined event occurs.
2.5 Interfacing touchscreen with microcontroller with the
STMPE811 via I2C
The STMPE811 has a simple 2-wire I2C 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.
Figure 3 shows how the STM32F10xxx microcontroller (master device) must be connected
to the STMPE811 device.
Figure 3.Two STMPE811s in IOExpander mode
+3V
C8
100n
IO_Expander_SCK
IO_Expander_SDA
IO_Expander_INT
VC
14
Vio
10
GN
SCLK
B1
R15
+3V
R3
10
+3V
SDAT
Data
A0/Data
ST
devic
Out
address:0x8
16
15
13
12
11
TouchScreen_Y-
TouchScreen_XTouchScreen_Y+
TouchScreen_X+
EXP
EXP
EXP
EXP
R5
100
C9
100n
VC
14
Vio
10
GN
SCLK
SDAT
R160
10
+3V
For more information on the touchscreen controller, refer to the STMPE811, datasheet,
+3V
R164
10
Data
A0/Data
Out
R5
ST
10
devic
address:0x8
16
15
13
12
11
R5
100
EXP
EXP
EXP
EXP
EXP
EXP
EXP
EXP
where it is possible to find details about the registers concerning the data of the touched
points on the touchscreen.
AM08449v1
Doc ID 16918 Rev 513/105
Multi-input embedded GUI libraryAN3128
3 Multi-input embedded GUI library
3.1 Introduction
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 using 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 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 included in the
final application as source files (.c and .h) if the user wants to debug the library itself, and/or
change the HAL functions in order to port the library on an LCD different (in model and
resolution).
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, on future power-on of the board it does not have to be run
again because the calibration parameters are saved on the Flash memory.
3.2 Graphic object introduction
This solution enables designers, 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.
Designers can combine touch sensing functions using multiple configurations (touchscreen,
joystick, and keys) with traditional MCU features (communication, LED control, beeper, LCD
control, etc.).
The multi-input embedded GUI library is part of the application firmware.
Maturity, robustness, flexibility, and performance, with good time-to-market, make this
solution simple to implement to develop any kind of application.
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 QVGA resolution (320x240)
which is the default, but the library is independent to the LCD resolution, although it has not
been tested with others.
The library has been designed to have the minimum memory footprint possible.
The reserved Flash memory footprint requirement depends on the application configuration.
It is therefore not possible to specify a precise value, but normally for a “typical” user
application, 64 Kbytes of Flash memory are needed (the images are stored in ROM).
14/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library
It is the same as far as the RAM usage is concerned: the user can calculate the space
required by the application considering the heap space required by each graphic object
used in their own application. For a typical application, 32 KB of RAM are required.
Ta bl e 2 shows the ROM usage (Flash memory) of the bitmap images for each type of
graphic object using IAR 5.5 and high optimization for size:
Table 2.ROM usage of graphic objects
Graphic object typeROM (Flash)Note
Label 0 bytesTotally
Button 2.904 bytes Totally
Checkbox1.736 bytesTotally
RadioButton1.736 bytesTotally
ComboBox4.144 bytesTotally
Switch 2.904 bytes Totally
Icon 0 bytesTotally
Slidebar 944 bytesTotally
Histogram 0 bytesTotally
Graph chart 0 bytesTotally
Ta bl e 3 shows the RAM usage of each type of graphic object:
Table 3.RAM usage of graphic objects
Graphic object typeRAM (Heap)Note
Label101 bytesEach
Button 70 bytesEach
Checkbox79 bytesEach
RadioButtonGrp40 bytesEach
RadioOption48 bytesEach
ComboBoxGrp90 bytesEach
ComboOption29 bytesEach
Switch86 bytesEach
Icon53 bytesEach
Slidebar79 bytesEach
Histogram156 bytesEach
Graph chart257 bytesEach
Page162 bytesEach
Doc ID 16918 Rev 515/105
Multi-input embedded GUI libraryAN3128
Ta bl e 4 shows the ROM usage (Flash memory) of the font sets:
Table 4.ROM usage of font sets
Font setROM (Flash)Note
Font 16x244.560 bytesTotally
Font 8x122.688 bytesTotally
All the graphic objects are allocated dynamically, in a typical application the heap size
should be about 16 KB, and the stack should be about 2 KB.
3.3 Library package
The library was developed supporting Raisonance Ride Kit ARM, IAR the IAR EWARM,
Atollic TrueSTUDIO, Keil MDK-ARM , TASKING VX-toolset for ARM Cortex-M3 and the
related workspace/project files are included in the delivered package.
The “Libraries” folder contains all the subdirectories and files that make up the core of the
library.
Embedded_GUI_HAL contains all files and subdirectories that makes the hardware
abstraction layer (HAL). The developer has to modify only these files if he needs to port the
library to other board with other TSC/LCD/JOYSTICK controller, and set the defined
constant into the file “hw_config.h” contained under the folder
“./Embedded_GUI_Example/inc”:
●inc: sub-folder contains the HAL header files.
–LcdHal.h: HAL layer file; contains all the LCD function prototypes whose
implementation depends on the LCD used. The final user should change this file in
order to re-use this library with other LCDs.
–JoyHal.h: HAL layer file; contains all the joystick function prototypes whose
implementation depends on the joystick controller used by the application. The
user need only change these function implementations in order to re-use this code
with other joystick controllers.
–TscHal.h: HAL layer file; contains all the touchscreen function prototypes whose
implementation depends on the TSC controller used by the application. The user
need only change these function implementations in order to re-use this code with
other TSC controllers.
–touchscreen.h: contains all the function prototypes for the touchscreen firmware
driver.
●src: sub-folder contains the HAL source files.
–LcdHal.c: HAL layer file; contains all the LCD function declarations whose
implementation depends on the LCD used and the MCU (STM32 for this delivery).
The final user should change this file in order to re-use this library with other
LCDs.
–JoyHal.c: HAL layer file; contains all the joystick management function
declarations whose implementation depends on the joystick controller used by the
application. The user only needs to change these functions implementations in
order to re-use this code with other joystick controllers.
16/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library
–TscHal.c: HAL layer file; contains all the touchscreen management function
declarations whose implementation depends on the TSC controller used by the
application. The user only needs to change these functions implementations in
order to re-use this code with other TSC controllers.
–touchscreen.c: contains all the function declarations for the touchscreen firmware
driver.
Embedded_GUI_Library contains all files and subdirectories that makes the graphic objects
core:
●inc: sub-folder contains the firmware library header files
–cursor.h: contains all the function prototypes and basic structure for the cursor
pointer (arrow header).
–gl_fonts.h: contains all the LCD fonts size definition exported declarations.
–GraphicObject.h: API layer file; contains all the function prototypes for the graphic
objects; the API functions are declared in this file.
–GraphicObjectTypes.h: API layer file; contains all the defined types used by
GraphicObject.c file and related to the graphic objects structures; and the
structure parameters for the LCD, touchscreen, joystick and push button.
–images.h: contains all the Hex dumps of the various images used by the
application.
●src: sub-folder contains the firmware library source files.
–cursor.c: API layer file; contains the exported public API (application programming
interface) and the related private internal functions for the cursor pointer (arrow
header). No direct reference to the hardware and micro firmware library occurs in
this file.
–gl_fonts.c: contains all the LCD font size definitions.
–GraphicObject.c: API layer file; contains the entire exported public API (application
programming interface) and the related private internal functions for the graphic
objects and touchscreen calibration; no direct reference to the hardware and
microcontroller firmware library occurs in this file.
–images.c: contains all the Hex dumps of the various images used by the library
application.
STM32F10x_StdPeriph_Driver, STM32L1xx_StdPeriph_Driver and
STM32F2xx_StdPeriph_Driver sub-folders contain respectively the STM32F10xxxV3.5.0,
STM32L1xxV1.0.0 and STM32F2xxV1.0.0 firmware library files. If the final user wants to
use another microcontroller library version, he can replace the updated library folder and
check the HAL types and the microcontroller library function calls inside the HAL layer files
(TscHal.c, TscHal.h, JoyHal.h, JoyHal.c, LcdHal.c, LcdHal.h).
CMSIS sub-folder contains the STM32F10xxx, STM32L1xx and STM32F2xx CMSIS files:
device peripheral access layer and core peripheral access layer.
The “Project” folder contains all the subdirectories and files that make up the library
demonstration.
●Embedded_GUI_Example sub-folder contains the STM32F10xxx Graphic library
demonstration:
–inc: sub-folder contains the graphic library demonstration header files
–src: sub-folder contains the graphic library demonstration header source files
–EWARM sub-folder contains the IAR EWARM workspace and project files
–RIDE sub-folder contains the Raisonance Ride workspace and project files
Doc ID 16918 Rev 517/105
Multi-input embedded GUI libraryAN3128
–MDK-ARM sub-folder contains the Keil MDK-ARM workspace and project files
–TrueSTUDIO sub-folder contains the Atollic TrueSTUDIO workspace and project
files
–TASKING sub-folder contains the TASKING VX-toolset for ARM Cortex-M3
workspace and project files
●Embedded_GUI_Template sub-folder contains the STM32 Graphic library template for
Resource Editor (PC Software) output files:
●inc : sub-folder where to place generated header files from Resource Editor PC
The “_htmresc” folder contains all package html page resources.
Figure 4.Firmware library project files
18/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library
3.4 Library architecture
Library architecture is thought out and developed in two separate layers:
●API layer
●HAL layer
This layer architecture improves the code re-usability splitting the application programming
interface code (fully portable and re-usable) from the hardware abstraction layer code
(hardware dependent and written upon the LCD library).
Figure 5.Firmware library architecture
3.4.1 API layer
The application programming interface layer allows the final application to use the library as
a black-box. The library firmware encapsulation feature and exported API allow a full control
of the LCD and touchscreen without knowing, in-depth, LCD registers and SPI/I
read/write operation steps for the LCD and touchscreen respectively.
●The API layer includes the following files:
–graphicObject.h
–graphicObject.c
–graphicObjectTypes
–cursor.c
–cursor.h
See Section 4.1 for a more detailed description.
3.4.2 HAL layer
The hardware abstraction layer is directly built into the specific LCD firmware library and
allows the build-upon layers, like the API layer, to implement its functions without knowing,
in-depth, the LCD, MCU and touchscreen controller used. This improves the library code re-
2
C
Doc ID 16918 Rev 519/105
Multi-input embedded GUI libraryAN3128
usability and guarantees an easy portability on other LCDs, MCUs and touchscreen
controllers.
●The HAL layer includes the following files:
–LcdHal.h
–LcdHal.c
–TscHal.h
–TscHal.c
–JoyHal.h
–JoyHal.c
–Touchscreen.h
–Touchscreen.c
SeeSection 4.4for a more detailed description.
20/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library firmware
4 Multi-input embedded GUI library firmware
This section describes the API and HAL layer implementation. Each library firmware
function is described in detail. An example of how to use API functions is provided. No
example is provided for the HAL function, because the final application should manage the
graphic objects through the API layer functions only, without any direct access to the HAL
functions.
The functions are described in the following format:
Table 5.Function description format
NameDescription
Function name The name of the function
Function prototype Prototype declaration of the function
Behavior description Brief explanation of how the function is executed
Input parameter {x} Description of the input parameters
Output parameter {x} Description of the output parameters
Return value Value returned by the function
Required preconditions Requirements before calling the function
Called functions Other library functions called
4.1 Graphic object API functions
The application programming interface layer allows the final application to create pages of
graphic objects and easy use of the STMPE811 touchscreen controller. An OOP approach
is used, so it's possible for the application developer to create and use one or more
instances of a graphic object and work with pages of object without writing the code to
display the graphic objects every time the application changes the focus on another page.
Graphic object structures are seen by the application as objects with encapsulated
properties and methods. In the end, they are advanced structures containing:
●Properties as data fields
●Methods as function pointers
In this way each API function belongs to the related graphic object instance and so, many
graphic objects can be managed without any conflicts.
Every type of graphic object has a pre-event function that provides the process to change its
visualization on the screen and the internal status of the object; for example in a ComboBox,
when the user hits the “Down Arrow” the pre-event function changes the image associated
showing the one associated to Image2_PTR for a few moments, and sets the next option in
the list as active. This function is predefined for each type of object and very useful in order
to minimize the developer workload. In this way, the developer need only place graphic
objects on the screen page and write a function event that is called after the pre-event
function, when a touch/click event occurs between the object coordinates area.
Doc ID 16918 Rev 521/105
Multi-input embedded GUI library firmwareAN3128
The library exports the following public API global functions in order to create the graphic
objects type structure instance and set/get the relative properties:
●NewLabel function
●NewButton function
●NewSwitch function
●NewCheckbox function
●NewIcon function
●NewRadioButtonGrp function
●AddRadioOption function
●NewSlidebar function
●NewHistogram function
●NewGraphChart function
●NewComboBoxGrp function
●AddComboOption function
●Create_PageObj function
●AddPageControlObj function
●DestroyPageControl function
●DestroyPage function
●Set_Label function
●Get_Label function
●Get_SlidebarValue function
●SetGraphChartPoints function
●SetHistogramPoints function
●GetObjStatus function
●GetComboOptionActive function
●ResetComboOptionActive function
●GetComboOptionLabel function
●SetComboOptionLabel function
●SetIconImage function
●ShowPage function
●RefreshPage function
●RefreshPageControl function
●ChangePage function.
22/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library firmware
4.1.1 NewLabel API global function
Ta bl e 6 describes the NewLabel function:
Table 6.NewLabel API function
NameDescription
Function name NewLabel
Function prototype
Behavior description Create and initialize a new Label Object (a C structure)
Input parameter {x}
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
oName: object name
Label: text on a Label Object
Direction: the direction to follow printing the Label
FontSize: the size of the font: FONT_BIG or FONT_SMALL
Color: color of the Label text
Called functions No API/HAL layer functions
Example:
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declares and initiates a Label Object and add it with specified coordinates to a
Page Object */
GL_PageControls_TypeDef* pageLabel = NewLabel("pageLabel","Graphic Library",
GL_HORIZONTAL, GL_FONT_BIG, GL_Blue);
AddPageControlObj((uint16_t)((LCD_Width/11)*9),(uint8_t)(LCD_Height/11),pageLabel,
&page1);
Once a Label Object instance is created using the NewLabel function, the Label Object itself
provides all its features through its internal function pointers.
Figure 14, 15, 16, show, in detail, the Label Object properties and methods which the final
application can use to interact with.
Doc ID 16918 Rev 523/105
Multi-input embedded GUI library firmwareAN3128
4.1.2 NewButton API global function
The button object is the most used and its graphical look changes temporarily during the
interaction between the touchscreen or the joystick. In fact there are two looks for the button
as well as for the majority of the others objects.
When the button is pressed, its “graphical look” changes for a few moments and then
returns to the starting aspect.
Inside the button, it's possible to insert a text Label, by which the button width itself depends.
The library automatically fits the width and places the text in the center.
Figure 6.Button graphical layout
Ta bl e 7 describes the NewButton function:
Table 7.NewButton API function
NameDescription
Function name NewButton
Function prototype
Behavior description Create and initialize a new button object (a C structure)
Input parameter {x}
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
oName: object name
Label: Label on button
pEventHandler: pointer to function associated to its touch event
Example:
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declares & initiates a Button Object and add it with specified coordinates to a
Page Object */
GL_PageControls_TypeDef* TestBtn = NewButton("TestBtn", "Test Button", TestBtnFunc);
AddPageControlObj((uint16_t)((LCD_Width/10)*6), (uint8_t)((LCD_Height/9)*4),
TestBtn, &page1);
Once a button object instance is created using the NewButton function, the button object
itself provides all its features through its internal function pointers.
24/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library firmware
Figure 14, 15, 16, show, in detail, the button object properties and methods which the final
application can use to interact with.
4.1.3 NewCheckbox API global function
The checkbox object follows a Boolean principle so its value can be defined in a binary way
(0/1).
A typical example of this kind of object could be enable/disable a variable concerning a
specified feature/option.
Figure 7.Checkbox graphical layout
Ta bl e 8 describes the NewCheckbox function:
Table 8.NewCheckbox API function
NameDescription
Function name NewCheckbox
Function prototype
Behavior description Create and initialize a new Label Object (a C structure)
Input parameter {x}
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
oName: object name
Label: Label for the checkbox
pEventHandler: pointer to function associated to its touch event
Required preconditions None
Called functions No API/HAL layer functions
Example
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declares and initiates a Checkbox Object and add it with specified coordinates to
a Page Object */
GL_PageControls_TypeDef* CheckBox = NewCheckbox("CheckBox", "Enable", CheckboxFunc);
AddPageControlObj((uint16_t)((LCD_Width/10)*7),(uint8_t)((LCD_Height/9)*4),CheckBox,
&page1);
Once a checkbox object instance is created using the NewCheckbox function, the checkbox
object itself provides all its features through its internal function pointers.
Figure 14, 15, 16, show, in detail, the Checkbox object properties and methods which the
final application can use to interact with.
Doc ID 16918 Rev 525/105
Multi-input embedded GUI library firmwareAN3128
4.1.4 NewSwitch API global function
The switch object or SwitchButton is very similar to the button object and actually contains
all its features, the only difference being that when this object is stimulated through the
touchscreen or the joystick, its state, and then its graphical look, change permanently until a
new press event.
The most obvious function of this object is to change the status of a Boolean/Binary variable
(0/1) and so enable/disable something.
Figure 8.Switch graphical layout
Ta bl e 9 describes the NewSwitch function:
Table 9.NewSwitch API function
NameDescription
Function name NewSwitch
Function prototype
Behavior description Create and initialize a new Label Object (a C structure)
Input parameter {x}
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
oName: object name
Label_1: Label on not clicked switch button
Label_2: Label on clicked switch button
pEventHandler: pointer to function associated to its touch event
Example
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declares and initiates a Switch Object and add it with specified coordinates to a
Page Object */
GL_PageControls_TypeDef* EnDisBtn = NewSwitch("EnDisBtn","Enable","Disable",MyFunc);
AddPageControlObj((uint16_t)((LCD_Width/10)*6),(uint8_t)((LCD_Height/9)*4),EnDisBtn,
&page1);
Once a switch object instance is created using the NewSwitch function, the switch object
itself provides all its features through its internal function pointers.
Figure 14, 15, 16, show, in detail, the switch object properties and methods which the final
application can use to interact with.
26/105Doc ID 16918 Rev 5
AN3128Multi-input embedded GUI library firmware
4.1.5 NewIcon API global function
This object allows the user to show an arbitrary image on the LCD, stored in the Flash
memory of the MCU, and associate the press event of the image itself through the
touchscreen or the joystick.
oName: object name
Image_PTR: icon image pointer
Width: image width
Height: image height
pEventHandler: pointer to function associated to its touch event
Required preconditions None
Called functions No API/HAL layer functions
Example:
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declare and initiate a Icon Object and add it with specified coordinates to a Page
Object */
GL_PageControls_TypeDef* MyIcon = NewIcon ("MyIcon", NULL, 90, 90, NullFunc);
AddPageControlObj( (uint16_t)((LCD_Width/2)+45),(uint8_t)((LCD_Height/2)+45),MyIcon,
&page1 );
Once an icon object instance is created using the icon function, the icon object itself
provides all its features through its internal function pointers.
Figure 14, 15, 16, show, in detail, the icon object properties and methods which the final
application can use to interact with.
Doc ID 16918 Rev 527/105
Multi-input embedded GUI library firmwareAN3128
4.1.6 NewRadioButtonGrp API global function
The radio button (sometimes called the option button) is a special kind of button that allows
the user to choose only one of a predefined set of alternatives. Its name derives from the old
car radio, where this button was used to select the preset stations. The major difference with
the ordinary button is that the radio buttons are arranged in groups where the group acts as
a big switchboard. In a group, only one radio button must be selected at most. Then, if in a
group, the first radio button is in the selected state, and suddenly the second radio button is
pressed, the first one must be immediately released going back to the normal state, and the
second passes to the selected state.
Figure 9.Radio button graphical layout
Ta bl e 1 1 describes the NewRadioButtonGrp function:
Table 11.NewRadioButtonGrp API function
NameDescription
Function name NewRadioButtonGrp
Function prototype GL_RadioButtonGrp_TypeDef* NewRadioButtonGrp (char* oName)
Behavior description Create and initialize a new RadioButtonGrp object (a C structure)
Input parameter {x} oName: object name
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
Required preconditions None
Called functions No API/HAL layer functions
Example:
/* Declares and initiates a RadioButtonGrp Object */
GL_RadioButtonGrp_TypeDef* RadioButtonGrp = NewRadioButtonGrp("RadioButtonGrp");
4.1.7 AddRadioOption API global function
Ta bl e 1 2 describes the AddRadioOption function:
Table 12.AddRadioOption API function
NameDescription
Function name AddRadioOption
GL_PageControls_TypeDef* AddRadioOption
Function prototype
Behavior description Create and initialize a new Label Object (a C structure)
Once a RadioOption object instance is created using the AddRadioOption function, the
RadioOption object itself provides all its features through its internal function pointers.
Figure 14, 15, 16,show, in detail, the RadioOption object properties and methods which the
final application can use to interact with.
4.1.8 NewComboBoxGrp API global function
This kind of object allows the user to choose an option from a list of alternatives that can be
scrolled by selecting the up/down arrows.
Figure 10. Combobox graphical layout
Doc ID 16918 Rev 529/105
Multi-input embedded GUI library firmwareAN3128
Ta bl e 1 3 describes the NewComboBoxGrp function:
Table 13.NewComboBoxGrp API function
NameDescription
Function name NewComboBoxGrp
Function prototype GL_PageControls_TypeDef* NewComboBoxGrp (char* oName)
Behavior description Create and initialize a new
Input parameter {x} oName: object name
Output parameter {x} None
Return value The created object pointer or null if the object cannot be created
Required preconditions None
Called functions No API/HAL layer functions
ComboBoxGrp object (a C structure)
Example:
/* Declares and initiates a Page Object */
GL_Page_TypeDef page1;
Create_PageObj( &page1 );
/* Declares and initiates a ComboBoxGroup Object and add it with specified
coordinates to a Page Object */
GL_PageControls_TypeDef* MyComboGrp = NewComboBoxGrp("MyComboGrp");
AddPageControlObj((uint16_t)((LCD_Width/10)*8),(uint8_t)(LCD_Height/2),MyComboGrp,
&page1);
Once a ComboBoxGrp object instance is created using the NewComboBoxGrp function, the
ComboBoxGrp object itself provides all its features through its internal function pointers.
Figure 14, 15, 16,show, in detail, the ComboBoxGrp object properties and methods which
the final application can use to interact with.
4.1.9 AddComboOption API global function
Ta bl e 1 4 describes the AddComboOption function:
Table 14.AddComboOption API function
NameDescription
Function name AddComboOption
Function prototype
Behavior description Create and initialize a new ComboBoxOption object (a C structure)
Input parameter {x}
Output parameter {x} None
Return value GL_OK if successful, GL_ERROR otherwise