|
本帖最后由 自学STM32 于 2012-10-12 00:54 编辑
这两天一直在学习RTT,有个问题困惑着,
int rt_application_init()
{
rt_thread_t init_thread;
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, 8, 20);
if (init_thread != RT_NULL)
{
rt_thread_startup(init_thread);
}
return 0;
}
建立的init线程系统是怎么知道他只要运行一次 然后在idle线程里把init线程删除的,什么原理?
还有就是不知道怎么用RTGUI,我用的是ILI9328 2.8寸的TFT ,设置成横屏模式,现在可以画水平直线 垂直直线 任意坐标画指定长度的水平直线,我主要是为了学习RT-Thread系统,在驱动文件里已经加上下面的代码:
struct rt_device_graphic_ops lcd_ili_ops =
{
rt_hw_lcd_set_pixel,
rt_hw_lcd_get_pixel,
rt_hw_lcd_draw_hline,
rt_hw_lcd_draw_vline,
rt_hw_lcd_draw_blit_line
};
struct rt_device _lcd_device;
static rt_err_t lcd_init(rt_device_t dev)
{
return RT_EOK;
}
static rt_err_t lcd_open(rt_device_t dev, rt_uint16_t oflag)
{
return RT_EOK;
}
static rt_err_t lcd_close(rt_device_t dev)
{
return RT_EOK;
}
static rt_err_t lcd_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{
switch (cmd)
{
case RTGRAPHIC_CTRL_GET_INFO:
{
struct rt_device_graphic_info *info;
info = (struct rt_device_graphic_info*) args;
RT_ASSERT(info != RT_NULL);
info->bits_per_pixel = 16;
info->pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
info->framebuffer = RT_NULL;
info->width = 320;
info->height = 240;
}
break;
case RTGRAPHIC_CTRL_RECT_UPDATE:
/* nothong to be done */
break;
default:
break;
}
return RT_EOK;
}
void rt_hw_lcd_init(void)
{
/* 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 = &lcd_ili_ops;
ILI9328_CPT28_Initial();
/* register graphic device driver */
rt_device_register(&_lcd_device, "lcd",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
}
也把RTGUI的代码加进来了
void rtgui_system_server_init(void)
{
/* init image */
rtgui_system_image_init();
/* init font */
rtgui_font_system_init();
/* init rtgui server */
rtgui_topwin_init();
rtgui_server_init();
/* init theme */
rtgui_system_theme_init();
}
static void rt_init_thread_entry(void* parameter)
{
extern void rtgui_system_server_init(void);
extern void rt_hw_lcd_init();
extern void rtgui_touch_hw_init(void);
rt_device_t lcd;
/* init lcd */
rt_hw_lcd_init();
/* init touch panel */
//rtgui_touch_hw_init();
/* re-init device driver */
rt_device_init_all();
/* find lcd device */
lcd = rt_device_find("lcd");
/* set lcd device as rtgui graphic driver */
rtgui_graphic_set_device(lcd);
/* init rtgui system server */
rtgui_system_server_init();
}
触摸屏 rtgui_touch_hw_init(); 没有运行,先不考虑,我想等把基本GUI跑起来再搞,这样应该没有问题吧,启动以后FINSH超级终端显示
关于ILI9328的问题我在STM32版块的求助http://www.amobbs.com/thread-5500902-1-1.html |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|