int main(void) { // // Set the system clock to run at 80MHz (max freq) from the PLL. // SysCtlClockSet( SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Configure SysTick for a 100Hz interrupt. // SysTickPeriodSet(SysCtlClockGet() / TICKS_PER_SECOND); SysTickEnable(); /// Init RTC rtc_init(); // Init LCD ssd1289_init(); // // Initialize the display context // GrContextInit(&sContext, pDisplay); initClock(pDisplay); // Init touch xpt2046_init(); xpt2046_setTouchScreenCallback(WidgetPointerMessage); xpt2046_enableTouchIRQ(); SysTickIntEnable(); startMainMenuApplication(); while (true) { // // Process any messages in the widget message queue. // WidgetMessageQueueProcess(); } }
void rt_hw_lcd_init_ssd1289(void) { /* LCD RESET */ /* PF10 : LCD RESET */ { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_Init(GPIOF,&GPIO_InitStructure); GPIO_ResetBits(GPIOF,GPIO_Pin_10); GPIO_SetBits(GPIOF,GPIO_Pin_10); /* wait for lcd reset */ // rt_thread_delay(1); } /* register lcd device */ _lcd_device.type = RT_Device_Class_Graphic; _lcd_device.init = lcd_init; _lcd_device.open = lcd_open; _lcd_device.close = lcd_close; _lcd_device.control = lcd_control; _lcd_device.read = RT_NULL; _lcd_device.write = RT_NULL; _lcd_device.user_data = &ssd1289_ops; ssd1289_init(); /* register graphic device driver */ rt_device_register(&_lcd_device, "lcd", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE); }
void radio_rtgui_init(void) { rtgui_rect_t rect; rtgui_system_server_init(); /* register dock panel */ rect.x1 = 0; rect.y1 = 0; rect.x2 = 240; rect.y2 = 25; rtgui_panel_register("info", &rect); rtgui_panel_set_nofocused("info"); /* register main panel */ rect.x1 = 0; rect.y1 = 25; rect.x2 = 240; rect.y2 = 320; rtgui_panel_register("main", &rect); rtgui_panel_set_default_focused("main"); //rt_hw_lcd_init(); { #if LCD_VERSION == 1 #include "fmt0371/FMT0371.h" _rtgui_lcd_driver.name = "lcd"; _rtgui_lcd_driver.byte_per_pixel = 2; _rtgui_lcd_driver.width = 240; _rtgui_lcd_driver.height = 320; _rtgui_lcd_driver.draw_hline = fmt_lcd_draw_hline; _rtgui_lcd_driver.draw_raw_hline = fmt_lcd_draw_raw_hline; _rtgui_lcd_driver.draw_vline = fmt_lcd_draw_vline; _rtgui_lcd_driver.get_pixel = fmt_lcd_get_pixel; _rtgui_lcd_driver.set_pixel = fmt_lcd_set_pixel; _rtgui_lcd_driver.screen_update = fmt_lcd_update; _rtgui_lcd_driver.get_framebuffer = fmt_lcd_get_framebuffer; fmt_lcd_init(); #elif LCD_VERSION == 2 #include "ili_lcd_general.h" _rtgui_lcd_driver.name = "lcd"; _rtgui_lcd_driver.byte_per_pixel = 2; _rtgui_lcd_driver.width = 240; _rtgui_lcd_driver.height = 320; _rtgui_lcd_driver.draw_hline = rt_hw_lcd_draw_hline; _rtgui_lcd_driver.draw_raw_hline = rt_hw_lcd_draw_raw_hline; _rtgui_lcd_driver.draw_vline = rt_hw_lcd_draw_vline; _rtgui_lcd_driver.get_pixel = rt_hw_lcd_get_pixel; _rtgui_lcd_driver.set_pixel = rt_hw_lcd_set_pixel; _rtgui_lcd_driver.screen_update = rt_hw_lcd_update; _rtgui_lcd_driver.get_framebuffer = rt_hw_lcd_get_framebuffer; lcd_Initializtion(); #elif LCD_VERSION == 3 #include "ssd1289.h" _rtgui_lcd_driver.name = "lcd"; _rtgui_lcd_driver.byte_per_pixel = 2; _rtgui_lcd_driver.width = 240; _rtgui_lcd_driver.height = 320; _rtgui_lcd_driver.draw_hline = ssd1289_lcd_draw_hline; _rtgui_lcd_driver.draw_raw_hline = ssd1289_lcd_draw_raw_hline; _rtgui_lcd_driver.draw_vline = ssd1289_lcd_draw_vline; _rtgui_lcd_driver.get_pixel = ssd1289_lcd_get_pixel; _rtgui_lcd_driver.set_pixel = ssd1289_lcd_set_pixel; _rtgui_lcd_driver.screen_update = ssd1289_lcd_update; _rtgui_lcd_driver.get_framebuffer = ssd1289_lcd_get_framebuffer; ssd1289_init(); #endif }//rt_hw_lcd_init /* add lcd driver into graphic driver */ rtgui_graphic_driver_add(&_rtgui_lcd_driver); info_init(); player_init(); lcd_backlight_init(); }