
Oct. 04, 2018
Page
8
of 18
Rev 1.00
M480 emWin
// Init System, IP clock and multi-function I/O
_SYS_Init();
//
// Init UART to 115200-8n1 for print message
//
UART_Open(UART0, 115200);
// Enable Timer0 clock and select Timer0 clock source
//
CLK_EnableModuleClock(TMR0_MODULE);
CLK_SetModuleClock(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);
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 MainTask() in main.c.
void MainTask(void)
{
WM_HWIN hWin;
Char acVersion[40] = "Framewin: Version of emWin: ";