From 9b3a3923cf439e9b2fd3e82941606fc8ede780d0 Mon Sep 17 00:00:00 2001 From: Gabor Date: Mon, 2 Jan 2017 15:29:05 +0100 Subject: [PATCH] Imporvements fot modularity --- img_conf_templ.h | 41 +++++++++++++++++++++++++++++++++++++++++ lv_conf_temp.h | 19 ++++++++++++++++--- lv_draw/lv_draw.c | 15 ++++++++++++++- lv_draw/lv_draw.h | 8 ++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 img_conf_templ.h diff --git a/img_conf_templ.h b/img_conf_templ.h new file mode 100644 index 000000000..b32a77704 --- /dev/null +++ b/img_conf_templ.h @@ -0,0 +1,41 @@ +/** + * @file img_conf.h + * + */ + +#if 0 /*Remove this to enable the content (Delete the last #endif too!)*/ + +#ifndef IMG_CONF_H +#define IMG_CONF_H + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/* Enable here the used images + * For example: + * #define USE_IMG_EXAMPLE 1 + * + * This is compatible with the images + * generated by the image converter utility + * For more information see: www.littlev.hu */ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif + +#endif /*Remove this to enable the content*/ diff --git a/lv_conf_temp.h b/lv_conf_temp.h index 21dc5581e..fbf430c7c 100644 --- a/lv_conf_temp.h +++ b/lv_conf_temp.h @@ -70,8 +70,10 @@ * LV OBJ X USAGE * ================*/ +/*Rectangle (dependencies: -*/ #define USE_LV_RECT 1 +/*Label (dependencies: -*/ #define USE_LV_LABEL 1 #if USE_LV_LABEL != 0 #define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/ @@ -80,42 +82,53 @@ #define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/ #endif +/*Button (dependencies: lv_rect*/ #define USE_LV_BTN 1 +/*Line (dependencies: -*/ #define USE_LV_LINE 1 -#define USE_LV_IMG 1 /*In misc_conf.h USE_FSINT 1 and USE_UFS 1 are required*/ +/*Image (dependencies: from misc: FSINT, UFS)*/ +#define USE_LV_IMG 1 #if USE_LV_IMG != 0 //#define LV_IMG_DEF_WALLPAPER img_wallpaper_var /*Comment this line to NOT use wallpaper*/ #endif /*USE_LV_IMG*/ +/*Page (dependencies: lv_rect)*/ #define USE_LV_PAGE 1 #if USE_LV_PAGE != 0 #define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/ #endif +/*List (dependencies: lv_btn, lv_label, lv_img)*/ #define USE_LV_LIST 1 +/*Check box (dependencies: lv_btn, lv_label)*/ #define USE_LV_CB 1 +/*Progress bar (dependencies: lv_rect, lv_label)*/ #define USE_LV_PB 1 +/*LED (dependencies: lv_rect)*/ #define USE_LV_LED 1 -#define USE_LV_CHARTBG 1 - +/*Chart (dependencies: lv_rect, lv_line)*/ #define USE_LV_CHART 1 +/*Text area (dependencies: lv_label, lv_page)*/ #define USE_LV_TA 1 #if USE_LV_TA != 0 #define LV_TA_MAX_LENGTH 8 #define LV_TA_CUR_BLINK_TIME 400 /*ms*/ #endif +/*Button matrix (dependencies: lv_rect, lv_label)*/ #define USE_LV_BTNM 1 +/*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/ #define USE_LV_WIN 1 +/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/ #define USE_LV_MBOX 1 /*================== diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 673676fe9..77909776f 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -31,11 +31,13 @@ /********************** * STATIC PROTOTYPES **********************/ +#if USE_LV_RECT != 0 static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_border_straight(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static void lv_draw_rect_border_corner(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); static uint16_t lv_draw_rect_radius_corr(uint16_t r, cord_t w, cord_t h); +#endif /*USE_LV_RECT != 0*/ /********************** * STATIC VARIABLES @@ -72,6 +74,8 @@ static lv_labels_t lv_img_no_pic_labels = { /********************** * GLOBAL FUNCTIONS **********************/ + +#if USE_LV_RECT != 0 /** * Draw a rectangle * @param cords_p the coordinates of the rectangle @@ -100,7 +104,9 @@ void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, } } } +#endif /*USE_LV_RECT != 0*/ +#if USE_LV_LABEL != 0 /** * Write a text * @param cords_p coordinates of the label @@ -158,6 +164,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, } } +#endif /* USE_LV_LABEL != 0*/ #if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 /** @@ -244,8 +251,9 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, } } -#endif +#endif /*USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0*/ +#if USE_LV_LINE != 0 /** * Draw a line * @param p1 first point of the line @@ -373,11 +381,13 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, fill_fp(&draw_area, mask_p, lines_p->objs.color, opa); } } +#endif /*USE_LV_LINE != 0*/ /********************** * STATIC FUNCTIONS **********************/ +#if USE_LV_RECT != 0 /** * Draw the middle part (rectangular) of a rectangle * @param cords_p the coordinates of the original rectangle @@ -865,3 +875,6 @@ static uint16_t lv_draw_rect_radius_corr(uint16_t r, cord_t w, cord_t h) return r; } + +#endif /*USE_LV_RECT != 0*/ + diff --git a/lv_draw/lv_draw.h b/lv_draw/lv_draw.h index 147c52857..ece7a29fc 100644 --- a/lv_draw/lv_draw.h +++ b/lv_draw/lv_draw.h @@ -28,12 +28,20 @@ /********************** * GLOBAL PROTOTYPES **********************/ +#if USE_LV_RECT != 0 void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_rects_t * rects_p, opa_t opa); +#endif + +#if USE_LV_LABEL != 0 void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_labels_t * labels_p, opa_t opa, const char * txt); +#endif + +#if USE_LV_LINE != 0 void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, const lv_lines_t * lines_p, opa_t opa); +#endif #if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 void lv_draw_img(const area_t * cords_p, const area_t * mask_p,