Hi,
I’m using NXP hardware with ST7565 LCD (128*64)
Currently, I’m using LVGL v7.11 version code in my project and everything works nice. Now I want to move to version 8.0 but it is not working as expected. System is getting crash with ported (V8.0) code.
I have followed all steps to initialize the buffer and driver as mentioned in porting doc of v8.0.
Please let me where I’m going wrong.
Here are v8.0 related changes
/Create a display buffer/
static lv_disp_draw_buf_t disp_buf;
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10];
lv_disp_draw_buf_init(&disp_buf, buf1_1, NULL, LV_HOR_RES_MAX * 10);
/*Create a display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.hor_res = LV_HOR_RES_MAX;
disp_drv.ver_res = LV_VER_RES_MAX;
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = displayFlush;
lv_disp_drv_register(&disp_drv);
void displayFlush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/Return if the area is out the screen/
if(area->x2 < 0) return;
if(area->y2 < 0) return;
if(area->x1 > LV_HOR_RES_MAX - 1) return;
if(area->y1 > LV_VER_RES_MAX - 1) return;
/*Truncate the area to the screen*/
int32_t act_x1 = area->x1 < 0 ? 0 : area->x1;
int32_t act_y1 = area->y1 < 0 ? 0 : area->y1;
int32_t act_x2 = area->x2 > LV_HOR_RES_MAX - 1 ? LV_HOR_RES_MAX - 1 : area->x2;
int32_t act_y2 = area->y2 > LV_VER_RES_MAX - 1 ? LV_VER_RES_MAX - 1 : area->y2;
int32_t x, y;
/*Set the first row in */
/*Refresh frame buffer*/
for(y = act_y1; y <= act_y2; y++) {
for(x = act_x1; x <= act_x2; x++) {
if(lv_color_to1(*color_p) != 0) {
lcd_fb[x + (y / 8)*LV_HOR_RES_MAX] &= ~(1 << (7 - (y % 8)));
} else {
lcd_fb[x + (y / 8)*LV_HOR_RES_MAX] |= (1 << (7 - (y % 8)));
}
color_p ++;
}
color_p += area->x2 - act_x2; /*Next row*/
}
displaySync(act_x1, act_y1, act_x2, act_y2);
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
static void displaySync(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
{
uint8_t c, p;
for(p = y1 / 8; p <= y2 / 8; p++) {
sendCommandParallel(CMD_SET_PAGE | pagemap[p]);
sendCommandParallel(CMD_SET_COLUMN_LOWER | (x1 & 0xf));
sendCommandParallel(CMD_SET_COLUMN_UPPER | ((x1 >> 4) & 0xf));
sendCommandParallel(CMD_RMW);
for(c = x1; c <= x2; c++) {
sendDataParallel(lcd_fb[(LV_HOR_RES_MAX * p) + c]);
}
}
}
and creating a label to display some text.
Thanks…