From dccdf1e5a410ee6b44426498eee31079eff29cf0 Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Mon, 25 Mar 2019 23:40:08 +0200 Subject: [PATCH 1/4] comment out unimplemented function --- src/lv_objx/lv_canvas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_objx/lv_canvas.h b/src/lv_objx/lv_canvas.h index d01d7cbc8..180e9f649 100644 --- a/src/lv_objx/lv_canvas.h +++ b/src/lv_objx/lv_canvas.h @@ -111,8 +111,8 @@ lv_color_t lv_canvas_get_px(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y); * Get the image of the canvas as a pointer to an `lv_img_dsc_t` variable. * @param canvas pointer to a canvas object * @return pointer to the image descriptor. - */ lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas); + */ /** * Get style of a canvas. From 5456418d542e445a11729b89da0082f9a85fb136 Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Tue, 26 Mar 2019 00:19:38 +0200 Subject: [PATCH 2/4] Changed 'typedef enum' to 'typedef uint8_t' --- src/lv_core/lv_group.h | 5 +++-- src/lv_core/lv_obj.h | 5 +++-- src/lv_objx/lv_cont.h | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lv_core/lv_group.h b/src/lv_core/lv_group.h index cfba02182..3a0b38da7 100644 --- a/src/lv_core/lv_group.h +++ b/src/lv_core/lv_group.h @@ -73,10 +73,11 @@ typedef struct _lv_group_t uint8_t wrap :1; /*1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end of list.*/ } lv_group_t; -typedef enum _lv_group_refocus_policy_t { +enum _lv_group_refocus_policy_t { LV_GROUP_REFOCUS_POLICY_NEXT = 0, LV_GROUP_REFOCUS_POLICY_PREV = 1 -} lv_group_refocus_policy_t; +}; +typedef uint8_t lv_group_refocus_policy_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 637087e1b..7918e10dc 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -72,7 +72,7 @@ enum typedef uint8_t lv_res_t; -typedef enum { +enum { LV_EVENT_PRESSED, /*The object has been pressed*/ LV_EVENT_PRESSING, /*The object is being pressed (called continuously while pressing)*/ LV_EVENT_PRESS_LOST, /*Still pressing but slid from the objects*/ @@ -94,7 +94,8 @@ typedef enum { LV_EVENT_REFRESH, LV_EVENT_APPLY, /*"Ok", "Apply" or similar specific button has clicked*/ LV_EVENT_CANCEL, /*"Close", "Cancel" or similar specific button has clicked*/ -}lv_event_t; +}; +typedef uint8_t lv_event_t; typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event); diff --git a/src/lv_objx/lv_cont.h b/src/lv_objx/lv_cont.h index 0dade26db..0f06e5504 100644 --- a/src/lv_objx/lv_cont.h +++ b/src/lv_objx/lv_cont.h @@ -48,12 +48,13 @@ enum typedef uint8_t lv_layout_t; -typedef enum { +enum { LV_FIT_NONE, /*Do not change the size automatically*/ LV_FIT_TIGHT, /*Involve the children*/ LV_FIT_FLOOD, /*Align the size to the parent's edge*/ LV_FIT_FILL, /*Align the size to the parent's edge first but if there is an object out of it then involve it*/ -}lv_fit_t; +}; +typedef uint8_t lv_fit_t; typedef struct { From e575d4728be955a0fb9a83f58fc69828afe5b0e8 Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Tue, 26 Mar 2019 00:19:38 +0200 Subject: [PATCH 3/4] Changed 'typedef enum' to 'typedef uint8_t' --- src/lv_core/lv_group.h | 5 +++-- src/lv_core/lv_obj.h | 5 +++-- src/lv_objx/lv_cont.h | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lv_core/lv_group.h b/src/lv_core/lv_group.h index cfba02182..7878d3688 100644 --- a/src/lv_core/lv_group.h +++ b/src/lv_core/lv_group.h @@ -73,10 +73,11 @@ typedef struct _lv_group_t uint8_t wrap :1; /*1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end of list.*/ } lv_group_t; -typedef enum _lv_group_refocus_policy_t { +enum { LV_GROUP_REFOCUS_POLICY_NEXT = 0, LV_GROUP_REFOCUS_POLICY_PREV = 1 -} lv_group_refocus_policy_t; +}; +typedef uint8_t lv_group_refocus_policy_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 637087e1b..7918e10dc 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -72,7 +72,7 @@ enum typedef uint8_t lv_res_t; -typedef enum { +enum { LV_EVENT_PRESSED, /*The object has been pressed*/ LV_EVENT_PRESSING, /*The object is being pressed (called continuously while pressing)*/ LV_EVENT_PRESS_LOST, /*Still pressing but slid from the objects*/ @@ -94,7 +94,8 @@ typedef enum { LV_EVENT_REFRESH, LV_EVENT_APPLY, /*"Ok", "Apply" or similar specific button has clicked*/ LV_EVENT_CANCEL, /*"Close", "Cancel" or similar specific button has clicked*/ -}lv_event_t; +}; +typedef uint8_t lv_event_t; typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event); diff --git a/src/lv_objx/lv_cont.h b/src/lv_objx/lv_cont.h index 0dade26db..0f06e5504 100644 --- a/src/lv_objx/lv_cont.h +++ b/src/lv_objx/lv_cont.h @@ -48,12 +48,13 @@ enum typedef uint8_t lv_layout_t; -typedef enum { +enum { LV_FIT_NONE, /*Do not change the size automatically*/ LV_FIT_TIGHT, /*Involve the children*/ LV_FIT_FLOOD, /*Align the size to the parent's edge*/ LV_FIT_FILL, /*Align the size to the parent's edge first but if there is an object out of it then involve it*/ -}lv_fit_t; +}; +typedef uint8_t lv_fit_t; typedef struct { From 9347165a5ac2cd6e4f53bbe936badeb3202c3053 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 26 Mar 2019 15:35:45 +0100 Subject: [PATCH 4/4] add lv_canvas_get_img() --- src/lv_objx/lv_canvas.c | 12 ++++++++++++ src/lv_objx/lv_canvas.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c index d27e5331e..b8015a553 100644 --- a/src/lv_objx/lv_canvas.c +++ b/src/lv_objx/lv_canvas.c @@ -171,6 +171,18 @@ lv_color_t lv_canvas_get_px(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y) return lv_img_buf_get_px(&ext->dsc, x, y); } +/** + * Get the image of the canvas as a pointer to an `lv_img_dsc_t` variable. + * @param canvas pointer to a canvas object + * @return pointer to the image descriptor. + */ +lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas) +{ + lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas); + + return &ext->img; +} + /** * Get style of a canvas. * @param canvas pointer to canvas object diff --git a/src/lv_objx/lv_canvas.h b/src/lv_objx/lv_canvas.h index 180e9f649..d01d7cbc8 100644 --- a/src/lv_objx/lv_canvas.h +++ b/src/lv_objx/lv_canvas.h @@ -111,8 +111,8 @@ lv_color_t lv_canvas_get_px(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y); * Get the image of the canvas as a pointer to an `lv_img_dsc_t` variable. * @param canvas pointer to a canvas object * @return pointer to the image descriptor. -lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas); */ +lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas); /** * Get style of a canvas.