comment updates

This commit is contained in:
Gabor Kiss-Vamosi
2018-02-23 17:03:00 +01:00
parent 93330eaf1d
commit ff2e425b48
6 changed files with 73 additions and 21 deletions

View File

@@ -46,7 +46,7 @@ void lv_indev_drv_init(lv_indev_drv_t *driver)
{ {
driver->read = NULL; driver->read = NULL;
driver->type = LV_INDEV_TYPE_NONE; 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; bool cont = false;
if(indev->driver.read) { if(indev->driver.read) {
data->priv = indev->driver.priv; data->user_data = indev->driver.user_data;
cont = indev->driver.read(data); cont = indev->driver.read(data);
} else { } else {
memset(data, 0, sizeof(lv_indev_data_t)); memset(data, 0, sizeof(lv_indev_data_t));

View File

@@ -48,14 +48,14 @@ typedef struct {
uint32_t key; /*For INDEV_TYPE_KEYPAD*/ uint32_t key; /*For INDEV_TYPE_KEYPAD*/
}; };
lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/ 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; }lv_indev_data_t;
/*Initialized by the user and registered by 'lv_indev_add()'*/ /*Initialized by the user and registered by 'lv_indev_add()'*/
typedef struct { 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)*/ 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; }lv_indev_drv_t;
struct _lv_obj_t; struct _lv_obj_t;

View File

@@ -198,16 +198,6 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img)
lv_obj_invalidate(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. * Enable the auto size feature.
* If enabled the object size will be same as the picture size. * 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 * 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) lv_img_src_t lv_img_get_src_type(const void * src)
{ {
if(src == NULL) return LV_IMG_SRC_UNKNOWN; 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); 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 "";
} }

View File

@@ -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); void lv_img_set_src(lv_obj_t * img, const void * src_img);
/** /**
* Set a file to the image * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0.
* @param img pointer to an image object * Use 'lv_img_set_src()' instead.
* @param fn file name in the RAMFS to set as picture (e.g. "U:/pic1"). * @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. * 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); 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 * 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); lv_img_src_t lv_img_get_src_type(const void * src);
/** /**
* Get the name of the file set for an image * Get the name of the file set for an image
* @param img pointer to 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); const char * lv_img_get_file_name(lv_obj_t * img);
/** /**
* Get the auto size enable attribute * Get the auto size enable attribute
* @param img pointer to an image * @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); 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 * MACROS
**********************/ **********************/

View File

@@ -71,6 +71,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
if(copy == NULL) { 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_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_style(new_line, NULL); /*Inherit parent's style*/
lv_obj_set_click(new_line, false);
} }
/*Copy an existing object*/ /*Copy an existing object*/
else { else {

View File

@@ -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); 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 * 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); 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 * MACROS
**********************/ **********************/