background image

 

 

  

 

 

 

 

Oct. 04, 2018 

Page 

13

 of 18 

Rev 1.00 

M480 emWin 

emWin GUIBuilder 

4.1  Create Widget 

Segger  provides  a  Windows  tool  GUIBuilder  to  create  application  with  drag  and  drop 
interface.  The  tool  is  located  under  the  ThirdParty\emWin\Tool\  directory.  This  tool  can 
generate  a  file  named  FramewinDLG.c  for  the  widget  of  target  application.  Please  refer  to 
chapter 20 of UM03001_emWin5.pdf for the usage of GUIBuilder. 

 

 

4.2  Handle Widget Event 

FramewinDLG.c  is  only  the  framework  of  widget  and  programmers  still  need  to  add  their 
desired widget event handler in this file after copying the FramewinDLG.c file into the project 
directory. Below is the event handling code of emWin_SimpleDemo. 

...... 

switch (pMsg->MsgId) 

case WM_INIT_DIALOG: 

// 

// Initialization of 'Edit' 

// 

value = 123; 

Содержание NuMicro M480 Series

Страница 1: ...roperty of Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based system design Nuvoton assumes no responsibility for errors or omissions All data and specifications are subject to change without notice For additional information or questions please contact Nuvoton Te...

Страница 2: ...4 Include Files ThirdParty emWin Include 4 2 5 Library ThirdParty emWin Lib 4 2 6 Tools ThirdParty emWin Tool 5 3 EMWIN SAMPLE CODE 6 3 1 Project Structure 6 3 2 System Initialization 7 3 3 emWin Initialization 8 3 4 Build emWin Project 9 3 5 Download and Run 9 3 6 Touch Screen 10 4 EMWIN GUIBUILDER 13 4 1 Create Widget 13 4 2 Handle Widget Event 13 5 CHANGE DISPLAY PANEL 15 5 1 emWin Display Conf...

Страница 3: ...vide an efficient processor and display controller independent GUI for any application that operates with a graphical display Nuvoton provides emWin GUI library for free with the M480 series microcontroller MCU supporting up to 320x240 16 bpp resolution The emWin platform can be implemented on HMI for industrial machines appliances etc ...

Страница 4: ...stem dependent code for GUI GUIConf c Display controller initialization source code GUIConf h A header file configures emWins features fonts etc LCDConf c Display controller configuration source code LCDConf h Display driver configuration header file 2 3 Documents ThirdParty emWin Doc AN03002_Custom_ Widget_Type pdf emWin custom widget type creation guide UM03001_emWin5 pdf emWin user guide and re...

Страница 5: ...ing common image file formats like BMP PNG or GIF into the desired emWin bitmap format emWinPlayer exe This tool can show the previously created emWin Movie File EMF on a Computer with a Windows operating system GUIBuilder exe A tool for creating dialogs by drag and drop operation JPEG2Movie exe A tool to convert JPEG files to an EMF file ...

Страница 6: ...e widgets feature emWin_SimpleDemo utilizes the emWin library to demonstrate interactive feature 3 1 Project Structure The following uses emWin_SimpleDemo as a sample to explain the emWin project structure in BSP This sample contains a frame window four buttons a text and a text editor User can update the number shown in the text field by clicking four buttons shown on the display panel ...

Страница 7: ...roup contains emWin library and panel configuration for the NuMicro family The Application group contains the C code generated by emWin GUIBuilder The tslib group is the touch screen library The FatFs group contains the file system library to access the SD card The src group contains the main file 3 2 System Initialization The system initialization code is located in main function including periph...

Страница 8: ...SEL1_TMR0SEL_HXT 0 Initial Timer0 to periodic mode with 1000Hz TIMER_Open TIMER0 TIMER_PERIODIC_MODE 1000 Enable Timer0 interrupt TIMER_EnableInt TIMER0 NVIC_EnableIRQ TMR0_IRQn Start Timer0 TIMER_Start TIMER0 printf n nCPU d Hz n SystemCoreClock MainTask while 1 3 3 emWin Initialization To initialize emWin GUI the application needs to call GUI_Init and CreatFramewin function The code is in MainTa...

Страница 9: ...rsion while 1 GUI_Delay 500 3 4 Build emWin Project To build the emWin project in Keil MDK click the rebuild icon as shown below or press F7 function key 3 5 Download and Run Press Ctrl F5 to download the application and start a debug session or click start stop debug session icon as shown below After entering debug session press F5 to start code execution ...

Страница 10: ...rsion result can be affected by power noise mechanical misalignment etc To overcome this issue the tslib supports calibration function and the calibration parameter is stored ether in APROM or a SD card As mentioned in section 3 1 there are two targets in this project emWin_SimpleDemo uses the calibration parameter in the APROM offset 0x00040000 and emWin_SimpleDemo_SD uses the calibration paramet...

Страница 11: ...ffset define __DEMO_TS_WIDTH__ 320 define __DEMO_TS_HEIGHT__ 240 endif If APROM is used to store the calibration parameter main function will load the parameter from APROM If the parameter doesn t exist main function will call ts_calibrate to generate a copy Unlock protected registers SYS_UnlockReg Enable FMC ISP function FMC_Open If calibration parameter exists call ts_calibrate to generate a cop...

Страница 12: ...nerate a copy This sample uses FatFS to access FAT file system SDH_Open_Disk TEST_SDH CardDetect_From_GPIO printf rc d n WORD disk_initialize 0 disk_read 0 Buff 2 1 GUI_Init res f_open hFile 0 ts_calib FA_OPEN_EXISTING FA_READ if res file does not exists so do calibration res f_open hFile 0 ts_calib FA_CREATE_ALWAYS FA_WRITE if res f_close hFile GUI_DispStringAt CANNOT create the calibration file ...

Страница 13: ...med FramewinDLG c for the widget of target application Please refer to chapter 20 of UM03001_emWin5 pdf for the usage of GUIBuilder 4 2 Handle Widget Event FramewinDLG c is only the framework of widget and programmers still need to add their desired widget event handler in this file after copying the FramewinDLG c file into the project directory Below is the event handling code of emWin_SimpleDemo...

Страница 14: ...ta v 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 value 1 sprintf sBuf d value hItem WM_GetDialogItem pMsg hWin ID_EDIT_0 EDIT_SetText hItem sBuf break case WM_NOTIFICATION_RELEASED USER START Optionally insert code for reacting on notification message USER END break USER...

Страница 15: ... 320 In the LCDConf c file the panel orientation and control functions are also defined These settings need to be modified according to the display panel attached to the system void LCD_WR_REG uint8_t cmd EBI0_WRITE_DATA16 0x00030000 cmd uint8_t LCD_RD_DATA void return EBI0_READ_DATA16 0x00030000 void LCD_X_Config void Orientation Config Orientation GUI_MIRROR_X GUI_MIRROR_Y GUI_SWAP_XY GUIDRV_Fle...

Страница 16: ...COLOR_M16C0B16 5 2 Display Driver The project file includes the ebi c driver since demo system is connected to a MPU display using the EBI interface For systems connecting display with the SPI or I2 C interface spi c or i2c c needs to be added to the project ...

Страница 17: ...Oct 04 2018 Page 17 of 18 Rev 1 00 M480 emWin Revision History Date Revision Description 2018 10 04 1 00 1 Initially issued ...

Страница 18: ...d to equipment for surgical implementation atomic energy control instruments airplane or spaceship instruments the control or operation of dynamic brake or safety systems designed for vehicular use traffic signal instruments all types of safety devices and other applications intended to support or sustain life All Insecure Usage shall be made at customer s risk and in the event that third parties ...

Отзывы: