git-svn-id: https://rt-thread.googlecode.com/svn/trunk@263 bbd45198-f89e-11dd-88c7-29a3b14d5316

This commit is contained in:
aganhx@gmail.com 2009-12-30 12:30:13 +00:00
parent 089427d9c5
commit de899dfc52
5 changed files with 298 additions and 1 deletions

View File

@ -56,7 +56,7 @@ if rtconfig.RT_USING_RTGUI:
src_drv += ['lcd.c']
if rtconfig.RT_USING_DEMO_GUI:
src_drv += ['demo_gui.c']
src_drv += ['gui_init.c','demo_gui.c','info.c']
objs = objs + env.Object(src_bsp + src_drv)

View File

@ -39,6 +39,7 @@
#ifdef RT_USING_RTGUI
extern void rt_hw_lcd_init(void);
extern void rt_hw_key_init(void);
extern void radio_rtgui_init(void);
#endif
void rt_init_thread_entry(void* parameter)
@ -77,6 +78,7 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_RTGUI
{
radio_rtgui_init();
rt_hw_key_init();
}
#endif

33
bsp/mini2440/gui_init.c Normal file
View File

@ -0,0 +1,33 @@
#include "rtthread.h"
#include <rtgui/rtgui.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/rtgui_system.h>
extern void info_init(void);
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);
/* register main panel */
rect.x1 = 0;
rect.y1 = 25;
rect.x2 = 320;
rect.y2 = 320;
rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main");
info_init();
/* player_init(); */
}

90
bsp/mini2440/info.c Normal file
View File

@ -0,0 +1,90 @@
#include <rtgui/rtgui.h>
#include <rtgui/image.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/widgets/workbench.h>
#include "network.xpm"
static rtgui_image_t *rtt_image = RT_NULL;
static rtgui_image_t *network_image = RT_NULL;
static rtgui_image_t *usb_image = RT_NULL;
static rtgui_image_t *power_image = RT_NULL;
static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
{
if (event->type == RTGUI_EVENT_PAINT)
{
struct rtgui_dc* dc;
struct rtgui_rect rect;
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) return RT_FALSE;
rtgui_widget_get_rect(widget, &rect);
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y2 - 1);
/* draw RT-Thread logo */
rtt_image = rtgui_image_create_from_file("hdc",
"/resource/RTT.hdc", RT_FALSE);
if (rtt_image != RT_NULL)
{
rtgui_image_blit(rtt_image, dc, &rect);
rtgui_image_destroy(rtt_image);
rtt_image = RT_NULL;
}
if (network_image != RT_NULL)
{
rect.x1 = rect.x2 - (network_image->w + 2);
rtgui_image_blit(network_image, dc, &rect);
}
rtgui_dc_end_drawing(dc);
return RT_FALSE;
}
return rtgui_view_event_handler(widget, event);
}
static void info_entry(void* parameter)
{
rt_mq_t mq;
struct rtgui_view* view;
struct rtgui_workbench* workbench;
mq = rt_mq_create("qInfo", 256, 4, RT_IPC_FLAG_FIFO);
rtgui_thread_register(rt_thread_self(), mq);
network_image = rtgui_image_create_from_mem("xpm",
(rt_uint8_t*)network_xpm, sizeof(network_xpm), RT_TRUE);
workbench = rtgui_workbench_create("info", "workbench");
if (workbench == RT_NULL) return;
view = rtgui_view_create("view");
rtgui_widget_set_event_handler(RTGUI_WIDGET(view), view_event_handler);
rtgui_workbench_add_view(workbench, view);
rtgui_view_show(view, RT_FALSE);
rtgui_workbench_event_loop(workbench);
rtgui_thread_deregister(rt_thread_self());
rt_mq_delete(mq);
}
void info_init()
{
rt_thread_t tid;
tid = rt_thread_create("info",
info_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL) rt_thread_startup(tid);
}

172
bsp/mini2440/network.xpm Normal file
View File

@ -0,0 +1,172 @@
/* XPM */
static char * network_xpm[] = {
"24 24 145 2",
" c None",
". c #6C6E6A",
"+ c #676965",
"@ c #6B6D6A",
"# c #C6C8C4",
"$ c #F0F1F0",
"% c #F1F1F0",
"& c #C8CAC6",
"* c #646662",
"= c #446795",
"- c #27508B",
"; c #2A538D",
"> c #2E558F",
", c #315890",
"' c #355B92",
") c #385E94",
"! c #3C6196",
"~ c #5C7BA2",
"{ c #F2F3F2",
"] c #626460",
"^ c #F2F2F2",
"/ c #3E6297",
"( c #86ACD5",
"_ c #88AED6",
": c #8BB0D7",
"< c #8DB1D7",
"[ c #8CB1D7",
"} c #8CB0D6",
"| c #8DAED6",
"1 c #5B7AA7",
"2 c #F4F4F4",
"3 c #61635F",
"4 c #30578F",
"5 c #88ADD6",
"6 c #8EB1D7",
"7 c #92B3D8",
"8 c #96B6D8",
"9 c #92B2D6",
"0 c #8CADD3",
"a c #84A7CF",
"b c #5F615D",
"c c #204A87",
"d c #6694C7",
"e c #6391C5",
"f c #618FC3",
"g c #5E8CC1",
"h c #5B8ABF",
"i c #5887BD",
"j c #5684BB",
"k c #5D5F5B",
"l c #5D8CC0",
"m c #5A89BE",
"n c #5886BD",
"o c #5584BB",
"p c #5281B9",
"q c #4F7FB7",
"r c #4D7CB5",
"s c #5C5E5A",
"t c #5482BA",
"u c #5180B8",
"v c #4F7EB6",
"w c #4C7BB4",
"x c #4979B2",
"y c #4676B1",
"z c #4373AF",
"A c #5A5C58",
"B c #406492",
"C c #31527F",
"D c #656D70",
"E c #5E605B",
"F c #C3C4C1",
"G c #80827F",
"H c #C8CAC7",
"I c #545651",
"J c #5E605C",
"K c #6A6E68",
"L c #72756F",
"M c #7B7E79",
"N c #848781",
"O c #8D908A",
"P c #969993",
"Q c #9FA29C",
"R c #416593",
"S c #244E89",
"T c #29518C",
"U c #2D558E",
"V c #325991",
"W c #375C93",
"X c #3B6096",
"Y c #5D7BA3",
"Z c #555753",
"` c #D0D2CE",
" . c #BBBEB7",
".. c #BABDB6",
"+. c #F2F2F1",
"@. c #345A92",
"#. c #81A8D3",
"$. c #83ABD4",
"%. c #8AAFD6",
"&. c #8FB3D8",
"*. c #92B4DA",
"=. c #5978A6",
"-. c #D2D4D1",
";. c #2C548E",
">. c #85ACD5",
",. c #92B5DA",
"'. c #98B9DB",
"). c #95B6DA",
"!. c #90B2D7",
"~. c #88ACD3",
"{. c #464644",
"]. c #719ECE",
"^. c #6E9BCC",
"/. c #6A98C9",
"(. c #6794C7",
"_. c #608EC2",
":. c #5C8BC0",
"<. c #757773",
"[. c #DADAD9",
"}. c #6391C4",
"|. c #5F8DC2",
"1. c #5C8ABF",
"2. c #5181B8",
"3. c #7F817C",
"4. c #ECECEA",
"5. c #5B89BF",
"6. c #5483BA",
"7. c #4D7DB6",
"8. c #4A7AB3",
"9. c #4776B1",
"0. c #80827D",
"a. c #EEEEEC",
"b. c #3F6392",
"c. c #82847F",
"d. c #848680",
"e. c #7F817D",
"f. c #7D7F7B",
"g. c #666863",
"h. c #A8ACA5",
"i. c #B1B3AC",
"j. c #E1E1DE",
"k. c #EDEDEB",
"l. c #E0E0DE",
"m. c #565854",
"n. c #767874",
" ",
" . + + + + + + + + + . ",
" @ # $ % % % % % % % $ & @ ",
" * $ = - ; > , ' ) ! ~ { * ",
" ] ^ / ( _ : < [ } | 1 2 ] ",
" 3 % 4 5 6 7 8 9 0 a ) % 3 ",
" b % c d e f g h i j c % b ",
" k % c l m n o p q r c % k ",
" s % c t u v w x y z c % s ",
" A $ B c c c c c c C D + + + + + + + + + . ",
" E F $ % % % % % % G # $ % % % % % % % $ H @ ",
" I J K L M N O P Q * $ R c S T U V W X Y { * ",
" Z ` .............] +.@.#.$.( %.[ &.*.=.2 ] ",
" Z -.+.+.+.+.+.+.+.3 % ;.>.: ,.'.).!.~.W % 3 ",
" {.Z Z Z Z Z Z Z Z b % c ].^./.(.e _.:.c % b ",
" <.[.<. k % c d }.|.1.i o 2.c % k ",
" 3.4.3. s % c 5.i 6.u 7.8.9.c % s ",
" 0.a.0. A $ B c c c c c c c b.$ A ",
" c...c. E F $ % % % % % % % $ F E ",
" 0.a.0.d.0.e.f.g.J K L M N O P Q h.i.J I ",
" 0.j.a...a.k.l.m.` ............... .` Z ",
" 0.0.c.0.3.n.Z -.+.+.+.+.+.+.+.+.+.-.Z ",
" {.Z Z Z Z Z Z Z Z Z Z Z {. ",
" "};