BigW Consortium Gitlab

Commit 925a174a by Gabor Kiss-Vamosi

update templates and themes

parent 5654c97c
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
*=====================*/ *=====================*/
/* Horizontal and vertical resolution of the library.*/ /* Horizontal and vertical resolution of the library.*/
#define LV_HOR_RES 320 #define LV_HOR_RES (480)
#define LV_VER_RES 240 #define LV_VER_RES (320)
#define LV_DPI 100 #define LV_DPI 100
/* Buffered rendering: >= LV_DOWNSCALE * lv_disp_hor_res() or 0 to disable buffering*/ /* Buffered rendering: >= LV_DOWNSCALE * lv_disp_hor_res() or 0 to disable buffering*/
#define LV_VDB_SIZE (20 * 1024 ) #define LV_VDB_SIZE (20 * 1024)
#define LV_VDB_ADR 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate into RAM)*/ #define LV_VDB_ADR 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate into RAM)*/
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing /* Use two Virtual Display buffers (VDB) parallelize rendering and flushing
...@@ -73,23 +73,23 @@ ...@@ -73,23 +73,23 @@
#define LV_TXT_UTF8 1 #define LV_TXT_UTF8 1
#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/ #define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/
/*Feature usage*/ /*Graphics feature usage*/
#define USE_LV_ANIMATION 1 /*1: disable all animations*/ #define USE_LV_ANIMATION 1 /*1: disable all animations*/
#define USE_LV_SHADOW 1 /*1: disable shadows*/ #define USE_LV_SHADOW 1 /*1: disable shadows*/
#define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/ #define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/
#define USE_LV_GPU 1 /*1: Enable GPU interface*/ #define USE_LV_GPU 0 /*1: Enable GPU interface*/
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images aka. lv_img)*/ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images aka. lv_img)*/
/*================== /*================
* THEME USAGE * THEME USAGE
*================*/ *================*/
#define USE_LV_THEME_TEMPL 0 /*Just for test*/ #define USE_LV_THEME_TEMPL 0 /*Just for test*/
#define USE_LV_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ #define USE_LV_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/
#define USE_LV_THEME_ALIEN 1 /*Dark futuristic theme*/ #define USE_LV_THEME_ALIEN 1 /*Dark futuristic theme*/
#define USE_LV_THEME_NIGHT 1 /*Dark elegant theme*/ #define USE_LV_THEME_NIGHT 1 /*Dark elegant theme*/
#define USE_LV_THEME_MONO 1 /*Mono color theme for monochrome displays*/ #define USE_LV_THEME_MONO 1 /*Mono color theme for monochrome displays*/
#define USE_LV_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows (Planned)*/ #define USE_LV_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/
#define USE_LV_THEME_ZEN 0 /*Peaceful, mainly black and white theme (Planned)*/ #define USE_LV_THEME_ZEN 1 /*Peaceful, mainly light theme */
/*================== /*==================
* FONT USAGE * FONT USAGE
...@@ -202,10 +202,10 @@ ...@@ -202,10 +202,10 @@
/*Bar (dependencies: -)*/ /*Bar (dependencies: -)*/
#define USE_LV_BAR 1 #define USE_LV_BAR 1
/*Line meter (dependencies: bar; misc: trigo)*/ /*Line meter (dependencies: *;)*/
#define USE_LV_LMETER 1 #define USE_LV_LMETER 1
/*Gauge (dependencies:bar, lmeter; misc: trigo)*/ /*Gauge (dependencies:bar, lmeter)*/
#define USE_LV_GAUGE 1 #define USE_LV_GAUGE 1
/*Chart (dependencies: -)*/ /*Chart (dependencies: -)*/
...@@ -220,8 +220,8 @@ ...@@ -220,8 +220,8 @@
/*Text area (dependencies: lv_label, lv_page)*/ /*Text area (dependencies: lv_label, lv_page)*/
#define USE_LV_TA 1 #define USE_LV_TA 1
#if USE_LV_TA != 0 #if USE_LV_TA != 0
#define LV_TA_CURSOR_BLINK_TIME 400 /*ms*/ #define LV_TA_CURSOR_BLINK_TIME 400 /*ms*/
#define LV_TA_PWD_SHOW_TIME 1500 /*ms*/ #define LV_TA_PWD_SHOW_TIME 1500 /*ms*/
#endif #endif
/************************* /*************************
...@@ -240,9 +240,6 @@ ...@@ -240,9 +240,6 @@
/*Check box (dependencies: lv_btn, lv_label)*/ /*Check box (dependencies: lv_btn, lv_label)*/
#define USE_LV_CB 1 #define USE_LV_CB 1
/*Switch (dependencies: lv_slider)*/
#define USE_LV_SW 1
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ /*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#define USE_LV_LIST 1 #define USE_LV_LIST 1
#if USE_LV_LIST != 0 #if USE_LV_LIST != 0
...@@ -255,12 +252,18 @@ ...@@ -255,12 +252,18 @@
#define LV_DDLIST_ANIM_TIME 200 /*Open and close default animation time [ms] (0: no animation)*/ #define LV_DDLIST_ANIM_TIME 200 /*Open and close default animation time [ms] (0: no animation)*/
#endif #endif
/*Drop down list (dependencies: lv_ddlist)*/ /*Roller (dependencies: lv_ddlist)*/
#define USE_LV_ROLLER 1 #define USE_LV_ROLLER 1
#if USE_LV_ROLLER != 0
#define LV_ROLLER_ANIM_TIME 200 /*Focus animation time [ms] (0: no animation)*/
#endif
/*Slider (dependencies: lv_bar)*/ /*Slider (dependencies: lv_bar)*/
#define USE_LV_SLIDER 1 #define USE_LV_SLIDER 1
/*Switch (dependencies: lv_slider)*/
#define USE_LV_SW 1
#endif /*LV_CONF_H*/ #endif /*LV_CONF_H*/
#endif /*Remove this to enable the content*/ #endif /*Remove this to enable the content*/
......
...@@ -65,6 +65,7 @@ typedef struct ...@@ -65,6 +65,7 @@ typedef struct
uint8_t long_pr_action_executed :1; /*1: Long press action executed (Handled by the library)*/ uint8_t long_pr_action_executed :1; /*1: Long press action executed (Handled by the library)*/
}lv_btn_ext_t; }lv_btn_ext_t;
/*Styles*/
typedef enum { typedef enum {
LV_BTN_STYLE_REL, LV_BTN_STYLE_REL,
LV_BTN_STYLE_PR, LV_BTN_STYLE_PR,
...@@ -138,7 +139,6 @@ static inline void lv_btn_set_fit(lv_obj_t * btn, bool hor_en, bool ver_en) ...@@ -138,7 +139,6 @@ static inline void lv_btn_set_fit(lv_obj_t * btn, bool hor_en, bool ver_en)
lv_cont_set_fit(btn, hor_en, ver_en); lv_cont_set_fit(btn, hor_en, ver_en);
} }
/** /**
* Set a style of a button. * Set a style of a button.
* @param btn pointer to button object * @param btn pointer to button object
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#if USE_LV_ANIMATION #if USE_LV_ANIMATION
# ifndef LV_DDLIST_ANIM_TIME # ifndef LV_DDLIST_ANIM_TIME
# define LV_DDLIST_ANIM_TIME 200 /*ms*/ # define LV_DDLIST_ANIM_TIME 200 /*ms*/
......
...@@ -105,6 +105,24 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -105,6 +105,24 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy)
*/ */
/**
* Set a style of a template.
* @param templ pointer to template object
* @param type which style should be set
* @param style pointer to a style
* */
void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, lv_style_t *style)
{
lv_templ_ext_t *ext = lv_obj_get_ext_attr(templ);
switch (type) {
case LV_TEMPL_STYLE_X:
break;
case LV_TEMPL_STYLE_Y:
break;
}
}
/*===================== /*=====================
* Getter functions * Getter functions
*====================*/ *====================*/
...@@ -113,6 +131,26 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -113,6 +131,26 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy)
* New object specific "get" functions come here * New object specific "get" functions come here
*/ */
/**
* Get style of a template.
* @param templ pointer to template object
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_btn_get_style(lv_obj_t * templ, lv_templ_style_t type)
{
lv_templ_ext_t *ext = lv_obj_get_ext_attr(templ);
switch (type) {
case LV_TEMPL_STYLE_X: return NULL;
case LV_TEMPL_STYLE_Y: return NULL;
default: return NULL;
}
/*To avoid warning*/
return NULL;
}
/*===================== /*=====================
* Other functions * Other functions
*====================*/ *====================*/
......
...@@ -39,6 +39,14 @@ typedef struct { ...@@ -39,6 +39,14 @@ typedef struct {
/*New data for this type */ /*New data for this type */
}lv_templ_ext_t; }lv_templ_ext_t;
/*Styles*/
typedef enum {
LV_TEMPL_STYLE_X,
LV_TEMPL_STYLE_Y,
}lv_templ_style_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
...@@ -51,15 +59,38 @@ typedef struct { ...@@ -51,15 +59,38 @@ typedef struct {
*/ */
lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy); lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/** /**
* Signal function of the template * Set a style of a template.
* @param templ pointer to a template object * @param templ pointer to template object
* @param sign a signal type from lv_signal_t enum * @param type which style should be set
* @param param pointer to a signal specific variable * @param style pointer to a style
* @return true: the object is still valid (not deleted), false: the object become invalid * */
*/ void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, lv_style_t *style);
bool lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param);
/*=====================
* Getter functions
*====================*/
/**
* Get style of a template.
* @param templ pointer to template object
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_btn_get_style(lv_obj_t * templ, lv_templ_style_t type);
/*=====================
* Other functions
*====================*/
/********************** /**********************
* MACROS * MACROS
......
...@@ -17,6 +17,14 @@ ...@@ -17,6 +17,14 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#if USE_LV_ANIMATION
# ifndef LV_ROLLER_ANIM_TIME
# define LV_ROLLER_ANIM_TIME 200 /*ms*/
# endif
#else
# undef LV_ROLLER_ANIM_TIME
# define LV_ROLLER_ANIM_TIME 0 /*No animation*/
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
...@@ -74,6 +82,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -74,6 +82,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_page_set_rel_action(new_roller, NULL); /*Roller don't uses it (like ddlist)*/ lv_page_set_rel_action(new_roller, NULL); /*Roller don't uses it (like ddlist)*/
lv_page_set_scrl_fit(new_roller, true, false); /*Height is specified directly*/ lv_page_set_scrl_fit(new_roller, true, false); /*Height is specified directly*/
lv_ddlist_open(new_roller, false); lv_ddlist_open(new_roller, false);
lv_ddlist_set_anim_time(new_roller, LV_ROLLER_ANIM_TIME);
lv_roller_set_visible_row_count(new_roller, 3); lv_roller_set_visible_row_count(new_roller, 3);
lv_label_set_align(ext->ddlist.label, LV_LABEL_ALIGN_CENTER); lv_label_set_align(ext->ddlist.label, LV_LABEL_ALIGN_CENTER);
......
...@@ -71,6 +71,13 @@ static void basic_init(void) ...@@ -71,6 +71,13 @@ static void basic_init(void)
panel.body.padding.ver = LV_DPI / 8; panel.body.padding.ver = LV_DPI / 8;
panel.body.padding.inner = LV_DPI / 10; panel.body.padding.inner = LV_DPI / 10;
lv_style_copy(&sb, &def);
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 90);
sb.body.grad_color = sb.body.main_color;
sb.body.border.width = 0;
sb.body.radius = LV_RADIUS_CIRCLE;
sb.body.padding.inner = LV_DPI / 10;
theme.bg = &bg; theme.bg = &bg;
theme.panel = &panel; theme.panel = &panel;
} }
...@@ -176,10 +183,10 @@ static void led_init(void) ...@@ -176,10 +183,10 @@ static void led_init(void)
led.body.radius = LV_RADIUS_CIRCLE; led.body.radius = LV_RADIUS_CIRCLE;
led.body.border.width= LV_DPI / 30; led.body.border.width= LV_DPI / 30;
led.body.border.opa = LV_OPA_30; led.body.border.opa = LV_OPA_30;
led.body.main_color = lv_color_hsv_to_rgb(_hue, 100, 100); led.body.main_color = lv_color_hsv_to_rgb(_hue, 60, 100);
led.body.grad_color = lv_color_hsv_to_rgb(_hue, 100, 40); led.body.grad_color = lv_color_hsv_to_rgb(_hue, 60, 40);
led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60); led.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 60);
led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 100, 100); led.body.shadow.color = lv_color_hsv_to_rgb(_hue, 80, 100);
theme.led = &led; theme.led = &led;
#endif #endif
...@@ -272,9 +279,17 @@ static void lmeter_init(void) ...@@ -272,9 +279,17 @@ static void lmeter_init(void)
static void gauge_init(void) static void gauge_init(void)
{ {
#if USE_LV_GAUGE != 0 #if USE_LV_GAUGE != 0
static lv_style_t gauge;
lv_style_copy(&gauge, &def);
gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70);
gauge.line.width = 3;
gauge.body.main_color = LV_COLOR_HEX3(0x999);
gauge.body.grad_color = gauge.body.main_color;
gauge.body.padding.hor = LV_DPI / 6;
gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/
theme.gauge = &def; theme.gauge = &gauge;
#endif #endif
} }
......
...@@ -3,6 +3,9 @@ CSRCS += lv_theme.c ...@@ -3,6 +3,9 @@ CSRCS += lv_theme.c
CSRCS += lv_theme_default.c CSRCS += lv_theme_default.c
CSRCS += lv_theme_night.c CSRCS += lv_theme_night.c
CSRCS += lv_theme_templ.c CSRCS += lv_theme_templ.c
CSRCS += lv_theme_zen.c
CSRCS += lv_theme_material.c
DEPPATH += --dep-path lvgl/lv_themes DEPPATH += --dep-path lvgl/lv_themes
VPATH += :lvgl/lv_themes VPATH += :lvgl/lv_themes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment