FA95 UDC Library Reference Guide Em Win Start N9H26 Series
User Manual:
Open the PDF directly: View PDF
.
Page Count: 20
| Download | |
| Open PDF In Browser | View PDF |
GUI emWin
Start Guide
V1.00.007
Publication Release Date: Dec. 2018
Support Chips:
Support Platforms:
N9H26 Series
Non-OS
GUI emWin Start Guide
The information in this document is subject to change without notice.
The Nuvoton Technology Corp. shall not be liable for technical or editorial errors or omissions
contained herein; nor for incidental or consequential damages resulting from the furnishing,
performance, or use of this material.
This documentation may not, in whole or in part, be copied, photocopied, reproduced,
translated, or reduced to any electronic medium or machine readable form without prior consent,
in writing, from the Nuvoton Technology Corp.
Nuvoton Technology Corp. All rights reserved.
V1.00.007
-2-
GUI emWin Start Guide
Table of Contents
1. Introduction ............................................................................................................. 4
1.1. Introduction ............................................................................................................................ 4
1.2. emWin Folder structure .......................................................................................................... 5
1.3. Resource link .......................................................................................................................... 6
1.4. How to update application binary ........................................................................................... 7
2. Start emWin ............................................................................................................ 8
2.1. Step 1: Open project ............................................................................................................... 8
2.2. Step 2: BSP Initialization ....................................................................................................... 9
2.3. Step 3: emWin Initialization ................................................................................................. 10
2.4. Step 4: Build ......................................................................................................................... 11
2.5. Before download and run ..................................................................................................... 12
2.6. Step 5: Download and run .................................................................................................... 13
2.7. Touch screen ......................................................................................................................... 14
3. Start emWin GUIBuilder ..................................................................................... 15
3.1. Step 1: Create widget ............................................................................................................ 15
3.2. Step 2: Handle widget event ................................................................................................. 16
4. How to change display panel ............................................................................... 17
4.1. Step 1: emWin display.......................................................................................................... 17
4.2. Step 2: BSP display .............................................................................................................. 18
5. Revision History .................................................................................................... 19
V1.00.007
-3-
GUI emWin Start Guide
1. Introduction
1.1. Introduction
emWin is a graphic library with graphical user interface (GUI). It is designed to provide an efficient,
processor- and display controller-independent graphical user interface (GUI) for any application that
operates with a graphical display.
Figure 1.1-1 emWin runs on N9H26.
N9H26 BSP includes emWin related materials, e. g., sample codes, library, documents and tools. We
can develop emWin applications on Keil MDK incudes IDE, compiler and debugger (embedded
development tools for Arm) to build, modify and debug. We’ll introduce the basic operations on
section 2.4.
V1.00.007
-4-
GUI emWin Start Guide
1.2. emWin Folder structure
N9H26 BSP contains emWin related materials and the folder structure is shown below:
Directory Name
SampleCode \ emWin
ThirdParty \ emWin \ Config
ThirdParty \ emWin \ Doc
ThirdParty \ emWin \ Include
ThirdParty \ emWin \ Lib
ThirdParty \ emWin \ Tool
Content
Two emWin samples:
1. GUIDemo
2. SimpleDemo
emWin configuration files
Two emWin official documents:
1. AN03002_Custom_Widget_Type.pdf
2. UM03001_emWin5.pdf
emWin include files
emWin library: NUemWin_ARM9_Keil.lib
emWin tools
V1.00.007
-5-
GUI emWin Start Guide
1.3. Resource link
We can utilize official websites for further assistance, here is the reouce link table:
Topic
SEGGER
Forum
Resource link
SEGGER emWin official forum link:
https://forum.segger.com/index.php/Board/12-emWin-related/
Nuvoton HMI/GUI official forum link:
Nuvoton
Forum
http://forum.nuvoton.com/viewforum.php?f=31&sid=94265886594b34c7cd812d3f74c
44fec
http://nuvoton-mcu.com/forum.php?mod=forumdisplay&fid=86
Nuvoton official website entrance link:
Nuvoton
Website
https://www.nuvoton.com/
The latest N9H26 BSP GitHub link:
Nuvoton
BSP
https://github.com/OpenNuvoton/N9H26_emWin_NonOS
Parts information list and pin configuration link:
Data Sheet
http://www.nuvoton.com/hq/products/application-specific-socs/hmi-emwinmpus/Data-Sheet/?__locale=en&resourcePage=Y
PCB schematic link:
PCB
Development
Tool
http://www.nuvoton.com/hq/products/application-specific-socs/hmi-emwinmpus/Development-Tool/?__locale=en&resourcePage=Y
Video for creating control interface:
Online
Training
http://www.nuvoton.com/hq/products/application-specific-socs/hmi-emwinmpus/Online-Training/?__locale=en&resourcePage=Y
BSP in zipped format:
Software
http://www.nuvoton.com/hq/products/application-specific-socs/hmi-emwinmpus/Software/?__locale=en&resourcePage=Y
Demo board user manual:
User Manual
http://www.nuvoton.com/hq/products/application-specific-socs/hmi-emwinmpus/User-Manual/?__locale=en&resourcePage=Y
V1.00.007
-6-
GUI emWin Start Guide
1.4. How to update application binary
We can update application binary through USB cable to device and here are the steps:
1. Power off device.
2. Plug in USB cable to PC/NB.
3. Keep pressing “Up” and “Down” button.
4. Power on device.
5. After 5 seconds, then release “Up” and “Down” button.
6. Rename application binary to “conprog.bin”.
7. Copy and replace “conprog.bin” to “SD1-1”.
8. Remove USB device safely.
9. Plug out USB cable from PC/NB.
10. Reset device.
Here are the pre-built application binaries for SimpleDemo and GUIDemo:
SimpleDemo application binary:
The path is in “BSP\SampleCode\emWin\SimpleDemo\Bin\”
Sample Target
Simple_N9H26K5_SD_800x480
Pre-built Application Binary
For 800 x 480 LCD with microSD card:
SimpleDemo_N9H26K5_SD_800x480.bin
GUIDemo application binary:
The path is in “BSP\SampleCode\emWin\GUIDemo\Bin\”
Sample Target
GUI_N9H26K5_SD_800x480
Pre-built Application Binary
For 800 x 480 LCD with microSD card:
GUIDemo_N9H26K5_SD_800x480.bin
Please note that we need to rename application binary to “conprog.bin” before copy to “SD1-1”.
V1.00.007
-7-
GUI emWin Start Guide
2. Start emWin
2.1. Step 1: Open project
Double click “SimpleDemo.uvproj” (the path is in “SampleCode\emWin\SimpleDemo\KEIL”) to open
project.
Figure 2.1-1 “SimpleDemo” project file.
“SimpleDemo” is a sample code to utilize emWin library to demonstrate interactive feature. It contains
a frame window, four buttons, a text and a text editor. We can touch the GUI button and check the
result that shown on the text editor.
The path of “SimpleDemo” is in “SampleCode\emWin”.
Figure 2.1-2 “SimpleDemo” sample folder is in “SampleCode\emWin”.
The structure of “SimpleDemo”:
Blue part is related with BSP.
Red part is related with emWin.
Figure 2.1-3 “SimpleDemo” project structure.
V1.00.007
-8-
GUI emWin Start Guide
2.2. Step 2: BSP Initialization
In “main.c”, it contains the N9H26 start up flow, e.g., clock setting, timer, uart debug port, display
output panel, vendor filesystem and resistor-type touch screen.
The path of “main.c” is in “SampleCode\emWin\SimpleDemo”:
Figure 2.2-1 “main.c” contains N9H26 start up flow.
int main(void)
{
...
/* N9H26 start up here */
...
/* emWin start up here */
MainTask();
return 0;
}
V1.00.007
-9-
GUI emWin Start Guide
2.3. Step 3: emWin Initialization
In “main.c”, called “MainTask()” to start up emWin GUI system.
“MainTask()” is in “SampleCode\emWin\SimpleDemo\main.c”:
void MainTask(void)
{
GUI_Init();
CreateFramewin();
while (1)
{
GUI_Delay(500);
}
}
V1.00.007
- 10 -
GUI emWin Start Guide
2.4. Step 4: Build
Please note that we suggest to utilize Keil MDK version 5 or above with professional or plus license.
To download and run the application, first, we need to utilize Keil to rebuild the application project.
Press “[F7]” to rebuild the application project or click “Rebuild”.
Figure 2.4-1 Rebuild application project.
V1.00.007
- 11 -
GUI emWin Start Guide
2.5. Before download and run
IMPORTANT!!! We need to configurate ICE setting to download and run.
Press “[Alt + F7]” for project options.
Figure 2.5-1 Options for target.
Choose “Debug” page and select properly ICE, e. g., J-LINK, then press “Settings”.
Figure 2.5-2 Select ICE to debug.
Set “Speed” (Auto or lower speed), disable “Debug Cache”, then select “Reset Strategy as Hardware, halt
after reset (normal)”, finally, click “OK”.
Figure 2.5-3 ICE environment setting.
V1.00.007
- 12 -
GUI emWin Start Guide
2.6. Step 5: Download and run
Press “CTRL + [F5]” to download the application and run debug session. After downloaded, it will halt
at main() and we should see the similar screenshow below.
Figure 2.6-1 Download and run application.
Figure 2.6-2 Debug session.
V1.00.007
- 13 -
GUI emWin Start Guide
2.7. Touch screen
To control touch panel, we utilize N9H26 ADC library and open source library “tslib”. The touch
calibration results store to a single file called “ts_calib”.
The path of “tslib” is in “SampleCode\emWin\SimpleDemo”:
Figure 2.7-1 tslib structure.
V1.00.007
- 14 -
GUI emWin Start Guide
3. Start emWin GUIBuilder
3.1. Step 1: Create widget
To create widget, we can utilize emWin “GUIBuilder” to arrange GUI layout and generate source file.
The path of “GUIBuilder” is in “ThirdParty\emWin\Tool”:
Figure 3.1-1 emWin GUIBuilder.
After finish GUI layout, then execute “File” “Save…”, we can get the source file called
“FramewinDLG.c”.
Figure 3.1-2 emWin GUIBuilder can arrange GUI layout and generate source file.
V1.00.007
- 15 -
GUI emWin Start Guide
3.2. Step 2: Handle widget event
In “FramewinDLG.c”, we can handle widget event, e. g., button clicked, released or others and update
text editor’s content when button released.
The path of “FramewinDLG.c” is in “SampleCode\emWin\SimpleDemo\Application”:
Figure 3.2-1 emWin GUI application source file.
...
switch(Id)
{
case ID_BUTTON_0: // Notifications sent by '+ 1'
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
value += 1;
sprintf(sBuf,"%d
", value);
hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
EDIT_SetText(hItem, sBuf);
// USER END
break;
// USER START (Optionally insert additional code for further notification
handling)
// USER END
}
break;
...
V1.00.007
- 16 -
GUI emWin Start Guide
4. How to change display panel
4.1. Step 1: emWin display
“LCDConf.c” defines emWin display configurations.
The path of “LCDConf.c” is in “ThirdParty\emWin\Config”:
Figure 4.1-1 emWin display configurations.
Display panel resolution:
In “N9H26TouchPanel.h”, we can modify the “XSIZE_PHYS” and “YSIZE_PHYS” for display
panel width and height respectively. Please note that “XSIZE_PHYS” and YSIZE_PHYS” are
defined in “SampleCode\emWin\SimpleDemo\tslib\N9H26TouchPanel.h”.
...
#define XSIZE_PHYS 320
#define YSIZE_PHYS 240
...
Display buffer address:
In “LCDConf.c”, we can assign display buffer address to emWin. Here, we utilize a “Sync-type
LCD 320x240”, the display buffer size in RGB565 is 320-width x 240-height x 2-byte-per-pixel =
153600Bytes = 150KB.
void LCD_X_Config(void)
{
...
/* assign display buffer address to emWin */
LCD_SetVRAMAddrEx(0, (void *)u8FrameBufPtr);
...
}
V1.00.007
- 17 -
GUI emWin Start Guide
4.2. Step 2: BSP display
N9H26 can utilize VPOST library to output display data to “Sync-type LCD”. N9H26 BSP contains the
default display library for 320 x 240 at 16-bit depth RGB565.
The path of the default display library is in “Library\IPLib\N9H26_GIANTPLUS_GPM1006D.lib“.
Figure 4.2-1 BSP default display library.
void LCD_X_Config(void)
{
...
/* assign display buffer address to emWin */
LCD_SetVRAMAddrEx(0, (void *)u8FrameBufPtr);
...
}
V1.00.007
- 18 -
GUI emWin Start Guide
5. Revision History
Version
Date
Description
V1.00.007
Dec. 28, 2018
V1.00.006
Dec. 25, 2018
V1.00.005
Dec. 25, 2018
Update
Update pre-built path to “Bin”
Update footer version
Update Nuvoton HMI/GUI forum link
Add official SEGGER emWin forum link
Add Nuvoton resource link
Add how to update application
V1.00.004
Oct. 11, 2018
Update N9H26 PCB picture
V1.00.003
Sep. 13, 2018
Update source path and description
V1.00.002
Aug. 17, 2018
Update introduction for Keil MDK
V1.00.001
Mar. 30, 2018
Created
V1.00.007
- 19 -
GUI emWin Start Guide
Important Notice
Nuvoton products are not designed, intended, authorized or warranted for use as components in
equipment or systems intended for surgical implantation, atomic energy control instruments,
aircraft or spacecraft instruments, transportation instruments, traffic signal instruments,
combustion control instruments, or for any other applications intended to support or sustain life.
Furthermore, Nuvoton products are not intended for applications whereby failure could result or
lead to personal injury, death or severe property or environmental damage.
Nuvoton customers using or selling these products for such applications do so at their own risk
and agree to fully indemnify Nuvoton for any damages resulting from their improper use or
sales.
V1.00.007
- 20 -
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.5 Linearized : No Page Count : 20 Language : zh-TW Tagged PDF : Yes Title : FA95 UDC Library Reference Guide Author : SPCheng Creator : Microsoft® Word 2010 Create Date : 2018:12:28 16:17:44+08:00 Modify Date : 2018:12:28 16:17:44+08:00 Producer : Microsoft® Word 2010EXIF Metadata provided by EXIF.tools