S7G2 Quick Tutorial Configuring the LCD event handling code and guix studio



I. Introduction

The purpose of this project was to create a more complex display on the Renesas SK – S7G2 LCD. The architecture of the LCD display was to resemble a tree, in which each path would branch out to
another. The focus was to create a complex menu and create the C language code that accompanies the complex menu. I was able to create over 40 paths, with each path leading a new window, back to
previous window or main menu. Along with the paths, I successfully coded over 500 lines of C
language code that dictates each path. I have used the same HAL drivers (Hardware Abstraction
Layer) , SCI (Serial Communications Interface), IC2 (inter-integrated circuit command) and Peripheral
driver setup as the last project. You can use the Hello World Project as a starting point and configure.
My main focus was to concentrate on coding, GUIX Studio, event handling and pixel map generation in GUIX Studio.

II. Tree Path Construction
This was the first section that I constructed. It is a map of each page and function. I used a simplistic
design. My goal was not the design itself, but design just enough were I can get into the coding. By
first constructing the map, it made it easier for me to code the functions. With the map, I knew exactly
where to place the buttons, the names of the pages and the paths it would take. It cut down the
production time substantially. My first trial was without any diagrams. This was very disastrous. I had
to reset my project several times, since I relied on memory for the names, paths and functions of each
page. The following map illustrates the path of the two-button path on the main menu, Special Force
Path and the Army Rangers Path.

The LCD pages are JPEG’s, can be created with GIMP, Paint, or design software. GUIX Studio can import almost any type of format, JPEG,PNG,BMP…etc.

III. Special Forces Button Path

IV. Ranger Button Path

V. Sample Pages

VI. Code Construction
To successfully have the code interact with the GUIX studio software, I first had to learn the special
function names, specific variable and naming convention. The coding was the most challenging
portion of this project. I dissected each line of code and attempted to interpret the code by trial and
error. I used my previous project, changed a few lines and noticed how it interacted with the hardware.
After numerous trial and error, I was finally able to define the majority of the functions. The following
are essential functions in making the screens go in the desired direction.
Function Name Definitions:

Function Name and Purpose

  1. UINT NameofPage_handler(GX_WINDOW *widget, GX_EVENT *event_ptr) Purpose: Defines the task of the page

  2. UINT result = gx_window_event_process(widget, event_ptr) Purpose: Points to the function in charge of events

  3. switch (event_ptr->gx_event_type) Purpose: Switch Case statement of task within the page

  4. case GX_SIGNAL(ID_ForwardButton, GX_EVENT_CLICKED) Purpose: Function in which defines the task of a button

  5. show_window((GX_WINDOW*)&SFSummaryPage, (GX_WIDGET*)widget, true) Purpose: Function that points to another page

  6. strcmp("FirstPage", (char*)(*pp_studio_widget)->widget_name) Initializes the first page “FirstPage”…you give it your own name, must match the name given in Guix Studio of the first page.
    The strcmp function gave me the most problems. This function is hidden in the main header file. We must give the input the name of the first page in quotes i.e. “MainMenu” or else we will see a black screen. This command declares the first page as a project in the studio widget. (Found in the Main File page)

  7. INSERTIONPAGE_CONTROL_BLOCK InsertionPage; (Header Page) Purpose: Declaration of each page in the Header File

  8. #define ID_InsertionPage 1 (Found in the Header Page) Purpose: Declaring buttons or action inside of a page

A. Sample Code

The following code is specifically from the program I created. I will compare the relationship of the code to the guix studio declaration.

Missions Page Sample Code

UINT MissionsPage_handler(GX_WINDOW *widget, GX_EVENT *event_ptr) // Main Menu Instructions {     UINT result = gx_window_event_process(widget, event_ptr); 
  switch (event_ptr->gx_event_type)   
  {       case GX_SIGNAL(ID_InsertionButton, GX_EVENT_CLICKED):         
 button_enabled = true;          
show_window((GX_WINDOW*)&InsertionPage, (GX_WIDGET*)widget, true);          
 case GX_SIGNAL(ID_RecoveryButton, GX_EVENT_CLICKED):         
 button_enabled = true;         
show_window((GX_WINDOW*)&RecoveryPage, (GX_WIDGET*)widget, true                
  case GX_SIGNAL(ID_SpecialReconButton, GX_EVENT_CLICKED):         
 button_enabled = true;         
show_window((GX_WINDOW*)&SpecialReconPage, (GX_WIDGET*)widget, true                 
 case GX_SIGNAL(ID_AirfieldButton, GX_EVENT_CLICKED):          
button_enabled = true;        
 show_window((GX_WINDOW*)&AirfieldPage, (GX_WIDGET*)widget, true);               
case GX_SIGNAL(ID_DirectActionButton, GX_EVENT_CLICKED):        
 button_enabled = true;         
show_window((GX_WINDOW*)&DirectActionPage, (GX_WIDGET*)widget, true);                  
 case GX_SIGNAL(ID_BackButton, GX_EVENT_CLICKED):                 
button_enabled = true;         
show_window((GX_WINDOW*)&TanBeretPage, (GX_WIDGET*)widget, true);                
 case GX_SIGNAL(ID_MainMenuButton, GX_EVENT_CLICKED):         
 button_enabled = true;        
 show_window((GX_WINDOW*)&MainMenu, (GX_WIDGET*)widget, true);         
    default:         gx_window_event_process(widget, event_ptr);        
 break;     } 

The above code is a sample code that belongs to just one of the page functions. In this specific page, the functions point to 12 different paths.

Function A.

UINT MissionsPage_handler(GX_WINDOW *widget, GX_EVENT *event_ptr) // Main Menu Instructions

In Function A. above, we notice that we are defining the tasks that are in within the Misisons Page.
Notice, in Figure A. below, the Missions Page Map and all the paths it points towards. In Figure C. Guix
Page Declaration, notice the “Event Function” category. The name given here must match exactly the
name in the function above, “MissionsPage_handler”, _handler is the name of the function that will point
to the sub tasks.

Function B.

    case GX_SIGNAL(ID_BackButton, GX_EVENT_CLICKED):         
    button_enabled = true; 
    show_window((GX_WINDOW*)&TanBeretPage, (GX_WIDGET*)widget, true);         

In the Function B. above, the back button is being defined. As seen, I named the back button as
“ID_BackButton”. Notice in Figure D., the back-button declaration on Guix studio must match exactly in
the “Widget ID” box.

Function C.

    show_window((GX_WINDOW*)&TanBeretPage, (GX_WIDGET*)widget, true);         

Function C. uses the call function named “show_window”. This function is a call by variable (“&”) that
calls upon the page. In this example, when “ID_BackButton” is clicked, “GX_EVENT_CLICKED”, it
will go to the “Tan Beret Page”, “&TanBeretPage”

Project View in Guix Studio

Project Overview

I have attached screen shots of the final project. Many times, I had to go back and re-adjust the
pixel dimensions of the pages. For optimal view, the pixel must be set at 250 pixels horizontal by 320 pixels vertical. I experimented with different values and it resulted in skewed and distorted images.

  1. The screen shots illustrate the potential path of each page. For example, the “Main Menu” screen
    shot has 3 different paths, 1) Green Beret Path, 2) Delta Force Path and 3) Army Rangers Path.
  2. “Information Page” Screen Shot points to 7 different paths 1) 18A Detachment, 2) 18B Weapons, 3)
    18C Explosives, 4) 18D Medical, 5) 18E Communications 6) Back Button, and 7) Main Menu
  3. The “Missions Page” also points to 7 different paths, as seen in the figure above.

Renesas Synergy Dev Board Project

V. Conclusion

This project further enabled me to dissect the inner workings of Guix studio and the e2 Renesas
design studio. It furthered my knowledge on the Renesas MCU. It demonstrates the power and
diversity of the functions of this MCU. I also learned the necessity of pre-planning before
going to coding. The technique of mapping out the paths or the idea of the program saves a
huge amount of time.

This is quick overview of how to configure multiple pages on the LCD, including the C code that accompanies the pages. There are many steps missing. I will be posting a tutorial in the near future. Any questions, please feel free to ask.


SK-S7G2 Tutorials

This is fantastic! Thanks for your contribution. It’s a beautiful interface you created. Nice job.


Rob, @elpaniagua, thanks again for posting this great work. Is it possible for you to make the following available:

  • source code and assets for your tutorial
  • list version of SSP that you used (Example 1.1.3)
  • list version of e2 Studio you used (Example 5.1.0)
  • list version of GUIX Studio you used (Example 5.3.0)

If you want to email me or @jcasman the zipped file of your project, I can also put it on GitHub. Or, you can put the zipped file on something like dropbox or your own GitHub repository.

My email is craig@oppkey.com Jesse’s email is jcasman@oppkey.com




My apologies. I did a fatal mistake. Earlier, I was prompted to upgrade to e2 studio 5.3, from 5.0. Now, I’m having issues compiling my the project. Some files are now missing. I was under the impression that everything would transfer over seamlessly. Not so much. I do have the event handler and specification files.



Wow, sorry to hear about this. Such a cool project too. Hey, if you want to get the older version of e2 studio, possibly run it on a different machine or VM, you can grab older versions from the archive.

When you originally built your program, do you remember what version of SSP you used? There are older versions of Synergy Software Package (SSP) in the archive.

Did you start off with the GUIX Hello World demo or did you write everything from scratch?

If you were using e2 Studio 5.0.0 for the previous build, you may have used SSP 1.1.0.

Also, if you started with the GUIX Hello World demo code, then that demo was originally built with SSP 1.1.0 You can adjust the SSP version using the BSP tab. Hopefully, you have a version of the code prior to re-generating the project files.

Have a nice day.