Description
hi, i am new here. hope i found the right place for my question.
i wonder if it is possible to refresh the display contents during the vertical sync/blank.
What MCU/Processor/Board and compiler are you using?
STM32F429 with a 480x272 TFT display.
What do you want to achieve?
avoid flicker, if memory is limited (no doublebuffer) and the framebuffer is directly displayed (direct_mode).
What have you tried so far?
- initialize the STM32F429 and its LTDC to generate an interrupt at the last line drawn on the TFT (about 1.2msec/20lines left until LTDC draws the first line)
- set a volatile variable in disp_drv.flush_cb and store all arguments
- within the ISR: copy the buffer contents to the framebuffer.
Code to reproduce
static volatile lv_disp_drv_t *mDispDrv;
static volatile lv_area_t *mArea;
static volatile lv_color_t *mColorP;
static volatile bool mRequest = false;
void lv_port_disp_init(void) {
static lv_disp_draw_buf_t draw_buf_dsc_4;
lv_disp_draw_buf_init(&draw_buf_dsc_4, (void *)alLtdcFb, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES);
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = MY_DISP_HOR_RES;
disp_drv.ver_res = MY_DISP_VER_RES;
disp_drv.flush_cb = disp_flush_request;
disp_drv.draw_buf = &draw_buf_dsc_4;
disp_drv.direct_mode = 1;
lv_disp_drv_register(&disp_drv);
}
static void disp_flush_request(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
if (!mRequest) {
mDispDrv = disp_drv;
mArea = area;
mColorP = color_p;
mRequest = true;
}
}
static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) {
int32_t x, y;
for (y = area->y1; y <= area->y2; y++) {
for (x = area->x1; x <= area->x2; x++) {
alLtdcFb[x + y * disp_drv->hor_res] = color_p->full;
color_p++;
}
}
lv_disp_flush_ready(disp_drv);
}
void lv_port_disp_flush_ISR(void) {
if (mRequest) {
disp_flush(mDispDrv, mArea, mColorP);
mRequest = false;
}
}
… i know, the above code has some race conditions. but i wonder, if this could be a way to get flicker free (vblank synced) direct_mode.