Setting rotated option in lv_disp_drv_t causes hard fault

Here is the code which worked me in the simulator:


void get_col(const lv_color_t * src, const lv_area_t * area, lv_coord_t y, lv_color_t * dest)
{
    lv_coord_t w = lv_area_get_width(area);
    lv_coord_t h = lv_area_get_height(area);

    lv_coord_t i;
    for(i = 0; i < h; i++) {
        dest[i].full = src[y].full;
        src += w ;
    }
}

void monitor_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) 
{
    lv_coord_t x2 = area->x2;
    if(x2 >= disp_drv->ver_res) x2 = MONITOR_VER_RES - 1;

    lv_color_t * dest = (lv_color_t *)monitor.tft_fb;
    dest +=  MONITOR_HOR_RES * (MONITOR_VER_RES - 1);
    dest -= MONITOR_HOR_RES * area->x1;

    lv_coord_t x;
    for(x = area->x1; x <= x2; x++) {
          get_col(color_p, area, (x - area->x1), dest + area->y1);
          dest -= MONITOR_HOR_RES;
    }
}

image

1 Like