Nuvoton NuMicro M2351 Series Quick Start Manual Download Page 4

 

 

  

 

 

 

 

Oct. 18, 2018 

Page 

4

 of 18 

Rev 1.00 

M2351 emWin 

emWin BSP Directory Structure 

This chapter introduces emWin related files and directories in the M2351 BSP. 

2.1  Sample Codes (sampleCode\NuMaker) 

emWin_GUIDemo

 

Utilize emWin library to demonstrate widgets feature.

 

emWin_SimpleDemo

 

Utilize emWin library to demonstrate interactive feature.

 

 

2.2  Configuration Files (ThirdParty\emWin\Config) 

GUI_X.c

 

Configuration and system 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 reference manual.

 

 

2.4  Include Files (ThirdParty\emWin\Include) 

This directory contains header files for emWin project. 

 

2.5  Library (ThirdParty\emWin\Lib) 

NUemWin_CM23_Keil.lib

 

emWin library for M2351 series MCU.

 

 

Summary of Contents for NuMicro M2351 Series

Page 1: ...property 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 T...

Page 2: ...4 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 9 3 4 Build emWin Project 9 3 5 Download and Run 10 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...

Page 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 M2351 series microcontroller MCU supporting up to 320x240 16 bpp resolution The emWin platform can be implemented on HMI for industrial machines appliances etc ...

Page 4: ...d system 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 an...

Page 5: ...ting 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 ...

Page 6: ...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 The project structure is shown in the following figure The CMSIS group contains system startup code The user group contains the main file The Libraries group contains low level driver The emWin grou...

Page 7: ...eDemo_ST7735 use ST7735 touch panel User can switch between different targets using the pull down menu marked in the red rectangle shown below 3 2 System Initialization The system initialization code is located in main function including peripheral clock preparation multi function pin configuration and UART debug port setting Also a 1000Hz ...

Page 8: ...k TMR0_MODULE CLK_CLKSEL1_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 multi function pin configuration GPIO_SetMode PB BIT6 GPIO_MODE_INPUT GPIO_SetMode PB BIT7 GPIO_MODE_INPUT GPIO_SetMode PB BIT5 GPIO_MODE_INPUT GPIO_SetMode PB BIT2 GPIO...

Page 9: ...AP bmM2351_320x240 WM_HWIN hWin char acVersion Nuvoton M2351 int32_t i32Scale GUI_Init GUI_SetBkColor GUI_BLACK GUI_Clear ifdef __DEMO_160x128__ i32Scale 500 else i32Scale 1000 endif GUI_DrawBitmapEx bmM2351_320x240 0 5 0 0 i32Scale i32Scale GUI_Delay 3000 hWin CreateFramewin FRAMEWIN_SetText hWin acVersion while 1 GUI_Delay 1000 3 4 Build emWin Project To build the emWin project in Keil MDK click...

Page 10: ...on as shown below After entering debug session press F5 to start code execution The following figure shows the application halts in main function after starting a debug session 3 6 Touch Screen To support resistive touch screen use ADC to convert the voltage of X axis and Y axis and then use the open source tslib to map the ADC conversion result into the coordination The ...

Page 11: ...WIDTH__ 160 define __DEMO_TS_HEIGHT__ 128 else define __DEMO_TS_WIDTH__ 320 define __DEMO_TS_HEIGHT__ 240 endif int Init_TouchPanel void int Read_TouchPanel int x int y int Uninit_TouchPanel void int Check_TouchPanel void 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 ...

Page 12: ...Oct 18 2018 Page 12 of 18 Rev 1 00 M2351 emWin ts_writefile FMC_DISABLE_AP_UPDATE else ts_readfile Disable FMC ISP function FMC_Close Lock protected registers SYS_LockReg ...

Page 13: ...ramewinDLG 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 swit...

Page 14: ... 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 STA...

Page 15: ...fied according to the display panel attached to the system void LCD_X_Config void Orientation Config Orientation DISPLAY_ORIENTATION GUIDRV_FlexColor_Config pDevice Config Set controller and operation mode PortAPI pfWrite8_A0 _Write0 PortAPI pfWrite8_A1 _Write1 PortAPI pfWriteM8_A0 _WriteM1 PortAPI pfWriteM8_A1 _WriteM1 PortAPI pfRead8_A0 _Read1 FIXME if panel supports read back feature PortAPI pf...

Page 16: ...Oct 18 2018 Page 16 of 18 Rev 1 00 M2351 emWin 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 ...

Page 17: ...Oct 18 2018 Page 17 of 18 Rev 1 00 M2351 emWin Revision History Date Revision Description 2018 10 18 1 00 1 Initially issued ...

Page 18: ...ed 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...

Reviews: