OpenEdv-开源电子网

 找回密码
 立即注册
查看: 5896|回复: 6
打印 上一主题 下一主题

求助 lvgl7.1移植完不显示控件 stm32F405RG

[复制链接]

0

主题

2

帖子

0

精华

新手入门

积分
14
金钱
14
注册时间
2020-1-6
在线时间
7 小时
跳转到指定楼层
楼主
发表于 2021-1-30 16:51:34 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式
1金钱
本帖最后由 GraetproX 于 2021-1-30 16:54 编辑

rt,板子是stm32f405rgt6 屏幕是ili9488
移植完之后什么都不显示,只有一片白
有没有大神知道是什么原因




lv_port_disp.c

#if 1
#include "lv_port_disp.h"
#include "lcd.h"
#include "gui.h"

#define COLOR_BUF_SIZE (LV_HOR_RES_MAX*LV_VER_RES_MAX)

static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);

void lv_port_disp_init(void)
{
    /*-----------------------------
     * Create a buffer for drawing
     *----------------------------*/
    /* Example for 1) */
    static lv_disp_buf_t disp_buf_1;
    static lv_color_t buf1_1[LV_HOR_RES_MAX * 10];                      /*A buffer for 10 rows*/
    lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10);   /*Initialize the display buffer*/

    /*-----------------------------------
     * Register the display in LittlevGL
     *----------------------------------*/

    lv_disp_drv_t disp_drv;                         /*Descriptor of a display driver*/
    lv_disp_drv_init(&disp_drv);                    /*Basic initialization*/

    /*Set up the functions to access to your display*/

    /*Set the resolution of the display*/
    disp_drv.hor_res = lcddev.width;
    disp_drv.ver_res = lcddev.height;
               

    /*Used to copy the buffer's content to the display*/
    disp_drv.flush_cb = disp_flush;

    /*Set a display buffer*/
    disp_drv.buffer = &disp_buf_1;

#if LV_USE_GPU
    /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/

    /*Blend two color array using opacity*/
    disp_drv.gpu_blend = gpu_blend;

    /*Fill a memory array with a color*/
    disp_drv.gpu_fill = gpu_fill;
#endif

    /*Finally register the driver*/
    lv_disp_drv_register(&disp_drv);
}


static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
         
          LCD_Fill(area->x1,area->y1,area->x2,area->y2,color_p->full);
        
    lv_disp_flush_ready(disp_drv);//???????,?? lvgl ???? flushing ?????
}

#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif


回复

使用道具 举报

0

主题

2

帖子

0

精华

新手入门

积分
14
金钱
14
注册时间
2020-1-6
在线时间
7 小时
2#
 楼主| 发表于 2021-1-30 16:52:28 | 显示全部楼层
main.c

#include "delay.h"
#include "sys.h"
#include "lcd.h"
#include "touch.h"
#include "gui.h"
#include "test.h"
#include "lv_port_disp.h"
#include "lv_port_indev.h"

void lvgl_first_demo_start(void);

int main(void)
{       
        delay_init(168);     //3õê¼»ˉÑóê±oˉêy
        LCD_Init();           //òo¾§Æá3õê¼»ˉ
       
        lv_init(); //lvgl ?????
        lv_port_disp_init();
//        lv_port_indev_init();
        LCD_Fill(0,0,lcddev.width,lcddev.height,GREEN);
       
        lvgl_first_demo_start();

        while(1)
        {
                lv_tick_inc(1);
                lv_task_handler();
        }
}

void lvgl_first_demo_start(void)
{
    lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);     /*Add a button the current screen*/
    lv_obj_set_pos(btn, 1, 1);                            /*Set its position*/
    lv_obj_set_size(btn, 12, 5);                          /*Set its size*/
//    lv_obj_set_event_cb(btn, btn_event_cb);                 /*Assign a callback to the button*/

    lv_obj_t * label = lv_label_create(btn, NULL);          /*Add a label to the button*/
    lv_label_set_text(label, "Button");                     /*Set the labels text*/


        lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
        lv_label_set_text(label1, "Hello world!");
        lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);
        lv_obj_align(btn, label1, LV_ALIGN_OUT_TOP_MID, 0, -10);
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

原子哥极力推荐上一条 /1 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2026-3-15 10:00

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表