diff --git a/src/lv_api_map.h b/src/lv_api_map.h index 918d475e3a..d19650e904 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -31,7 +31,6 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ - static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void) { return lv_timer_handler(); diff --git a/src/lv_core/lv_disp.c b/src/lv_core/lv_disp.c index f7165550bb..728074afa0 100644 --- a/src/lv_core/lv_disp.c +++ b/src/lv_core/lv_disp.c @@ -365,8 +365,8 @@ void lv_disp_clean_dcache(lv_disp_t * disp) return; } - if(disp->driver.clean_dcache_cb) - disp->driver.clean_dcache_cb(&disp->driver); + if(disp->driver->clean_dcache_cb) + disp->driver->clean_dcache_cb(disp->driver); } /** diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 8bb5692d09..c36dc36b0f 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -325,14 +325,14 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point) static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) { lv_disp_t *disp = i->driver.disp; - if(disp->driver.rotated == LV_DISP_ROT_180 || disp->driver.rotated == LV_DISP_ROT_270) { - data->point.x = disp->driver.hor_res - data->point.x - 1; - data->point.y = disp->driver.ver_res - data->point.y - 1; + if(disp->driver->rotated == LV_DISP_ROT_180 || disp->driver->rotated == LV_DISP_ROT_270) { + data->point.x = disp->driver->hor_res - data->point.x - 1; + data->point.y = disp->driver->ver_res - data->point.y - 1; } - if(disp->driver.rotated == LV_DISP_ROT_90 || disp->driver.rotated == LV_DISP_ROT_270) { + if(disp->driver->rotated == LV_DISP_ROT_90 || disp->driver->rotated == LV_DISP_ROT_270) { lv_coord_t tmp = data->point.y; data->point.y = data->point.x; - data->point.x = disp->driver.ver_res - tmp - 1; + data->point.x = disp->driver->ver_res - tmp - 1; } /*Move the cursor if set and moved*/ if(i->cursor != NULL && diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index 80b096c27a..a8707a9d26 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -139,7 +139,7 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p) return; } - if(disp->driver.rounder_cb) disp->driver.rounder_cb(&disp->driver, &com_area); + if(disp->driver->rounder_cb) disp->driver->rounder_cb(disp->driver, &com_area); /*Save only if this area is not in one of the saved areas*/ uint16_t i; @@ -233,8 +233,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) elaps = lv_tick_elaps(start); /*Call monitor cb if present*/ - if(disp_refr->driver.monitor_cb) { - disp_refr->driver.monitor_cb(&disp_refr->driver, elaps, px_num); + if(disp_refr->driver->monitor_cb) { + disp_refr->driver->monitor_cb(disp_refr->driver, elaps, px_num); } } @@ -384,15 +384,15 @@ static void lv_refr_areas(void) } } - disp_refr->driver.buffer->last_area = 0; - disp_refr->driver.buffer->last_part = 0; + disp_refr->driver->draw_buf->last_area = 0; + disp_refr->driver->draw_buf->last_part = 0; for(i = 0; i < disp_refr->inv_p; i++) { /*Refresh the unjoined areas*/ if(disp_refr->inv_area_joined[i] == 0) { - if(i == last_i) disp_refr->driver.buffer->last_area = 1; - disp_refr->driver.buffer->last_part = 0; + if(i == last_i) disp_refr->driver->draw_buf->last_area = 1; + disp_refr->driver->draw_buf->last_part = 0; lv_refr_area(&disp_refr->inv_areas[i]); px_num += lv_area_get_size(&disp_refr->inv_areas[i]); @@ -409,17 +409,17 @@ static void lv_refr_area(const lv_area_t * area_p) /*True double buffering: there are two screen sized buffers. Just redraw directly into a * buffer*/ if(lv_disp_is_true_double_buf(disp_refr)) { - lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp_refr); vdb->area.x1 = 0; vdb->area.x2 = lv_disp_get_hor_res(disp_refr) - 1; vdb->area.y1 = 0; vdb->area.y2 = lv_disp_get_ver_res(disp_refr) - 1; - disp_refr->driver.buffer->last_part = 1; + disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); } /*The buffer is smaller: refresh the area in parts*/ else { - lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp_refr); /*Calculate the max row num*/ lv_coord_t w = lv_area_get_width(area_p); lv_coord_t h = lv_area_get_height(area_p); @@ -431,7 +431,7 @@ static void lv_refr_area(const lv_area_t * area_p) if(max_row > h) max_row = h; /*Round down the lines of VDB if rounding is added*/ - if(disp_refr->driver.rounder_cb) { + if(disp_refr->driver->rounder_cb) { lv_area_t tmp; tmp.x1 = 0; tmp.x2 = 0; @@ -440,7 +440,7 @@ static void lv_refr_area(const lv_area_t * area_p) lv_coord_t h_tmp = max_row; do { tmp.y2 = h_tmp - 1; - disp_refr->driver.rounder_cb(&disp_refr->driver, &tmp); + disp_refr->driver->rounder_cb(disp_refr->driver, &tmp); /*If this height fits into `max_row` then fine*/ if(lv_area_get_height(&tmp) <= max_row) break; @@ -470,7 +470,7 @@ static void lv_refr_area(const lv_area_t * area_p) vdb->area.y2 = row + max_row - 1; if(vdb->area.y2 > y2) vdb->area.y2 = y2; row_last = vdb->area.y2; - if(y2 == row_last) disp_refr->driver.buffer->last_part = 1; + if(y2 == row_last) disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); } @@ -482,7 +482,7 @@ static void lv_refr_area(const lv_area_t * area_p) vdb->area.y1 = row; vdb->area.y2 = y2; - disp_refr->driver.buffer->last_part = 1; + disp_refr->driver->draw_buf->last_part = 1; lv_refr_area_part(area_p); } } @@ -494,10 +494,10 @@ static void lv_refr_area(const lv_area_t * area_p) */ static void lv_refr_area_part(const lv_area_t * area_p) { - lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp_refr); while(vdb->flushing) { - if(disp_refr->driver.wait_cb) disp_refr->driver.wait_cb(&disp_refr->driver); + if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver); } lv_obj_t * top_act_scr = NULL; @@ -833,7 +833,7 @@ static void lv_refr_vdb_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * co * Rotate the VDB to the display's native orientation. */ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { - lv_disp_drv_t * drv = &disp_refr->driver; + lv_disp_drv_t * drv = disp_refr->driver; if(lv_disp_is_true_double_buf(disp_refr) && drv->sw_rotate) { LV_LOG_ERROR("cannot rotate a true double-buffered display!"); return; @@ -844,7 +844,7 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { } else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) { /*Allocate a temporary buffer to store rotated image */ lv_color_t * rot_buf = NULL; - lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp_refr); lv_coord_t area_w = lv_area_get_width(area); lv_coord_t area_h = lv_area_get_height(area); /*Determine the maximum number of rows that can be rotated at a time*/ @@ -907,24 +907,24 @@ static void lv_refr_vdb_rotate(lv_area_t *area, lv_color_t *color_p) { */ static void lv_refr_vdb_flush(void) { - lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp_refr); lv_color_t * color_p = vdb->buf_act; vdb->flushing = 1; - if(disp_refr->driver.buffer->last_area && disp_refr->driver.buffer->last_part) vdb->flushing_last = 1; + if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) vdb->flushing_last = 1; else vdb->flushing_last = 0; /*Flush the rendered content to the display*/ lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver); - if(disp->driver.flush_cb) { + if(disp->driver->flush_cb) { /*Rotate the buffer to the display's native orientation if necessary*/ - if(disp->driver.rotated != LV_DISP_ROT_NONE && disp->driver.sw_rotate) { + if(disp->driver->rotated != LV_DISP_ROT_NONE && disp->driver->sw_rotate) { lv_refr_vdb_rotate(&vdb->area, vdb->buf_act); } else { - call_flush_cb(&disp->driver, &vdb->area, color_p); + call_flush_cb(disp->driver, &vdb->area, color_p); } } if(vdb->buf1 && vdb->buf2) { diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index 8f3760bbb1..9d2db88b65 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -84,7 +84,7 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co #define FILL_NORMAL_MASK_PX_SCR_TRANSP(out_x, color) \ if(*mask_tmp_x) { \ if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[out_x] = color; \ - else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_first[out_x], disp_buf_first[out_x].ch.alpha, \ + else if(disp->driver->screen_transp) lv_color_mix_with_alpha(disp_buf_first[out_x], disp_buf_first[out_x].ch.alpha, \ color, *mask_tmp_x, &disp_buf_first[out_x], &disp_buf_first[out_x].ch.alpha); \ else disp_buf_first[out_x] = lv_color_mix(color, disp_buf_first[out_x], *mask_tmp_x); \ } \ @@ -100,7 +100,7 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co #define MAP_NORMAL_MASK_PX_SCR_TRANSP(x) \ if(*mask_tmp_x) { \ if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[x] = map_buf_first[x]; \ - else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, \ + else if(disp->driver->screen_transp) lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, \ map_buf_first[x], *mask_tmp_x, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); \ else disp_buf_first[x] = lv_color_mix(map_buf_first[x], disp_buf_first[x], *mask_tmp_x); \ } \ @@ -132,11 +132,11 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_ if(mask_res == LV_DRAW_MASK_RES_TRANSP) return; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; lv_color_t * disp_buf = vdb->buf_act; - if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -153,13 +153,13 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_ draw_area.y2 -= disp_area->y1; /*Round the values in the mask if anti-aliasing is disabled*/ - if(mask && disp->driver.antialiasing == 0 && mask) { + if(mask && disp->driver->antialiasing == 0 && mask) { int32_t mask_w = lv_area_get_width(&draw_area); int32_t i; for(i = 0; i < mask_w; i++) mask[i] = mask[i] > 128 ? LV_OPA_COVER : LV_OPA_TRANSP; } - if(disp->driver.set_px_cb) { + if(disp->driver->set_px_cb) { fill_set_px(disp_area, disp_buf, &draw_area, color, opa, mask, mask_res); } else if(mode == LV_BLEND_MODE_NORMAL) { @@ -202,11 +202,11 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a if(!is_common) return; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; lv_color_t * disp_buf = vdb->buf_act; - if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver); /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ @@ -216,13 +216,13 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a draw_area.y2 -= disp_area->y1; /*Round the values in the mask if anti-aliasing is disabled*/ - if(mask && disp->driver.antialiasing == 0) + if(mask && disp->driver->antialiasing == 0) { int32_t mask_w = lv_area_get_width(&draw_area); int32_t i; for(i = 0; i < mask_w; i++) mask[i] = mask[i] > 128 ? LV_OPA_COVER : LV_OPA_TRANSP; } - if(disp->driver.set_px_cb) { + if(disp->driver->set_px_cb) { map_set_px(disp_area, disp_buf, &draw_area, map_area, map_buf, opa, mask, mask_res); } else if(mode == LV_BLEND_MODE_NORMAL) { @@ -255,7 +255,7 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) { for(y = draw_area->y1; y <= draw_area->y2; y++) { for(x = draw_area->x1; x <= draw_area->x2; x++) { - disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color, opa); + disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, color, opa); } } } @@ -271,7 +271,7 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con for(y = draw_area->y1; y <= draw_area->y2; y++) { for(x = draw_area->x1; x <= draw_area->x2; x++) { if(mask_tmp[x]) { - disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color, + disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, color, (uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8); } } @@ -335,8 +335,8 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co } #endif - if(disp->driver.gpu_fill_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) { - disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color); + if(disp->driver->gpu_fill_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) { + disp->driver->gpu_fill_cb(disp->driver, disp_buf, disp_w, draw_area, color); return; } @@ -374,7 +374,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co last_dest_color = disp_buf_first[x]; #if LV_COLOR_SCREEN_TRANSP - if(disp->driver.screen_transp) { + if(disp->driver->screen_transp) { lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, color, opa, &last_res_color, &last_res_color.ch.alpha); } @@ -473,7 +473,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co (uint32_t)((uint32_t)(*mask_tmp_x) * opa) >> 8; if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_first[x].full) { #if LV_COLOR_SCREEN_TRANSP - if(disp->driver.screen_transp) { + if(disp->driver->screen_transp) { lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, color, opa_tmp, &last_res_color, &last_res_color.ch.alpha); } @@ -616,7 +616,7 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) { for(y = draw_area->y1; y <= draw_area->y2; y++) { for(x = draw_area->x1; x <= draw_area->x2; x++) { - disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x], opa); + disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x], opa); } map_buf_tmp += map_w; } @@ -630,7 +630,7 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons for(y = draw_area->y1; y <= draw_area->y2; y++) { for(x = draw_area->x1; x <= draw_area->x2; x++) { if(mask_tmp[x]) { - disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x], + disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x], (uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8); } } @@ -782,7 +782,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col for(y = 0; y < draw_area_h; y++) { for(x = 0; x < draw_area_w; x++) { #if LV_COLOR_SCREEN_TRANSP - if(disp->driver.screen_transp) { + if(disp->driver->screen_transp) { lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, map_buf_first[x], opa, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); } @@ -868,7 +868,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col if(mask[x]) { lv_opa_t opa_tmp = mask[x] >= LV_OPA_MAX ? opa : ((opa * mask[x]) >> 8); #if LV_COLOR_SCREEN_TRANSP - if(disp->driver.screen_transp) { + if(disp->driver->screen_transp) { lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, map_buf_first[x], opa_tmp, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); } diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 31057ca298..c3e52662cb 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -344,7 +344,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_copy(&draw_area, clip_area); lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; /* Now `draw_area` has absolute coordinates. diff --git a/src/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c index 291fff4161..503a1edfad 100644 --- a/src/lv_draw/lv_draw_line.c +++ b/src/lv_draw/lv_draw_line.c @@ -150,7 +150,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const /*If there other mask apply it*/ else { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -251,7 +251,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const /*If there other mask apply it*/ else { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -408,7 +408,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons } lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); const lv_area_t * disp_area = &vdb->area; diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 518a9be736..cda822604a 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -140,7 +140,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -421,7 +421,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -552,7 +552,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ @@ -1286,7 +1286,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are } lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); + lv_disp_draw_buf_t * vdb = lv_disp_get_buf(disp); /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ diff --git a/src/lv_gpu/lv_gpu_nxp_vglite.c b/src/lv_gpu/lv_gpu_nxp_vglite.c index 4ff7f73d4e..8b4da59178 100644 --- a/src/lv_gpu/lv_gpu_nxp_vglite.c +++ b/src/lv_gpu/lv_gpu_nxp_vglite.c @@ -107,8 +107,8 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv rect.width = (fill_area->x2 - fill_area->x1) + 1; rect.height = (fill_area->y2 - fill_area->y1) + 1; - if(disp && disp->driver.clean_dcache_cb) { /* Clean & invalidate cache */ - disp->driver.clean_dcache_cb(&disp->driver); + if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */ + disp->driver->clean_dcache_cb(&disp->driver); } err |= vg_lite_clear(&rt, &rect, col32.full); @@ -141,8 +141,8 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv colMix.ch.blue = ((uint16_t)col32.ch.blue * opa) >> 8; colMix.ch.alpha = opa; - if(disp && disp->driver.clean_dcache_cb) { /* Clean & invalidate cache */ - disp->driver.clean_dcache_cb(&disp->driver); + if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */ + disp->driver->clean_dcache_cb(&disp->driver); } vg_lite_matrix_t matrix; @@ -219,8 +219,8 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit) vg_lite_identity(&matrix); vg_lite_translate(blit->dst_area.x1, blit->dst_area.y1, &matrix); - if(disp && disp->driver.clean_dcache_cb) { /* Clean & invalidate cache */ - disp->driver.clean_dcache_cb(&disp->driver); + if(disp && disp->driver->clean_dcache_cb) { /* Clean & invalidate cache */ + disp->driver->clean_dcache_cb(&disp->driver); } uint32_t color; diff --git a/src/lv_gpu/lv_gpu_stm32_dma2d.c b/src/lv_gpu/lv_gpu_stm32_dma2d.c index 21fb3001e9..0883703432 100644 --- a/src/lv_gpu/lv_gpu_stm32_dma2d.c +++ b/src/lv_gpu/lv_gpu_stm32_dma2d.c @@ -239,7 +239,7 @@ void lv_gpu_stm32_dma2d_wait_cb(lv_disp_drv_t * drv) static void invalidate_cache(void) { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - if(disp->driver.clean_dcache_cb) disp->driver.clean_dcache_cb(&disp->driver); + if(disp->driver->clean_dcache_cb) disp->driver->clean_dcache_cb(&disp->driver); else { #if __CORTEX_M >= 0x07 if((SCB->CCR) & (uint32_t)SCB_CCR_DC_Msk) @@ -251,10 +251,10 @@ static void invalidate_cache(void) static void wait_finish(void) { lv_disp_t * disp = _lv_refr_get_disp_refreshing(); - if(disp->driver.gpu_wait_cb) return; + if(disp->driver->gpu_wait_cb) return; while(DMA2D->CR & DMA2D_CR_START_Msk) { - if(disp->driver.wait_cb) disp->driver.wait_cb(&disp->driver); + if(disp->driver->wait_cb) disp->driver->wait_cb(&disp->driver); } } diff --git a/src/lv_hal/lv_hal_disp.c b/src/lv_hal/lv_hal_disp.c index 8c0e348651..c040ec6dde 100644 --- a/src/lv_hal/lv_hal_disp.c +++ b/src/lv_hal/lv_hal_disp.c @@ -60,7 +60,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver) driver->flush_cb = NULL; driver->hor_res = 320; driver->ver_res = 240; - driver->buffer = NULL; + driver->draw_buf = NULL; driver->rotated = LV_DISP_ROT_NONE; driver->sw_rotate = 0; driver->color_chroma_key = LV_COLOR_CHROMA_KEY; @@ -88,9 +88,9 @@ void lv_disp_drv_init(lv_disp_drv_t * driver) * sent. Set to `NULL` if unused. * @param size_in_px_cnt size of the `buf1` and `buf2` in pixel count. */ -void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt) +void lv_disp_draw_buf_init(lv_disp_draw_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt) { - lv_memset_00(disp_buf, sizeof(lv_disp_buf_t)); + lv_memset_00(disp_buf, sizeof(lv_disp_draw_buf_t)); disp_buf->buf1 = buf1; disp_buf->buf2 = buf2; @@ -101,7 +101,7 @@ void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32 /** * Register an initialized display driver. * Automatically set the first display as active. - * @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable) + * @param driver pointer to an initialized 'lv_disp_drv_t' variable. Only its pointer is saved! * @return pointer to the new display or NULL on error */ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) @@ -113,7 +113,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) } lv_memset_00(disp, sizeof(lv_disp_t)); - lv_memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t)); + + disp->driver = driver; disp->last_activity_time = 0; @@ -252,12 +253,12 @@ lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp) if(disp == NULL) { return 0; } else { - switch(disp->driver.rotated) { + switch(disp->driver->rotated) { case LV_DISP_ROT_90: case LV_DISP_ROT_270: - return disp->driver.ver_res; + return disp->driver->ver_res; default: - return disp->driver.hor_res; + return disp->driver->hor_res; } } } @@ -274,12 +275,12 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp) if(disp == NULL) { return 0; } else { - switch(disp->driver.rotated) { + switch(disp->driver->rotated) { case LV_DISP_ROT_90: case LV_DISP_ROT_270: - return disp->driver.hor_res; + return disp->driver->hor_res; default: - return disp->driver.ver_res; + return disp->driver->ver_res; } } } @@ -294,7 +295,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp) if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) return false; - return disp->driver.antialiasing ? true : false; + return disp->driver->antialiasing ? true : false; } /** @@ -306,7 +307,7 @@ lv_coord_t lv_disp_get_dpi(lv_disp_t * disp) { if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) return LV_DPI_DEF; /*Do not return 0 because it might be a divider*/ - return disp->driver.dpi; + return disp->driver->dpi; } /** @@ -318,12 +319,12 @@ LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv) /*If the screen is transparent initialize it when the flushing is ready*/ #if LV_COLOR_SCREEN_TRANSP if(disp_drv->screen_transp) { - lv_memset_00(disp_drv->buffer->buf_act, disp_drv->buffer->size * sizeof(lv_color32_t)); + lv_memset_00(disp_drv->draw_buf->buf_act, disp_drv->draw_buf->size * sizeof(lv_color32_t)); } #endif - disp_drv->buffer->flushing = 0; - disp_drv->buffer->flushing_last = 0; + disp_drv->draw_buf->flushing = 0; + disp_drv->draw_buf->flushing_last = 0; } /** @@ -334,7 +335,7 @@ LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv) */ LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_drv_t * disp_drv) { - return disp_drv->buffer->flushing_last; + return disp_drv->draw_buf->flushing_last; } /** @@ -355,9 +356,9 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp) * @param disp pointer to a display * @return pointer to the internal buffers */ -lv_disp_buf_t * lv_disp_get_buf(lv_disp_t * disp) +lv_disp_draw_buf_t * lv_disp_get_buf(lv_disp_t * disp) { - return disp->driver.buffer; + return disp->driver->draw_buf; } /** @@ -389,7 +390,7 @@ void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num) */ bool lv_disp_is_double_buf(lv_disp_t * disp) { - if(disp->driver.buffer->buf1 && disp->driver.buffer->buf2) + if(disp->driver->draw_buf->buf1 && disp->driver->draw_buf->buf2) return true; else return false; @@ -403,9 +404,9 @@ bool lv_disp_is_double_buf(lv_disp_t * disp) */ bool lv_disp_is_true_double_buf(lv_disp_t * disp) { - uint32_t scr_size = disp->driver.hor_res * disp->driver.ver_res; + uint32_t scr_size = disp->driver->hor_res * disp->driver->ver_res; - if(lv_disp_is_double_buf(disp) && disp->driver.buffer->size == scr_size) { + if(lv_disp_is_double_buf(disp) && disp->driver->draw_buf->size == scr_size) { return true; } else { @@ -422,8 +423,8 @@ void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rot_t rotation) { if(disp == NULL) disp = lv_disp_get_default(); - disp->driver.rotated = rotation; - lv_disp_drv_update(disp, &disp->driver); + disp->driver->rotated = rotation; + lv_disp_drv_update(disp, disp->driver); } /** @@ -435,7 +436,7 @@ lv_disp_rot_t lv_disp_get_rotation(lv_disp_t * disp) { if(disp == NULL) disp = lv_disp_get_default(); - return disp->driver.rotated; + return disp->driver->rotated; } /********************** diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h index 027b2f40e5..ea5004d739 100644 --- a/src/lv_hal/lv_hal_disp.h +++ b/src/lv_hal/lv_hal_disp.h @@ -59,7 +59,7 @@ typedef struct { volatile int flushing_last; volatile uint32_t last_area : 1; /*1: the last area is being rendered*/ volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/ -} lv_disp_buf_t; +} lv_disp_draw_buf_t; typedef enum { @@ -70,26 +70,26 @@ typedef enum { } lv_disp_rot_t; /** - * Display Driver structure to be registered by HAL + * Display Driver structure to be registered by HAL. + * Only its pointer will be saved in `lv_disp_t` so it should be declared as + * `static lv_disp_drv_t my_drv` or allocated dynamically. */ typedef struct _lv_disp_drv_t { lv_coord_t hor_res; /**< Horizontal resolution. */ lv_coord_t ver_res; /**< Vertical resolution. */ - /** Pointer to a buffer initialized with `lv_disp_buf_init()`. + /** Pointer to a buffer initialized with `lv_disp_draw_buf_init()`. * LVGL will use this buffer(s) to draw the screens contents */ - lv_disp_buf_t * buffer; + lv_disp_draw_buf_t * draw_buf; uint32_t sw_rotate : 1; /**< 1: use software rotation (slower) */ uint32_t antialiasing : 1; /**< 1: anti-aliasing is enabled on this display. */ uint32_t rotated : 3; /**< 1: turn the display by 90 degree. @warning Does not update coordinates for you!*/ -#if LV_COLOR_SCREEN_TRANSP /**Handle if the screen doesn't have a solid (opa == LV_OPA_COVER) background. * Use only if required because it's slower.*/ uint32_t screen_transp : 1; -#endif /** DPI (dot per inch) of the display. * Set to `LV_DPI` from `lv_Conf.h` by default. @@ -147,7 +147,7 @@ struct _lv_obj_t; */ typedef struct _lv_disp_t { /**< Driver to the display*/ - lv_disp_drv_t driver; + lv_disp_drv_t * driver; /**< A timer which periodically checks the dirty areas and refreshes them*/ lv_timer_t * refr_timer; @@ -212,12 +212,12 @@ void lv_disp_drv_init(lv_disp_drv_t * driver); * sent. Set to `NULL` if unused. * @param size_in_px_cnt size of the `buf1` and `buf2` in pixel count. */ -void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt); +void lv_disp_draw_buf_init(lv_disp_draw_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt); /** * Register an initialized display driver. * Automatically set the first display as active. - * @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable) + * @param driver pointer to an initialized 'lv_disp_drv_t' variable. Only its pointer is saved! * @return pointer to the new display or NULL on error */ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver); @@ -320,7 +320,7 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp); * @param disp pointer to a display * @return pointer to the internal buffers */ -lv_disp_buf_t * lv_disp_get_buf(lv_disp_t * disp); +lv_disp_draw_buf_t * lv_disp_get_buf(lv_disp_t * disp); /** * Get the number of areas in the buffer diff --git a/src/lv_widgets/lv_canvas.c b/src/lv_widgets/lv_canvas.c index af2e4cc812..840a5d1db4 100644 --- a/src/lv_widgets/lv_canvas.c +++ b/src/lv_widgets/lv_canvas.c @@ -581,23 +581,23 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_CHROMA_KEY; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && draw_dsc->bg_color.full == ctransp.full) { - disp.driver.antialiasing = 0; + disp.driver->antialiasing = 0; } lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); @@ -639,17 +639,17 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); _lv_refr_set_disp_refreshing(&disp); @@ -697,17 +697,17 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); _lv_refr_set_disp_refreshing(&disp); @@ -741,23 +741,23 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t points[], uint32_t lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_CHROMA_KEY; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && draw_dsc->color.full == ctransp.full) { - disp.driver.antialiasing = 0; + disp.driver->antialiasing = 0; } lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); @@ -796,23 +796,23 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32 lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_CHROMA_KEY; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && draw_dsc->bg_color.full == ctransp.full) { - disp.driver.antialiasing = 0; + disp.driver->antialiasing = 0; } lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); @@ -849,23 +849,23 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ lv_disp_t disp; lv_memset_00(&disp, sizeof(lv_disp_t)); - lv_disp_buf_t disp_buf; - lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); + lv_disp_draw_buf_t disp_buf; + lv_disp_draw_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h); lv_area_copy(&disp_buf.area, &mask); - lv_disp_drv_init(&disp.driver); + lv_disp_drv_init(disp.driver); - disp.driver.buffer = &disp_buf; - disp.driver.hor_res = dsc->header.w; - disp.driver.ver_res = dsc->header.h; + disp.driver->draw_buf = &disp_buf; + disp.driver->hor_res = dsc->header.w; + disp.driver->ver_res = dsc->header.h; - set_set_px_cb(&disp.driver, dsc->header.cf); + set_set_px_cb(disp.driver, dsc->header.cf); /*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/ lv_color_t ctransp = LV_COLOR_CHROMA_KEY; if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED && draw_dsc->color.full == ctransp.full) { - disp.driver.antialiasing = 0; + disp.driver->antialiasing = 0; } lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index 17ad1e111d..6868103032 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -484,7 +484,7 @@ lv_coord_t * lv_chart_get_array(const lv_obj_t * obj, lv_chart_series_t * ser) return ser->points; } -int32_t lv_chart_get_pressed_point(const lv_obj_t * obj) +uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj) { lv_chart_t * chart = (lv_chart_t *)obj; return chart->pressed_point_id; diff --git a/src/lv_widgets/lv_chart.h b/src/lv_widgets/lv_chart.h index e567fa59ea..4a57cd1971 100644 --- a/src/lv_widgets/lv_chart.h +++ b/src/lv_widgets/lv_chart.h @@ -327,9 +327,9 @@ lv_coord_t * lv_chart_get_array(const lv_obj_t * obj, lv_chart_series_t * ser); /** * Get the index of the currently pressed point. It's the same for every series. * @param obj pointer to a chart object - * @return -1: if no pointid being pressed or the index of the point [0 .. point count] + * @return the index of the point [0 .. point count] or LV_CHART_POINT_ID_NONE if no point is being pressed */ -int32_t lv_chart_get_pressed_point(const lv_obj_t * obj); +uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj); /********************** * MACROS diff --git a/tests/lv_test_main.c b/tests/lv_test_main.c index e992ab8893..759fe5b4c5 100644 --- a/tests/lv_test_main.c +++ b/tests/lv_test_main.c @@ -91,12 +91,12 @@ static lv_fs_res_t tell_cb(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * static void hal_init(void) { - static lv_disp_buf_t disp_buf; + static lv_disp_draw_buf_t disp_buf; lv_color_t * disp_buf1 = (lv_color_t *)malloc(LV_HOR_RES * LV_VER_RES * sizeof(lv_color_t)); - lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES * LV_VER_RES); + lv_disp_draw_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES * LV_VER_RES); - lv_disp_drv_t disp_drv; + static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); disp_drv.buffer = &disp_buf; disp_drv.flush_cb = dummy_flush_cb;