Okay, I’m trying to change my LCD_flush function, now I solved a few problem.
First of all, the color value wasn’t reflected in LCD_flush.
That’s because I set 3rd parameter of LCD_flush() as a pointer value of color_map.
Instead of that, I changed it to get the real value contained in the address.
Former LCD_flush
void LCD_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
uint16_t x, y;
uint32_t size = (area->x2 - area->x1 + 1) * (area->y2 - area->y1 + 1);
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
LCD_DrawPaint((uint16_t ) area->x1, (uint16_t ) area->y1, (uint16_t *)color_map);
color_map++;
}
}
lv_disp_flush_ready(drv);
DEV_Digital_Write(DEV_CS_PIN, 1);
}
Revised
void LCD_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
//DEV_Digital_Write(DEV_DC_PIN, 1);
lv_color_t color = *color_map;
LCD_DrawPaint(area->x2, area->y2, (uint16_t)color.full);
lv_disp_flush_ready(drv);
DEV_Digital_Write(DEV_CS_PIN, 1);
}
void LCD_DrawPaint(uint16_t x, uint16_t y, uint16_t Color)
{
LCD_SetCursor(x, y);
LCD_WriteData_Word(Color);
}
After that, I can watch the specific pixel (the coordinate x2 = 52, y2 = 43, that I set in App_Start()) color is changed.
This is only effective when I put the test line.
I set the specific color and area and called the LCD_flush.
nothing is changed when I delete LCD_flush(&disp_drv, &area, &my_color); line.
int lv_config_main(void)
{
static lv_disp_draw_buf_t disp_buf;
static lv_color_t buf_1[LV_HOR_RES_MAX*10];
//static lv_color_t buf_2[LV_HOR_RES_MAX * 10];
lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, LV_HOR_RES_MAX * 10);
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
lv_area_t area;
lv_color_t my_color;
my_color.ch.red = (uint16_t)0x06;
my_color.ch.green_h = (uint16_t)0x06;
my_color.ch.green_l = (uint16_t)0x03;
my_color.ch.blue = (uint16_t)0x08;
area.x1 = 0;
area.y1 = 0;
area.x2 = 52;
area.y2 = 43;
LCD_flush(&disp_drv, &area, &my_color);
disp_drv.flush_cb = LCD_flush;
lv_disp_t * disp_ex;
disp_ex = lv_disp_drv_register(&disp_drv);
}
I guess it is big progress, there are still a lot of problems to be solved, though.