background image

uEZ GUI Start Here Guide 

 

UEZGUI-1788-56VI 

 
 

Rev. 1.11    Aug 31, 2016

 

 

Page 23 

 

All the tasks that will run in a project are called within main.c. In the following tasks we 
will update main.c to create the new task. 

1.

 

Open main.c 

2.

 

Add the new #include shown below. 

 

3.

 

Within the function MainTask(), find the existing UEZTaskCreate() function calls. 

4.

 

Add a new UEZTaskCreate() function call for the temperature monitoring thread. 

 

#include <uEZ.h> 
#include <uEZTemperature.h> 
#include <uEZGPIO.h> 
#include <uEZProcessor.h> 
#include "MyTask.h" 
#include <stdio.h> 

 

extern

 

void

 UpdateTemp

(

char

 

*

myString

);

 

// Access to function in 

SecondScreen.c 

 
TUInt32 TemperatureLoopTask

(

T_uezTask aMyTask

,

 

void

 

*

aParams

) {

 

  

char

 myString

[

10

]

 

=

 

""

;

 

// String to hold temperature 

  TInt32 i

,

 f

;

 

// Variables for conversion 

  T_uezDevice temp

;

 

// uEZ device variable 

  TInt32 Temperature

;

 

// Variable to hold temperature reading

 

   
  UEZTemperatureOpen

(

"Temp0"

,

 

&

temp

);

 

// Open the on board device 

 
  

while

(

1

)

 

{

 

    UEZTemperatureRead

(

temp

,

 

&

Temperature

);

 

// Read the temperature 

     

    // Convert to integer and decimal

 

    i 

=

 Temperature 

>>

 

16

;

 

    f 

=

 

((((

TUInt32

)

Temperature

)

 

&

 

0xFFFF

)

 

*

 

10

)

 

>>

 

16

;

 

 

    sprintf

(

myString

,

 

"%02d.%01d *C"

,

 i

,

 f

);

 

// Print to text array 

 
    UpdateTemp

(

myString

);

 

// Update the temperature text on the screen 

 
    UEZTaskDelay

(

250

);

 

// Wait 1/4 seconds before reading again 

  

}

 

}

 

#include "MyTask.h"

 

void

 MainTask

(

void

) {

 

  

// Run the teperature reading task located in My.Task.c 

  UEZTaskCreate

(

TemperatureLoopTask

,

 

"Temperature"

,

 

1024

                      

(

void

 

*)

0

,

 UEZ_PRIORITY_NORMAL

,

 

0

);

 

  

//Start emWin 

  UEZTaskCreate

(

GUIInterfaceTask

,

 

"GUIInterface"

,

 

(

4

 

*

 

1024

), 

                      

(

void

 

*)

0

,

 UEZ_PRIORITY_NORMAL

,

 

0

);

 

 
  

while

(

1

)

 

{

// Loop forever so that the main task never exits 

    UEZTaskDelay

(

1000

);

 

  

}

 

}

 

Summary of Contents for UEZGUI-1788-56VI

Page 1: ...ny additional resources available at www TeamFDI com If you ever need more help contact us and we will be happy to assist you Hardware Used in This Guide Included in Kit UEZGUI 1788 56VI BA SEGGER J L...

Page 2: ...t is provided solely to enable the use of Future Designs products FDI assumes no liability whatsoever including infringement of any patent or copyright FDI reserves the right to make changes to these...

Page 3: ...the mini USB Type B connector P2 on the EZ GUI 2 Connect the other end of the USB cable to the provided universal AC power supply s 5V USB power output NOTE The EZ GUI must be powered with the include...

Page 4: ...Windows http tinyurl com z2wgnsk Mac http tinyurl com he4tgtu Linux x86 http tinyurl com zzcu5ny Linux ARMV7 http tinyurl com hvzpq8e o Activating Crossworks 30 day evaluation license instructions ht...

Page 5: ...bbon cable and FDI adapter for the EZ GUI are supplied in the kit The 10 pin connector can only be connected one way 3 If not already done connect the EZ GUI to the power supply with the second includ...

Page 6: ...he LPC1788 the emWin license applies See here for more information http tinyurl com gueckmp NXP emWin introduction video http tinyurl com jrata57 This section of the guide will take a simple screen an...

Page 7: ...el number of the EZ GUI This UEZGUI 1788 56VI uses an LPC1788 micro controller and the corresponding folder referenced in this step is labeled accordingly 4 Navigate to FreeRTOS IAR or FreeRTOS Crossw...

Page 8: ...oject Explorer sub window if not already selected 6 Next building the project For IAR Select Project Make or press F7 to build the EZ library project For Crossworks Select Build Build or press F7 to b...

Page 9: ...For Crossworks the project file is at StartHere Build uEZGUI_1788_56VI Crossworks uEZGUI_StartHere hzp 10 Verify that the Debug build is selected to match the library project 11 If using IAR proceed...

Page 10: ...ink probe 17 Build if needed download and run the project following the respective IDE steps For IAR Press Ctrl D or select Project Download and Debug from the menu at the top For Crossworks Press F5...

Page 11: ...ile contains the information that is used to create a window and any widgets buttons etc that will load with the window The beginning of the file contains the includes and a list of definitions that d...

Page 12: ...n additional widget is as simple as setting it to the next value GUI_ID_USER is equal to 0x800 by default and needs to be used to avoid conflicts with other areas of the program Constants define ID_WI...

Page 13: ...NDOW_XPOS 0 define WINDOW_YPOS 0 if UEZ_DEFAULT_LCD LCD_RES_WVGA define SPACING 10 define FONTSIZE FONT_LARGE else define SPACING 5 define FONTSIZE FONT_SMALL endif define TITLE_TEXT_XSIZE WINDOW_XSIZ...

Page 14: ...DIINFO_TEXT_YPOS FDIINFO_TEXT_XSIZE FDIINFO_TEXT_YSIZE TEXT_CF_HCENTER TEXT_CF_VCENTER 0 0 Generic Mapping of Screen Layout static T_LAFMapping HomeScreenMapping ID_WINDOW GUI_BLACK GUI_WHITE FONT_SMA...

Page 15: ...ning Folder For Crossworks Select Select in File Explorer 2 Copy the HomeScreen c file located in the emWin directory and rename it SecondScreen c 3 Back in the IDE right click the emWin folder For IA...

Page 16: ...H to open the Find and Replace dialog Insert HomeScreen in the Find what field and SecondScreen in the Replace with field Select Match case and make sure Match whole word is unselected Click Replace A...

Page 17: ...the information for the various widgets on a window are shown below Delete the lines highlighted in red that are specific to the first window The only remaining values within each of these array varia...

Page 18: ...to setup a blank window The final step to creating the window is to update the WindowManager c file Open the file and update the WindowManager_Create_All_Active _Windows function as shown below You al...

Page 19: ..._MESSAGE TInt32 TInt32 IHandleSecondScreen to make the function name easily understandable 2 Declare the callback function s prototype between the Global Data and Local Data sections of the HomeScreen...

Page 20: ...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 s...

Page 21: ...cal Data Structure to hold all of the widgets used in this dialog static const GUI_WIDGET_CREATE_INFO _iSecondScreenDialog Function Name ID XP YP XS YS WINDOW_CreateIndirect ID_WINDOW WINDOW_XPOS WIND...

Page 22: ...are equivalent to threads It is important that a small delay is introduced into the task s loop to avoid bogging down the processor Doing this allows the other tasks to take priority during the delaye...

Page 23: ...ng 10 String to hold temperature TInt32 i f Variables for conversion T_uezDevice temp uEZ device variable TInt32 Temperature Variable to hold temperature reading UEZTemperatureOpen Temp0 temp Open the...

Page 24: ...EZ GUI s onboard LED is also included in the project s MyTask c file It may be implemented using the same instructions provided for the temperature task by calling UEZTaskCreate H Adding a Back Button...

Page 25: ...ISPLAY_HEIGHT define WINDOW_XPOS 0 define WINDOW_YPOS 0 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_...

Page 26: ...EXT_CF_HCENTER TEXT_CF_VCENTER 0 0 TEXT_CreateIndirect ID_TEMP_TEXT TEMP_TEXT_XPOS TEMP_TEXT_YPOS TEMP_TEXT_XSIZE TEMP_TEXT_YSIZE TEXT_CF_HCENTER TEXT_CF_VCENTER 0 0 BUTTON_CreateIndirect ID_BACK_BUTT...

Page 27: ...or how to restore the factory demo to the EZ GUI if desired 5 Restoring the Out of Box OOB Demo Optional 1 Remove the SD card from the EZ GUI 2 Insert the EZ GUI s SD card into the PC depending on you...

Page 28: ...http tinyurl com zlu9ood Bootloader User s Manual http tinyurl com z6lw2fd JTAG Programming EZ GUI http tinyurl com h9dnu96 7 Website and Support Documentation EZ Library Online Documentation http ww...

Reviews: