您尚未登录。

楼主 #1 2020-07-18 23:28:16

逗倪豌儿
会员
注册时间: 2020-06-09
已发帖子: 23
积分: 18

rtthread+littlevGL+f1c100s卡卡卡

硬件平台:F1C100S  系统主频 408M
软件平台:用的WhyCan 网友staunchheart提供的代码,码云地址https://gitee.com/zhangheyang/f1c100s_rt-thread
改动地方:
只改了800*480的屏幕参数和gt911芯片的中断和复位脚,为了适配自己的板子

问题:
系统跑起来后启动了个littlevGL的titleView的demo,切换界面的时候卡的不行,已经把动画时间设置为0了
还是卡




littlevGL关键代码:

刷新函数

lvgl_rtt_lcd_flush_cb
{
	……
	uint32_t w = lv_area_get_width(area);
    uint32_t *fbp32 = (uint32_t*) info.framebuffer;  // 是我的info.framebuffer
    for (y = area->y1; y <= area->y2 && y < disp_drv->ver_res; y++)
    {
        memcpy(&fbp32[y * info.width + area->x1], color_p, w * sizeof(lv_color_t));
        color_p += w;
    }
	……
	
}

lv缓存初始化函数

rt_err_t lvgl_rtt_init(const char *name)
{
		……
    static lv_color_t buffer[LV_HOR_RES_MAX * LV_VER_RES_MAX];

    static lv_disp_buf_t disp_buf;
    lv_disp_buf_init(&disp_buf, buffer, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX);
    /* littlevGL Display device interface */
    lv_disp_drv_t    disp_drv;
    lv_disp_drv_init(&disp_drv);
		……
}

lv tick函数  lvgl_rtt_tick_run是一个rtt的线程任务函数,在里面进行lv_tick_inc(1);

static void lvgl_rtt_tick_run(void *p)
{
    while (1)
    {
        lv_tick_inc(1);
        rt_thread_delay(1);
    }
}

lv_task_handler函数 :lvgl_demo_run也是自己开启的一个rtt的任务函数,在里面进行lv_task_handler()调用

void lvgl_demo_run(void *p)
{
    /* 新建个样式 */
	static lv_style_t style_desktop;

	static lv_style_t style_tabview;
	static lv_style_t style_label;

	lv_style_copy(&style_desktop, &lv_style_scr);
	style_desktop.body.main_color = LV_COLOR_WHITE;		/* 设置底色 */
	style_desktop.body.grad_color = LV_COLOR_WHITE;		/* 设置渐变色 */

	lv_obj_t *scr = lv_disp_get_scr_act(NULL);				/* 获取当前屏幕 */
	lv_obj_set_style(scr, &style_desktop);					/* 设置样式 */
	
	
	static lv_point_t valid_pos1[] = { { 0, 0 }, { 1, 0 } ,{ 2, 0 } };
	lv_obj_t *tileview;
	tileview = lv_tileview_create(scr, NULL);              // 父亲是main_title
	lv_tileview_set_valid_positions(tileview, valid_pos1, 3);
	lv_tileview_set_edge_flash(tileview, true);
    lv_tileview_set_anim_time(tileview,10);
	lv_tileview_set_tile_act(tileview, 1, 0, LV_ANIM_ON);

	/*
	* left title
	*/
	lv_obj_t * left_title = lv_obj_create(tileview, NULL);
	lv_obj_set_size(left_title, LV_HOR_RES, LV_VER_RES);
	//lv_obj_set_pos(left_title, -LV_HOR_RES, 0);
	lv_obj_set_style(left_title, &lv_style_pretty);
	lv_tileview_add_element(tileview, left_title);

	lv_obj_t * left_label = lv_label_create(left_title, NULL);
	lv_label_set_text(left_label, "left title");
	lv_obj_align(left_label, NULL, LV_ALIGN_CENTER, 0, 0);

	/*
	* mid title
	*/
	lv_obj_t * mid_title = lv_obj_create(tileview, NULL);
	lv_obj_set_size(mid_title, LV_HOR_RES, LV_VER_RES);
	lv_obj_set_pos(mid_title, LV_HOR_RES, 0);
	lv_obj_set_style(mid_title, &lv_style_pretty);
	lv_tileview_add_element(tileview, mid_title);

	lv_obj_t * mid_label = lv_label_create(mid_title, NULL);
	lv_label_set_text(mid_label, "mid title");
	lv_obj_align(mid_label, NULL, LV_ALIGN_CENTER, 0, 0);


	/*
	* right title
	*/
	lv_obj_t * right_title = lv_obj_create(tileview, NULL);
	lv_obj_set_size(right_title, LV_HOR_RES, LV_VER_RES);
	lv_obj_set_pos(right_title, LV_HOR_RES*2, 0);
	lv_obj_set_style(right_title, &lv_style_pretty);
	lv_tileview_add_element(tileview, right_title);

	lv_obj_t * right_label = lv_label_create(right_title, NULL);
	lv_label_set_text(right_label, "right title");
	lv_obj_align(right_label, NULL, LV_ALIGN_CENTER, 0, 0);
	
	
	
	
	
	
    while (1)
    {
        rt_thread_delay(RT_TICK_PER_SECOND / 100);
        lv_task_handler(); // 这里进行lv task任务函数
        
 
    }
}

运行效果如下:
手滑动的时候,界面都是慢慢的切过去的。好慢。
https://whycan.cn/files/members/4433/QQ%E7%9F%AD%E8%A7%86%E9%A2%9120200718232506.mp4

离线

#2 2020-07-19 09:55:07

exculivor
会员
注册时间: 2020-07-19
已发帖子: 2
积分: 2

Re: rtthread+littlevGL+f1c100s卡卡卡

好多做F1C100的,(pS:为啥回帖至少须间隔这么长时间.......)

离线

#3 2021-08-24 16:01:29

逍暗博
会员
注册时间: 2021-06-25
已发帖子: 9
积分: 4.5

Re: rtthread+littlevGL+f1c100s卡卡卡

楼主,  我通过网站下载的编译器bin里面全部时exe文件; 
并且我自己去arm-gcc官网下载编译器后, 每次编译都会报库文件错误;

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn