
Oct. 18, 2018
Page
8
of 18
Rev 1.00
NUC126 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);
//
// multi- function pin configuration
//
GPIO_SetMode(PB, BIT13, GPIO_MODE_INPUT);
GPIO_SetMode(PB, BIT14, GPIO_MODE_INPUT);
GPIO_SetMode(PC, BIT9, GPIO_MODE_INPUT);
GPIO_SetMode(PC, BIT12, GPIO_MODE_INPUT);
GPIO_SetMode(PC, BIT10, GPIO_MODE_INPUT);
GPIO_SetMode(PC, BIT11, GPIO_MODE_INPUT);
GPIO_SetMode(PC, BIT13, GPIO_MODE_INPUT);
MainTask();
while(1);
}
3.3 emWin Initialization
To initialize emWin GUI, the application needs to call GUI_Init() and CreatFramewin()