From 3d399ad8428d249f6ea9120d63dfcc8c69971782 Mon Sep 17 00:00:00 2001 From: Gabor Date: Mon, 2 Jan 2017 10:48:21 +0100 Subject: [PATCH] Adding dependency check to oject types --- lv_draw/lv_draw.c | 5 ++++- lv_draw/lv_draw.h | 5 +++++ lv_draw/lv_draw_rbasic.c | 2 +- lv_draw/lv_draw_vbasic.c | 4 ++-- lv_objx/lv_btn.h | 5 +++++ lv_objx/lv_btnm.h | 9 +++++++++ lv_objx/lv_cb.h | 8 ++++++++ lv_objx/lv_chart.h | 9 +++++++++ lv_objx/lv_img.c | 3 ++- lv_objx/lv_img.h | 3 ++- lv_objx/lv_led.h | 5 +++++ lv_objx/lv_list.h | 13 +++++++++++++ lv_objx/lv_mbox.h | 14 ++++++++++++++ lv_objx/lv_page.h | 5 +++++ lv_objx/lv_pb.h | 9 +++++++++ lv_objx/lv_ta.h | 9 +++++++++ lv_objx/lv_win.h | 25 +++++++++++++++++++++++++ 17 files changed, 127 insertions(+), 6 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 6dba62280..ebfe23bd3 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -51,6 +51,7 @@ static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color #endif +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 static lv_rects_t lv_img_no_pic_rects = { .objs.color = COLOR_BLACK, .gcolor = COLOR_BLACK, .bcolor = COLOR_RED, .bwidth = 2 * LV_DOWNSCALE, .bopa = 100, @@ -62,6 +63,7 @@ static lv_labels_t lv_img_no_pic_labels = { .letter_space = 1 * LV_DOWNSCALE, .line_space = 1 * LV_DOWNSCALE, .mid = 1, }; +#endif /********************** * MACROS @@ -157,6 +159,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p, } +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 /** * Draw an image * @param cords_p the coordinates of the image @@ -241,7 +244,7 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p, } } - +#endif /** * Draw a line diff --git a/lv_draw/lv_draw.h b/lv_draw/lv_draw.h index 9b2af6f6f..147c52857 100644 --- a/lv_draw/lv_draw.h +++ b/lv_draw/lv_draw.h @@ -15,6 +15,8 @@ #include "../lv_objx/lv_img.h" #include "../lv_objx/lv_label.h" +#include "misc_conf.h" + /********************* * DEFINES *********************/ @@ -32,8 +34,11 @@ 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); 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); + +#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, const lv_imgs_t * imgs_p, opa_t opa, const char * fn); +#endif /********************** * MACROS **********************/ diff --git a/lv_draw/lv_draw_rbasic.c b/lv_draw/lv_draw_rbasic.c index 74508df99..06eda9a3d 100644 --- a/lv_draw/lv_draw_rbasic.c +++ b/lv_draw/lv_draw_rbasic.c @@ -136,7 +136,7 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p, map_p += map_width; } }else { - color_t transp_color = LV_IMG_COLOR_TRANSP; + color_t transp_color = LV_COLOR_TRANSP; cord_t row; for(row = 0; row < area_get_height(&masked_a); row++) { cord_t col; diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 24b430319..60af48469 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -228,7 +228,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, cord_t row; cord_t col; cord_t row_cnt = 0; - color_t transp_color = LV_IMG_COLOR_TRANSP; + color_t transp_color = LV_COLOR_TRANSP; color_t color_tmp; cord_t map_i; map_p -= map_width; /*Compensate the first row % LV_DOWNSCALE*/ @@ -278,7 +278,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, } else { /*transp == true: Check all pixels */ cord_t row; cord_t col; - color_t transp_color = LV_IMG_COLOR_TRANSP; + color_t transp_color = LV_COLOR_TRANSP; if(recolor_opa == OPA_TRANSP)/*No recolor*/ { diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 5e4687b10..eb3e19646 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_BTN != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "lv_rect.h" #include "../lv_obj/lv_dispi.h" diff --git a/lv_objx/lv_btnm.h b/lv_objx/lv_btnm.h index 04b117ba0..c7cd78836 100644 --- a/lv_objx/lv_btnm.h +++ b/lv_objx/lv_btnm.h @@ -13,6 +13,15 @@ #include "lv_conf.h" #if USE_LV_BTNM != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_btnm: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_btnm: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_label.h" diff --git a/lv_objx/lv_cb.h b/lv_objx/lv_cb.h index 27a18bcaa..d97d9303c 100644 --- a/lv_objx/lv_cb.h +++ b/lv_objx/lv_cb.h @@ -11,6 +11,14 @@ *********************/ #include "lv_conf.h" #if USE_LV_CB != 0 +/*Testing of dependencies*/ +#if USE_LV_BTN == 0 +#error "lv_cb: lv_rect is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_cb: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif #include "../lv_obj/lv_obj.h" #include "lv_btn.h" diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index a3d612118..54c09ae3b 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -12,6 +12,15 @@ #include "lv_conf.h" #if USE_LV_CHART != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_chart: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_LINE == 0 +#error "lv_chart: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_line.h" diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 41a72181f..3bc50ea82 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_IMG != 0 +#include "misc_conf.h" +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 #include "lv_img.h" #include "../lv_draw/lv_draw.h" diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index 2f57bb0bd..b3ac611f4 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -10,7 +10,8 @@ * INCLUDES *********************/ #include "lv_conf.h" -#if USE_LV_IMG != 0 +#include "misc_conf.h" +#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0 #include "../lv_obj/lv_obj.h" #include "misc/fs/fsint.h" diff --git a/lv_objx/lv_led.h b/lv_objx/lv_led.h index 71dcdc946..0ca8e0e82 100644 --- a/lv_objx/lv_led.h +++ b/lv_objx/lv_led.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_LED != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_led: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "../lv_obj/lv_obj.h" /********************* diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 5089400ab..e0bb81089 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -12,6 +12,19 @@ #include "lv_conf.h" #if USE_LV_LIST != 0 +/*Testing of dependencies*/ +#if USE_LV_BTN == 0 +#error "lv_list: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_list: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + +#if USE_LV_IMG == 0 +#error "lv_list: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_page.h" #include "lv_btn.h" diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index 840754bd9..d6099fad2 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -12,6 +12,20 @@ #include "lv_conf.h" #if USE_LV_MBOX != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_mbox: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_mbox: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_mbox: lv_rlabel is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_btn.h" diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 50ff3e538..74268152d 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -12,6 +12,11 @@ #include "lv_conf.h" #if USE_LV_PAGE != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_page: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" diff --git a/lv_objx/lv_pb.h b/lv_objx/lv_pb.h index 69e43ed24..cf096a233 100644 --- a/lv_objx/lv_pb.h +++ b/lv_objx/lv_pb.h @@ -12,6 +12,15 @@ #include "lv_conf.h" #if USE_LV_PB != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_pb: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_pb: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_label.h" diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index 557e0288c..e656ac37c 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -12,6 +12,15 @@ #include "lv_conf.h" #if USE_LV_TA != 0 +/*Testing of dependencies*/ +#if USE_LV_PAGE == 0 +#error "lv_ta: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_ta: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_page.h" #include "lv_label.h" diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 1dacc2894..da8f8c18f 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -12,6 +12,31 @@ #include "lv_conf.h" #if USE_LV_WIN != 0 +/*Testing of dependencies*/ +#if USE_LV_RECT == 0 +#error "lv_win: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) " +#endif + +#if USE_LV_BTN == 0 +#error "lv_win: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) " +#endif + +#if USE_LV_LABEL == 0 +#error "lv_win: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) " +#endif + +#if USE_LV_IMG == 0 +#error "lv_win: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) " +#endif + +#if USE_LV_PAGE == 0 +#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + +#if USE_LV_PAGE == 0 +#error "lv_win: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) " +#endif + #include "../lv_obj/lv_obj.h" #include "lv_rect.h" #include "lv_btn.h"