From ff2e425b48283f1c7e2252c7cc4127636780519a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 23 Feb 2018 17:03:00 +0100 Subject: [PATCH] comment updates --- lv_hal/lv_hal_indev.c | 4 ++-- lv_hal/lv_hal_indev.h | 6 +++--- lv_objx/lv_img.c | 21 ++++++++++----------- lv_objx/lv_img.h | 42 +++++++++++++++++++++++++++++++++++++----- lv_objx/lv_line.c | 1 + lv_objx/lv_line.h | 20 ++++++++++++++++++++ 6 files changed, 73 insertions(+), 21 deletions(-) diff --git a/lv_hal/lv_hal_indev.c b/lv_hal/lv_hal_indev.c index f25e813cf..f1a9bc167 100644 --- a/lv_hal/lv_hal_indev.c +++ b/lv_hal/lv_hal_indev.c @@ -46,7 +46,7 @@ void lv_indev_drv_init(lv_indev_drv_t *driver) { driver->read = NULL; driver->type = LV_INDEV_TYPE_NONE; - driver->priv = NULL; + driver->user_data = NULL; } /** @@ -108,7 +108,7 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data) bool cont = false; if(indev->driver.read) { - data->priv = indev->driver.priv; + data->user_data = indev->driver.user_data; cont = indev->driver.read(data); } else { memset(data, 0, sizeof(lv_indev_data_t)); diff --git a/lv_hal/lv_hal_indev.h b/lv_hal/lv_hal_indev.h index 5485eb0af..9212eba52 100644 --- a/lv_hal/lv_hal_indev.h +++ b/lv_hal/lv_hal_indev.h @@ -48,14 +48,14 @@ typedef struct { uint32_t key; /*For INDEV_TYPE_KEYPAD*/ }; lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/ - void *priv; /*'lv_indev_drv_t.priv' for this driver*/ + void *user_data; /*'lv_indev_drv_t.priv' for this driver*/ }lv_indev_data_t; /*Initialized by the user and registered by 'lv_indev_add()'*/ typedef struct { - lv_hal_indev_type_t type; /*Input device type*/ + lv_hal_indev_type_t type; /*Input device type*/ bool (*read)(lv_indev_data_t *data); /*Function pointer to read data. Return 'true' if there is still data to be read (buffered)*/ - void *priv; /*Opaque pointer for driver's use, passed in 'lv_indev_data_t' on read*/ + void *user_data; /*Pointer to user defined data, passed in 'lv_indev_data_t' on read*/ }lv_indev_drv_t; struct _lv_obj_t; diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 62a5bc596..bffa730f2 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -198,16 +198,6 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img) lv_obj_invalidate(img); } -/** - * Set a file to the image - * @param img pointer to an image object - * @param fn file name in the RAMFS to set as picture (e.g. "U:/pic1"). - */ -void lv_img_set_file(lv_obj_t * img, const char * fn) -{ - lv_img_set_src(img, fn); -} - /** * Enable the auto size feature. * If enabled the object size will be same as the picture size. @@ -226,6 +216,14 @@ void lv_img_set_auto_size(lv_obj_t * img, bool autosize_en) * Getter functions *====================*/ +/** + * Get the type of an image source + * @param src pointer to an image source: + * - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code) + * - a path to an file (e.g. "S:/folder/image.bin") + * - or a symbol (e.g. SYMBOL_CLOSE) + * @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKOWN + */ lv_img_src_t lv_img_get_src_type(const void * src) { if(src == NULL) return LV_IMG_SRC_UNKNOWN; @@ -247,7 +245,8 @@ const char * lv_img_get_file_name(lv_obj_t * img) { lv_img_ext_t * ext = lv_obj_get_ext_attr(img); - return ext->src; + if(ext->src_type == LV_IMG_SRC_FILE) return ext->src; + else return ""; } diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index 972a4c917..5f1154160 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -68,11 +68,15 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy); void lv_img_set_src(lv_obj_t * img, const void * src_img); /** - * Set a file to the image - * @param img pointer to an image object - * @param fn file name in the RAMFS to set as picture (e.g. "U:/pic1"). + * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0. + * Use 'lv_img_set_src()' instead. + * @param img + * @param fn */ -void lv_img_set_file(lv_obj_t * img, const char * fn); +static inline void lv_img_set_file(lv_obj_t * img, const char * fn) +{ + +} /** * Enable the auto size feature. @@ -92,12 +96,31 @@ static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style) lv_obj_set_style(img, style); } +/** + * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 + * @param img + * @param upscale + */ +static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale) +{ + +} + /*===================== * Getter functions *====================*/ +/** + * Get the type of an image source + * @param src pointer to an image source: + * - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code) + * - a path to an file (e.g. "S:/folder/image.bin") + * - or a symbol (e.g. SYMBOL_CLOSE) + * @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKOWN + */ lv_img_src_t lv_img_get_src_type(const void * src); + /** * Get the name of the file set for an image * @param img pointer to an image @@ -105,7 +128,6 @@ lv_img_src_t lv_img_get_src_type(const void * src); */ const char * lv_img_get_file_name(lv_obj_t * img); - /** * Get the auto size enable attribute * @param img pointer to an image @@ -123,6 +145,16 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img) return lv_obj_get_style(img); } +/** + * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 + * @param img + * @return false + */ +static inline bool lv_img_get_upscale(lv_obj_t * img) +{ + return false; +} + /********************** * MACROS **********************/ diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index a52f30231..8dd897e01 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -71,6 +71,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) if(copy == NULL) { lv_obj_set_size(new_line, LV_DPI, LV_DPI); /*Auto size is enables, but set default size until no points are added*/ lv_obj_set_style(new_line, NULL); /*Inherit parent's style*/ + lv_obj_set_click(new_line, false); } /*Copy an existing object*/ else { diff --git a/lv_objx/lv_line.h b/lv_objx/lv_line.h index 6be90c87c..2fb5b2ddc 100644 --- a/lv_objx/lv_line.h +++ b/lv_objx/lv_line.h @@ -88,6 +88,15 @@ static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style) lv_obj_set_style(line, style); } +/** + * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 + * @param line + * @param upscale + */ +static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale) +{ + +} /*===================== * Getter functions *====================*/ @@ -116,6 +125,17 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line) return lv_obj_get_style(line); } +/** + * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 + * @param line + * @return false + */ +static inline bool lv_line_get_upscale(lv_obj_t * line) +{ + return false; +} + + /********************** * MACROS **********************/