
uEZ GUI Start Here Guide
UEZGUI-1788-56VI
Rev. 1.11 Aug 31, 2016
Page 20
4.
Use the appropriate steps to Build, download, debug, and run the updated project
to test the functionality. Since the second window is blank, pressing the button will
display a black screen.
F.
Interfacing with the Onboard Temperature Sensor
In the following steps of this guide we will demonstrate how to interface with the uEZ
GUI hardware using the on-board temperature sensor and how to update the
temperature on the screen. We will start by returning to the SecondScreen.c file in the
IDE, then creating two new text fields. One text field will be a title for the temperature
reading, and the other will show the onboard temperature sensor value. Finally, we will
add a back button to return to the home screen.
1.
First, open SecondScreen.c to add the new text fields and give the temperature text
an update function.
2.
Define a new ID for the Temperature Text.
3.
Define the temperature fields’ position and size.
NOTE: We use WINDOW_XSIZE and WINDOW_YSIZE to size and place all GUI elements
relative to the screen, so it is easy to change to a different LCD screen resolution
without need to re-write the element placement code.
/*-------------------------------------------------------------------------*
* Routine: IHandleSecondScreen
*-------------------------------------------------------------------------*
* Description:
* Change to the second screen when the temperature button is pressed.
*-------------------------------------------------------------------------*/
static
TBool IHandleSecondScreen
(
WM_MESSAGE
*
pMsg
,
int
aNCode
,
int
aID
)
{
if
(
aNCode
==
WM_NOTIFICATION_RELEASED
)
{
WindowManager_Show_Window
(
SECOND_SCREEN
);
}
return
EFalse
;
}
#define
ID_WINDOW (GUI_I 0x00)
#define
ID_TITLE_TEXT (GUI_I 0x01)
#define
ID_TEMP_TEXT (GUI_I 0x02)
#define
TITLE_TEXT_XSIZE (WINDOW_XSIZE)
#define
TITLE_TEXT_YSIZE ((WINDOW_YSIZE/10))
#define
TITLE_TEXT_XPOS (0)
#define
TITLE_TEXT_YPOS (0)
#define
TEMP_TEXT_XSIZE (WINDOW_XSIZE/3)
#define
TEMP_TEXT_YSIZE ((WINDOW_YSIZE/5))
#define
TEMP_TEXT_XPOS (WINDOW_XSIZE/3)
#define
TEMP_TEXT_YPOS ((WINDOW_YSIZE/10)*4)