Renesas SK-S7G2 GUI Application Application Note
The SK-S7G2 is a GUI application that runs on the Synergy Platform. The document outlines the steps to setup a simple GUI application using Express Logic's GUIX within the Synergy Platform. The document covers all configuration steps including the setup of hardware functions such as LCD, SPI, I2C interface, setup of threads and message passing, setup of the interrupts, setup of the LCD driver, and setup of the touchscreen. This document will cover all steps necessary to create the GUI interface using the GUIX Studio editor. The application responds to touchscreen actions, presenting a basic graphical user interface (GUI).
Advertisement
Advertisement
APPLICATION NOTE
GUIX "Hello World" for SK-S7G2
GUI Application
R12AN0021EU0100
Rev.1.00
Jan 22, 2016
Introduction
This document outlines the steps to setup a simple GUI Application using Express Logic’s GUIX™ within the Synergy
Platform.
Target Device
SK-S7G2 board version 2.0
Minimum PC Recommendation:
- Microsoft® Windows® 7
- Intel® Core™ family processor running at 2.0 GHz or higher (or equivalent processor)
- 8 GB memory
- 250 GB hard disk or SSD
- USB 2.0
- Connection to the Internet
Installed Software:
- Synergy e
2
studio 4.2.0.012 or later
- Synergy Software Platform (SSP) v1.0.0
- GUIX Studio v5.2.9
NOTE: If you do not have one of these software applications you should install it before continuing.
Provided Software Files:
- guiapp_event_handlers.c
- main_thread_entry.c
- sf_message_port.c
- sf_message_port.h
- lcd_setup.c
- lcd.h
Purpose
This document will guide the user through the setup of a GUIX touch screen interface “Hello World” application in e
2
studio. It will cover all configuration steps including the setup of hardware functions (LCD, SPI, I2C interface), setup of threads and message passing, setup of the interrupts, setup of the LCD driver, and setup of the touchscreen. This document will cover all steps necessary to create the GUI interface using the GUIX Studio editor. In addition this app note will cover basic project setup in e
2
studio along with basic debugging operations. When it is running, the application will respond to touchscreen actions, presenting a basic graphical user interface (GUI).
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 1 of 43
GUIX "Hello World" for SK-S7G2
Intended Audience
The intended audience is users who want to design GUI applications.
Contents
GUI Application
studio ..................................................................................... 2
studio ISDE (Integrated Solution Development
Adding Code for Custom Interface Controls and Building project ........................... 38
1. Overview
This document explains the steps to setup a project and develop a simple GUI based application using GUIX Studio.
2. Import the Project into e
2
studio
To skip the development walkthrough in this document and open a completed project in e
2
studio, refer to the "Synergy
Project Import Guide.pdf" for instructions on importing the project into e
2
studio and building the project. The included
“GUIX_Hello_World_SK-S7G2.zip” file contains the completed project.
3. Creating the Project in e
2
studio ISDE (Integrated Solution Development
Environment)
Start by creating a new project in e
2
studio.
1. Open e
2
studio by clicking on the “e2 studio” icon in the Windows Start Menu -> “All Programs -> Renesas
Electronics e2studio” folder.
2. If the workspace launcher dialog box appears, click <OK> to use the default workspace.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 2 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 1 Workspace Launcher Dialog
3. Create a new workspace:
A. From the “File” pull down menu select “Switch Workspace -> Other…”
4. Append a workspace name:
A. In the Workspace Launcher window add text to the end of the workspace name to make it unique. We suggest “GUI_APP”. If you installed to the default location, the new workspace name will be
“C:\Users\[your name]\e2_studio\workspace\GUI_APP”.
5. Click <OK> to create the new workspace.
6. Proceed past the Welcome Screen by clicking in the Workbench area.
Figure 2 Close the Welcome Window by clicking in the Workbench Area
7. Start a new project by clicking the black triangle, , next to the New icon in the Tool Bar.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 3 of 43
GUIX "Hello World" for SK-S7G2
Figure 3 Start a New Project
8. Select “Synergy Project” from the menu.
GUI Application
Tool Bar
Figure 4 Select Synergy Project in the drop down Menu
is empty, continue with the below steps (A to C).
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 5 Configured License File
Page 4 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
A. Click the browse <…> button. e
2
studio will display the Open Dialog box and should be displaying the
Licenses directory.
NOTE: If you installed e
2
studio into the default location, the license file is located in the
“C:\Renesas\e2_studio\internal\projectgen\arm\Licenses” directory.
B. Select the “SSP_License_Example_EvalLicence_*.xml” located in the directory.
C. Click <Open> to set the License file.
10. Enter a name for the project in the Project name text field, for example “GUIApp”.
Figure 6 Enter a Project Name
11. On the top right of this page, verify that the Toolchain option is set to “GCC ARM Embedded”.
Figure 7 Verify GCC ARM Embedded Toolchain
12. Click the <Next> button to continue.
13. Under Device Selection (top left), select SSP version 1.0.0 (or later).
14. For Board, select “S7G2 SK”. The Device will be updated automatically.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 5 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 8 Device Selection
15. Click the <Next> button to continue.
16. In the Project Configuration Dialog select the option “S7G2-SK BSP”.
Figure 9 Select the S7G2-SK BSP
17. Click the <Finish> button.
18. If you have not directed e
2
studio to remember your perspectives, e
2
studio will display the “Open Associated
Perspective” dialog box. If opened, click <Yes> to acknowledge and close.
Figure 10 Open Perspective Dialog Box
When the project finishes being created, you will see the following screen.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 6 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 11 GUIApp Project
4. Configure the Project in the ISDE
Now that the project has been successfully created in section Creating the Project in e
studio ISDE (Integrated Solution
Development Environment) we can start configuring the project for our GUI application.
1. Open the Synergy Configuration, if not already open, by double clicking the “configuration.xml” file in the Project
Explorer Window.
Figure 12 Selecting the configuration.xml file in Project Explorer
2. Click the <BSP> tab of the Synergy Configuration Window.
Figure 13 Synergy Configuration BSP Tab
3. Now look in the Properties Window (bottom left window) and set the “RTOS being used” to “ThreadX”. (Helpful hint: After you set ThreadX, click on another area of the properties and verify that ThreadX is still set.)
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 7 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 14 Setting the BSP to use the ThreadX RTOS
4. Go back to the <Components> tab at the bottom of the Synergy Configuration Window.
Figure 15 Synergy Configuration Tabs
5. Click the <Threads> tab in the configuration window.
Figure 16 Synergy configuration Threads Tab
6. Create a new thread by clicking <New> in the Threads area.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 17 Create a New Thread
Page 8 of 43
GUIX "Hello World" for SK-S7G2
7. Click on “New Thread” to pull up the properties.
GUI Application
Figure 18 Click on “New Thread”
8. Edit the Properties to match the following:
Figure 19 Configure Main Thread Properties
9. Back in the Synergy Configuration Window, Threads tab, Main Thread Modules area, click on <New >.
Figure 20 Main Thread Modules
10. Select “Driver -> Graphic -> Display Driver on r_glcd”
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 9 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 21 Adding Display Driver on r_glcd
11. Configure the properties as follows.
Figure 22 Configure Display Driver property (Input general & screen1)
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 10 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 23 Configure Display Driver property (Output, CLUT, TCON)
12. Select “Driver -> Connectivity -> SCI Common” by clicking <New> in the “Main Thread Modules” section.
Figure 24 Adding SCI Common Driver
13. Enable “Simple SPI Mode (r_sci_spi)” in the properties as follows.
Figure 25 Enable Simple SPI in SCI Common property
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 11 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
14. Select “Driver -> Connectivity -> SPI Driver on r_sci_spi” by clicking <New> in the “Main Thread Modules” section.
Figure 26 Adding Simple SPI (on SCI) Driver
15. Configure the properties as follows.
Figure 27 Configure Simple SPI (on SCI) property
16. Select “Framework -> Graphics -> D/AVE 2D Port on sf_tes_2d_drw” by clicking <New> in the “Main Thread
Modules” section.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 12 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 28 Adding Framework for D/AVE 2D Port
17. Configure the properties as follows.
Figure 29 D/AVE 2D Port on sf_test2d_drw Properties
18. Select “Framework -> Graphics -> D/AVE 2D Driver on dave2d” by clicking <New> in the “Main Thread
Modules” section.
Figure 30 Adding Framework for D/AVE 2D Port
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 13 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
19. Select “Framework -> Graphics -> GUIX on gx” by clicking <New> in the “Main Thread Modules” section.
Figure 31 Adding Framework for GUIX
20. Select “Framework -> Graphics -> GUIX Port on sf_el_gx” by clicking <New> in the “Main Thread Modules” section.
Figure 32 Adding Framework for GUIX Port
21. Configure the properties as follows.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 33 Configure GUIX Port property
Page 14 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Note: if using a JPEG splash screen these settings can be left as is and the appropriate framework and driver components can be added to the project.
22. Select “Driver -> Input -> External IRQ Driver on r_icu” by clicking <New> in the “Main Thread Modules” section.
Figure 34 Adding External IRQ Driver on r_icu
23. Configure the properties for the new modules as follows. Hint: Change the “Channel” first!
Figure 35 Touch screen IRQ properties
24. Select “Framework -> Input -> External IRQ Framework on sf_external_irq” by clicking <New> in the “Main
Thread Modules” section.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 15 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 36 Adding Framework for External Interrupts
25. Configure the properties as follows.
Figure 37 Configure External Interrupts Properties
26. Select “Driver -> Connectivity -> I2C Driver on r_riic” by clicking <New> in the “Main Thread Modules” section.
Figure 38 Adding I2C Driver
27. Configure the properties for the “I2C Driver on RIIC” as follows. Hint: Change the “Channel” option first!
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 16 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 39 Configuring I2C Driver
28. Select “Framework -> Input -> Touch Panel Framework on sf_touch_panel_i2c” by clicking <New> in the “Main
Thread Modules” section.
Figure 40 Adding Touch Panel Framework
29. Configure the properties as follows.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 41 Configure Touch Panel Properties
Page 17 of 43
GUIX "Hello World" for SK-S7G2
30. In the Synergy Configuration Window, Threads tab, select the HAL/Common thread.
GUI Application
Figure 42 Click on “HAL/Common” thread
31. In the HAL/Common Modules area, add a messaging framework by selecting <New> “Framework -> Services ->
Messaging Framework on sf_message”.
Figure 43 Add Message Framework
32. In the Synergy Configuration Window, Threads Tab, select the Main Thread.
Figure 44 Click on “Main Thread”
33. Under the Main Thread Objects click <New> “Queue”.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 18 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
34. Configure the properties as follows.
Figure 45 Add a Queue
Figure 46 Configure Queue
35. Under the Main Thread Objects click <New> “Semaphore”.
36. Configure the properties as follows.
Figure 47 Add a Semaphore
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 48 Configure Semaphore
Page 19 of 43
GUIX "Hello World" for SK-S7G2
37. In the Synergy Configuration Window, select the <Pins> tab.
GUI Application
Figure 49 Configuration Pins
38. Select “Peripherals -> RSPI -> SPI0_Pin_Option_A” in Pin Selection, and change “Operation Mode” from “SPI
Op” to “Disabled” in Pin Configuration of SPI0_Pin_Option_A module.
Figure 50 Disable SPI0_Pin_Option_A in Pin Configuration
39. Select “Peripherals -> SCI0_2_4_6_8 -> SCI0” in Pin Selection, and configure in Pin Configuration of SCI0 module as follows.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 20 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 51 Configure SCI0 Pin Configuration
40. Select “Peripherals -> RIIC -> IIC2” in Pin Selection, and enable IIC2 module in Pin Configuration as follows.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 52 Configure IIC2 Pin Configuration
Page 21 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
41. Select “Ports -> P1 -> P115” in Pin Selection, and configure GPIO in Pin Configuration as follows. This pin was connected with LCD panel on SK-S7G2 board to control data access timing as LCD_WR signal.
Figure 53 P115 configuration
42. Same as P115 (LCD_WR) above, configure P609 (RESET# for Touch Panel), P610 (LCD_RESET) and P611
(LCD_CS) with output mode of GPIO.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 22 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 54 P609, P610 and P611 configurations
43. Configure “Drive Capacity” into High in all pins related to GLCD_Controller_Pin_Option_B as shown in Figure
64. There are two methods for setting the Drive Capacities to High. You may pick either one (A or B).
A. You can confirm which pins would be used for GLCD_Controller_Pin_Option_B shown in Figures 65 and
66 below.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 23 of 43
GUIX "Hello World" for SK-S7G2
Figure 55 Example of Drive Capability configuration for GLCDC
GUI Application
By clicking allow button, you can jump into the corresponded pin configuration tab.
For example, this allow leads to one of P900 shown in Figure 64.
Figure 56 Pin assignment for GLCD_Controller_Pin_Option_B
Figure 57 Pin assignment for GLCD_Controller_Pin_Option_B (continued)
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 24 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
B. You can also set the pins by port. Below is an ordered list of the pins that the “Drive Capacity” needs to be set to “High” on. You can access these ports by going to Ports -> PX -> PXYZ. Where X is the second digit of the port from the list, and PXYZ is the entire port. Once the port is selected, set the “Drive
Capacity” to “High” as shown in Figure 65.
P803
P804
P900
P901
P905
P906
P907
P908
PA00
S7G2
Pin
P313
P314
P315
P606
P607
P615
P802
PA01
PA08
PA09
PA10
Figure 58 Ordered List of Ports to Configure as High Drive Capacity
44. Click the <Generate Project Content> button to update the project files.
Figure 59 Generate Project Content
45. In the Project Explorer Window, right click on “src” and select “New -> Folder” to bring up the new folder dialog box.
Figure 60 Creating a New Folder
46. Enter the name of the new folder, “hardware”, in the “Folder name:” text box.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 25 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 61 New Folder Dialog
47. Click <Finish>.
48. The folder should now appear in Project Explorer, and be highlighted.
Figure 62 hardware folder
49. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Files\lcd.h”. Now drag the file from the Windows Explorer Window into the new hardware folder inside the e
2
studio Project Explorer window. When asked how to import the selected files, click <OK> to copy the files.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 63 File Operation Dialog
Page 26 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
NOTE: This file contains the command definitions to control LCD panel.
50. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Files\ lcd_setup.c”. Now drag the file from the Windows Explorer Window into the “hardware” folder inside the e
2
studio Project Explorer window.
A. When asked how to import the selected files, click <OK> to copy the files.
NOTE: This file contains command protocol via SPI to LCD panel and initialization sequence.
51. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Files\sf_message_port.h”. Now drag the file from the Windows Explorer Window into the “src” folder inside the e
2
studio Project Explorer window.
A. When asked how to import the selected files, click <OK> to copy the files.
NOTE: This file contains the event class definitions for the touchscreen events.
52. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Files\sf_message_port.c”. Now drag the file from the Windows Explorer Window into the “src” folder inside the e
2
studio Project Explorer window.
A. When asked how to import the selected files, click <OK> to copy the files.
NOTE: This file contains the event queue initialization and linking variables.
53. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Files\main_thread_entry.c”. Now drag the file from the Windows Explorer Window into the “src” folder inside the e
2
studio Project Explorer window.
A. When asked how to import the selected files, click <OK> to copy the files.
B. When asked if you want to overwrite, click <Yes>.
NOTE: This file contains the Main Thread event handling code. It reads low level touchscreen events from the queue and transforms them to graphical user interface actions.
5. Create the GUIX Interface Using GUIX Studio
Now that the base project is setup we can start adding the GUIX components.
1. Create a new folder named “gui” inside the “src” by right clicking on the “src” folder and selecting “New ->
Folder”.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 64 Creating “gui” folder under “src” folder
Page 27 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
2. Create another new folder named “guix_studio” in the root folder of the project by right clicking on “GUIApp” and selecting “New -> Folder”. The final folder layout should now look like the figure below.
Figure 65 Final Folder List
3. Open GUIX Studio by clicking the desktop icon or by clicking on the GUIX icon in the Windows Start Menu, “All
Programs -> Express Logic -> GUIX Studio 5.2” folder.
Figure 66 Start GUIX Studio
4. On the Recent Projects dialog click the button <Create New Project…>
Figure 67 Create New Project
5. Name the project “guiapp”.
WARNING:
Filenames will be generated by appending names to the project name. You must be careful to be case sensitive when you define your project name. Later, we will add files to the project that will assume you have called this
GUIX project “guiapp”.
6. For the Project Path, browse to the location of the folder we created earlier called “guix_studio”.
NOTE:
If you installed the tools into the default directories, the folder will be located at:
“C:\Users\[User]\e2_studio\workspace\GUIAPP\GUIApp\guix_studio”
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 28 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 68 Create a New GUIX Project
7. Click <Save>.
8. Change the Directories for all three options to be “..\src\gui” and setup the Display Configuration as follows.
Figure 69 Configure Project
CAUTION: Make sure you put in two dots “..” in the directories above.
9. Click <SAVE> to generate the project.
10. Right-click on display_1 in the project view.
11. Select Insert -> Window -> Window.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 29 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 70 New Window
12. Modify the properties by selecting the new window and editing the Properties View. Update the current settings to match the following. Notice the Event Function field. This is the event that will be initiated when the touch screen is pressed in window1.
Figure 71 Configure Window1 Properties
13. In the Project View Window, right click on display_1 and create another window by selecting Insert -> Window ->
Window.
14. Modify the properties to match the following. Notice the Event Function field. This is the event that will be initiated when the touch screen is pressed in window2.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 30 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 72 Configure Window2 Properties
15. In the Project View, right-click on window1 and insert a Button (Text Button).
Figure 73 Add a New Text Button
16. In the Project View, right-click on window1 and insert a Button Checkbox.
Figure 74 Add a New Checkbox
17. In the Project View, right-click on window1 and insert a Text Prompt.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 31 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 75 Adding New Prompt
18. In the Project View, right-click on window1 and insert another Text Prompt.
19. In the Project View, right-click on window2 and insert a Text Prompt.
20. In the Project View, right-click on window2 and insert another Text Prompt.
21. If you have followed these directions correctly, your Project View should look like this:
Figure 76 GUIX Project View
22. Press the ‘+’ character on right of “</> Strings” to expand the Strings menu.
Figure 77 Strings Button
23. Double click on any of the strings to open the String Table Editor.
24. Delete the existing strings by selecting them then clicking on the <Delete String> button in the String Table Editor.
25. Add the following Strings using the <Add String> button.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 32 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 78 New Strings
26. When correct, click the <SAVE> button.
27. In the Project View under window1, click on button_1 then modify the properties (Properties View) to match the following.
Figure 79 Configure Windowchanger Button Properties
28. In the Project View under window1, click on checkbox_1 then modify the properties (Properties View) to match the following.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 33 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 80 Configure Buttonenabler Checkbox Properties
29. In the Project View under window1, click on prompt_1 then modify the properties to match the following.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 34 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 81 Configure Prompt Properties
30. In the Project View under window1, click on prompt_2 then modify the properties to match the following.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 82 Configure Window Text Properties
Page 35 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
31. In the Project View under window2, click on prompt_3 then modify the properties to match the following. Notice the “Event Function” field.
-
Figure 83 Configure Hello Text Prompt Properties
32. In the Project View under window2, click on prompt_4 then modify the properties to match the following.
Figure 84 Configure Window Text Properties
After these configuration steps, the two windows should now look similar to the images below.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 36 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 85 Configured Window1
Figure 86 Configured Window2
33. Save the project.
Figure 87 Save Project
34. From the pull down menu select “Project -> Generate all Output Files”.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 37 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
Figure 88 Generate All Output files
35. Return to e
2
studio.
6. Adding Code for Custom Interface Controls and Building project
1. Open Windows Explorer and surf to where you put the files included with this application note. Locate the file
“Source Code\guiapp_event_handlers.c”. Now drag the file from the Windows Explorer Window into the “src” folder inside the e
2
studio Project Explorer window.
A. When asked how to import the selected files, click <OK> to copy the files.
NOTE: This file contains the event management functions for the different graphical elements created in
GUIX Studio (window1, window2).
GUIX handles the events that are required at a system level but to handle custom commands like screen transitions and button actions event handler need to be defined. Shown below is the event handler for window1.
UINT window1_handler( GX_WINDOW *widget, GX_EVENT *event_ptr)
{
UINT result = gx_window_event_process(widget, event_ptr);
switch
(event_ptr-> gx_event_type )
{
case
GX_SIGNAL(ID_BUTTONENABLER, GX_EVENT_TOGGLE_ON):
button_enabled = true;
update_text_id(widget-> gx_widget_parent , ID_WINDOWCHANGER, GX_STRING_ID_BUTTON_ENABLED);
update_text_id(widget-> gx_widget_parent , ID_INSTRUCTIONS, GX_STRING_ID_INSTRUCT_BUTTON);
break
;
case
GX_SIGNAL(ID_BUTTONENABLER, GX_EVENT_TOGGLE_OFF):
button_enabled = false;
update_text_id(widget-> gx_widget_parent , ID_WINDOWCHANGER, GX_STRING_ID_BUTTON_DISABLED);
update_text_id(widget-> gx_widget_parent , ID_INSTRUCTIONS, GX_STRING_ID_INSTRUCT_CHECKBOX);
break
;
case
GX_SIGNAL(ID_WINDOWCHANGER, GX_EVENT_CLICKED):
if
(button_enabled){
show_window(( GX_WINDOW *)&window2, ( GX_WIDGET *)widget, true);
}
break
;
default
:
gx_window_event_process(widget, event_ptr);
break
;
}
return
result;
}
Events can be routed based on the ID of the widget and the signal from GUIX. For example the checkbox
ID_BUTTONENABLER can have two states; GX_EVENT_TOGGLE_ON and GX_EVENTS_TOGGLE_OFF. When
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 38 of 43
GUIX "Hello World" for SK-S7G2 GUI Application box is uncheck and then pressed the event GX_EVENT_TOGGLE_ON is sent to the handler, after which the box we be checked.
2. Turn optimization off:
A. Right-click on “GUIApp” in the Project Explorer window and select “Properties” from the pulldown menu
B. Within the properties window, expand the “C/C++ Build” tree element
C. Select “Settings”
D. In the “Tool Settings” tab, click Optimization
E. Change the Optimization Level to “None (-O0)”
F. Click <OK> to save these changes
Figure 89 Disabling Compiler Optimizations
3. Build the project by clicking the Hamer icon below the Menu Bar, . . If all steps were followed correctly, there will be no errors reported in the build output.
Figure 90 Build the Project
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 91 Build finished with 0 errors
Page 39 of 43
GUIX "Hello World" for SK-S7G2
7. Running the Application
1. Connect the SK-S7G2 (J19) to the PC with micro USB cable.
NOTE:
The application is not yet ready to be run on the target hardware. The following steps are necessary in order to run it.
2. Click the dropdown menu for the debug icon.
GUI Application
Figure 92 Debug Options
3. Select the “Debug Configurations...” option
4. Under the “Renesas GDB Hardware Debugging” section, select “GUIApp Debug”.
5. Click on the <Debug> button to start debugging.
Note:
If the debug button is greyed out then there is likely an issue with the build. Check all steps from the document again for mismatched options.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Figure 93 Debug Configurations
Page 40 of 43
GUIX "Hello World" for SK-S7G2 GUI Application
6. If asked to confirm a Perspective Switch, click <Yes>. (If you have previously instructed e
2
studio to
Remember your decision, this dialog box will not be displayed.)
Figure 94 Perspective Switch Dialog
7. Press “F8” or the resume button to start the application. It will now stop at main.
Figure 95 Resume Button
8. Press “F8” or the resume button to run the code.
Note:
The GUI created earlier should now be on the screen.
9. Overview of the Demo:
Figure 96 Window1
a. Figure shows Window1. In this window are four elements:
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 41 of 43
GUIX "Hello World" for SK-S7G2 GUI Application i. Button – Checkbox: We use this button to enable going to Window2. Text is set to “Press
Me!” and it is unchecked. When the user presses within the Checkbox active area we activate the event “window1_handler”. This event is picked up inside “guiapp_event_handlers.c” where the code toggles the checkbox then sets the text in “Text –Prompt 1” and “Button –
Text Box” to the appropriate message. ii. Button – Text Box: This box simply shows what window you will go to if you press outside the “Text –Prompt 1” area. (Refer to “Button – Checkbox” to see how it is changed.) Press in this area to activate the “window1 _handler” event which is picked up by
“guiapp_event_handlers.c” where the code changes the window to window2. iii. Text – Prompt 1: This area instructs the user how to control the demo. (Refer to “Button –
Checkbox” to see how it is changed.)
iv. Text – Prompt 2: This Prompt is used to show the user which window they are in. It never changes (always shows window1).
Figure 97 Window2
b. Figure shows Window2. In this window are two elements:
i. Text – Prompt 1: This area presents “Hello World”. Pressing in this area initiates the
“window2_handler” event which is picked up guiapp_event_handlers.c and changes the active window to window1.
ii. Text – Prompt 2: This Prompt is used to show the user which window they are in. It never changes (always shows window2).
10. Press “Ctrl + F2” or the stop button to end the debug session.
Figure 98 Stop Button
11. This concludes the GUIX “Hello World” for SK-S7G2.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
Page 42 of 43
GUIX "Hello World" for SK-S7G2
Website and Support
Support: https://synergygallery.renesas.com/support
Technical Contact Details
• America: https://renesas.zendesk.com/anonymous_requests/new
• Europe: http://www.renesas.eu/support/index.jsp
• Japan: http://japan.renesas.com/contact/index.jsp
All trademarks and registered trademarks are the property of their respective owners.
R12AN0021EU0100 Rev.1.00
Jan 22, 2016
GUI Application
Page 43 of 43
Revision History
Rev.
1.00
Date
January 22,
2016
Description
Page Summary
Initial Version
A-1
General Precautions in the Handling of Microprocessing Unit and Microcontroller Unit Products
The following usage notes are applicable to all Microprocessing unit and Microcontroller unit products from Renesas.
For detailed usage notes on the products covered by this document, refer to the relevant sections of the document as well as any technical updates that have been issued for the products.
1. Handling of Unused Pins
Handle unused pins in accordance with the directions given under Handling of Unused Pins in the manual.
The input pins of CMOS products are generally in the high-impedance state. In operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of
LSI, an associated shoot-through current flows internally, and malfunctions occur due to the false recognition of the pin state as an input signal become possible. Unused pins should be handled as described under Handling of Unused Pins in the manual.
2. Processing at Power-on
The state of the product is undefined at the moment when power is supplied.
The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied.
In a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed.
In a similar way, the states of pins in a product that is reset by an on-chip power-on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified.
3. Prohibition of Access to Reserved Addresses
Access to reserved addresses is prohibited.
The reserved addresses are provided for the possible future expansion of functions. Do not access these addresses; the correct operation of LSI is not guaranteed if they are accessed.
4. Clock Signals
After applying a reset, only release the reset line after the operating clock signal has become stable. When switching the clock signal during program execution, wait until the target clock signal has stabilized.
When the clock signal is generated with an external resonator (or from an external oscillator) during a reset, ensure that the reset line is only released after full stabilization of the clock signal. Moreover, when switching to a clock signal produced with an external resonator (or by an external oscillator) while program execution is in progress, wait until the target clock signal is stable.
5. Differences between Products
Before changing from one product to another, i.e. to a product with a different part number, confirm that the change will not lead to problems.
The characteristics of Microprocessing unit or Microcontroller unit products in the same group but having a different part number may differ in terms of the internal memory capacity, layout pattern, and other factors, which can affect the ranges of electrical characteristics, such as characteristic values, operating margins, immunity to noise, and amount of radiated noise.
When changing to a product with a different part number, implement a system-evaluation test for the given product.
Notice
1.
Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits, software, or information.
2.
Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein.
3.
Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or others.
4.
You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration, modification, copy or otherwise misappropriation of Renesas Electronics product.
5.
Renesas Electronics products are classified according to the following two quality grades: "Standard" and "High Quality". The recommended applications for each Renesas Electronics product depends on the product's quality grade, as indicated below.
"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots etc.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-crime systems; and safety equipment etc.
Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause serious property damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may not use any Renesas Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics.
6.
You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges.
7.
Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or systems manufactured by you.
8.
Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.
9.
Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military, including but not limited to the development of weapons of mass destruction. When exporting the Renesas Electronics products or technology described in this document, you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products.
11. This document may not be reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority-owned subsidiaries.
(Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics.
SALES OFFICES
Refer to "http://www.renesas.com/" for the latest and detailed information.
Renesas Electronics America Inc.
2801 Scott Boulevard Santa Clara, CA 95050-2549, U.S.A.
Tel: +1-408-588-6000, Fax: +1-408-588-6130
Renesas Electronics Canada Limited
9251 Yonge Street, Suite 8309 Richmond Hill, Ontario Canada L4C 9T3
Tel: +1-905-237-2004
Renesas Electronics Europe Limited
Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.K
Tel: +44-1628-585-100, Fax: +44-1628-585-900
Renesas Electronics Europe GmbH
Arcadiastrasse 10, 40472 Düsseldorf, Germany
Tel: +49-211-6503-0, Fax: +49-211-6503-1327
Renesas Electronics (China) Co., Ltd.
Room 1709, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100191, P.R.China
Tel: +86-10-8235-1155, Fax: +86-10-8235-7679
Renesas Electronics (Shanghai) Co., Ltd.
Unit 301, Tower A, Central Towers, 555 Langao Road, Putuo District, Shanghai, P. R. China 200333
Tel: +86-21-2226-0888, Fax: +86-21-2226-0999
Renesas Electronics Hong Kong Limited
Unit 1601-1611, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong
Tel: +852-2265-6688, Fax: +852 2886-9022
Renesas Electronics Taiwan Co., Ltd.
13F, No. 363, Fu Shing North Road, Taipei 10543, Taiwan
Tel: +886-2-8175-9600, Fax: +886 2-8175-9670
Renesas Electronics Singapore Pte. Ltd.
80 Bendemeer Road, Unit #06-02 Hyflux Innovation Centre, Singapore 339949
Tel: +65-6213-0200, Fax: +65-6213-0300
Renesas Electronics Malaysia Sdn.Bhd.
Unit 1207, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia
Tel: +60-3-7955-9390, Fax: +60-3-7955-9510
Renesas Electronics India Pvt. Ltd.
No.777C, 100 Feet Road, HALII Stage, Indiranagar, Bangalore, India
Tel: +91-80-67208700, Fax: +91-80-67208777
Renesas Electronics Korea Co., Ltd.
12F., 234 Teheran-ro, Gangnam-Gu, Seoul, 135-080, Korea
Tel: +82-2-558-3737, Fax: +82-2-558-5141 http://www.renesas.com
© 2016 Renesas Electronics Corporation. All rights reserved.
Colophon 5.0
Advertisement
Key Features
- Synergy Platform support
- GUIX Studio editor
- Touchscreen interface
- LCD, SPI, I2C hardware function setup
- Thread and message passing setup
- Interrupt setup