remove RT-Thread/GUI dependence.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1062 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-11-18 12:33:52 +00:00
parent d9cb84f484
commit b300351874
3 changed files with 7 additions and 52 deletions

View File

@ -50,12 +50,15 @@ void thread_test()
} }
FINSH_FUNCTION_EXPORT(thread_test, test thread!!); FINSH_FUNCTION_EXPORT(thread_test, test thread!!);
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui.h> #include <rtgui/rtgui.h>
#include <rtgui/event.h> #include <rtgui/event.h>
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>
#endif
int rt_application_init() int rt_application_init()
{ {
#ifdef RT_USING_RTGUI
rtgui_rect_t rect; rtgui_rect_t rect;
rtgui_system_server_init(); rtgui_system_server_init();
@ -76,57 +79,9 @@ int rt_application_init()
rtgui_panel_set_default_focused("main"); rtgui_panel_set_default_focused("main");
rt_hw_lcd_init(); rt_hw_lcd_init();
#endif
/* init example workbench */
// workbench_init();
return 0; return 0;
} }
/* key simulator */
static struct rtgui_event_kbd kbd_event;
void key_simulator(int key)
{
/* init keyboard event */
RTGUI_EVENT_KBD_INIT(&kbd_event);
kbd_event.mod = RTGUI_KMOD_NONE;
kbd_event.unicode = 0;
kbd_event.type = RTGUI_KEYDOWN;
kbd_event.key = key;
/* post down event */
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
/* delay to post up event */
rt_thread_delay(50);
/* post up event */
kbd_event.type = RTGUI_KEYUP;
rtgui_server_post_event(&(kbd_event.parent), sizeof(kbd_event));
}
void left()
{
key_simulator(RTGUIK_LEFT);
}
FINSH_FUNCTION_EXPORT(left, left key);
void right()
{
key_simulator(RTGUIK_LEFT);
}
FINSH_FUNCTION_EXPORT(right, right key);
void down()
{
key_simulator(RTGUIK_DOWN);
}
FINSH_FUNCTION_EXPORT(down, down key);
void up()
{
key_simulator(RTGUI_KEYUP);
}
FINSH_FUNCTION_EXPORT(up, up key);
/*@}*/ /*@}*/

View File

@ -13,6 +13,7 @@
*/ */
#include <rtthread.h> #include <rtthread.h>
#ifdef RT_USING_RTGUI
#include <soc3210.h> #include <soc3210.h>
#include <rtgui/driver.h> #include <rtgui/driver.h>
#include <rtgui/color.h> #include <rtgui/color.h>
@ -171,10 +172,8 @@ void lcd_init()
rt_kprintf("HVLEN 0x%08x\n", LCD_HVLEN); rt_kprintf("HVLEN 0x%08x\n", LCD_HVLEN);
rt_kprintf("HSB_MISC 0x%08x\n", HSB_MISC_REG); rt_kprintf("HSB_MISC 0x%08x\n", HSB_MISC_REG);
#ifdef RT_USING_RTGUI
/* add lcd driver into graphic driver */ /* add lcd driver into graphic driver */
rtgui_graphic_driver_add(&_rtgui_lcd_driver); rtgui_graphic_driver_add(&_rtgui_lcd_driver);
#endif
} }
FINSH_FUNCTION_EXPORT(lcd_init, init lcd); FINSH_FUNCTION_EXPORT(lcd_init, init lcd);
@ -182,3 +181,4 @@ void rt_hw_lcd_init()
{ {
lcd_init(); lcd_init();
} }
#endif

View File

@ -130,7 +130,7 @@
#define RT_LWIP_ETHTHREAD_STACKSIZE 512 #define RT_LWIP_ETHTHREAD_STACKSIZE 512
/* SECTION: RT-Thread/GUI */ /* SECTION: RT-Thread/GUI */
#define RT_USING_RTGUI /* #define RT_USING_RTGUI */
/* name length of RTGUI object */ /* name length of RTGUI object */
#define RTGUI_NAME_MAX 12 #define RTGUI_NAME_MAX 12