diff --git a/lv_core/lv_core.mk b/lv_core/lv_core.mk deleted file mode 100644 index daf6b33b1..000000000 --- a/lv_core/lv_core.mk +++ /dev/null @@ -1,11 +0,0 @@ -CSRCS += lv_group.c -CSRCS += lv_indev.c -CSRCS += lv_disp.c -CSRCS += lv_obj.c -CSRCS += lv_refr.c -CSRCS += lv_style.c - -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_core -VPATH += :$(LVGL_DIR)/lvgl/lv_core - -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_core" diff --git a/lv_hal/lv_hal.mk b/lv_hal/lv_hal.mk deleted file mode 100644 index 83f4bf175..000000000 --- a/lv_hal/lv_hal.mk +++ /dev/null @@ -1,8 +0,0 @@ -CSRCS += lv_hal_disp.c -CSRCS += lv_hal_indev.c -CSRCS += lv_hal_tick.c - -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_hal -VPATH += :$(LVGL_DIR)/lvgl/lv_hal - -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_hal" diff --git a/lvgl.h b/lvgl.h index f4a3149fc..efe05f59f 100644 --- a/lvgl.h +++ b/lvgl.h @@ -14,53 +14,54 @@ extern "C" { * INCLUDES *********************/ -#include "lv_version.h" +#include "src/lv_version.h" -#include "lv_misc/lv_log.h" -#include "lv_misc/lv_task.h" +#include "src/lv_misc/lv_log.h" +#include "src/lv_misc/lv_task.h" +#include "src/lv_misc/lv_math.h" -#include "lv_hal/lv_hal.h" +#include "src/lv_hal/lv_hal.h" -#include "lv_core/lv_obj.h" -#include "lv_core/lv_group.h" +#include "src/lv_core/lv_obj.h" +#include "src/lv_core/lv_group.h" -#include "lv_core/lv_refr.h" -#include "lv_core/lv_disp.h" +#include "src/lv_core/lv_refr.h" +#include "src/lv_core/lv_disp.h" -#include "lv_themes/lv_theme.h" +#include "src/lv_themes/lv_theme.h" -#include "lv_objx/lv_btn.h" -#include "lv_objx/lv_imgbtn.h" -#include "lv_objx/lv_img.h" -#include "lv_objx/lv_label.h" -#include "lv_objx/lv_line.h" -#include "lv_objx/lv_page.h" -#include "lv_objx/lv_cont.h" -#include "lv_objx/lv_list.h" -#include "lv_objx/lv_chart.h" -#include "lv_objx/lv_table.h" -#include "lv_objx/lv_cb.h" -#include "lv_objx/lv_bar.h" -#include "lv_objx/lv_slider.h" -#include "lv_objx/lv_led.h" -#include "lv_objx/lv_btnm.h" -#include "lv_objx/lv_kb.h" -#include "lv_objx/lv_ddlist.h" -#include "lv_objx/lv_roller.h" -#include "lv_objx/lv_ta.h" -#include "lv_objx/lv_canvas.h" -#include "lv_objx/lv_win.h" -#include "lv_objx/lv_tabview.h" -#include "lv_objx/lv_tileview.h" -#include "lv_objx/lv_mbox.h" -#include "lv_objx/lv_gauge.h" -#include "lv_objx/lv_lmeter.h" -#include "lv_objx/lv_sw.h" -#include "lv_objx/lv_kb.h" -#include "lv_objx/lv_arc.h" -#include "lv_objx/lv_preload.h" -#include "lv_objx/lv_calendar.h" -#include "lv_objx/lv_spinbox.h" +#include "src/lv_objx/lv_btn.h" +#include "src/lv_objx/lv_imgbtn.h" +#include "src/lv_objx/lv_img.h" +#include "src/lv_objx/lv_label.h" +#include "src/lv_objx/lv_line.h" +#include "src/lv_objx/lv_page.h" +#include "src/lv_objx/lv_cont.h" +#include "src/lv_objx/lv_list.h" +#include "src/lv_objx/lv_chart.h" +#include "src/lv_objx/lv_table.h" +#include "src/lv_objx/lv_cb.h" +#include "src/lv_objx/lv_bar.h" +#include "src/lv_objx/lv_slider.h" +#include "src/lv_objx/lv_led.h" +#include "src/lv_objx/lv_btnm.h" +#include "src/lv_objx/lv_kb.h" +#include "src/lv_objx/lv_ddlist.h" +#include "src/lv_objx/lv_roller.h" +#include "src/lv_objx/lv_ta.h" +#include "src/lv_objx/lv_canvas.h" +#include "src/lv_objx/lv_win.h" +#include "src/lv_objx/lv_tabview.h" +#include "src/lv_objx/lv_tileview.h" +#include "src/lv_objx/lv_mbox.h" +#include "src/lv_objx/lv_gauge.h" +#include "src/lv_objx/lv_lmeter.h" +#include "src/lv_objx/lv_sw.h" +#include "src/lv_objx/lv_kb.h" +#include "src/lv_objx/lv_arc.h" +#include "src/lv_objx/lv_preload.h" +#include "src/lv_objx/lv_calendar.h" +#include "src/lv_objx/lv_spinbox.h" /********************* * DEFINES diff --git a/lvgl.mk b/lvgl.mk index a4f323769..a895f33f1 100644 --- a/lvgl.mk +++ b/lvgl.mk @@ -1,8 +1,8 @@ -include $(LVGL_DIR)/lvgl/lv_core/lv_core.mk -include $(LVGL_DIR)/lvgl/lv_hal/lv_hal.mk -include $(LVGL_DIR)/lvgl/lv_objx/lv_objx.mk -include $(LVGL_DIR)/lvgl/lv_fonts/lv_fonts.mk -include $(LVGL_DIR)/lvgl/lv_misc/lv_misc.mk -include $(LVGL_DIR)/lvgl/lv_themes/lv_themes.mk -include $(LVGL_DIR)/lvgl/lv_draw/lv_draw.mk +include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk +include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk +include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk +include $(LVGL_DIR)/lvgl/src/lv_fonts/lv_fonts.mk +include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk +include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk +include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk diff --git a/lv_conf_checker.py b/scrips/lv_conf_checker.py similarity index 92% rename from lv_conf_checker.py rename to scrips/lv_conf_checker.py index 1c9cb421a..fa062016a 100644 --- a/lv_conf_checker.py +++ b/scrips/lv_conf_checker.py @@ -5,8 +5,8 @@ Generates a chechker file for lv_conf.h from lv_conf_templ.h define all the not import re -fin = open("lv_conf_templ.h", "r"); -fout = open("lv_conf_checker.h", "w"); +fin = open("../src/lv_conf_templ.h", "r"); +fout = open("../src/lv_conf_checker.h", "w"); fout.write( diff --git a/lv_conf_checker.h b/src/lv_conf_checker.h similarity index 98% rename from lv_conf_checker.h rename to src/lv_conf_checker.h index e693539d0..8fe96eb7f 100644 --- a/lv_conf_checker.h +++ b/src/lv_conf_checker.h @@ -330,7 +330,7 @@ * LV_OBJ SETTINGS *==================*/ #ifndef LV_OBJ_REALIGN -#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/ #endif /*================== @@ -570,6 +570,9 @@ #ifndef LV_ROLLER_ANIM_TIME # define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/ #endif +#ifndef LV_ROLLER_INF_PAGES +# define LV_ROLLER_INF_PAGES 7 /*With inifinite rollers the options are added multiple times (on select positioned back to the center)*/ +#endif #endif /*Slider (dependencies: lv_bar)*/ diff --git a/lv_conf_templ.h b/src/lv_conf_templ.h similarity index 98% rename from lv_conf_templ.h rename to src/lv_conf_templ.h index ef1ab71d3..8def85a49 100644 --- a/lv_conf_templ.h +++ b/src/lv_conf_templ.h @@ -334,6 +334,7 @@ typedef void * lv_obj_user_data_t; /*Declare the type of the user data #define LV_USE_ROLLER 1 #if LV_USE_ROLLER != 0 # define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/ +# define LV_ROLLER_INF_PAGES 7 /*With inifinite rollers the options are added multiple times (on select positioned back to the center)*/ #endif /*Slider (dependencies: lv_bar)*/ @@ -352,7 +353,7 @@ typedef void * lv_obj_user_data_t; /*Declare the type of the user data /*--END OF LV_CONF_H--*/ /*Be sure every define has a default value*/ -#include "lvgl/lv_conf_checker.h" +#include "lvgl/src/lv_conf_checker.h" #endif /*LV_CONF_H*/ diff --git a/src/lv_core/lv_core.mk b/src/lv_core/lv_core.mk new file mode 100644 index 000000000..5cd51bfb5 --- /dev/null +++ b/src/lv_core/lv_core.mk @@ -0,0 +1,11 @@ +CSRCS += lv_group.c +CSRCS += lv_indev.c +CSRCS += lv_disp.c +CSRCS += lv_obj.c +CSRCS += lv_refr.c +CSRCS += lv_style.c + +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_core +VPATH += :$(LVGL_DIR)/lvgl/src/lv_core + +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_core" diff --git a/lv_core/lv_disp.c b/src/lv_core/lv_disp.c similarity index 100% rename from lv_core/lv_disp.c rename to src/lv_core/lv_disp.c diff --git a/lv_core/lv_disp.h b/src/lv_core/lv_disp.h similarity index 100% rename from lv_core/lv_disp.h rename to src/lv_core/lv_disp.h diff --git a/lv_core/lv_group.c b/src/lv_core/lv_group.c similarity index 100% rename from lv_core/lv_group.c rename to src/lv_core/lv_group.c diff --git a/lv_core/lv_group.h b/src/lv_core/lv_group.h similarity index 99% rename from lv_core/lv_group.h rename to src/lv_core/lv_group.h index 4cb730f2b..cfba02182 100644 --- a/lv_core/lv_group.h +++ b/src/lv_core/lv_group.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "lv_obj.h" diff --git a/lv_core/lv_indev.c b/src/lv_core/lv_indev.c similarity index 99% rename from lv_core/lv_indev.c rename to src/lv_core/lv_indev.c index 2d26f86c7..1112ae6b5 100644 --- a/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -198,7 +198,7 @@ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point) } /** - * Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) + * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) * @param indev pointer to an input device * @return the last pressed key (0 on error) */ @@ -386,6 +386,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) lv_obj_t * focused = lv_group_get_focused(g); if(focused == NULL) return; + /*Save the last key to compare it with the current latter on RELEASE*/ + uint32_t prev_key = i->proc.types.keypad.last_key; + + /* Save the last key. + * It must be done here else `lv_indev_get_key` will return the last key in events and signals*/ + i->proc.types.keypad.last_key = data->key; + /*Key press happened*/ if(data->state == LV_INDEV_STATE_PR && i->proc.types.keypad.last_state == LV_INDEV_STATE_REL) @@ -468,7 +475,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) else if(data->state == LV_INDEV_STATE_REL && i->proc.types.keypad.last_state == LV_INDEV_STATE_PR) { /*The user might clear the key when it was released. Always release the pressed key*/ - data->key = i->proc.types.keypad.last_key; + data->key = prev_key; if(data->key == LV_GROUP_KEY_ENTER) { focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL); @@ -489,7 +496,6 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) } i->proc.types.keypad.last_state = data->state; - i->proc.types.keypad.last_key = data->key; #else (void)data; /*Unused*/ (void)i; /*Unused*/ diff --git a/lv_core/lv_indev.h b/src/lv_core/lv_indev.h similarity index 98% rename from lv_core/lv_indev.h rename to src/lv_core/lv_indev.h index a5287fca7..ff4224015 100644 --- a/lv_core/lv_indev.h +++ b/src/lv_core/lv_indev.h @@ -106,7 +106,7 @@ void lv_indev_set_feedback(lv_indev_t *indev, lv_indev_feedback_t feedback); void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); /** - * Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) + * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) * @param indev pointer to an input device * @return the last pressed key (0 on error) */ diff --git a/lv_core/lv_obj.c b/src/lv_core/lv_obj.c similarity index 100% rename from lv_core/lv_obj.c rename to src/lv_core/lv_obj.c diff --git a/lv_core/lv_obj.h b/src/lv_core/lv_obj.h similarity index 99% rename from lv_core/lv_obj.h rename to src/lv_core/lv_obj.h index 0d764df34..683cfba19 100644 --- a/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_core/lv_refr.c b/src/lv_core/lv_refr.c similarity index 100% rename from lv_core/lv_refr.c rename to src/lv_core/lv_refr.c diff --git a/lv_core/lv_refr.h b/src/lv_core/lv_refr.h similarity index 100% rename from lv_core/lv_refr.h rename to src/lv_core/lv_refr.h diff --git a/lv_core/lv_style.c b/src/lv_core/lv_style.c similarity index 79% rename from lv_core/lv_style.c rename to src/lv_core/lv_style.c index 76071deef..57c251d39 100644 --- a/lv_core/lv_style.c +++ b/src/lv_core/lv_style.c @@ -94,17 +94,17 @@ void lv_style_init(void) lv_style_scr.body.shadow.width = 0; lv_style_scr.text.opa = LV_OPA_COVER; - lv_style_scr.text.color = LV_COLOR_MAKE(0x30, 0x30, 0x30); + lv_style_scr.text.color = lv_color_make(0x30, 0x30, 0x30); lv_style_scr.text.font = LV_FONT_DEFAULT; lv_style_scr.text.letter_space = 2; lv_style_scr.text.line_space = 2; lv_style_scr.image.opa = LV_OPA_COVER; - lv_style_scr.image.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); + lv_style_scr.image.color = lv_color_make(0x20, 0x20, 0x20); lv_style_scr.image.intense = LV_OPA_TRANSP; lv_style_scr.line.opa = LV_OPA_COVER; - lv_style_scr.line.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); + lv_style_scr.line.color = lv_color_make(0x20, 0x20, 0x20); lv_style_scr.line.width = 2; lv_style_scr.line.rounded = 0; @@ -117,32 +117,32 @@ void lv_style_init(void) /*Plain color style*/ memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t)); - lv_style_plain_color.text.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); - lv_style_plain_color.image.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); - lv_style_plain_color.line.color = LV_COLOR_MAKE(0xf0, 0xf0, 0xf0); - lv_style_plain_color.body.main_color = LV_COLOR_MAKE(0x55, 0x96, 0xd8); + lv_style_plain_color.text.color = lv_color_make(0xf0, 0xf0, 0xf0); + lv_style_plain_color.image.color = lv_color_make(0xf0, 0xf0, 0xf0); + lv_style_plain_color.line.color = lv_color_make(0xf0, 0xf0, 0xf0); + lv_style_plain_color.body.main_color = lv_color_make(0x55, 0x96, 0xd8); lv_style_plain_color.body.grad_color = lv_style_plain_color.body.main_color; /*Pretty style */ memcpy(&lv_style_pretty, &lv_style_plain, sizeof(lv_style_t)); - lv_style_pretty.text.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); - lv_style_pretty.image.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); - lv_style_pretty.line.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); + lv_style_pretty.text.color = lv_color_make(0x20, 0x20, 0x20); + lv_style_pretty.image.color = lv_color_make(0x20, 0x20, 0x20); + lv_style_pretty.line.color = lv_color_make(0x20, 0x20, 0x20); lv_style_pretty.body.main_color = LV_COLOR_WHITE; lv_style_pretty.body.grad_color = LV_COLOR_SILVER; lv_style_pretty.body.radius = LV_DPI / 15; - lv_style_pretty.body.border.color = LV_COLOR_MAKE(0x40, 0x40, 0x40); + lv_style_pretty.body.border.color = lv_color_make(0x40, 0x40, 0x40); lv_style_pretty.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; lv_style_pretty.body.border.opa = LV_OPA_30; /*Pretty color style*/ memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t)); - lv_style_pretty_color.text.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0); - lv_style_pretty_color.image.color = LV_COLOR_MAKE(0xe0, 0xe0, 0xe0); - lv_style_pretty_color.line.color = LV_COLOR_MAKE(0xc0, 0xc0, 0xc0); - lv_style_pretty_color.body.main_color = LV_COLOR_MAKE(0x6b, 0x9a, 0xc7); - lv_style_pretty_color.body.grad_color = LV_COLOR_MAKE(0x2b, 0x59, 0x8b); - lv_style_pretty_color.body.border.color = LV_COLOR_MAKE(0x15, 0x2c, 0x42); + lv_style_pretty_color.text.color = lv_color_make(0xe0, 0xe0, 0xe0); + lv_style_pretty_color.image.color = lv_color_make(0xe0, 0xe0, 0xe0); + lv_style_pretty_color.line.color = lv_color_make(0xc0, 0xc0, 0xc0); + lv_style_pretty_color.body.main_color = lv_color_make(0x6b, 0x9a, 0xc7); + lv_style_pretty_color.body.grad_color = lv_color_make(0x2b, 0x59, 0x8b); + lv_style_pretty_color.body.border.color = lv_color_make(0x15, 0x2c, 0x42); /*Transparent style*/ memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t)); @@ -163,55 +163,55 @@ void lv_style_init(void) /*Button released style*/ memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t)); - lv_style_btn_rel.body.main_color = LV_COLOR_MAKE(0x76, 0xa2, 0xd0); - lv_style_btn_rel.body.grad_color = LV_COLOR_MAKE(0x19, 0x3a, 0x5d); + lv_style_btn_rel.body.main_color = lv_color_make(0x76, 0xa2, 0xd0); + lv_style_btn_rel.body.grad_color = lv_color_make(0x19, 0x3a, 0x5d); lv_style_btn_rel.body.radius = LV_DPI / 15; lv_style_btn_rel.body.padding.left= LV_DPI / 4; lv_style_btn_rel.body.padding.right = LV_DPI / 4; lv_style_btn_rel.body.padding.top = LV_DPI / 6; lv_style_btn_rel.body.padding.bottom = LV_DPI / 6; lv_style_btn_rel.body.padding.inner = LV_DPI / 10; - lv_style_btn_rel.body.border.color = LV_COLOR_MAKE(0x0b, 0x19, 0x28); + lv_style_btn_rel.body.border.color = lv_color_make(0x0b, 0x19, 0x28); lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; lv_style_btn_rel.body.border.opa = LV_OPA_70; lv_style_btn_rel.body.shadow.color = LV_COLOR_GRAY; lv_style_btn_rel.body.shadow.width = 0; - lv_style_btn_rel.text.color = LV_COLOR_MAKE(0xff, 0xff, 0xff); - lv_style_btn_rel.image.color = LV_COLOR_MAKE(0xff, 0xff, 0xff); + lv_style_btn_rel.text.color = lv_color_make(0xff, 0xff, 0xff); + lv_style_btn_rel.image.color = lv_color_make(0xff, 0xff, 0xff); /*Button pressed style*/ memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t)); - lv_style_btn_pr.body.main_color = LV_COLOR_MAKE(0x33, 0x62, 0x94); - lv_style_btn_pr.body.grad_color = LV_COLOR_MAKE(0x10, 0x26, 0x3c); - lv_style_btn_pr.text.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); - lv_style_btn_pr.image.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); - lv_style_btn_pr.line.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); + lv_style_btn_pr.body.main_color = lv_color_make(0x33, 0x62, 0x94); + lv_style_btn_pr.body.grad_color = lv_color_make(0x10, 0x26, 0x3c); + lv_style_btn_pr.text.color = lv_color_make(0xa4, 0xb5, 0xc6); + lv_style_btn_pr.image.color = lv_color_make(0xa4, 0xb5, 0xc6); + lv_style_btn_pr.line.color = lv_color_make(0xa4, 0xb5, 0xc6); /*Button toggle released style*/ memcpy(&lv_style_btn_tgl_rel, &lv_style_btn_rel, sizeof(lv_style_t)); - lv_style_btn_tgl_rel.body.main_color = LV_COLOR_MAKE(0x0a, 0x11, 0x22); - lv_style_btn_tgl_rel.body.grad_color = LV_COLOR_MAKE(0x37, 0x62, 0x90); - lv_style_btn_tgl_rel.body.border.color = LV_COLOR_MAKE(0x01, 0x07, 0x0d); - lv_style_btn_tgl_rel.text.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); - lv_style_btn_tgl_rel.image.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); - lv_style_btn_tgl_rel.line.color = LV_COLOR_MAKE(0xc8, 0xdd, 0xf4); + lv_style_btn_tgl_rel.body.main_color = lv_color_make(0x0a, 0x11, 0x22); + lv_style_btn_tgl_rel.body.grad_color = lv_color_make(0x37, 0x62, 0x90); + lv_style_btn_tgl_rel.body.border.color = lv_color_make(0x01, 0x07, 0x0d); + lv_style_btn_tgl_rel.text.color = lv_color_make(0xc8, 0xdd, 0xf4); + lv_style_btn_tgl_rel.image.color = lv_color_make(0xc8, 0xdd, 0xf4); + lv_style_btn_tgl_rel.line.color = lv_color_make(0xc8, 0xdd, 0xf4); /*Button toggle pressed style*/ memcpy(&lv_style_btn_tgl_pr, &lv_style_btn_tgl_rel, sizeof(lv_style_t)); - lv_style_btn_tgl_pr.body.main_color = LV_COLOR_MAKE(0x02, 0x14, 0x27); - lv_style_btn_tgl_pr.body.grad_color = LV_COLOR_MAKE(0x2b, 0x4c, 0x70); - lv_style_btn_tgl_pr.text.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); - lv_style_btn_tgl_pr.image.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); - lv_style_btn_tgl_pr.line.color = LV_COLOR_MAKE(0xa4, 0xb5, 0xc6); + lv_style_btn_tgl_pr.body.main_color = lv_color_make(0x02, 0x14, 0x27); + lv_style_btn_tgl_pr.body.grad_color = lv_color_make(0x2b, 0x4c, 0x70); + lv_style_btn_tgl_pr.text.color = lv_color_make(0xa4, 0xb5, 0xc6); + lv_style_btn_tgl_pr.image.color = lv_color_make(0xa4, 0xb5, 0xc6); + lv_style_btn_tgl_pr.line.color = lv_color_make(0xa4, 0xb5, 0xc6); /*Button inactive style*/ memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t)); - lv_style_btn_ina.body.main_color = LV_COLOR_MAKE(0xd8, 0xd8, 0xd8); - lv_style_btn_ina.body.grad_color = LV_COLOR_MAKE(0xd8, 0xd8, 0xd8); - lv_style_btn_ina.body.border.color = LV_COLOR_MAKE(0x90, 0x90, 0x90); - lv_style_btn_ina.text.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); - lv_style_btn_ina.image.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); - lv_style_btn_ina.line.color = LV_COLOR_MAKE(0x70, 0x70, 0x70); + lv_style_btn_ina.body.main_color = lv_color_make(0xd8, 0xd8, 0xd8); + lv_style_btn_ina.body.grad_color = lv_color_make(0xd8, 0xd8, 0xd8); + lv_style_btn_ina.body.border.color = lv_color_make(0x90, 0x90, 0x90); + lv_style_btn_ina.text.color = lv_color_make(0x70, 0x70, 0x70); + lv_style_btn_ina.image.color = lv_color_make(0x70, 0x70, 0x70); + lv_style_btn_ina.line.color = lv_color_make(0x70, 0x70, 0x70); } diff --git a/lv_core/lv_style.h b/src/lv_core/lv_style.h similarity index 100% rename from lv_core/lv_style.h rename to src/lv_core/lv_style.h diff --git a/lv_draw/lv_draw.c b/src/lv_draw/lv_draw.c similarity index 100% rename from lv_draw/lv_draw.c rename to src/lv_draw/lv_draw.c diff --git a/lv_draw/lv_draw.h b/src/lv_draw/lv_draw.h similarity index 98% rename from lv_draw/lv_draw.h rename to src/lv_draw/lv_draw.h index ccd7b2ce4..a3d41b745 100644 --- a/lv_draw/lv_draw.h +++ b/src/lv_draw/lv_draw.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "../lv_core/lv_style.h" diff --git a/lv_draw/lv_draw.mk b/src/lv_draw/lv_draw.mk similarity index 59% rename from lv_draw/lv_draw.mk rename to src/lv_draw/lv_draw.mk index 70fa7103f..ac9e76041 100644 --- a/lv_draw/lv_draw.mk +++ b/src/lv_draw/lv_draw.mk @@ -7,7 +7,7 @@ CSRCS += lv_draw_img.c CSRCS += lv_draw_arc.c CSRCS += lv_draw_triangle.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_draw -VPATH += :$(LVGL_DIR)/lvgl/lv_draw +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_draw +VPATH += :$(LVGL_DIR)/lvgl/src/lv_draw -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_draw" +CFLAGS += "-I$(LVGL_DIR)lvgl/src/lv_draw" diff --git a/lv_draw/lv_draw_arc.c b/src/lv_draw/lv_draw_arc.c similarity index 100% rename from lv_draw/lv_draw_arc.c rename to src/lv_draw/lv_draw_arc.c diff --git a/lv_draw/lv_draw_arc.h b/src/lv_draw/lv_draw_arc.h similarity index 100% rename from lv_draw/lv_draw_arc.h rename to src/lv_draw/lv_draw_arc.h diff --git a/lv_draw/lv_draw_basic.c b/src/lv_draw/lv_draw_basic.c similarity index 100% rename from lv_draw/lv_draw_basic.c rename to src/lv_draw/lv_draw_basic.c diff --git a/lv_draw/lv_draw_basic.h b/src/lv_draw/lv_draw_basic.h similarity index 98% rename from lv_draw/lv_draw_basic.h rename to src/lv_draw/lv_draw_basic.h index 2e52d29d8..ec261744d 100644 --- a/lv_draw/lv_draw_basic.h +++ b/src/lv_draw/lv_draw_basic.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "../lv_misc/lv_color.h" diff --git a/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c similarity index 99% rename from lv_draw/lv_draw_img.c rename to src/lv_draw/lv_draw_img.c index 026de429b..504c63063 100644 --- a/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -439,7 +439,7 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t * uint32_t i; for(i = 0; i < palette_size; i++) { - decoder_index_map[i] = LV_COLOR_MAKE(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue); + decoder_index_map[i] = lv_color_make(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue); } return NULL; #else diff --git a/lv_draw/lv_draw_img.h b/src/lv_draw/lv_draw_img.h similarity index 100% rename from lv_draw/lv_draw_img.h rename to src/lv_draw/lv_draw_img.h diff --git a/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c similarity index 99% rename from lv_draw/lv_draw_label.c rename to src/lv_draw/lv_draw_label.c index 2441d90be..a1febd9d9 100644 --- a/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -161,7 +161,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]); g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]); b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]); - recolor = LV_COLOR_MAKE(r, g, b); + recolor = lv_color_make(r, g, b); } else { recolor.full = style->text.color.full; } diff --git a/lv_draw/lv_draw_label.h b/src/lv_draw/lv_draw_label.h similarity index 100% rename from lv_draw/lv_draw_label.h rename to src/lv_draw/lv_draw_label.h diff --git a/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c similarity index 100% rename from lv_draw/lv_draw_line.c rename to src/lv_draw/lv_draw_line.c diff --git a/lv_draw/lv_draw_line.h b/src/lv_draw/lv_draw_line.h similarity index 100% rename from lv_draw/lv_draw_line.h rename to src/lv_draw/lv_draw_line.h diff --git a/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c similarity index 100% rename from lv_draw/lv_draw_rect.c rename to src/lv_draw/lv_draw_rect.c diff --git a/lv_draw/lv_draw_rect.h b/src/lv_draw/lv_draw_rect.h similarity index 100% rename from lv_draw/lv_draw_rect.h rename to src/lv_draw/lv_draw_rect.h diff --git a/lv_draw/lv_draw_triangle.c b/src/lv_draw/lv_draw_triangle.c similarity index 97% rename from lv_draw/lv_draw_triangle.c rename to src/lv_draw/lv_draw_triangle.c index 24c0f390d..3cc004247 100644 --- a/lv_draw/lv_draw_triangle.c +++ b/src/lv_draw/lv_draw_triangle.c @@ -33,14 +33,14 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2); /********************** * GLOBAL FUNCTIONS **********************/ -#if LV_USE_TRIANGLE != 0 /** * * @param points pointer to an array with 3 points * @param mask the triangle will be drawn only in this mask * @param color color of the triangle + * @param opa_scale scale down all opacities by the factor */ -void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color) +void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color, lv_opa_t opa_scale) { lv_point_t tri[3]; @@ -138,14 +138,12 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo } while(edge2.y == y2_tmp); } } -#endif /********************** * STATIC FUNCTIONS **********************/ -#if LV_USE_TRIANGLE != 0 /** * Swap two points * p1 pointer to the first point @@ -164,5 +162,3 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2) p2->y = tmp.y; } - -#endif diff --git a/lv_draw/lv_draw_triangle.h b/src/lv_draw/lv_draw_triangle.h similarity index 86% rename from lv_draw/lv_draw_triangle.h rename to src/lv_draw/lv_draw_triangle.h index af5c4891f..11ec2a1d9 100644 --- a/lv_draw/lv_draw_triangle.h +++ b/src/lv_draw/lv_draw_triangle.h @@ -26,18 +26,15 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ -/*Experimental use for 3D modeling*/ -#define LV_USE_TRIANGLE 1 -#if LV_USE_TRIANGLE != 0 /** * * @param points pointer to an array with 3 points * @param mask the triangle will be drawn only in this mask * @param color color of the triangle + * @param opa_scale scale down all opacities by the factor */ -void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color); -#endif +void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_color_t color, lv_opa_t opa_scale); /********************** * MACROS diff --git a/lv_fonts/lv_font_builtin.c b/src/lv_fonts/lv_font_builtin.c similarity index 100% rename from lv_fonts/lv_font_builtin.c rename to src/lv_fonts/lv_font_builtin.c diff --git a/lv_fonts/lv_font_builtin.h b/src/lv_fonts/lv_font_builtin.h similarity index 98% rename from lv_fonts/lv_font_builtin.h rename to src/lv_fonts/lv_font_builtin.h index 07667ef32..65b1e1943 100644 --- a/lv_fonts/lv_font_builtin.h +++ b/src/lv_fonts/lv_font_builtin.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "../lv_misc/lv_font.h" diff --git a/lv_fonts/lv_font_dejavu_10.c b/src/lv_fonts/lv_font_dejavu_10.c similarity index 100% rename from lv_fonts/lv_font_dejavu_10.c rename to src/lv_fonts/lv_font_dejavu_10.c diff --git a/lv_fonts/lv_font_dejavu_10_cyrillic.c b/src/lv_fonts/lv_font_dejavu_10_cyrillic.c similarity index 100% rename from lv_fonts/lv_font_dejavu_10_cyrillic.c rename to src/lv_fonts/lv_font_dejavu_10_cyrillic.c diff --git a/lv_fonts/lv_font_dejavu_10_latin_sup.c b/src/lv_fonts/lv_font_dejavu_10_latin_sup.c similarity index 100% rename from lv_fonts/lv_font_dejavu_10_latin_sup.c rename to src/lv_fonts/lv_font_dejavu_10_latin_sup.c diff --git a/lv_fonts/lv_font_dejavu_20.c b/src/lv_fonts/lv_font_dejavu_20.c similarity index 100% rename from lv_fonts/lv_font_dejavu_20.c rename to src/lv_fonts/lv_font_dejavu_20.c diff --git a/lv_fonts/lv_font_dejavu_20_cyrillic.c b/src/lv_fonts/lv_font_dejavu_20_cyrillic.c similarity index 100% rename from lv_fonts/lv_font_dejavu_20_cyrillic.c rename to src/lv_fonts/lv_font_dejavu_20_cyrillic.c diff --git a/lv_fonts/lv_font_dejavu_20_latin_sup.c b/src/lv_fonts/lv_font_dejavu_20_latin_sup.c similarity index 100% rename from lv_fonts/lv_font_dejavu_20_latin_sup.c rename to src/lv_fonts/lv_font_dejavu_20_latin_sup.c diff --git a/lv_fonts/lv_font_dejavu_30.c b/src/lv_fonts/lv_font_dejavu_30.c similarity index 100% rename from lv_fonts/lv_font_dejavu_30.c rename to src/lv_fonts/lv_font_dejavu_30.c diff --git a/lv_fonts/lv_font_dejavu_30_cyrillic.c b/src/lv_fonts/lv_font_dejavu_30_cyrillic.c similarity index 100% rename from lv_fonts/lv_font_dejavu_30_cyrillic.c rename to src/lv_fonts/lv_font_dejavu_30_cyrillic.c diff --git a/lv_fonts/lv_font_dejavu_30_latin_sup.c b/src/lv_fonts/lv_font_dejavu_30_latin_sup.c similarity index 100% rename from lv_fonts/lv_font_dejavu_30_latin_sup.c rename to src/lv_fonts/lv_font_dejavu_30_latin_sup.c diff --git a/lv_fonts/lv_font_dejavu_40.c b/src/lv_fonts/lv_font_dejavu_40.c similarity index 100% rename from lv_fonts/lv_font_dejavu_40.c rename to src/lv_fonts/lv_font_dejavu_40.c diff --git a/lv_fonts/lv_font_dejavu_40_cyrillic.c b/src/lv_fonts/lv_font_dejavu_40_cyrillic.c similarity index 100% rename from lv_fonts/lv_font_dejavu_40_cyrillic.c rename to src/lv_fonts/lv_font_dejavu_40_cyrillic.c diff --git a/lv_fonts/lv_font_dejavu_40_latin_sup.c b/src/lv_fonts/lv_font_dejavu_40_latin_sup.c similarity index 100% rename from lv_fonts/lv_font_dejavu_40_latin_sup.c rename to src/lv_fonts/lv_font_dejavu_40_latin_sup.c diff --git a/lv_fonts/lv_font_monospace_8.c b/src/lv_fonts/lv_font_monospace_8.c similarity index 100% rename from lv_fonts/lv_font_monospace_8.c rename to src/lv_fonts/lv_font_monospace_8.c diff --git a/lv_fonts/lv_font_symbol_10.c b/src/lv_fonts/lv_font_symbol_10.c similarity index 100% rename from lv_fonts/lv_font_symbol_10.c rename to src/lv_fonts/lv_font_symbol_10.c diff --git a/lv_fonts/lv_font_symbol_20.c b/src/lv_fonts/lv_font_symbol_20.c similarity index 100% rename from lv_fonts/lv_font_symbol_20.c rename to src/lv_fonts/lv_font_symbol_20.c diff --git a/lv_fonts/lv_font_symbol_30.c b/src/lv_fonts/lv_font_symbol_30.c similarity index 100% rename from lv_fonts/lv_font_symbol_30.c rename to src/lv_fonts/lv_font_symbol_30.c diff --git a/lv_fonts/lv_font_symbol_40.c b/src/lv_fonts/lv_font_symbol_40.c similarity index 100% rename from lv_fonts/lv_font_symbol_40.c rename to src/lv_fonts/lv_font_symbol_40.c diff --git a/lv_fonts/lv_fonts.mk b/src/lv_fonts/lv_fonts.mk similarity index 81% rename from lv_fonts/lv_fonts.mk rename to src/lv_fonts/lv_fonts.mk index f124b5590..002fb75b6 100644 --- a/lv_fonts/lv_fonts.mk +++ b/src/lv_fonts/lv_fonts.mk @@ -17,7 +17,7 @@ CSRCS += lv_font_symbol_30.c CSRCS += lv_font_symbol_40.c CSRCS += lv_font_monospace_8.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_fonts -VPATH += :$(LVGL_DIR)/lvgl/lv_fonts +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_fonts +VPATH += :$(LVGL_DIR)/lvgl/src/lv_fonts -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_fonts" +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_fonts" diff --git a/lv_hal/lv_hal.h b/src/lv_hal/lv_hal.h similarity index 100% rename from lv_hal/lv_hal.h rename to src/lv_hal/lv_hal.h diff --git a/src/lv_hal/lv_hal.mk b/src/lv_hal/lv_hal.mk new file mode 100644 index 000000000..05af078ce --- /dev/null +++ b/src/lv_hal/lv_hal.mk @@ -0,0 +1,8 @@ +CSRCS += lv_hal_disp.c +CSRCS += lv_hal_indev.c +CSRCS += lv_hal_tick.c + +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_hal +VPATH += :$(LVGL_DIR)/lvgl/src/lv_hal + +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_hal" diff --git a/lv_hal/lv_hal_disp.c b/src/lv_hal/lv_hal_disp.c similarity index 100% rename from lv_hal/lv_hal_disp.c rename to src/lv_hal/lv_hal_disp.c diff --git a/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h similarity index 100% rename from lv_hal/lv_hal_disp.h rename to src/lv_hal/lv_hal_disp.h diff --git a/lv_hal/lv_hal_indev.c b/src/lv_hal/lv_hal_indev.c similarity index 94% rename from lv_hal/lv_hal_indev.c rename to src/lv_hal/lv_hal_indev.c index 1200a88b0..3f7b27a16 100644 --- a/lv_hal/lv_hal_indev.c +++ b/src/lv_hal/lv_hal_indev.c @@ -116,6 +116,10 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data) data->point.x = indev->proc.types.pointer.act_point.x; data->point.y = indev->proc.types.pointer.act_point.y; } + /*Similarly set at least the last key in case of the the user doesn't set it on release*/ + else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) { + data->key = indev->proc.types.keypad.last_key; + } if(indev->driver.read_cb) { LV_LOG_TRACE("idnev read started"); diff --git a/lv_hal/lv_hal_indev.h b/src/lv_hal/lv_hal_indev.h similarity index 99% rename from lv_hal/lv_hal_indev.h rename to src/lv_hal/lv_hal_indev.h index 9d224948a..9ed1479f9 100644 --- a/lv_hal/lv_hal_indev.h +++ b/src/lv_hal/lv_hal_indev.h @@ -18,7 +18,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_hal/lv_hal_tick.c b/src/lv_hal/lv_hal_tick.c similarity index 98% rename from lv_hal/lv_hal_tick.c rename to src/lv_hal/lv_hal_tick.c index 0310092c6..621e05f53 100644 --- a/lv_hal/lv_hal_tick.c +++ b/src/lv_hal/lv_hal_tick.c @@ -9,7 +9,7 @@ #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "lv_hal_tick.h" diff --git a/lv_hal/lv_hal_tick.h b/src/lv_hal/lv_hal_tick.h similarity index 97% rename from lv_hal/lv_hal_tick.h rename to src/lv_hal/lv_hal_tick.h index 088b360a7..e016abbf6 100644 --- a/lv_hal/lv_hal_tick.h +++ b/src/lv_hal/lv_hal_tick.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include #include diff --git a/lv_misc/lv_anim.c b/src/lv_misc/lv_anim.c similarity index 100% rename from lv_misc/lv_anim.c rename to src/lv_misc/lv_anim.c diff --git a/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h similarity index 99% rename from lv_misc/lv_anim.h rename to src/lv_misc/lv_anim.h index 611f38611..70e0db9f0 100644 --- a/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_ANIMATION diff --git a/lv_misc/lv_area.c b/src/lv_misc/lv_area.c similarity index 100% rename from lv_misc/lv_area.c rename to src/lv_misc/lv_area.c diff --git a/lv_misc/lv_area.h b/src/lv_misc/lv_area.h similarity index 100% rename from lv_misc/lv_area.h rename to src/lv_misc/lv_area.h diff --git a/lv_misc/lv_circ.c b/src/lv_misc/lv_circ.c similarity index 100% rename from lv_misc/lv_circ.c rename to src/lv_misc/lv_circ.c diff --git a/lv_misc/lv_circ.h b/src/lv_misc/lv_circ.h similarity index 100% rename from lv_misc/lv_circ.h rename to src/lv_misc/lv_circ.h diff --git a/lv_misc/lv_color.c b/src/lv_misc/lv_color.c similarity index 96% rename from lv_misc/lv_color.c rename to src/lv_misc/lv_color.c index f6001eb4b..84ae5b660 100644 --- a/lv_misc/lv_color.c +++ b/src/lv_misc/lv_color.c @@ -57,7 +57,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v) r = v; g = v; b = v; - return LV_COLOR_MAKE(v, v, v); + return lv_color_make(v, v, v); } region = h / 43; @@ -100,7 +100,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v) break; } - lv_color_t result = LV_COLOR_MAKE(r, g, b); + lv_color_t result = lv_color_make(r, g, b); return result; } diff --git a/lv_misc/lv_color.h b/src/lv_misc/lv_color.h similarity index 87% rename from lv_misc/lv_color.h rename to src/lv_misc/lv_color.h index 1774f2790..fc2a483d8 100644 --- a/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif /*Error checking*/ @@ -364,53 +364,68 @@ static inline uint8_t lv_color_brightness(lv_color_t color) return (uint16_t) bright >> 3; } -/* The most simple macro to create a color from R,G and B values - * The order of bit field is different on Big-endian and Little-endian machines*/ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +/* The most simple macro to create a color from R,G and B values */ #if LV_COLOR_DEPTH == 1 #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)}) +static inline lv_color_t lv_color_make(int r8, int g8, int b8){ + lv_color_t color; + color.full = (b8 >> 7 | g8 >> 7 | r8 >> 7); + return color; +} #elif LV_COLOR_DEPTH == 8 #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}}) +static inline lv_color_t lv_color_make(uint8_t r8, int g8, int b8){ + lv_color_t color; + color.ch.blue = b8 >> 6; + color.ch.green = g8 >> 5; + color.ch.red = r8 >> 5; + return color; +} #elif LV_COLOR_DEPTH == 16 # if LV_COLOR_16_SWAP == 0 # define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}}) +static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){ + lv_color_t color; + color.ch.blue = (uint16_t)(b8 >> 3); + color.ch.green = (uint16_t)(g8 >> 2); + color.ch.red = (uint16_t)(r8 >> 3); + return color; +} # else # define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}}) +static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){ + lv_color_t color; + color.ch.green_h = (uint16_t)(g8 >> 5); + color.ch.red = (uint16_t)(r8 >> 3); + color.ch.blue = (uint16_t)(b8 >> 3); + color.ch.green_l = (uint16_t)((g8 >> 2) & 0x7); + return color; +} # endif #elif LV_COLOR_DEPTH == 32 #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/ -#endif -#else -#if LV_COLOR_DEPTH == 1 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(r8 >> 7 | g8 >> 7 | b8 >> 7)}) -#elif LV_COLOR_DEPTH == 8 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 6, g8 >> 5, b8 >> 5}}) -#elif LV_COLOR_DEPTH == 16 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 3, g8 >> 2, b8 >> 3}}) -#elif LV_COLOR_DEPTH == 32 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{0xff, r8, g8, b8}}) /*Fix 0xff alpha*/ -#endif +static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){ + lv_color_t color; + color.ch.blue = b8; + color.ch.green = g8; + color.ch.red = r8; + color.ch.alpha = 0xff; + return color; +} #endif - -#define LV_COLOR_HEX(c) LV_COLOR_MAKE((uint8_t) ((uint32_t)((uint32_t)c >> 16) & 0xFF), \ - (uint8_t) ((uint32_t)((uint32_t)c >> 8) & 0xFF), \ - (uint8_t) ((uint32_t) c & 0xFF)) - -/*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/ -#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \ - (uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \ - (uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4))) - -static inline lv_color_t lv_color_hex(uint32_t c){ - return LV_COLOR_HEX(c); +static inline lv_color_t lv_color_hex(uint32_t c) { + return lv_color_make((uint8_t) ((c >> 16) & 0xFF), + (uint8_t) ((c >> 8) & 0xFF), + (uint8_t) (c & 0xFF)); } -static inline lv_color_t lv_color_hex3(uint32_t c){ - return LV_COLOR_HEX3(c); +static inline lv_color_t lv_color_hex3(uint32_t c) { + return lv_color_make((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), + (uint8_t) ((c & 0xF0) | ((c & 0xF0) >> 4)), + (uint8_t) ((c & 0xF) | ((c & 0xF) << 4))); } - /** * Convert a HSV color to RGB * @param h hue [0..359] diff --git a/lv_misc/lv_font.c b/src/lv_misc/lv_font.c similarity index 100% rename from lv_misc/lv_font.c rename to src/lv_misc/lv_font.c diff --git a/lv_misc/lv_font.h b/src/lv_misc/lv_font.h similarity index 99% rename from lv_misc/lv_font.h rename to src/lv_misc/lv_font.h index d1d24f3fe..b09674b33 100644 --- a/lv_misc/lv_font.h +++ b/src/lv_misc/lv_font.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_misc/lv_fs.c b/src/lv_misc/lv_fs.c similarity index 100% rename from lv_misc/lv_fs.c rename to src/lv_misc/lv_fs.c diff --git a/lv_misc/lv_fs.h b/src/lv_misc/lv_fs.h similarity index 99% rename from lv_misc/lv_fs.h rename to src/lv_misc/lv_fs.h index 35e70408e..3559d35ce 100644 --- a/lv_misc/lv_fs.h +++ b/src/lv_misc/lv_fs.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_FILESYSTEM diff --git a/lv_misc/lv_gc.c b/src/lv_misc/lv_gc.c similarity index 100% rename from lv_misc/lv_gc.c rename to src/lv_misc/lv_gc.c diff --git a/lv_misc/lv_gc.h b/src/lv_misc/lv_gc.h similarity index 97% rename from lv_misc/lv_gc.h rename to src/lv_misc/lv_gc.h index 35559f39b..c6c89e1ef 100644 --- a/lv_misc/lv_gc.h +++ b/src/lv_misc/lv_gc.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_misc/lv_ll.c b/src/lv_misc/lv_ll.c similarity index 100% rename from lv_misc/lv_ll.c rename to src/lv_misc/lv_ll.c diff --git a/lv_misc/lv_ll.h b/src/lv_misc/lv_ll.h similarity index 100% rename from lv_misc/lv_ll.h rename to src/lv_misc/lv_ll.h diff --git a/lv_misc/lv_log.c b/src/lv_misc/lv_log.c similarity index 100% rename from lv_misc/lv_log.c rename to src/lv_misc/lv_log.c diff --git a/lv_misc/lv_log.h b/src/lv_misc/lv_log.h similarity index 98% rename from lv_misc/lv_log.h rename to src/lv_misc/lv_log.h index b124a9294..9e399e802 100644 --- a/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_misc/lv_math.c b/src/lv_misc/lv_math.c similarity index 100% rename from lv_misc/lv_math.c rename to src/lv_misc/lv_math.c diff --git a/lv_misc/lv_math.h b/src/lv_misc/lv_math.h similarity index 100% rename from lv_misc/lv_math.h rename to src/lv_misc/lv_math.h diff --git a/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c similarity index 89% rename from lv_misc/lv_mem.c rename to src/lv_misc/lv_mem.c index cfe4ed627..8a53469cc 100644 --- a/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -39,7 +39,7 @@ typedef union { struct { MEM_UNIT used: 1; //1: if the entry is used MEM_UNIT d_size: 31; //Size off the data (1 means 4 bytes) - }; + } s; MEM_UNIT header; //The header (used + d_size) } lv_mem_header_t; @@ -92,9 +92,9 @@ void lv_mem_init(void) #endif lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; - full->header.used = 0; + full->header.s.used = 0; /*The total mem size id reduced by the first header and the close patterns */ - full->header.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); + full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); #endif } @@ -147,8 +147,8 @@ void * lv_mem_alloc(uint32_t size) /*Allocate a header too to store the size*/ alloc = LV_MEM_CUSTOM_ALLOC(size + sizeof(lv_mem_header_t)); if(alloc != NULL) { - ((lv_mem_ent_t *) alloc)->header.d_size = size; - ((lv_mem_ent_t *) alloc)->header.used = 1; + ((lv_mem_ent_t *) alloc)->header.s.d_size = size; + ((lv_mem_ent_t *) alloc)->header.s.used = 1; alloc = &((lv_mem_ent_t *) alloc)->first_data; } #endif /* LV_ENABLE_GC */ @@ -180,7 +180,7 @@ void lv_mem_free(const void * data) #if LV_ENABLE_GC==0 /*e points to the header*/ lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t)); - e->header.used = 0; + e->header.s.used = 0; #endif #if LV_MEM_CUSTOM == 0 @@ -190,8 +190,8 @@ void lv_mem_free(const void * data) lv_mem_ent_t * e_next; e_next = ent_get_next(e); while(e_next != NULL) { - if(e_next->header.used == 0) { - e->header.d_size += e_next->header.d_size + sizeof(e->header); + if(e_next->header.s.used == 0) { + e->header.s.d_size += e_next->header.s.d_size + sizeof(e->header); } else { break; } @@ -222,7 +222,7 @@ void * lv_mem_realloc(void * data_p, uint32_t new_size) /*data_p could be previously freed pointer (in this case it is invalid)*/ if(data_p != NULL) { lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data_p - sizeof(lv_mem_header_t)); - if(e->header.used == 0) { + if(e->header.s.used == 0) { data_p = NULL; } } @@ -281,7 +281,7 @@ void lv_mem_defrag(void) while(1) { /*Search the next free entry*/ while(e_free != NULL) { - if(e_free->header.used != 0) { + if(e_free->header.s.used != 0) { e_free = ent_get_next(e_free); } else { break; @@ -293,8 +293,8 @@ void lv_mem_defrag(void) /*Joint the following free entries to the free*/ e_next = ent_get_next(e_free); while(e_next != NULL) { - if(e_next->header.used == 0) { - e_free->header.d_size += e_next->header.d_size + sizeof(e_next->header); + if(e_next->header.s.used == 0) { + e_free->header.s.d_size += e_next->header.s.d_size + sizeof(e_next->header); } else { break; } @@ -326,11 +326,11 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p) e = ent_get_next(e); while(e != NULL) { - if(e->header.used == 0) { + if(e->header.s.used == 0) { mon_p->free_cnt++; - mon_p->free_size += e->header.d_size; - if(e->header.d_size > mon_p->free_biggest_size) { - mon_p->free_biggest_size = e->header.d_size; + mon_p->free_size += e->header.s.d_size; + if(e->header.s.d_size > mon_p->free_biggest_size) { + mon_p->free_biggest_size = e->header.s.d_size; } } else { mon_p->used_cnt++; @@ -360,7 +360,7 @@ uint32_t lv_mem_get_size(const void * data) lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *) data - sizeof(lv_mem_header_t)); - return e->header.d_size; + return e->header.s.d_size; } #else /* LV_ENABLE_GC */ @@ -390,7 +390,7 @@ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e) next_e = (lv_mem_ent_t *) work_mem; } else { /*Get the next entry */ uint8_t * data = &act_e->first_data; - next_e = (lv_mem_ent_t *)&data[act_e->header.d_size]; + next_e = (lv_mem_ent_t *)&data[act_e->header.s.d_size]; if(&next_e->first_data >= &work_mem[LV_MEM_SIZE]) next_e = NULL; } @@ -410,11 +410,11 @@ static void * ent_alloc(lv_mem_ent_t * e, uint32_t size) void * alloc = NULL; /*If the memory is free and big enough then use it */ - if(e->header.used == 0 && e->header.d_size >= size) { + if(e->header.s.used == 0 && e->header.s.d_size >= size) { /*Truncate the entry to the desired size */ ent_trunc(e, size), - e->header.used = 1; + e->header.s.used = 1; /*Save the allocated data*/ alloc = &e->first_data; @@ -445,20 +445,20 @@ static void ent_trunc(lv_mem_ent_t * e, uint32_t size) #endif /*Don't let empty space only for a header without data*/ - if(e->header.d_size == size + sizeof(lv_mem_header_t)) { - size = e->header.d_size; + if(e->header.s.d_size == size + sizeof(lv_mem_header_t)) { + size = e->header.s.d_size; } /* Create the new entry after the current if there is space for it */ - if(e->header.d_size != size) { + if(e->header.s.d_size != size) { uint8_t * e_data = &e->first_data; lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size]; - after_new_e->header.used = 0; - after_new_e->header.d_size = e->header.d_size - size - sizeof(lv_mem_header_t); + after_new_e->header.s.used = 0; + after_new_e->header.s.d_size = e->header.s.d_size - size - sizeof(lv_mem_header_t); } /* Set the new size for the original entry */ - e->header.d_size = size; + e->header.s.d_size = size; } #endif diff --git a/lv_misc/lv_mem.h b/src/lv_misc/lv_mem.h similarity index 98% rename from lv_misc/lv_mem.h rename to src/lv_misc/lv_mem.h index f195f7ac2..257e18536 100644 --- a/lv_misc/lv_mem.h +++ b/src/lv_misc/lv_mem.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_misc/lv_misc.mk b/src/lv_misc/lv_misc.mk similarity index 64% rename from lv_misc/lv_misc.mk rename to src/lv_misc/lv_misc.mk index ad553d2ed..f9f2cbdc2 100644 --- a/lv_misc/lv_misc.mk +++ b/src/lv_misc/lv_misc.mk @@ -12,7 +12,7 @@ CSRCS += lv_math.c CSRCS += lv_log.c CSRCS += lv_gc.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_misc -VPATH += :$(LVGL_DIR)/lvgl/lv_misc +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_misc +VPATH += :$(LVGL_DIR)/lvgl/src/lv_misc -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_misc" +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_misc" diff --git a/lv_misc/lv_symbol_def.h b/src/lv_misc/lv_symbol_def.h similarity index 99% rename from lv_misc/lv_symbol_def.h rename to src/lv_misc/lv_symbol_def.h index fd73d29be..2ecbd1895 100644 --- a/lv_misc/lv_symbol_def.h +++ b/src/lv_misc/lv_symbol_def.h @@ -7,7 +7,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif /* diff --git a/lv_misc/lv_task.c b/src/lv_misc/lv_task.c similarity index 100% rename from lv_misc/lv_task.c rename to src/lv_misc/lv_task.c diff --git a/lv_misc/lv_task.h b/src/lv_misc/lv_task.h similarity index 99% rename from lv_misc/lv_task.h rename to src/lv_misc/lv_task.h index 2c59b3979..a63420fd6 100644 --- a/lv_misc/lv_task.h +++ b/src/lv_misc/lv_task.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_misc/lv_templ.c b/src/lv_misc/lv_templ.c similarity index 80% rename from lv_misc/lv_templ.c rename to src/lv_misc/lv_templ.c index 11478b71d..c5bb68c0b 100644 --- a/lv_misc/lv_templ.c +++ b/src/lv_misc/lv_templ.c @@ -15,6 +15,10 @@ * TYPEDEFS **********************/ +/* This typedef exists purely to keep -Wpedantic happy when the file is empty. */ +/* It can be removed. */ +typedef int keep_pedantic_happy; + /********************** * STATIC PROTOTYPES **********************/ diff --git a/lv_misc/lv_templ.h b/src/lv_misc/lv_templ.h similarity index 100% rename from lv_misc/lv_templ.h rename to src/lv_misc/lv_templ.h diff --git a/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c similarity index 100% rename from lv_misc/lv_txt.c rename to src/lv_misc/lv_txt.c diff --git a/lv_misc/lv_txt.h b/src/lv_misc/lv_txt.h similarity index 99% rename from lv_misc/lv_txt.h rename to src/lv_misc/lv_txt.h index 22a780618..c1d955ad1 100644 --- a/lv_misc/lv_txt.h +++ b/src/lv_misc/lv_txt.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include diff --git a/lv_objx/lv_arc.c b/src/lv_objx/lv_arc.c similarity index 100% rename from lv_objx/lv_arc.c rename to src/lv_objx/lv_arc.c diff --git a/lv_objx/lv_arc.h b/src/lv_objx/lv_arc.h similarity index 98% rename from lv_objx/lv_arc.h rename to src/lv_objx/lv_arc.h index b37efee2e..49595f34c 100644 --- a/lv_objx/lv_arc.h +++ b/src/lv_objx/lv_arc.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_ARC != 0 diff --git a/lv_objx/lv_bar.c b/src/lv_objx/lv_bar.c similarity index 100% rename from lv_objx/lv_bar.c rename to src/lv_objx/lv_bar.c diff --git a/lv_objx/lv_bar.h b/src/lv_objx/lv_bar.h similarity index 99% rename from lv_objx/lv_bar.h rename to src/lv_objx/lv_bar.h index c9e98d25a..71cb32fe3 100644 --- a/lv_objx/lv_bar.h +++ b/src/lv_objx/lv_bar.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_BAR != 0 diff --git a/lv_objx/lv_btn.c b/src/lv_objx/lv_btn.c similarity index 100% rename from lv_objx/lv_btn.c rename to src/lv_objx/lv_btn.c diff --git a/lv_objx/lv_btn.h b/src/lv_objx/lv_btn.h similarity index 99% rename from lv_objx/lv_btn.h rename to src/lv_objx/lv_btn.h index 7612cb44e..203f069c3 100644 --- a/lv_objx/lv_btn.h +++ b/src/lv_objx/lv_btn.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_BTN != 0 diff --git a/lv_objx/lv_btnm.c b/src/lv_objx/lv_btnm.c similarity index 99% rename from lv_objx/lv_btnm.c rename to src/lv_objx/lv_btnm.c index 3aef349ca..c9a525608 100644 --- a/lv_objx/lv_btnm.c +++ b/src/lv_objx/lv_btnm.c @@ -1091,6 +1091,8 @@ static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p) static void invalidate_button_area(const lv_obj_t * btnm, uint16_t btn_idx) { + if(btn_idx == LV_BTNM_BTN_NONE) return; + lv_area_t btn_area; lv_area_t btnm_area; diff --git a/lv_objx/lv_btnm.h b/src/lv_objx/lv_btnm.h similarity index 99% rename from lv_objx/lv_btnm.h rename to src/lv_objx/lv_btnm.h index 6386d4dfb..b1e0f043b 100644 --- a/lv_objx/lv_btnm.h +++ b/src/lv_objx/lv_btnm.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_BTNM != 0 diff --git a/lv_objx/lv_calendar.c b/src/lv_objx/lv_calendar.c similarity index 100% rename from lv_objx/lv_calendar.c rename to src/lv_objx/lv_calendar.c diff --git a/lv_objx/lv_calendar.h b/src/lv_objx/lv_calendar.h similarity index 99% rename from lv_objx/lv_calendar.h rename to src/lv_objx/lv_calendar.h index 9064ee2fb..19ca98349 100644 --- a/lv_objx/lv_calendar.h +++ b/src/lv_objx/lv_calendar.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_CALENDAR != 0 diff --git a/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c similarity index 100% rename from lv_objx/lv_canvas.c rename to src/lv_objx/lv_canvas.c diff --git a/lv_objx/lv_canvas.h b/src/lv_objx/lv_canvas.h similarity index 99% rename from lv_objx/lv_canvas.h rename to src/lv_objx/lv_canvas.h index f8d6e94d4..e68f70d05 100644 --- a/lv_objx/lv_canvas.h +++ b/src/lv_objx/lv_canvas.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_CANVAS != 0 diff --git a/lv_objx/lv_cb.c b/src/lv_objx/lv_cb.c similarity index 100% rename from lv_objx/lv_cb.c rename to src/lv_objx/lv_cb.c diff --git a/lv_objx/lv_cb.h b/src/lv_objx/lv_cb.h similarity index 99% rename from lv_objx/lv_cb.h rename to src/lv_objx/lv_cb.h index 5c6c0b04e..3e8c38f20 100644 --- a/lv_objx/lv_cb.h +++ b/src/lv_objx/lv_cb.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_CB != 0 diff --git a/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c similarity index 91% rename from lv_objx/lv_chart.c rename to src/lv_objx/lv_chart.c index 18f156a17..c41acb912 100644 --- a/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -35,6 +35,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask); static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask); static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask); static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mask); +static void lv_chart_draw_areas(lv_obj_t * chart, const lv_area_t * mask); /********************** * STATIC VARIABLES @@ -490,6 +491,7 @@ static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_ if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask); if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask); if(ext->type & LV_CHART_TYPE_VERTICAL_LINE) lv_chart_draw_vertical_lines(chart, mask); + if(ext->type & LV_CHART_TYPE_AREA) lv_chart_draw_areas(chart, mask); } return true; } @@ -819,4 +821,69 @@ static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mas } } } + +/** + * Draw the data lines as areas on a chart + * @param obj pointer to chart object + */ +static void lv_chart_draw_areas(lv_obj_t * chart, const lv_area_t * mask) +{ + lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + + uint16_t i; + lv_point_t p1; + lv_point_t p2; + lv_coord_t w = lv_obj_get_width(chart); + lv_coord_t h = lv_obj_get_height(chart); + lv_coord_t x_ofs = chart->coords.x1; + lv_coord_t y_ofs = chart->coords.y1; + int32_t y_tmp; + lv_coord_t p_prev; + lv_coord_t p_act; + lv_chart_series_t * ser; + lv_opa_t opa_scale = lv_obj_get_opa_scale(chart); + lv_style_t style; + lv_style_copy(&style, &lv_style_plain); + style.line.opa = ext->series.opa; + style.line.width = ext->series.width; + + /*Go through all data lines*/ + LV_LL_READ_BACK(ext->series_ll, ser) { + style.line.color = ser->color; + + p1.x = 0 + x_ofs; + p2.x = 0 + x_ofs; + + p_prev = ser->start_point; + y_tmp = (int32_t)((int32_t) ser->points[p_prev] - ext->ymin) * h; + y_tmp = y_tmp / (ext->ymax - ext->ymin); + p2.y = h - y_tmp + y_ofs; + + for(i = 1; i < ext->point_cnt; i ++) { + p1.x = p2.x; + p1.y = p2.y; + + p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs; + p_act = (ser->start_point + i) % ext->point_cnt; + + y_tmp = (int32_t)((int32_t) ser->points[p_act] - ext->ymin) * h; + y_tmp = y_tmp / (ext->ymax - ext->ymin); + p2.y = h - y_tmp + y_ofs; + + if(ser->points[p_prev] != LV_CHART_POINT_DEF && ser->points[p_act] != LV_CHART_POINT_DEF) { + lv_point_t triangle_points[3]; + triangle_points[0] = p1; + triangle_points[1].x = p2.x; + triangle_points[1].y = y_ofs + h; + triangle_points[2].x = p1.x; + triangle_points[2].y = y_ofs + h; + lv_draw_triangle(triangle_points, mask, style.line.color, opa_scale); + triangle_points[2] = p2; + lv_draw_triangle(triangle_points, mask, style.line.color, opa_scale); + } + p_prev = p_act; + } + } +} + #endif diff --git a/lv_objx/lv_chart.h b/src/lv_objx/lv_chart.h similarity index 91% rename from lv_objx/lv_chart.h rename to src/lv_objx/lv_chart.h index 7fc8af114..d0ca97df1 100644 --- a/lv_objx/lv_chart.h +++ b/src/lv_objx/lv_chart.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_CHART != 0 @@ -32,6 +32,18 @@ extern "C" { /********************** * TYPEDEFS **********************/ + +/*Chart types*/ +enum +{ + LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/ + LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/ + LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/ + LV_CHART_TYPE_VERTICAL_LINE = 0x08, /*Draw vertical lines on points (useful when chart width == point count)*/ + LV_CHART_TYPE_AREA = 0x10, /*Draw area chart*/ +}; +typedef uint8_t lv_chart_type_t; + typedef struct { lv_coord_t * points; @@ -44,13 +56,13 @@ typedef struct { /*No inherited ext*/ /*Ext. of ancestor*/ /*New data for this type */ - lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/ - lv_coord_t ymin; /*y min value (used to scale the data)*/ - lv_coord_t ymax; /*y max value (used to scale the data)*/ - uint8_t hdiv_cnt; /*Number of horizontal division lines*/ - uint8_t vdiv_cnt; /*Number of vertical division lines*/ - uint16_t point_cnt; /*Point number in a data line*/ - uint8_t type :4; /*Line, column or point chart (from 'lv_chart_type_t')*/ + lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/ + lv_coord_t ymin; /*y min value (used to scale the data)*/ + lv_coord_t ymax; /*y max value (used to scale the data)*/ + uint8_t hdiv_cnt; /*Number of horizontal division lines*/ + uint8_t vdiv_cnt; /*Number of vertical division lines*/ + uint16_t point_cnt; /*Point number in a data line*/ + lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/ struct { lv_coord_t width; /*Line width or point radius*/ uint8_t num; /*Number of data lines in dl_ll*/ @@ -59,15 +71,6 @@ typedef struct } series; } lv_chart_ext_t; -/*Chart types*/ -enum -{ - LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/ - LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/ - LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/ - LV_CHART_TYPE_VERTICAL_LINE = 0x08, /*Draw vertical lines on points (useful when chart width == point count)*/ -}; -typedef uint8_t lv_chart_type_t; /********************** diff --git a/lv_objx/lv_cont.c b/src/lv_objx/lv_cont.c similarity index 100% rename from lv_objx/lv_cont.c rename to src/lv_objx/lv_cont.c diff --git a/lv_objx/lv_cont.h b/src/lv_objx/lv_cont.h similarity index 99% rename from lv_objx/lv_cont.h rename to src/lv_objx/lv_cont.h index cf09e1740..0dade26db 100644 --- a/lv_objx/lv_cont.h +++ b/src/lv_objx/lv_cont.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_CONT != 0 diff --git a/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c similarity index 98% rename from lv_objx/lv_ddlist.c rename to src/lv_objx/lv_ddlist.c index 70a180421..8ef5280ac 100644 --- a/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -109,7 +109,6 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy) ext->label = lv_label_create(new_ddlist, NULL); lv_cont_set_fit2(new_ddlist, LV_FIT_TIGHT, LV_FIT_NONE); - lv_page_set_sb_mode(new_ddlist, LV_SB_MODE_DRAG); lv_page_set_sb_mode(new_ddlist, LV_SB_MODE_HIDE); lv_page_set_style(new_ddlist, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight); @@ -133,11 +132,13 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy) ext->label = lv_label_create(new_ddlist, copy_ext->label); lv_label_set_text(ext->label, lv_label_get_text(copy_ext->label)); ext->sel_opt_id = copy_ext->sel_opt_id; + ext->sel_opt_id_ori = copy_ext->sel_opt_id; ext->fix_height = copy_ext->fix_height; ext->option_cnt = copy_ext->option_cnt; ext->sel_style = copy_ext->sel_style; ext->anim_time = copy_ext->anim_time; ext->draw_arrow = copy_ext->draw_arrow; + ext->stay_open = copy_ext->stay_open; /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_ddlist); @@ -169,6 +170,8 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options) if(options[i] == '\n') ext->option_cnt++; } ext->option_cnt++; /*Last option in the at row*/ + ext->sel_opt_id = 0; + ext->sel_opt_id_ori = 0; lv_label_set_text(ext->label, options); lv_ddlist_refr_size(ddlist, false); @@ -219,6 +222,13 @@ void lv_ddlist_set_fit(lv_obj_t * ddlist, lv_fit_t fit) { lv_cont_set_fit2(ddlist, fit, LV_FIT_NONE); + if(fit == LV_FIT_NONE) { + lv_page_set_scrl_fit2(ddlist, LV_FIT_FLOOD, LV_FIT_NONE); + } else { + lv_page_set_scrl_fit2(ddlist, LV_FIT_TIGHT, LV_FIT_NONE); + + } + lv_ddlist_refr_size(ddlist, false); } diff --git a/lv_objx/lv_ddlist.h b/src/lv_objx/lv_ddlist.h similarity index 99% rename from lv_objx/lv_ddlist.h rename to src/lv_objx/lv_ddlist.h index 390352ea9..5a516a932 100644 --- a/lv_objx/lv_ddlist.h +++ b/src/lv_objx/lv_ddlist.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_DDLIST != 0 diff --git a/lv_objx/lv_gauge.c b/src/lv_objx/lv_gauge.c similarity index 100% rename from lv_objx/lv_gauge.c rename to src/lv_objx/lv_gauge.c diff --git a/lv_objx/lv_gauge.h b/src/lv_objx/lv_gauge.h similarity index 99% rename from lv_objx/lv_gauge.h rename to src/lv_objx/lv_gauge.h index b37be3909..409c79e0f 100644 --- a/lv_objx/lv_gauge.h +++ b/src/lv_objx/lv_gauge.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_GAUGE != 0 diff --git a/lv_objx/lv_img.c b/src/lv_objx/lv_img.c similarity index 100% rename from lv_objx/lv_img.c rename to src/lv_objx/lv_img.c diff --git a/lv_objx/lv_img.h b/src/lv_objx/lv_img.h similarity index 99% rename from lv_objx/lv_img.h rename to src/lv_objx/lv_img.h index 40fa43782..8681009b8 100644 --- a/lv_objx/lv_img.h +++ b/src/lv_objx/lv_img.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_IMG != 0 diff --git a/lv_objx/lv_imgbtn.c b/src/lv_objx/lv_imgbtn.c similarity index 100% rename from lv_objx/lv_imgbtn.c rename to src/lv_objx/lv_imgbtn.c diff --git a/lv_objx/lv_imgbtn.h b/src/lv_objx/lv_imgbtn.h similarity index 99% rename from lv_objx/lv_imgbtn.h rename to src/lv_objx/lv_imgbtn.h index a3d4e7ff4..de551d67d 100644 --- a/lv_objx/lv_imgbtn.h +++ b/src/lv_objx/lv_imgbtn.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_IMGBTN != 0 diff --git a/lv_objx/lv_kb.c b/src/lv_objx/lv_kb.c similarity index 100% rename from lv_objx/lv_kb.c rename to src/lv_objx/lv_kb.c diff --git a/lv_objx/lv_kb.h b/src/lv_objx/lv_kb.h similarity index 99% rename from lv_objx/lv_kb.h rename to src/lv_objx/lv_kb.h index 1ae5e3156..4c9c4ec72 100644 --- a/lv_objx/lv_kb.h +++ b/src/lv_objx/lv_kb.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_KB != 0 diff --git a/lv_objx/lv_label.c b/src/lv_objx/lv_label.c similarity index 100% rename from lv_objx/lv_label.c rename to src/lv_objx/lv_label.c diff --git a/lv_objx/lv_label.h b/src/lv_objx/lv_label.h similarity index 99% rename from lv_objx/lv_label.h rename to src/lv_objx/lv_label.h index 2acc9c965..b72bc8ecf 100644 --- a/lv_objx/lv_label.h +++ b/src/lv_objx/lv_label.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_LABEL != 0 diff --git a/lv_objx/lv_led.c b/src/lv_objx/lv_led.c similarity index 100% rename from lv_objx/lv_led.c rename to src/lv_objx/lv_led.c diff --git a/lv_objx/lv_led.h b/src/lv_objx/lv_led.h similarity index 98% rename from lv_objx/lv_led.h rename to src/lv_objx/lv_led.h index 8711570b5..22e661484 100644 --- a/lv_objx/lv_led.h +++ b/src/lv_objx/lv_led.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_LED != 0 diff --git a/lv_objx/lv_line.c b/src/lv_objx/lv_line.c similarity index 100% rename from lv_objx/lv_line.c rename to src/lv_objx/lv_line.c diff --git a/lv_objx/lv_line.h b/src/lv_objx/lv_line.h similarity index 99% rename from lv_objx/lv_line.h rename to src/lv_objx/lv_line.h index d0c546062..b1c9a43a8 100644 --- a/lv_objx/lv_line.h +++ b/src/lv_objx/lv_line.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_LINE != 0 diff --git a/lv_objx/lv_list.c b/src/lv_objx/lv_list.c similarity index 100% rename from lv_objx/lv_list.c rename to src/lv_objx/lv_list.c diff --git a/lv_objx/lv_list.h b/src/lv_objx/lv_list.h similarity index 99% rename from lv_objx/lv_list.h rename to src/lv_objx/lv_list.h index ccf294b52..a634a9f12 100644 --- a/lv_objx/lv_list.h +++ b/src/lv_objx/lv_list.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_LIST != 0 diff --git a/lv_objx/lv_lmeter.c b/src/lv_objx/lv_lmeter.c similarity index 100% rename from lv_objx/lv_lmeter.c rename to src/lv_objx/lv_lmeter.c diff --git a/lv_objx/lv_lmeter.h b/src/lv_objx/lv_lmeter.h similarity index 99% rename from lv_objx/lv_lmeter.h rename to src/lv_objx/lv_lmeter.h index 7852b870e..dfabe4cb1 100644 --- a/lv_objx/lv_lmeter.h +++ b/src/lv_objx/lv_lmeter.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_LMETER != 0 diff --git a/lv_objx/lv_mbox.c b/src/lv_objx/lv_mbox.c similarity index 100% rename from lv_objx/lv_mbox.c rename to src/lv_objx/lv_mbox.c diff --git a/lv_objx/lv_mbox.h b/src/lv_objx/lv_mbox.h similarity index 99% rename from lv_objx/lv_mbox.h rename to src/lv_objx/lv_mbox.h index 1d256b3ac..953f12c55 100644 --- a/lv_objx/lv_mbox.h +++ b/src/lv_objx/lv_mbox.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_MBOX != 0 diff --git a/lv_objx/lv_objx.mk b/src/lv_objx/lv_objx.mk similarity index 82% rename from lv_objx/lv_objx.mk rename to src/lv_objx/lv_objx.mk index d35252bce..45b3e2ad3 100644 --- a/lv_objx/lv_objx.mk +++ b/src/lv_objx/lv_objx.mk @@ -30,7 +30,7 @@ CSRCS += lv_page.c CSRCS += lv_sw.c CSRCS += lv_win.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_objx -VPATH += :$(LVGL_DIR)/lvgl/lv_objx +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_objx +VPATH += :$(LVGL_DIR)/lvgl/src/lv_objx -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_objx" +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_objx" diff --git a/lv_objx/lv_objx_templ.c b/src/lv_objx/lv_objx_templ.c similarity index 94% rename from lv_objx/lv_objx_templ.c rename to src/lv_objx/lv_objx_templ.c index fc154e982..18864a1d4 100644 --- a/lv_objx/lv_objx_templ.c +++ b/src/lv_objx/lv_objx_templ.c @@ -8,13 +8,16 @@ * templ -> object short name with lower case(e.g. btn, label etc) * TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.) * + * You can remove the defined() clause from the #if statement below. This exists because LV_USE_TEMPL + * is not in lv_conf.h or lv_conf_templ.h by default. */ /********************* * INCLUDES *********************/ //#include "lv_templ.h" /*TODO uncomment this*/ -#if LV_USE_TEMPL != 0 + +#if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0 /********************* * DEFINES @@ -228,4 +231,8 @@ static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param return res; } +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; #endif diff --git a/lv_objx/lv_objx_templ.h b/src/lv_objx/lv_objx_templ.h similarity index 98% rename from lv_objx/lv_objx_templ.h rename to src/lv_objx/lv_objx_templ.h index 13a75d179..3fdac8eb6 100644 --- a/lv_objx/lv_objx_templ.h +++ b/src/lv_objx/lv_objx_templ.h @@ -24,7 +24,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_TEMPL != 0 diff --git a/lv_objx/lv_page.c b/src/lv_objx/lv_page.c similarity index 100% rename from lv_objx/lv_page.c rename to src/lv_objx/lv_page.c diff --git a/lv_objx/lv_page.h b/src/lv_objx/lv_page.h similarity index 99% rename from lv_objx/lv_page.h rename to src/lv_objx/lv_page.h index 365708669..2c9de41f2 100644 --- a/lv_objx/lv_page.h +++ b/src/lv_objx/lv_page.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_PAGE != 0 diff --git a/lv_objx/lv_preload.c b/src/lv_objx/lv_preload.c similarity index 100% rename from lv_objx/lv_preload.c rename to src/lv_objx/lv_preload.c diff --git a/lv_objx/lv_preload.h b/src/lv_objx/lv_preload.h similarity index 99% rename from lv_objx/lv_preload.h rename to src/lv_objx/lv_preload.h index 965c2e278..913297a1a 100644 --- a/lv_objx/lv_preload.h +++ b/src/lv_objx/lv_preload.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_PRELOAD != 0 diff --git a/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c similarity index 85% rename from lv_objx/lv_roller.c rename to src/lv_objx/lv_roller.c index f5d44f9fd..84d4a49bf 100644 --- a/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -25,6 +25,7 @@ # define LV_ROLLER_ANIM_TIME 0 /*No animation*/ #endif + /********************** * TYPEDEFS **********************/ @@ -36,6 +37,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param); static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param); static void refr_position(lv_obj_t * roller, bool anim_en); +static void inf_normalize(void * roller_scrl); static void draw_bg(lv_obj_t * roller, const lv_area_t * mask); /********************** @@ -99,16 +101,20 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) lv_roller_set_style(new_roller, LV_ROLLER_STYLE_BG, th->style.roller.bg); lv_roller_set_style(new_roller, LV_ROLLER_STYLE_SEL, th->style.roller.sel); } else { - /*Let the ddlist's style*/ + /*Refresh the roller's style*/ lv_obj_refresh_style(new_roller); /*To set scrollable size automatically*/ } } /*Copy an existing roller*/ else { + lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy); + ext->inf = copy_ext->inf; + lv_obj_t * scrl = lv_page_get_scrl(new_roller); lv_ddlist_open(new_roller, false); lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal); + /*Refresh the roller's style*/ lv_obj_refresh_style(new_roller); /*Refresh the style with new signal function*/ } @@ -123,6 +129,39 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) * Setter functions *====================*/ +/** + * Set the options on a roller + * @param roller pointer to roller object + * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" + */ +void lv_roller_set_options(lv_obj_t * roller, const char * options, bool inf) +{ + lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); + + if(inf== false) { + ext->inf = 0; + lv_ddlist_set_options(roller, options); + } else { + ext->inf = 1; + + uint32_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/ + char * opt_extra = lv_mem_alloc(opt_len * LV_ROLLER_INF_PAGES); + uint8_t i; + for(i = 0; i < LV_ROLLER_INF_PAGES; i++) { + strcpy(&opt_extra[opt_len * i], options); + opt_extra[opt_len * (i + 1) - 1] = '\n'; + } + opt_extra[opt_len * LV_ROLLER_INF_PAGES - 1] = '\0'; + lv_ddlist_set_options(roller, opt_extra); + lv_mem_free(opt_extra); + + uint16_t real_id_cnt = ext->ddlist.option_cnt / LV_ROLLER_INF_PAGES; + ext->ddlist.sel_opt_id = ((LV_ROLLER_INF_PAGES / 2) + 1) * real_id_cnt; /*Select the middle page*/ + + } + +} + /** * Set the align of the roller's options (left or center) * @param roller - pointer to a roller object @@ -189,6 +228,32 @@ void lv_roller_set_style(lv_obj_t * roller, lv_roller_style_t type, lv_style_t * * Getter functions *====================*/ +/** + * Get the id of the selected option + * @param roller pointer to a roller object + * @return id of the selected option (0 ... number of option - 1); + */ +uint16_t lv_roller_get_selected(const lv_obj_t *roller) +{ + lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); + if(ext->inf) { + uint16_t real_id_cnt = ext->ddlist.option_cnt / LV_ROLLER_INF_PAGES; + return lv_ddlist_get_selected(roller) % real_id_cnt; + } else { + return lv_ddlist_get_selected(roller); + } +} + +/** + * Get the current selected option as a string + * @param roller pointer to roller object + * @param buf pointer to an array to store the string + */ +void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf) +{ + lv_ddlist_get_selected_str(roller, buf); +} + /** * Get the align attribute. Default alignment after _create is LV_LABEL_ALIGN_CENTER * @param roller pointer to a roller object @@ -447,9 +512,12 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, lv_coord_t label_unit = font_h + style_label->text.line_space; lv_coord_t mid = (roller->coords.y2 - roller->coords.y1) / 2; id = (mid - label_y1 + style_label->text.line_space / 2) / label_unit; + if(id < 0) id = 0; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1; + ext->ddlist.sel_opt_id = id; + ext->ddlist.sel_opt_id_ori = id; res = lv_obj_send_event(roller, LV_EVENT_VALUE_CHANGED); if(res != LV_RES_OK) return res; } else if(sign == LV_SIGNAL_RELEASED) { @@ -552,6 +620,13 @@ static void refr_position(lv_obj_t * roller, bool anim_en) const lv_font_t * font = style_label->text.font; lv_coord_t font_h = lv_font_get_height(font); lv_coord_t h = lv_obj_get_height(roller); + + /* Normally the animtaion's `end_cb` sets correct position of the roller is infinite. + * But without animations do it manually*/ + if(anim_en == false || ext->ddlist.anim_time == 0) { + inf_normalize(roller_scrl); + } + int32_t id = ext->ddlist.sel_opt_id; lv_coord_t line_y1 = id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1; lv_coord_t new_y = - line_y1 + (h - font_h) / 2; @@ -566,7 +641,7 @@ static void refr_position(lv_obj_t * roller, bool anim_en) a.end = new_y; a.fp = (lv_anim_fp_t)lv_obj_set_y; a.path = lv_anim_path_linear; - a.end_cb = NULL; + a.end_cb = inf_normalize; a.act_time = 0; a.time = ext->ddlist.anim_time; a.playback = 0; @@ -578,4 +653,35 @@ static void refr_position(lv_obj_t * roller, bool anim_en) } } +/** + * Set the middle page for the roller if inifinte is enabled + * @param roller_scrl pointer to the roller's scrollable + */ +static void inf_normalize(void * roller_scrl) +{ + lv_obj_t * roller = lv_obj_get_parent(roller_scrl); + lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); + + if(ext->inf) { + uint16_t real_id_cnt = ext->ddlist.option_cnt / LV_ROLLER_INF_PAGES; + + ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id % real_id_cnt; + + ext->ddlist.sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/ + ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; + + /*Move to the new id*/ + lv_obj_t * roller_scrl = lv_page_get_scrl(roller); + lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); + lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label); + const lv_font_t * font = style_label->text.font; + lv_coord_t font_h = lv_font_get_height(font); + lv_coord_t h = lv_obj_get_height(roller); + + lv_coord_t line_y1 = ext->ddlist.sel_opt_id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1; + lv_coord_t new_y = - line_y1 + (h - font_h) / 2; + lv_obj_set_y(roller_scrl, new_y); + } +} + #endif diff --git a/lv_objx/lv_roller.h b/src/lv_objx/lv_roller.h similarity index 92% rename from lv_objx/lv_roller.h rename to src/lv_objx/lv_roller.h index f3779f5f2..bb76de7a6 100644 --- a/lv_objx/lv_roller.h +++ b/src/lv_objx/lv_roller.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_ROLLER != 0 @@ -41,6 +41,7 @@ extern "C" { typedef struct { lv_ddlist_ext_t ddlist; /*Ext. of ancestor*/ /*New data for this type */ + uint8_t inf :1; /*Infinite*/ } lv_roller_ext_t; enum { @@ -65,6 +66,13 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy); * Setter functions *====================*/ +/** + * Set the options on a roller + * @param roller pointer to roller object + * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" + */ +void lv_roller_set_options(lv_obj_t * roller, const char * options, bool inf); + /** * Set the align of the roller's options (left, right or center[default]) * @param roller - pointer to a roller object @@ -72,16 +80,6 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy); */ void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align); -/** - * Set the options on a roller - * @param roller pointer to roller object - * @param options a string with '\n' separated options. E.g. "One\nTwo\nThree" - */ -static inline void lv_roller_set_options(lv_obj_t * roller, const char * options) -{ - lv_ddlist_set_options(roller, options); -} - /** * Set the selected option * @param roller pointer to a roller object @@ -128,6 +126,19 @@ void lv_roller_set_style(lv_obj_t *roller, lv_roller_style_t type, lv_style_t *s /*===================== * Getter functions *====================*/ +/** + * Get the id of the selected option + * @param roller pointer to a roller object + * @return id of the selected option (0 ... number of option - 1); + */ +uint16_t lv_roller_get_selected(const lv_obj_t *roller); + +/** + * Get the current selected option as a string + * @param roller pointer to roller object + * @param buf pointer to an array to store the string + */ +void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf); /** * Get the align attribute. Default alignment after _create is LV_LABEL_ALIGN_CENTER @@ -146,26 +157,6 @@ static inline const char * lv_roller_get_options(const lv_obj_t *roller) return lv_ddlist_get_options(roller); } -/** - * Get the id of the selected option - * @param roller pointer to a roller object - * @return id of the selected option (0 ... number of option - 1); - */ -static inline uint16_t lv_roller_get_selected(const lv_obj_t *roller) -{ - return lv_ddlist_get_selected(roller); -} - -/** - * Get the current selected option as a string - * @param roller pointer to roller object - * @param buf pointer to an array to store the string - */ -static inline void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf) -{ - lv_ddlist_get_selected_str(roller, buf); -} - /** * Get the open/close animation time. * @param roller pointer to a roller diff --git a/lv_objx/lv_slider.c b/src/lv_objx/lv_slider.c similarity index 100% rename from lv_objx/lv_slider.c rename to src/lv_objx/lv_slider.c diff --git a/lv_objx/lv_slider.h b/src/lv_objx/lv_slider.h similarity index 99% rename from lv_objx/lv_slider.h rename to src/lv_objx/lv_slider.h index edf376d08..7339aba6d 100644 --- a/lv_objx/lv_slider.h +++ b/src/lv_objx/lv_slider.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_SLIDER != 0 diff --git a/lv_objx/lv_spinbox.c b/src/lv_objx/lv_spinbox.c similarity index 100% rename from lv_objx/lv_spinbox.c rename to src/lv_objx/lv_spinbox.c diff --git a/lv_objx/lv_spinbox.h b/src/lv_objx/lv_spinbox.h similarity index 99% rename from lv_objx/lv_spinbox.h rename to src/lv_objx/lv_spinbox.h index b387b6a80..ab2e6d1ad 100644 --- a/lv_objx/lv_spinbox.h +++ b/src/lv_objx/lv_spinbox.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_SPINBOX != 0 diff --git a/lv_objx/lv_sw.c b/src/lv_objx/lv_sw.c similarity index 100% rename from lv_objx/lv_sw.c rename to src/lv_objx/lv_sw.c diff --git a/lv_objx/lv_sw.h b/src/lv_objx/lv_sw.h similarity index 99% rename from lv_objx/lv_sw.h rename to src/lv_objx/lv_sw.h index b8e72ef55..3937cd978 100644 --- a/lv_objx/lv_sw.h +++ b/src/lv_objx/lv_sw.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_SW != 0 diff --git a/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c similarity index 100% rename from lv_objx/lv_ta.c rename to src/lv_objx/lv_ta.c diff --git a/lv_objx/lv_ta.h b/src/lv_objx/lv_ta.h similarity index 99% rename from lv_objx/lv_ta.h rename to src/lv_objx/lv_ta.h index 3a29998df..58234603d 100644 --- a/lv_objx/lv_ta.h +++ b/src/lv_objx/lv_ta.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_TA != 0 diff --git a/lv_objx/lv_table.c b/src/lv_objx/lv_table.c similarity index 96% rename from lv_objx/lv_table.c rename to src/lv_objx/lv_table.c index 8f003c020..d3e15e93c 100644 --- a/lv_objx/lv_table.c +++ b/src/lv_objx/lv_table.c @@ -144,10 +144,10 @@ void lv_table_set_cell_value(lv_obj_t * table, uint16_t row, uint16_t col, const } /*Initialize the format byte*/ else { - format.align = LV_LABEL_ALIGN_LEFT; - format.right_merge = 0; - format.type = 0; - format.crop = 0; + format.s.align = LV_LABEL_ALIGN_LEFT; + format.s.right_merge = 0; + format.s.type = 0; + format.s.crop = 0; } @@ -262,7 +262,7 @@ void lv_table_set_cell_align(lv_obj_t * table, uint16_t row, uint16_t col, lv_la lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - format.align = align; + format.s.align = align; ext->cell_data[cell][0] = format.format_byte; } @@ -293,7 +293,7 @@ void lv_table_set_cell_type(lv_obj_t * table, uint16_t row, uint16_t col, uint8_ lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - format.type = type; + format.s.type = type; ext->cell_data[cell][0] = format.format_byte; } @@ -321,7 +321,7 @@ void lv_table_set_cell_crop(lv_obj_t * table, uint16_t row, uint16_t col, bool c lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - format.crop = crop; + format.s.crop = crop; ext->cell_data[cell][0] = format.format_byte; } @@ -351,7 +351,7 @@ void lv_table_set_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col, lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - format.right_merge = en ? 1 : 0; + format.s.right_merge = en ? 1 : 0; ext->cell_data[cell][0] = format.format_byte; refr_size(table); } @@ -474,7 +474,7 @@ lv_label_align_t lv_table_get_cell_align(lv_obj_t * table, uint16_t row, uint16_ else { lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - return format.align; + return format.s.align; } } @@ -498,7 +498,7 @@ lv_label_align_t lv_table_get_cell_type(lv_obj_t * table, uint16_t row, uint16_t else { lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - return format.type + 1; /*0,1,2,3 is stored but user sees 1,2,3,4*/ + return format.s.type + 1; /*0,1,2,3 is stored but user sees 1,2,3,4*/ } } @@ -522,7 +522,7 @@ lv_label_align_t lv_table_get_cell_crop(lv_obj_t * table, uint16_t row, uint16_t else { lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - return format.crop; + return format.s.crop; } } @@ -547,7 +547,7 @@ bool lv_table_get_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col) else { lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - return format.right_merge ? true : false; + return format.s.right_merge ? true : false; } } @@ -638,13 +638,13 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ if(ext->cell_data[cell]) { format.format_byte = ext->cell_data[cell][0]; } else { - format.right_merge = 0; - format.align = LV_LABEL_ALIGN_LEFT; - format.type = 0; - format.crop = 1; + format.s.right_merge = 0; + format.s.align = LV_LABEL_ALIGN_LEFT; + format.s.type = 0; + format.s.crop = 1; } - cell_style = ext->cell_style[format.type]; + cell_style = ext->cell_style[format.s.type]; cell_area.x1 = cell_area.x2; cell_area.x2 = cell_area.x1 + ext->col_w[col]; @@ -653,7 +653,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ if(ext->cell_data[cell + col_merge] != NULL) { format.format_byte = ext->cell_data[cell + col_merge][0]; - if(format.right_merge) cell_area.x2 += ext->col_w[col + col_merge + 1]; + if(format.s.right_merge) cell_area.x2 += ext->col_w[col + col_merge + 1]; else break; } else { break; @@ -669,7 +669,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ txt_area.y1 = cell_area.y1 + cell_style->body.padding.top; txt_area.y2 = cell_area.y2 - cell_style->body.padding.bottom; /*Align the content to the middle if not cropped*/ - if(format.crop == 0) { + if(format.s.crop == 0) { txt_flags = LV_TXT_FLAG_NONE; } else { txt_flags = LV_TXT_FLAG_EXPAND; @@ -679,12 +679,12 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ cell_style->text.letter_space, cell_style->text.line_space, lv_area_get_width(&txt_area), txt_flags); /*Align the content to the middle if not cropped*/ - if(format.crop == 0) { + if(format.s.crop == 0) { txt_area.y1 = cell_area.y1 + h_row / 2 - txt_size.y / 2; txt_area.y2 = cell_area.y1 + h_row / 2 + txt_size.y / 2; } - switch(format.align) { + switch(format.s.align) { default: case LV_LABEL_ALIGN_LEFT: txt_flags |= LV_TXT_FLAG_NONE; @@ -822,7 +822,7 @@ static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id) if(ext->cell_data[cell + col_merge] != NULL) { lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell + col_merge][0]; - if(format.right_merge) txt_w += ext->col_w[col + col_merge + 1]; + if(format.s.right_merge) txt_w += ext->col_w[col + col_merge + 1]; else break; } else { break; @@ -831,10 +831,10 @@ static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id) lv_table_cell_format_t format; format.format_byte = ext->cell_data[cell][0]; - cell_style = ext->cell_style[format.type]; + cell_style = ext->cell_style[format.s.type]; /*With text crop assume 1 line*/ - if(format.crop) { + if(format.s.crop) { h_max = LV_MATH_MAX(lv_font_get_height(cell_style->text.font) + cell_style->body.padding.top + cell_style->body.padding.bottom, h_max); diff --git a/lv_objx/lv_table.h b/src/lv_objx/lv_table.h similarity index 99% rename from lv_objx/lv_table.h rename to src/lv_objx/lv_table.h index ad47224c5..c11dff336 100644 --- a/lv_objx/lv_table.h +++ b/src/lv_objx/lv_table.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_TABLE != 0 @@ -47,7 +47,7 @@ typedef union { uint8_t right_merge:1; uint8_t type:2; uint8_t crop:1; - }; + } s; uint8_t format_byte; }lv_table_cell_format_t; diff --git a/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c similarity index 100% rename from lv_objx/lv_tabview.c rename to src/lv_objx/lv_tabview.c diff --git a/lv_objx/lv_tabview.h b/src/lv_objx/lv_tabview.h similarity index 99% rename from lv_objx/lv_tabview.h rename to src/lv_objx/lv_tabview.h index 7a56f3c22..6c451a6a6 100644 --- a/lv_objx/lv_tabview.h +++ b/src/lv_objx/lv_tabview.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_TABVIEW != 0 diff --git a/lv_objx/lv_tileview.c b/src/lv_objx/lv_tileview.c similarity index 100% rename from lv_objx/lv_tileview.c rename to src/lv_objx/lv_tileview.c diff --git a/lv_objx/lv_tileview.h b/src/lv_objx/lv_tileview.h similarity index 99% rename from lv_objx/lv_tileview.h rename to src/lv_objx/lv_tileview.h index c01aa7faa..56748747d 100644 --- a/lv_objx/lv_tileview.h +++ b/src/lv_objx/lv_tileview.h @@ -17,7 +17,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_TILEVIEW != 0 diff --git a/lv_objx/lv_win.c b/src/lv_objx/lv_win.c similarity index 100% rename from lv_objx/lv_win.c rename to src/lv_objx/lv_win.c diff --git a/lv_objx/lv_win.h b/src/lv_objx/lv_win.h similarity index 99% rename from lv_objx/lv_win.h rename to src/lv_objx/lv_win.h index 37d0fd55e..9a153a2e5 100644 --- a/lv_objx/lv_win.h +++ b/src/lv_objx/lv_win.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_WIN != 0 diff --git a/lv_porting/lv_port_disp_templ.c b/src/lv_porting/lv_port_disp_templ.c similarity index 97% rename from lv_porting/lv_port_disp_templ.c rename to src/lv_porting/lv_port_disp_templ.c index 044e6ca21..7fdfa79bc 100644 --- a/lv_porting/lv_port_disp_templ.c +++ b/src/lv_porting/lv_port_disp_templ.c @@ -184,4 +184,8 @@ static void mem_fill(lv_color_t * dest, uint32_t length, lv_color_t color) #endif /*LV_USE_GPU*/ +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; #endif diff --git a/lv_porting/lv_port_disp_templ.h b/src/lv_porting/lv_port_disp_templ.h similarity index 100% rename from lv_porting/lv_port_disp_templ.h rename to src/lv_porting/lv_port_disp_templ.h diff --git a/lv_porting/lv_port_fs_templ.c b/src/lv_porting/lv_port_fs_templ.c similarity index 98% rename from lv_porting/lv_port_fs_templ.c rename to src/lv_porting/lv_port_fs_templ.c index ead8c1f99..31edfcfb2 100644 --- a/lv_porting/lv_port_fs_templ.c +++ b/src/lv_porting/lv_port_fs_templ.c @@ -358,4 +358,8 @@ static lv_fs_res_t fs_dir_close (void * rddir_p) return res; } +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; #endif diff --git a/lv_porting/lv_port_fs_templ.h b/src/lv_porting/lv_port_fs_templ.h similarity index 100% rename from lv_porting/lv_port_fs_templ.h rename to src/lv_porting/lv_port_fs_templ.h diff --git a/lv_porting/lv_port_indev_templ.c b/src/lv_porting/lv_port_indev_templ.c similarity index 98% rename from lv_porting/lv_port_indev_templ.c rename to src/lv_porting/lv_port_indev_templ.c index 7c1f0505f..98fe79b1d 100644 --- a/lv_porting/lv_port_indev_templ.c +++ b/src/lv_porting/lv_port_indev_templ.c @@ -421,4 +421,8 @@ static bool button_is_pressed(uint8_t id) return false; } +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; #endif diff --git a/lv_porting/lv_port_indev_templ.h b/src/lv_porting/lv_port_indev_templ.h similarity index 100% rename from lv_porting/lv_port_indev_templ.h rename to src/lv_porting/lv_port_indev_templ.h diff --git a/lv_themes/lv_theme.c b/src/lv_themes/lv_theme.c similarity index 100% rename from lv_themes/lv_theme.c rename to src/lv_themes/lv_theme.c diff --git a/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h similarity index 99% rename from lv_themes/lv_theme.h rename to src/lv_themes/lv_theme.h index 855699979..96df2a649 100644 --- a/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #include "../lv_core/lv_style.h" diff --git a/lv_themes/lv_theme_alien.c b/src/lv_themes/lv_theme_alien.c similarity index 96% rename from lv_themes/lv_theme_alien.c rename to src/lv_themes/lv_theme_alien.c index 41e44807d..dfd200ea6 100644 --- a/lv_themes/lv_theme_alien.c +++ b/src/lv_themes/lv_theme_alien.c @@ -72,8 +72,8 @@ static void basic_init(void) def.body.opa = LV_OPA_COVER; def.glass = 0; - def.body.main_color = LV_COLOR_HEX3(0x222); - def.body.grad_color = LV_COLOR_HEX3(0x222); + def.body.main_color = lv_color_hex3(0x222); + def.body.grad_color = lv_color_hex3(0x222); def.body.radius = 0; def.body.padding.left = LV_DPI / 8; def.body.padding.right = LV_DPI / 8; @@ -87,31 +87,31 @@ static void basic_init(void) def.body.shadow.width = 0; def.body.shadow.type = LV_SHADOW_FULL; - def.text.color = LV_COLOR_HEX3(0xDDD); + def.text.color = lv_color_hex3(0xDDD); def.text.font = _font; def.text.letter_space = 1; def.text.line_space = 2; - def.image.color = LV_COLOR_HEX3(0xDDD); + def.image.color = lv_color_hex3(0xDDD); def.image.intense = LV_OPA_TRANSP; - def.line.color = LV_COLOR_HEX3(0xDDD); + def.line.color = lv_color_hex3(0xDDD); def.line.width = 1; /*Background*/ lv_style_copy(&bg, &def); - bg.body.main_color = LV_COLOR_HEX3(0x333); - bg.body.grad_color = LV_COLOR_HEX3(0x333); + bg.body.main_color = lv_color_hex3(0x333); + bg.body.grad_color = lv_color_hex3(0x333); bg.body.border.width = 2; - bg.body.border.color = LV_COLOR_HEX3(0x666); + bg.body.border.color = lv_color_hex3(0x666); bg.body.shadow.color = LV_COLOR_SILVER; /*Panel*/ lv_style_copy(&panel, &def); panel.body.radius = LV_DPI / 10; - panel.body.main_color = LV_COLOR_HEX3(0x666); - panel.body.grad_color = LV_COLOR_HEX3(0x666); - panel.body.border.color = LV_COLOR_HEX3(0xccc); + panel.body.main_color = lv_color_hex3(0x666); + panel.body.grad_color = lv_color_hex3(0x666); + panel.body.border.color = lv_color_hex3(0xccc); panel.body.border.width = 2; panel.body.border.opa = LV_OPA_60; panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); @@ -341,8 +341,8 @@ static void sw_init(void) sw_bg.body.padding.right = -2 ; sw_bg.body.padding.top = -2 ; sw_bg.body.padding.bottom = -2 ; - sw_bg.body.main_color = LV_COLOR_HEX3(0x666); - sw_bg.body.grad_color = LV_COLOR_HEX3(0x999); + sw_bg.body.main_color = lv_color_hex3(0x666); + sw_bg.body.grad_color = lv_color_hex3(0x999); sw_bg.body.border.width = 2; sw_bg.body.border.opa = LV_OPA_50; @@ -372,7 +372,7 @@ static void lmeter_init(void) lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 80); lmeter_bg.body.padding.left = LV_DPI / 8; /*Scale line length*/ lmeter_bg.body.padding.right = LV_DPI / 8; /*Scale line length*/ - lmeter_bg.line.color = LV_COLOR_HEX3(0x222); + lmeter_bg.line.color = lv_color_hex3(0x222); lmeter_bg.line.width = 2; theme.style.lmeter = &lmeter_bg; @@ -392,7 +392,7 @@ static void gauge_init(void) gauge_bg.body.padding.top = LV_DPI / 10; /*Needle center size*/ gauge_bg.body.padding.bottom = LV_DPI / 10; /*Needle center size*/ gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/ - gauge_bg.body.border.color = LV_COLOR_HEX3(0x777); + gauge_bg.body.border.color = lv_color_hex3(0x777); gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75); gauge_bg.line.width = 2; gauge_bg.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); @@ -414,7 +414,7 @@ static void arc_init(void) /*For preloader*/ arc.body.border.width = 2; - arc.body.border.color = LV_COLOR_HEX3(0x555); + arc.body.border.color = lv_color_hex3(0x555); arc.body.padding.left = 3; arc.body.padding.right = 3; arc.body.padding.top = 3; @@ -698,8 +698,8 @@ static void roller_init(void) lv_style_copy(&roller_bg, &ddlist_bg); roller_bg.text.line_space = LV_DPI / 6; roller_bg.body.radius = LV_DPI / 20; - roller_bg.body.main_color = LV_COLOR_HEX3(0x222); - roller_bg.body.grad_color = LV_COLOR_HEX3(0x666); + roller_bg.body.main_color = lv_color_hex3(0x222); + roller_bg.body.grad_color = lv_color_hex3(0x666); roller_bg.body.border.opa = LV_OPA_30; roller_bg.text.opa = LV_OPA_70; roller_bg.text.color = lv_color_hsv_to_rgb(_hue, 20, 70); @@ -721,8 +721,8 @@ static void tabview_init(void) #if LV_USE_TABVIEW != 0 static lv_style_t tab_rel, tab_pr, tab_trel, tab_tpr, tab_indic; lv_style_copy(&tab_rel, &def); - tab_rel.body.main_color = LV_COLOR_HEX3(0x666); - tab_rel.body.grad_color = LV_COLOR_HEX3(0x666); + tab_rel.body.main_color = lv_color_hex3(0x666); + tab_rel.body.grad_color = lv_color_hex3(0x666); tab_rel.body.padding.left = 0; tab_rel.body.padding.right = 0; tab_rel.body.padding.top = LV_DPI / 6; @@ -731,12 +731,12 @@ static void tabview_init(void) tab_rel.body.border.width = 1; tab_rel.body.border.color = LV_COLOR_SILVER; tab_rel.body.border.opa = LV_OPA_40; - tab_rel.text.color = LV_COLOR_HEX3(0xDDD); + tab_rel.text.color = lv_color_hex3(0xDDD); tab_rel.text.font = _font; lv_style_copy(&tab_pr, &tab_rel); - tab_pr.body.main_color = LV_COLOR_HEX3(0x444); - tab_pr.body.grad_color = LV_COLOR_HEX3(0x444); + tab_pr.body.main_color = lv_color_hex3(0x444); + tab_pr.body.grad_color = lv_color_hex3(0x444); lv_style_copy(&tab_trel, &def); tab_trel.body.opa = LV_OPA_TRANSP; diff --git a/lv_themes/lv_theme_alien.h b/src/lv_themes/lv_theme_alien.h similarity index 97% rename from lv_themes/lv_theme_alien.h rename to src/lv_themes/lv_theme_alien.h index ca88696ed..e25383d0c 100644 --- a/lv_themes/lv_theme_alien.h +++ b/src/lv_themes/lv_theme_alien.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_ALIEN diff --git a/lv_themes/lv_theme_default.c b/src/lv_themes/lv_theme_default.c similarity index 96% rename from lv_themes/lv_theme_default.c rename to src/lv_themes/lv_theme_default.c index ecf291558..b649be608 100644 --- a/lv_themes/lv_theme_default.c +++ b/src/lv_themes/lv_theme_default.c @@ -61,7 +61,7 @@ static void basic_init(void) lv_style_copy(&plain_bordered, &lv_style_plain); plain_bordered.body.border.width = 2; - plain_bordered.body.border.color = LV_COLOR_HEX3(0xbbb); + plain_bordered.body.border.color = lv_color_hex3(0xbbb); theme.style.bg = &lv_style_plain; theme.style.panel = &lv_style_pretty; @@ -87,9 +87,9 @@ static void label_init(void) lv_style_copy(&label_sec, &lv_style_plain); lv_style_copy(&label_hint, &lv_style_plain); - label_prim.text.color = LV_COLOR_HEX3(0x111); - label_sec.text.color = LV_COLOR_HEX3(0x888); - label_hint.text.color = LV_COLOR_HEX3(0xaaa); + label_prim.text.color = lv_color_hex3(0x111); + label_sec.text.color = lv_color_hex3(0x888); + label_hint.text.color = lv_color_hex3(0xaaa); theme.style.label.prim = &label_prim; @@ -180,7 +180,7 @@ static void lmeter_init(void) #if LV_USE_LMETER != 0 lv_style_copy(&lmeter, &lv_style_pretty_color); - lmeter.line.color = LV_COLOR_HEX3(0xddd); + lmeter.line.color = lv_color_hex3(0xddd); lmeter.line.width = 2; lmeter.body.main_color = lv_color_mix(lmeter.body.main_color, LV_COLOR_WHITE, LV_OPA_50); lmeter.body.grad_color = lv_color_mix(lmeter.body.grad_color, LV_COLOR_BLACK, LV_OPA_50); @@ -196,9 +196,9 @@ static void gauge_init(void) lv_style_copy(&gauge, &lmeter); gauge.line.color = lmeter.body.grad_color; gauge.line.width = 2; - gauge.body.main_color = LV_COLOR_HEX3(0x888); + gauge.body.main_color = lv_color_hex3(0x888); gauge.body.grad_color = lmeter.body.main_color; - gauge.text.color = LV_COLOR_HEX3(0x888); + gauge.text.color = lv_color_hex3(0x888); theme.style.gauge = &gauge; #endif diff --git a/lv_themes/lv_theme_default.h b/src/lv_themes/lv_theme_default.h similarity index 97% rename from lv_themes/lv_theme_default.h rename to src/lv_themes/lv_theme_default.h index 772d76430..285c60445 100644 --- a/lv_themes/lv_theme_default.h +++ b/src/lv_themes/lv_theme_default.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_DEFAULT diff --git a/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c similarity index 93% rename from lv_themes/lv_theme_material.c rename to src/lv_themes/lv_theme_material.c index b5108209e..fc1f45e3f 100644 --- a/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -14,7 +14,7 @@ * DEFINES *********************/ #define DEF_RADIUS 4 -#define DEF_SHADOW_COLOR LV_COLOR_HEX3(0xaaa) +#define DEF_SHADOW_COLOR lv_color_hex3(0xaaa) /********************** * TYPEDEFS @@ -54,7 +54,7 @@ static void basic_init(void) def.body.radius = DEF_RADIUS; lv_style_copy(&bg, &def); - bg.body.main_color = LV_COLOR_HEX(0xf0f0f0); + bg.body.main_color = lv_color_hex(0xf0f0f0); bg.body.grad_color = bg.body.main_color; bg.body.radius = 0; @@ -63,7 +63,7 @@ static void basic_init(void) panel.body.main_color = LV_COLOR_WHITE; panel.body.grad_color = LV_COLOR_WHITE; panel.body.border.width = 1; - panel.body.border.color = LV_COLOR_HEX3(0xbbb); + panel.body.border.color = lv_color_hex3(0xbbb); panel.body.border.opa = LV_OPA_COVER; panel.body.shadow.color = DEF_SHADOW_COLOR; panel.body.shadow.type = LV_SHADOW_BOTTOM; @@ -73,8 +73,8 @@ static void basic_init(void) panel.body.padding.top = LV_DPI / 8; panel.body.padding.bottom = LV_DPI / 8; panel.body.padding.inner = LV_DPI / 12; - panel.text.color = LV_COLOR_HEX3(0x333); - panel.image.color = LV_COLOR_HEX3(0x333); + panel.text.color = lv_color_hex3(0x333); + panel.image.color = lv_color_hex3(0x333); lv_style_copy(&sb, &def); sb.body.main_color = LV_COLOR_BLACK; @@ -134,7 +134,7 @@ static void btn_init(void) tgl_pr.body.shadow.width = 2; lv_style_copy(&ina, &rel); - ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.main_color = lv_color_hex3(0xccc); ina.body.grad_color = ina.body.main_color; ina.body.shadow.width = 0; ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5); @@ -278,10 +278,10 @@ static void sw_init(void) lv_style_copy(&sw_knob_off, &sw_knob_on); - sw_knob_off.body.main_color = LV_COLOR_HEX(0xfafafa); + sw_knob_off.body.main_color = lv_color_hex(0xfafafa); sw_knob_off.body.grad_color = sw_knob_off.body.main_color; sw_knob_off.body.border.width = 1; - sw_knob_off.body.border.color = LV_COLOR_HEX3(0x999); + sw_knob_off.body.border.color = lv_color_hex3(0x999); sw_knob_off.body.border.opa = LV_OPA_COVER; theme.style.sw.bg = &sw_bg; @@ -300,7 +300,7 @@ static void lmeter_init(void) lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 90); lmeter.body.grad_color = lmeter.body.main_color; lmeter.body.padding.left = LV_DPI / 10; /*Scale line length*/ - lmeter.line.color = LV_COLOR_HEX3(0x999); + lmeter.line.color = lv_color_hex3(0x999); lmeter.line.width = 2; theme.style.lmeter = &lmeter; @@ -317,8 +317,8 @@ static void gauge_init(void) gauge.body.grad_color = gauge.body.main_color; gauge.body.padding.left = LV_DPI / 16; /*Scale line length*/ gauge.body.padding.inner = LV_DPI / 8; - gauge.body.border.color = LV_COLOR_HEX3(0x999); - gauge.text.color = LV_COLOR_HEX3(0x333); + gauge.body.border.color = lv_color_hex3(0x999); + gauge.text.color = lv_color_hex3(0x333); gauge.line.width = 3; gauge.line.color = lv_color_hsv_to_rgb(_hue, 95, 70); @@ -412,7 +412,7 @@ static void cb_init(void) rel.body.shadow.width = 3; lv_style_copy(&pr, &rel); - pr.body.main_color = LV_COLOR_HEX3(0xccc); + pr.body.main_color = lv_color_hex3(0xccc); pr.body.grad_color = pr.body.main_color; pr.body.shadow.width = 0; @@ -450,18 +450,18 @@ static void btnm_init(void) bg.body.padding.top = 0; bg.body.padding.bottom = 0; bg.body.padding.inner = 0; - bg.text.color = LV_COLOR_HEX3(0x555); + bg.text.color = lv_color_hex3(0x555); lv_style_copy(&rel, theme.style.panel); rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL; rel.body.border.width = 1; - rel.body.border.color = LV_COLOR_HEX3(0xbbb); + rel.body.border.color = lv_color_hex3(0xbbb); rel.body.opa = LV_OPA_TRANSP; rel.body.shadow.width = 0; lv_style_copy(&pr, &rel); pr.glass = 0; - pr.body.main_color = LV_COLOR_HEX3(0xddd); + pr.body.main_color = lv_color_hex3(0xddd); pr.body.grad_color = pr.body.main_color; pr.body.border.width = 0; pr.body.opa = LV_OPA_COVER; @@ -478,7 +478,7 @@ static void btnm_init(void) tgl_pr.body.border.width = 0; lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.main_color = lv_color_hex3(0xccc); ina.body.grad_color = ina.body.main_color; theme.style.btnm.bg = &bg; @@ -549,9 +549,9 @@ static void ta_init(void) oneline.body.radius = 0; oneline.body.border.part = LV_BORDER_BOTTOM; oneline.body.border.width = 3; - oneline.body.border.color = LV_COLOR_HEX3(0x333); + oneline.body.border.color = lv_color_hex3(0x333); oneline.body.border.opa = LV_OPA_COVER; - oneline.text.color = LV_COLOR_HEX3(0x333); + oneline.text.color = lv_color_hex3(0x333); theme.style.ta.area = theme.style.panel; theme.style.ta.oneline = &oneline; @@ -588,13 +588,13 @@ static void list_init(void) rel.body.padding.top = LV_DPI / 6; rel.body.padding.bottom = LV_DPI / 6; rel.body.radius = 10; - rel.body.border.color = LV_COLOR_HEX3(0xbbb); + rel.body.border.color = lv_color_hex3(0xbbb); rel.body.border.width = 1; rel.body.border.part = LV_BORDER_BOTTOM; lv_style_copy(&pr, &rel); pr.glass = 0; - pr.body.main_color = LV_COLOR_HEX3(0xddd); + pr.body.main_color = lv_color_hex3(0xddd); pr.body.grad_color = pr.body.main_color; pr.body.border.width = 0; pr.body.opa = LV_OPA_COVER; @@ -613,7 +613,7 @@ static void list_init(void) tgl_pr.body.border.width = 0; lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0xccc); + ina.body.main_color = lv_color_hex3(0xccc); ina.body.grad_color = ina.body.main_color; @@ -689,11 +689,11 @@ static void tabview_init(void) indic.body.padding.inner = LV_DPI / 20; lv_style_copy(&btn_bg, &def); - btn_bg.body.main_color = LV_COLOR_HEX3(0xccc); + btn_bg.body.main_color = lv_color_hex3(0xccc); btn_bg.body.grad_color = btn_bg.body.main_color; btn_bg.body.radius = 0; btn_bg.body.border.width = 1; - btn_bg.body.border.color = LV_COLOR_HEX3(0x888); + btn_bg.body.border.color = lv_color_hex3(0x888); btn_bg.body.border.part = LV_BORDER_BOTTOM; btn_bg.body.border.opa = LV_OPA_COVER; btn_bg.body.shadow.width = 5; @@ -704,7 +704,7 @@ static void tabview_init(void) btn_bg.body.padding.right = 0; btn_bg.body.padding.top = 0; btn_bg.body.padding.bottom = 0; - btn_bg.text.color = LV_COLOR_HEX3(0x333); + btn_bg.text.color = lv_color_hex3(0x333); lv_style_copy(&rel, &lv_style_transp); @@ -713,16 +713,16 @@ static void tabview_init(void) rel.text.font = _font; lv_style_copy(&pr, &def); - pr.body.main_color = LV_COLOR_HEX3(0xbbb); + pr.body.main_color = lv_color_hex3(0xbbb); pr.body.grad_color = pr.body.main_color; pr.body.border.width = 0; pr.body.opa = LV_OPA_COVER; pr.body.radius = 0; pr.body.border.width = 1; - pr.body.border.color = LV_COLOR_HEX3(0x888); + pr.body.border.color = lv_color_hex3(0x888); pr.body.border.part = LV_BORDER_BOTTOM; pr.body.border.opa = LV_OPA_COVER; - pr.text.color = LV_COLOR_HEX3(0x111); + pr.text.color = lv_color_hex3(0x111); lv_style_copy(&tgl_rel, &lv_style_transp); tgl_rel.glass = 0; @@ -780,11 +780,11 @@ static void win_init(void) static lv_style_t header, pr; lv_style_copy(&header, &def); - header.body.main_color = LV_COLOR_HEX3(0xccc); + header.body.main_color = lv_color_hex3(0xccc); header.body.grad_color = header.body.main_color; header.body.radius = 0; header.body.border.width = 1; - header.body.border.color = LV_COLOR_HEX3(0xbbb); + header.body.border.color = lv_color_hex3(0xbbb); header.body.border.part = LV_BORDER_BOTTOM; header.body.border.opa = LV_OPA_COVER; header.body.padding.inner = 0; @@ -792,17 +792,17 @@ static void win_init(void) header.body.padding.right = 0; header.body.padding.top = 0; header.body.padding.bottom = 0; - header.text.color = LV_COLOR_HEX3(0x333); - header.image.color = LV_COLOR_HEX3(0x333); + header.text.color = lv_color_hex3(0x333); + header.image.color = lv_color_hex3(0x333); lv_style_copy(&pr, &def); - pr.body.main_color = LV_COLOR_HEX3(0xbbb); + pr.body.main_color = lv_color_hex3(0xbbb); pr.body.grad_color = pr.body.main_color; pr.body.border.width = 0; pr.body.opa = LV_OPA_COVER; pr.body.radius = 0; - pr.text.color = LV_COLOR_HEX3(0x111); - pr.image.color = LV_COLOR_HEX3(0x111); + pr.text.color = lv_color_hex3(0x111); + pr.image.color = lv_color_hex3(0x111); theme.style.win.bg = theme.style.panel; diff --git a/lv_themes/lv_theme_material.h b/src/lv_themes/lv_theme_material.h similarity index 97% rename from lv_themes/lv_theme_material.h rename to src/lv_themes/lv_theme_material.h index 572801f2c..61fc323a6 100644 --- a/lv_themes/lv_theme_material.h +++ b/src/lv_themes/lv_theme_material.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_MATERIAL diff --git a/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c similarity index 100% rename from lv_themes/lv_theme_mono.c rename to src/lv_themes/lv_theme_mono.c diff --git a/lv_themes/lv_theme_mono.h b/src/lv_themes/lv_theme_mono.h similarity index 97% rename from lv_themes/lv_theme_mono.h rename to src/lv_themes/lv_theme_mono.h index 8e0e0553a..52665af1f 100644 --- a/lv_themes/lv_theme_mono.h +++ b/src/lv_themes/lv_theme_mono.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_MONO diff --git a/lv_themes/lv_theme_nemo.c b/src/lv_themes/lv_theme_nemo.c similarity index 96% rename from lv_themes/lv_theme_nemo.c rename to src/lv_themes/lv_theme_nemo.c index 090e1677a..03db61905 100644 --- a/lv_themes/lv_theme_nemo.c +++ b/src/lv_themes/lv_theme_nemo.c @@ -75,8 +75,8 @@ static void basic_init(void) def.body.opa = LV_OPA_COVER; def.glass = 0; - def.body.main_color = LV_COLOR_HEX3(0x222); - def.body.grad_color = LV_COLOR_HEX3(0x222); + def.body.main_color = lv_color_hex3(0x222); + def.body.grad_color = lv_color_hex3(0x222); def.body.radius = 0; def.body.padding.left = LV_DPI / 8; def.body.padding.right = LV_DPI / 8; @@ -90,31 +90,31 @@ static void basic_init(void) def.body.shadow.width = 0; def.body.shadow.type = LV_SHADOW_FULL; - def.text.color = LV_COLOR_HEX3(0xDDD); + def.text.color = lv_color_hex3(0xDDD); def.text.font = _font; def.text.letter_space = 1; def.text.line_space = 2; - def.image.color = LV_COLOR_HEX3(0xDDD); + def.image.color = lv_color_hex3(0xDDD); def.image.intense = LV_OPA_TRANSP; - def.line.color = LV_COLOR_HEX3(0xDDD); + def.line.color = lv_color_hex3(0xDDD); def.line.width = 1; /*Background*/ lv_style_copy(&bg, &def); - bg.body.main_color = LV_COLOR_HEX3(0x005); - bg.body.grad_color = LV_COLOR_HEX3(0x045); + bg.body.main_color = lv_color_hex3(0x005); + bg.body.grad_color = lv_color_hex3(0x045); bg.body.border.width = 2; - bg.body.border.color = LV_COLOR_HEX3(0x666); + bg.body.border.color = lv_color_hex3(0x666); bg.body.shadow.color = LV_COLOR_SILVER; /*Panel*/ lv_style_copy(&panel, &def); panel.body.radius = LV_DPI / 10; - panel.body.main_color = LV_COLOR_HEX3(0x500); - panel.body.grad_color = LV_COLOR_HEX3(0x505); - panel.body.border.color = LV_COLOR_HEX3(0xccc); + panel.body.main_color = lv_color_hex3(0x500); + panel.body.grad_color = lv_color_hex3(0x505); + panel.body.border.color = lv_color_hex3(0xccc); panel.body.border.width = 2; panel.body.border.opa = LV_OPA_60; panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); @@ -332,8 +332,8 @@ static void sw_init(void) sw_bg.body.padding.right = -2 ; sw_bg.body.padding.top = -2 ; sw_bg.body.padding.bottom = -2 ; - sw_bg.body.main_color = LV_COLOR_HEX3(0x666); - sw_bg.body.grad_color = LV_COLOR_HEX3(0x999); + sw_bg.body.main_color = lv_color_hex3(0x666); + sw_bg.body.grad_color = lv_color_hex3(0x999); sw_bg.body.border.width = 2; sw_bg.body.border.opa = LV_OPA_50; @@ -362,7 +362,7 @@ static void lmeter_init(void) lmeter_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 70); lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 80); lmeter_bg.body.padding.left = LV_DPI / 8; /*Scale line length*/ - lmeter_bg.line.color = LV_COLOR_HEX3(0x500); + lmeter_bg.line.color = lv_color_hex3(0x500); lmeter_bg.line.width = 2; theme.style.lmeter = &lmeter_bg; @@ -382,7 +382,7 @@ static void gauge_init(void) gauge_bg.body.padding.top = LV_DPI / 20; /*Needle center size*/ gauge_bg.body.padding.bottom = LV_DPI / 20; /*Needle center size*/ gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/ - gauge_bg.body.border.color = LV_COLOR_HEX3(0x500); + gauge_bg.body.border.color = lv_color_hex3(0x500); gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75); gauge_bg.line.width = 2; gauge_bg.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); @@ -676,8 +676,8 @@ static void roller_init(void) lv_style_copy(&roller_bg, &ddlist_bg); roller_bg.text.line_space = LV_DPI / 6; roller_bg.body.radius = LV_DPI / 20; - roller_bg.body.main_color = LV_COLOR_HEX3(0x500); - roller_bg.body.grad_color = LV_COLOR_HEX3(0x005); + roller_bg.body.main_color = lv_color_hex3(0x500); + roller_bg.body.grad_color = lv_color_hex3(0x005); roller_bg.body.border.opa = LV_OPA_30; roller_bg.text.opa = LV_OPA_70; roller_bg.text.color = lv_color_hsv_to_rgb(_hue, 20, 70); @@ -699,8 +699,8 @@ static void tabview_init(void) #if LV_USE_TABVIEW != 0 static lv_style_t tab_rel, tab_pr, tab_trel, tab_tpr, tab_indic; lv_style_copy(&tab_rel, &def); - tab_rel.body.main_color = LV_COLOR_HEX3(0x500); - tab_rel.body.grad_color = LV_COLOR_HEX3(0x005); + tab_rel.body.main_color = lv_color_hex3(0x500); + tab_rel.body.grad_color = lv_color_hex3(0x005); tab_rel.body.padding.left = 0; tab_rel.body.padding.right = 0; tab_rel.body.padding.top = LV_DPI / 6; @@ -709,12 +709,12 @@ static void tabview_init(void) tab_rel.body.border.width = 1; tab_rel.body.border.color = LV_COLOR_SILVER; tab_rel.body.border.opa = LV_OPA_40; - tab_rel.text.color = LV_COLOR_HEX3(0xDDD); + tab_rel.text.color = lv_color_hex3(0xDDD); tab_rel.text.font = _font; lv_style_copy(&tab_pr, &tab_rel); - tab_pr.body.main_color = LV_COLOR_HEX3(0x005); - tab_pr.body.grad_color = LV_COLOR_HEX3(0x500); + tab_pr.body.main_color = lv_color_hex3(0x005); + tab_pr.body.grad_color = lv_color_hex3(0x500); lv_style_copy(&tab_trel, &def); tab_trel.body.opa = LV_OPA_TRANSP; diff --git a/lv_themes/lv_theme_nemo.h b/src/lv_themes/lv_theme_nemo.h similarity index 97% rename from lv_themes/lv_theme_nemo.h rename to src/lv_themes/lv_theme_nemo.h index 1f8c70263..92aceb85f 100644 --- a/lv_themes/lv_theme_nemo.h +++ b/src/lv_themes/lv_theme_nemo.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_NEMO diff --git a/lv_themes/lv_theme_night.c b/src/lv_themes/lv_theme_night.c similarity index 95% rename from lv_themes/lv_theme_night.c rename to src/lv_themes/lv_theme_night.c index 1576db970..1ca30f706 100644 --- a/lv_themes/lv_theme_night.c +++ b/src/lv_themes/lv_theme_night.c @@ -105,7 +105,7 @@ static void btn_init(void) lv_style_copy(&btn_rel, &def); btn_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40); btn_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); - btn_rel.body.border.color = LV_COLOR_HEX3(0x111); + btn_rel.body.border.color = lv_color_hex3(0x111); btn_rel.body.border.width = 1; btn_rel.body.border.opa = LV_OPA_70; btn_rel.body.padding.left = LV_DPI / 4; @@ -113,10 +113,10 @@ static void btn_init(void) btn_rel.body.padding.top = LV_DPI / 8; btn_rel.body.padding.bottom = LV_DPI / 8; btn_rel.body.shadow.type = LV_SHADOW_BOTTOM; - btn_rel.body.shadow.color = LV_COLOR_HEX3(0x111); + btn_rel.body.shadow.color = lv_color_hex3(0x111); btn_rel.body.shadow.width = LV_DPI / 30; - btn_rel.text.color = LV_COLOR_HEX3(0xeee); - btn_rel.image.color = LV_COLOR_HEX3(0xeee); + btn_rel.text.color = lv_color_hex3(0xeee); + btn_rel.image.color = lv_color_hex3(0xeee); lv_style_copy(&btn_pr, &btn_rel); btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 30); @@ -126,22 +126,22 @@ static void btn_init(void) btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40); btn_tgl_rel.body.shadow.width = LV_DPI / 40; - btn_tgl_rel.text.color = LV_COLOR_HEX3(0xddd); - btn_tgl_rel.image.color = LV_COLOR_HEX3(0xddd); + btn_tgl_rel.text.color = lv_color_hex3(0xddd); + btn_tgl_rel.image.color = lv_color_hex3(0xddd); lv_style_copy(&btn_tgl_pr, &btn_rel); btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10); btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 30); btn_tgl_pr.body.shadow.width = LV_DPI / 30; - btn_tgl_pr.text.color = LV_COLOR_HEX3(0xddd); - btn_tgl_pr.image.color = LV_COLOR_HEX3(0xddd); + btn_tgl_pr.text.color = lv_color_hex3(0xddd); + btn_tgl_pr.image.color = lv_color_hex3(0xddd); lv_style_copy(&btn_ina, &btn_rel); btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_ina.body.shadow.width = 0; - btn_ina.text.color = LV_COLOR_HEX3(0xaaa); - btn_ina.image.color = LV_COLOR_HEX3(0xaaa); + btn_ina.text.color = lv_color_hex3(0xaaa); + btn_ina.image.color = lv_color_hex3(0xaaa); theme.style.btn.rel = &btn_rel; theme.style.btn.pr = &btn_pr; @@ -269,10 +269,10 @@ static void lmeter_init(void) lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 95, 90); lmeter_bg.body.padding.left = LV_DPI / 10; /*Scale line length*/ lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/ - lmeter_bg.body.border.color = LV_COLOR_HEX3(0x333); - lmeter_bg.line.color = LV_COLOR_HEX3(0x555); + lmeter_bg.body.border.color = lv_color_hex3(0x333); + lmeter_bg.line.color = lv_color_hex3(0x555); lmeter_bg.line.width = 1; - lmeter_bg.text.color = LV_COLOR_HEX3(0xddd); + lmeter_bg.text.color = lv_color_hex3(0xddd); theme.style.lmeter = &lmeter_bg; #endif @@ -287,7 +287,7 @@ static void gauge_init(void) gauge_bg.body.grad_color = gauge_bg.body.main_color; gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75); gauge_bg.line.width = 1; - gauge_bg.text.color = LV_COLOR_HEX3(0xddd); + gauge_bg.text.color = lv_color_hex3(0xddd); theme.style.gauge = &gauge_bg; #endif @@ -337,7 +337,7 @@ static void calendar_init(void) lv_style_copy(&cal_bg, &bg); cal_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40); cal_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40); - cal_bg.body.border.color = LV_COLOR_HEX3(0x333); + cal_bg.body.border.color = lv_color_hex3(0x333); cal_bg.body.border.width = 1; cal_bg.body.radius = LV_DPI / 20; cal_bg.body.padding.left = LV_DPI / 10; @@ -351,7 +351,7 @@ static void calendar_init(void) cal_header.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); cal_header.body.radius = 0; cal_header.body.border.width = 1; - cal_header.body.border.color = LV_COLOR_HEX3(0x333); + cal_header.body.border.color = lv_color_hex3(0x333); cal_header.body.padding.left = LV_DPI / 10; cal_header.body.padding.right = LV_DPI / 10; cal_header.body.padding.top = LV_DPI / 10; @@ -427,8 +427,8 @@ static void cb_init(void) tgl_pr.body.border.width = 1;; lv_style_copy(&ina, &rel); - ina.body.main_color = LV_COLOR_HEX3(0x777); - ina.body.grad_color = LV_COLOR_HEX3(0x777); + ina.body.main_color = lv_color_hex3(0x777); + ina.body.grad_color = lv_color_hex3(0x777); ina.body.border.width = 0; theme.style.cb.bg = &lv_style_transp; @@ -511,7 +511,7 @@ static void mbox_init(void) mbox_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 11, 20); mbox_bg.body.border.width = 1; mbox_bg.body.shadow.width = LV_DPI / 10; - mbox_bg.body.shadow.color = LV_COLOR_HEX3(0x222); + mbox_bg.body.shadow.color = lv_color_hex3(0x222); mbox_bg.body.radius = LV_DPI / 20; theme.style.mbox.bg = &mbox_bg; theme.style.mbox.btn.bg = &lv_style_transp; @@ -528,7 +528,7 @@ static void page_init(void) lv_style_copy(&page_scrl, &bg); page_scrl.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40); page_scrl.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40); - page_scrl.body.border.color = LV_COLOR_HEX3(0x333); + page_scrl.body.border.color = lv_color_hex3(0x333); page_scrl.body.border.width = 1; page_scrl.body.radius = LV_DPI / 20; @@ -697,7 +697,7 @@ static void win_init(void) #if LV_USE_WIN != 0 static lv_style_t win_bg; lv_style_copy(&win_bg, &bg); - win_bg.body.border.color = LV_COLOR_HEX3(0x333); + win_bg.body.border.color = lv_color_hex3(0x333); win_bg.body.border.width = 1; static lv_style_t win_header; @@ -714,8 +714,8 @@ static void win_init(void) lv_style_copy(&win_btn_pr, &def); win_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10); win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10); - win_btn_pr.text.color = LV_COLOR_HEX3(0xaaa); - win_btn_pr.image.color = LV_COLOR_HEX3(0xaaa); + win_btn_pr.text.color = lv_color_hex3(0xaaa); + win_btn_pr.image.color = lv_color_hex3(0xaaa); theme.style.win.bg = &win_bg; theme.style.win.sb = &sb; diff --git a/lv_themes/lv_theme_night.h b/src/lv_themes/lv_theme_night.h similarity index 97% rename from lv_themes/lv_theme_night.h rename to src/lv_themes/lv_theme_night.h index 7c1270c40..3ea15c370 100644 --- a/lv_themes/lv_theme_night.h +++ b/src/lv_themes/lv_theme_night.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_NIGHT diff --git a/lv_themes/lv_theme_templ.c b/src/lv_themes/lv_theme_templ.c similarity index 100% rename from lv_themes/lv_theme_templ.c rename to src/lv_themes/lv_theme_templ.c diff --git a/lv_themes/lv_theme_templ.h b/src/lv_themes/lv_theme_templ.h similarity index 97% rename from lv_themes/lv_theme_templ.h rename to src/lv_themes/lv_theme_templ.h index 9d17c4d9b..02a8a862b 100644 --- a/lv_themes/lv_theme_templ.h +++ b/src/lv_themes/lv_theme_templ.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_TEMPL diff --git a/lv_themes/lv_theme_zen.c b/src/lv_themes/lv_theme_zen.c similarity index 93% rename from lv_themes/lv_theme_zen.c rename to src/lv_themes/lv_theme_zen.c index f6a13479f..94721e161 100644 --- a/lv_themes/lv_theme_zen.c +++ b/src/lv_themes/lv_theme_zen.c @@ -51,8 +51,8 @@ static void basic_init(void) lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ def.body.border.opa = LV_OPA_COVER; def.text.font = _font; - def.text.color = LV_COLOR_HEX3(0x444); - def.image.color = LV_COLOR_HEX3(0x444); + def.text.color = lv_color_hex3(0x444); + def.image.color = lv_color_hex3(0x444); lv_style_copy(&bg, &def); bg.body.main_color = LV_COLOR_WHITE; @@ -67,7 +67,7 @@ static void basic_init(void) panel.body.border.color = lv_color_hsv_to_rgb(_hue, 30, 90); panel.body.border.opa = LV_OPA_COVER; panel.body.shadow.width = 4; - panel.body.shadow.color = LV_COLOR_HEX3(0xddd); + panel.body.shadow.color = lv_color_hex3(0xddd); panel.body.padding.left = LV_DPI / 6; panel.body.padding.right = LV_DPI / 6; panel.body.padding.top = LV_DPI / 8; @@ -105,7 +105,7 @@ static void btn_init(void) rel.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 90); rel.body.border.opa = LV_OPA_COVER; rel.body.shadow.width = 4; - rel.body.shadow.color = LV_COLOR_HEX3(0xddd); + rel.body.shadow.color = lv_color_hex3(0xddd); rel.body.padding.left = LV_DPI / 4; rel.body.padding.right = LV_DPI / 4; rel.body.padding.top = LV_DPI / 8; @@ -125,9 +125,9 @@ static void btn_init(void) tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50); lv_style_copy(&ina, &tgl_pr); - ina.body.border.color = LV_COLOR_HEX3(0xbbb); - ina.text.color = LV_COLOR_HEX3(0xbbb); - ina.image.color = LV_COLOR_HEX3(0xbbb); + ina.body.border.color = lv_color_hex3(0xbbb); + ina.text.color = lv_color_hex3(0xbbb); + ina.image.color = lv_color_hex3(0xbbb); theme.style.btn.rel = &rel; theme.style.btn.pr = ≺ @@ -145,7 +145,7 @@ static void label_init(void) lv_style_copy(&sec, &def); lv_style_copy(&hint, &def); - prim.text.color = LV_COLOR_HEX3(0x555); + prim.text.color = lv_color_hex3(0x555); sec.text.color = lv_color_hsv_to_rgb(_hue, 50, 80); hint.text.color = lv_color_hsv_to_rgb(_hue, 25, 85); @@ -276,7 +276,7 @@ static void lmeter_init(void) static lv_style_t lmeter; lv_style_copy(&lmeter, &def); - lmeter.line.color = LV_COLOR_HEX3(0xddd); + lmeter.line.color = lv_color_hex3(0xddd); lmeter.line.width = 2; lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70); lmeter.body.grad_color = lmeter.body.main_color; @@ -295,11 +295,11 @@ static void gauge_init(void) lv_style_copy(&gauge, &def); gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70); gauge.line.width = 1; - gauge.body.main_color = LV_COLOR_HEX3(0x999); + gauge.body.main_color = lv_color_hex3(0x999); gauge.body.grad_color = gauge.body.main_color; gauge.body.padding.left = LV_DPI / 16; gauge.body.padding.right = LV_DPI / 16; - gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/ + gauge.body.border.color = lv_color_hex3(0x666); /*Needle middle color*/ theme.style.gauge = &gauge; #endif @@ -375,7 +375,7 @@ static void cb_init(void) rel.body.border.width = 3; rel.body.border.opa = LV_OPA_COVER; rel.body.border.color = lv_color_hsv_to_rgb(_hue, 35, 80); - rel.body.main_color = LV_COLOR_HEX3(0xfff); + rel.body.main_color = lv_color_hex3(0xfff); rel.body.grad_color = rel.body.main_color; @@ -395,7 +395,7 @@ static void cb_init(void) lv_style_copy(&ina, &rel); - ina.body.border.color = LV_COLOR_HEX3(0xaaa); + ina.body.border.color = lv_color_hex3(0xaaa); theme.style.cb.bg = &lv_style_transp; @@ -446,9 +446,9 @@ static void btnm_init(void) tgl_pr.body.grad_color = tgl_pr.body.main_color; lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0x888); + ina.body.main_color = lv_color_hex3(0x888); ina.body.grad_color = tgl_pr.body.main_color; - ina.text.color = LV_COLOR_HEX3(0x888);; + ina.text.color = lv_color_hex3(0x888);; theme.style.btnm.bg = &bg; theme.style.btnm.btn.rel = &rel; @@ -464,7 +464,7 @@ static void kb_init(void) #if LV_USE_KB static lv_style_t bg, rel, pr, tgl_rel, tgl_pr, ina; lv_style_copy(&bg, &def); - bg.body.main_color = LV_COLOR_HEX3(0x666); + bg.body.main_color = lv_color_hex3(0x666); bg.body.grad_color = bg.body.main_color; bg.body.padding.left = 0; bg.body.padding.right = 0; @@ -478,34 +478,34 @@ static void kb_init(void) rel.body.opa = LV_OPA_COVER; rel.body.radius = 0; rel.body.border.width = 1; - rel.body.border.color = LV_COLOR_HEX3(0x888); + rel.body.border.color = lv_color_hex3(0x888); rel.body.border.opa = LV_OPA_COVER; rel.text.color = LV_COLOR_WHITE; lv_style_copy(&pr, &def); - pr.body.main_color = LV_COLOR_HEX3(0xeee); + pr.body.main_color = lv_color_hex3(0xeee); pr.body.grad_color = pr.body.main_color; - pr.body.border.color = LV_COLOR_HEX3(0x888); + pr.body.border.color = lv_color_hex3(0x888); pr.body.border.width = 1; pr.body.border.opa = LV_OPA_COVER; pr.body.radius = 0; - pr.text.color = LV_COLOR_HEX3(0x666); + pr.text.color = lv_color_hex3(0x666); lv_style_copy(&tgl_rel, &pr); - tgl_rel.body.main_color = LV_COLOR_HEX3(0x999); + tgl_rel.body.main_color = lv_color_hex3(0x999); tgl_rel.body.grad_color = tgl_rel.body.main_color; tgl_rel.text.color = LV_COLOR_WHITE; lv_style_copy(&tgl_pr, &pr); - tgl_pr.body.main_color = LV_COLOR_HEX3(0xbbb); + tgl_pr.body.main_color = lv_color_hex3(0xbbb); tgl_pr.body.grad_color = tgl_pr.body.main_color; - tgl_pr.text.color = LV_COLOR_HEX3(0xddd); + tgl_pr.text.color = lv_color_hex3(0xddd); lv_style_copy(&ina, &pr); - ina.body.main_color = LV_COLOR_HEX3(0x777); + ina.body.main_color = lv_color_hex3(0x777); ina.body.grad_color = ina.body.main_color; - ina.text.color = LV_COLOR_HEX3(0xbbb); + ina.text.color = lv_color_hex3(0xbbb); theme.style.kb.bg = &bg; theme.style.kb.btn.rel = &rel; @@ -608,8 +608,8 @@ static void list_init(void) rel.body.padding.right = LV_DPI / 8; rel.body.padding.top = LV_DPI / 8; rel.body.padding.bottom = LV_DPI / 8; - rel.text.color = LV_COLOR_HEX3(0x666); - rel.image.color = LV_COLOR_HEX3(0x666); + rel.text.color = lv_color_hex3(0x666); + rel.image.color = lv_color_hex3(0x666); lv_style_copy(&pr, &rel); pr.text.color = theme.style.btn.pr->text.color; @@ -647,7 +647,7 @@ static void ddlist_init(void) bg.body.padding.right = LV_DPI / 6; bg.body.padding.top = LV_DPI / 8; bg.body.padding.bottom = LV_DPI / 8; - bg.text.color = LV_COLOR_HEX3(0x666); + bg.text.color = lv_color_hex3(0x666); lv_style_copy(&sel, &def); sel.body.opa = LV_OPA_TRANSP; @@ -668,7 +668,7 @@ static void roller_init(void) bg.body.border.width = 0; bg.body.opa = LV_OPA_TRANSP; bg.text.line_space = LV_DPI / 6; - bg.text.color = LV_COLOR_HEX3(0x999); + bg.text.color = lv_color_hex3(0x999); lv_style_copy(&sel, theme.style.panel); sel.body.radius = LV_RADIUS_CIRCLE; @@ -700,11 +700,11 @@ static void tabview_init(void) lv_style_copy(&rel, &def); rel.body.opa = LV_OPA_TRANSP; rel.body.border.width = 0; - rel.text.color = LV_COLOR_HEX3(0x999); + rel.text.color = lv_color_hex3(0x999); lv_style_copy(&pr, &rel); - pr.text.color = LV_COLOR_HEX3(0x777); + pr.text.color = lv_color_hex3(0x777); lv_style_copy(&tgl_rel, &rel); tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 80); @@ -759,18 +759,18 @@ static void win_init(void) header.body.border.width = 2; header.body.border.part = LV_BORDER_BOTTOM; header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90); - header.text.color = LV_COLOR_HEX3(0x666); - header.image.color = LV_COLOR_HEX3(0x666); + header.text.color = lv_color_hex3(0x666); + header.image.color = lv_color_hex3(0x666); lv_style_copy(&rel, &def); rel.body.opa = LV_OPA_TRANSP; rel.body.border.width = 0; - rel.text.color = LV_COLOR_HEX3(0x666); - rel.image.color = LV_COLOR_HEX3(0x666); + rel.text.color = lv_color_hex3(0x666); + rel.image.color = lv_color_hex3(0x666); lv_style_copy(&pr, &rel); - pr.text.color = LV_COLOR_HEX3(0x333); - pr.image.color = LV_COLOR_HEX3(0x333); + pr.text.color = lv_color_hex3(0x333); + pr.image.color = lv_color_hex3(0x333); theme.style.win.bg = theme.style.panel; theme.style.win.sb = &sb; diff --git a/lv_themes/lv_theme_zen.h b/src/lv_themes/lv_theme_zen.h similarity index 97% rename from lv_themes/lv_theme_zen.h rename to src/lv_themes/lv_theme_zen.h index b43167335..181411fd0 100644 --- a/lv_themes/lv_theme_zen.h +++ b/src/lv_themes/lv_theme_zen.h @@ -16,7 +16,7 @@ extern "C" { #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else -#include "../../lv_conf.h" +#include "../../../lv_conf.h" #endif #if LV_USE_THEME_ZEN diff --git a/lv_themes/lv_themes.mk b/src/lv_themes/lv_themes.mk similarity index 62% rename from lv_themes/lv_themes.mk rename to src/lv_themes/lv_themes.mk index 0e4a81a54..fce41e4e1 100644 --- a/lv_themes/lv_themes.mk +++ b/src/lv_themes/lv_themes.mk @@ -8,7 +8,7 @@ CSRCS += lv_theme_material.c CSRCS += lv_theme_nemo.c CSRCS += lv_theme_mono.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/lv_themes -VPATH += :$(LVGL_DIR)/lvgl/lv_themes +DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_themes +VPATH += :$(LVGL_DIR)/lvgl/src/lv_themes -CFLAGS += "-I$(LVGL_DIR)/lvgl/lv_themes" +CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_themes" diff --git a/lv_version.h b/src/lv_version.h similarity index 100% rename from lv_version.h rename to src/lv_version.h