graphics/lvgl: Bump lvgl version to 7.0.2
This commit is contained in:
parent
fed7a53ef5
commit
7a85bc75dc
@ -45,21 +45,12 @@ MODULE = $(CONFIG_EXAMPLES_LVGLDEMO)
|
||||
# LittleVGL demo Example
|
||||
|
||||
CSRCS += fbdev.c tp.c tp_cal.c
|
||||
ifeq ($(CONFIG_EXAMPLES_LVGLDEMO_SIMPLE),y)
|
||||
CSRCS += demo.c
|
||||
ifeq ($(CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER),y)
|
||||
CSRCS += img_bubble_pattern.c
|
||||
endif
|
||||
else ifeq ($(CONFIG_EXAMPLES_LVGLDEMO_THEME_1),y)
|
||||
CSRCS += lv_test_theme_1.c
|
||||
else ifeq ($(CONFIG_EXAMPLES_LVGLDEMO_THEME_2),y)
|
||||
CSRCS += lv_test_theme_2.c
|
||||
endif
|
||||
|
||||
MAINSRC = lvgldemo.c
|
||||
|
||||
LVGLDIR=$(APPDIR)/graphics/littlevgl/lvgl
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" "$(LVGLDIR)"}
|
||||
CXXFLAGS += ${shell $(INCDIR) "$(CC)" "$(LVGLDIR)"}
|
||||
LVGL_SRC_DIR=$(APPDIR)/graphics/lvgl/lvgl
|
||||
LVGL_DIR=$(APPDIR)/graphics/lvgl
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" "$(LVGL_SRC_DIR)" "$(LVGL_DIR)"}
|
||||
CXXFLAGS += ${shell $(INCDIR) "$(CC)" "$(LVGL_SRC_DIR)" "$(LVGL_DIR)"}
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
|
@ -1,667 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/demo.c
|
||||
*
|
||||
* Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#include "demo.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_SIMPLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void write_create(lv_obj_t *parent);
|
||||
static void text_area_event_handler(lv_obj_t *text_area, lv_event_t event);
|
||||
static void keyboard_event_cb(lv_obj_t *keyboard, lv_event_t event);
|
||||
#if LV_USE_ANIMATION
|
||||
static void kb_hide_anim_end(lv_anim_t *a);
|
||||
#endif
|
||||
static void list_create(lv_obj_t *parent);
|
||||
static void chart_create(lv_obj_t *parent);
|
||||
static void slider_event_handler(lv_obj_t *slider, lv_event_t event);
|
||||
static void list_btn_event_handler(lv_obj_t *slider, lv_event_t event);
|
||||
#if LV_DEMO_SLIDE_SHOW
|
||||
static void tab_switcher(lv_task_t *task);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
FAR static lv_obj_t *chart;
|
||||
FAR static lv_obj_t *ta;
|
||||
FAR static lv_obj_t *kb;
|
||||
|
||||
static const char *mbox_btns[] =
|
||||
{
|
||||
"Got it",
|
||||
""
|
||||
};
|
||||
|
||||
static lv_style_t style_kb;
|
||||
static lv_style_t style_kb_rel;
|
||||
static lv_style_t style_kb_pr;
|
||||
|
||||
#if LV_DEMO_WALLPAPER
|
||||
LV_IMG_DECLARE(img_bubble_pattern)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kb_hide_anim_end
|
||||
*
|
||||
* Description:
|
||||
* Process the evnet of anim
|
||||
*
|
||||
* Input Parameters:
|
||||
* a - the handler of anim
|
||||
*
|
||||
* Returned Value:
|
||||
* none
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
static void kb_hide_anim_end(lv_anim_t *a)
|
||||
{
|
||||
lv_obj_del(a->var);
|
||||
kb = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: text_area_event_handler
|
||||
*
|
||||
* Description:
|
||||
* Process the evnet of text area
|
||||
*
|
||||
* Input Parameters:
|
||||
* text_area - the handler of text area controller
|
||||
* event - event type
|
||||
*
|
||||
* Returned Value:
|
||||
* none
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void text_area_event_handler(lv_obj_t *text_area, lv_event_t event)
|
||||
{
|
||||
(void)text_area;
|
||||
|
||||
/* Text area is on the scrollable part of the
|
||||
* page but we need the page itself
|
||||
*/
|
||||
|
||||
lv_obj_t *parent = lv_obj_get_parent(lv_obj_get_parent(ta));
|
||||
|
||||
if (event == LV_EVENT_CLICKED)
|
||||
{
|
||||
if (kb == NULL)
|
||||
{
|
||||
kb = lv_kb_create(parent, NULL);
|
||||
lv_obj_set_size(kb,
|
||||
lv_obj_get_width_fit(parent),
|
||||
lv_obj_get_height_fit(parent) / 2);
|
||||
lv_obj_align(kb, ta, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
|
||||
lv_kb_set_ta(kb, ta);
|
||||
lv_kb_set_style(kb, LV_KB_STYLE_BG, &style_kb);
|
||||
lv_kb_set_style(kb, LV_KB_STYLE_BTN_REL, &style_kb_rel);
|
||||
lv_kb_set_style(kb, LV_KB_STYLE_BTN_PR, &style_kb_pr);
|
||||
lv_obj_set_event_cb(kb, keyboard_event_cb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
a.var = kb;
|
||||
a.start = LV_VER_RES;
|
||||
a.end = lv_obj_get_y(kb);
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 300;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: keyboard_event_cb
|
||||
*
|
||||
* Description:
|
||||
* Process the evnet of keyboard
|
||||
*
|
||||
* Input Parameters:
|
||||
* keyboard - the handler of keyboard controller
|
||||
* event - event type
|
||||
*
|
||||
* Returned Value:
|
||||
* none
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void keyboard_event_cb(lv_obj_t *keyboard, lv_event_t event)
|
||||
{
|
||||
(void)keyboard;
|
||||
|
||||
lv_kb_def_event_cb(kb, event);
|
||||
|
||||
if (event == LV_EVENT_APPLY || event == LV_EVENT_CANCEL)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
a.var = kb;
|
||||
a.start = lv_obj_get_y(kb);
|
||||
a.end = LV_VER_RES;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = kb_hide_anim_end;
|
||||
a.act_time = 0;
|
||||
a.time = 300;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
#else
|
||||
lv_obj_del(kb);
|
||||
kb = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: write_create
|
||||
*
|
||||
* Description:
|
||||
* Create a text-area and keyboard, each composing half of the
|
||||
* parent container.
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - the lv_page_t* container to create the "write" page within
|
||||
*
|
||||
* Returned Value:
|
||||
* none
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void write_create(lv_obj_t *parent)
|
||||
{
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_SCRL, &lv_style_transp_fit);
|
||||
|
||||
lv_page_set_sb_mode(parent, LV_SB_MODE_OFF);
|
||||
|
||||
static lv_style_t style_ta;
|
||||
lv_style_copy(&style_ta, &lv_style_pretty);
|
||||
style_ta.body.opa = LV_OPA_30;
|
||||
style_ta.body.radius = 0;
|
||||
style_ta.text.color = lv_color_hex3(0x222);
|
||||
|
||||
ta = lv_ta_create(parent, NULL);
|
||||
lv_obj_set_size(ta,
|
||||
lv_page_get_scrl_width(parent),
|
||||
lv_obj_get_height(parent) / 2);
|
||||
lv_ta_set_style(ta, LV_TA_STYLE_BG, &style_ta);
|
||||
lv_ta_set_text(ta, "");
|
||||
lv_obj_set_event_cb(ta, text_area_event_handler);
|
||||
lv_style_copy(&style_kb, &lv_style_plain);
|
||||
lv_ta_set_text_sel(ta, true);
|
||||
|
||||
style_kb.body.opa = LV_OPA_70;
|
||||
style_kb.body.main_color = lv_color_hex3(0x333);
|
||||
style_kb.body.grad_color = lv_color_hex3(0x333);
|
||||
style_kb.body.padding.left = 0;
|
||||
style_kb.body.padding.right = 0;
|
||||
style_kb.body.padding.top = 0;
|
||||
style_kb.body.padding.bottom = 0;
|
||||
style_kb.body.padding.inner = 0;
|
||||
|
||||
lv_style_copy(&style_kb_rel, &lv_style_plain);
|
||||
style_kb_rel.body.opa = LV_OPA_TRANSP;
|
||||
style_kb_rel.body.radius = 0;
|
||||
style_kb_rel.body.border.width = 1;
|
||||
style_kb_rel.body.border.color = LV_COLOR_SILVER;
|
||||
style_kb_rel.body.border.opa = LV_OPA_50;
|
||||
style_kb_rel.body.main_color = lv_color_hex3(0x333);
|
||||
style_kb_rel.body.grad_color = lv_color_hex3(0x333);
|
||||
style_kb_rel.text.color = LV_COLOR_WHITE;
|
||||
|
||||
lv_style_copy(&style_kb_pr, &lv_style_plain);
|
||||
style_kb_pr.body.radius = 0;
|
||||
style_kb_pr.body.opa = LV_OPA_50;
|
||||
style_kb_pr.body.main_color = LV_COLOR_WHITE;
|
||||
style_kb_pr.body.grad_color = LV_COLOR_WHITE;
|
||||
style_kb_pr.body.border.width = 1;
|
||||
style_kb_pr.body.border.color = LV_COLOR_SILVER;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: list_create
|
||||
*
|
||||
* Description:
|
||||
* Create a list object within a parent page, populating it with sample
|
||||
* data.
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - The parent lv_page
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void list_create(lv_obj_t *parent)
|
||||
{
|
||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_SCRL, &lv_style_transp_fit);
|
||||
|
||||
lv_page_set_sb_mode(parent, LV_SB_MODE_OFF);
|
||||
|
||||
/* Create styles for the buttons */
|
||||
|
||||
static lv_style_t style_btn_rel;
|
||||
static lv_style_t style_btn_pr;
|
||||
lv_style_copy(&style_btn_rel, &lv_style_btn_rel);
|
||||
style_btn_rel.body.main_color = lv_color_hex3(0x333);
|
||||
style_btn_rel.body.grad_color = LV_COLOR_BLACK;
|
||||
style_btn_rel.body.border.color = LV_COLOR_SILVER;
|
||||
style_btn_rel.body.border.width = 1;
|
||||
style_btn_rel.body.border.opa = LV_OPA_50;
|
||||
style_btn_rel.body.radius = 0;
|
||||
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel);
|
||||
style_btn_pr.body.main_color = lv_color_make(0x55, 0x96, 0xd8);
|
||||
style_btn_pr.body.grad_color = lv_color_make(0x37, 0x62, 0x90);
|
||||
style_btn_pr.text.color = lv_color_make(0xbb, 0xd5, 0xf1);
|
||||
|
||||
lv_obj_t *list = lv_list_create(parent, NULL);
|
||||
lv_obj_set_height(list, 2 * lv_obj_get_height(parent) / 3);
|
||||
lv_list_set_style(list, LV_LIST_STYLE_BG, &lv_style_transp_tight);
|
||||
lv_list_set_style(list, LV_LIST_STYLE_SCRL, &lv_style_transp_tight);
|
||||
lv_list_set_style(list, LV_LIST_STYLE_BTN_REL, &style_btn_rel);
|
||||
lv_list_set_style(list, LV_LIST_STYLE_BTN_PR, &style_btn_pr);
|
||||
lv_obj_align(list, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 4);
|
||||
|
||||
lv_obj_t *list_btn;
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_FILE, "New");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_DIRECTORY, "Open");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_TRASH, "Delete");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_EDIT, "Edit");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_SAVE, "Save");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_WIFI, "WiFi");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_GPS, "GPS");
|
||||
lv_obj_set_event_cb(list_btn, list_btn_event_handler);
|
||||
|
||||
lv_obj_t *mbox = lv_mbox_create(parent, NULL);
|
||||
lv_mbox_set_text(mbox, "Click a button to copy"
|
||||
"its text to the Text area ");
|
||||
lv_obj_set_width(mbox, hres - LV_DPI);
|
||||
|
||||
lv_mbox_add_btns(mbox, mbox_btns);
|
||||
lv_obj_align(mbox, parent, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: list_btn_event_handler
|
||||
*
|
||||
* Description:
|
||||
* Callback for the buttons within the list on the list page. Appends
|
||||
* the button text to the content of the text area.
|
||||
*
|
||||
* Input Parameters:
|
||||
* btn - The button object that triggered the action
|
||||
* event - The button
|
||||
*
|
||||
* Returned Value:
|
||||
* LV_RES_OK - the object is still valid
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void list_btn_event_handler(lv_obj_t * btn, lv_event_t event)
|
||||
{
|
||||
if (event == LV_EVENT_SHORT_CLICKED)
|
||||
{
|
||||
lv_ta_add_char(ta, '\n');
|
||||
lv_ta_add_text(ta, lv_list_get_btn_text(btn));
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: chart_create
|
||||
*
|
||||
* Description:
|
||||
* Create a chart object within a parent page, populating it with sample
|
||||
* data and a slider to adjust the Y-axis.
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - The parent lv_page
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void chart_create(lv_obj_t *parent)
|
||||
{
|
||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
|
||||
lv_page_set_style(parent, LV_PAGE_STYLE_SCRL, &lv_style_transp_fit);
|
||||
|
||||
lv_page_set_scrl_height(parent, lv_obj_get_height(parent));
|
||||
lv_page_set_sb_mode(parent, LV_SB_MODE_OFF);
|
||||
|
||||
static lv_style_t style_chart;
|
||||
lv_style_copy(&style_chart, &lv_style_pretty);
|
||||
style_chart.body.opa = LV_OPA_60;
|
||||
style_chart.body.radius = 0;
|
||||
style_chart.line.color = LV_COLOR_GRAY;
|
||||
|
||||
chart = lv_chart_create(parent, NULL);
|
||||
lv_obj_set_size(chart,
|
||||
2 * lv_obj_get_width(parent) / 3,
|
||||
lv_obj_get_height(parent) / 2);
|
||||
lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 4);
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_COLUMN);
|
||||
lv_chart_set_style(chart, LV_CHART_STYLE_MAIN, &style_chart);
|
||||
lv_chart_set_series_opa(chart, LV_OPA_70);
|
||||
lv_chart_series_t *ser1;
|
||||
ser1 = lv_chart_add_series(chart, LV_COLOR_RED);
|
||||
lv_chart_set_next(chart, ser1, 40);
|
||||
lv_chart_set_next(chart, ser1, 30);
|
||||
lv_chart_set_next(chart, ser1, 47);
|
||||
lv_chart_set_next(chart, ser1, 59);
|
||||
lv_chart_set_next(chart, ser1, 59);
|
||||
lv_chart_set_next(chart, ser1, 31);
|
||||
lv_chart_set_next(chart, ser1, 55);
|
||||
lv_chart_set_next(chart, ser1, 70);
|
||||
lv_chart_set_next(chart, ser1, 82);
|
||||
lv_chart_set_next(chart, ser1, 91);
|
||||
|
||||
/* Create a bar, an indicator and a knob style */
|
||||
|
||||
static lv_style_t style_bar;
|
||||
static lv_style_t style_indic;
|
||||
static lv_style_t style_knob;
|
||||
|
||||
lv_style_copy(&style_bar, &lv_style_pretty);
|
||||
style_bar.body.main_color = LV_COLOR_BLACK;
|
||||
style_bar.body.grad_color = LV_COLOR_GRAY;
|
||||
style_bar.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_bar.body.border.color = LV_COLOR_WHITE;
|
||||
style_bar.body.opa = LV_OPA_60;
|
||||
style_bar.body.padding.left = 0;
|
||||
style_bar.body.padding.right = 0;
|
||||
style_bar.body.padding.top = LV_DPI / 10;
|
||||
style_bar.body.padding.bottom = LV_DPI / 10;
|
||||
|
||||
lv_style_copy(&style_indic, &lv_style_pretty);
|
||||
style_indic.body.grad_color = LV_COLOR_MAROON;
|
||||
style_indic.body.main_color = LV_COLOR_RED;
|
||||
style_indic.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_indic.body.shadow.width = LV_DPI / 10;
|
||||
style_indic.body.shadow.color = LV_COLOR_RED;
|
||||
style_indic.body.padding.left = LV_DPI / 30;
|
||||
style_indic.body.padding.right = LV_DPI / 30;
|
||||
style_indic.body.padding.top = LV_DPI / 30;
|
||||
style_indic.body.padding.bottom = LV_DPI / 30;
|
||||
|
||||
lv_style_copy(&style_knob, &lv_style_pretty);
|
||||
style_knob.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_knob.body.opa = LV_OPA_70;
|
||||
|
||||
/* Create a second slider */
|
||||
|
||||
lv_obj_t *slider = lv_slider_create(parent, NULL);
|
||||
lv_slider_set_style(slider, LV_SLIDER_STYLE_BG, &style_bar);
|
||||
lv_slider_set_style(slider, LV_SLIDER_STYLE_INDIC, &style_indic);
|
||||
lv_slider_set_style(slider, LV_SLIDER_STYLE_KNOB, &style_knob);
|
||||
lv_obj_set_size(slider, lv_obj_get_width(chart), LV_DPI / 3);
|
||||
lv_obj_align(slider,
|
||||
chart,
|
||||
LV_ALIGN_OUT_BOTTOM_MID,
|
||||
0,
|
||||
(vres - chart->coords.y2 - lv_obj_get_height(slider)) / 2);
|
||||
lv_obj_set_event_cb(slider, slider_event_handler);
|
||||
lv_slider_set_range(slider, 10, 1000);
|
||||
lv_slider_set_value(slider, 700, false);
|
||||
slider_event_handler(slider, LV_EVENT_VALUE_CHANGED);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: slider_event_handler
|
||||
*
|
||||
* Description:
|
||||
* Callback of the slider on the chart page. Adjusts the Y-axis range
|
||||
*
|
||||
* Input Parameters:
|
||||
* slider - the slider object that triggered this action
|
||||
* event - the event type
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Anything else that one might need to know to use this function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void slider_event_handler(lv_obj_t *slider, lv_event_t event)
|
||||
{
|
||||
if (event == LV_EVENT_VALUE_CHANGED)
|
||||
{
|
||||
int16_t v = lv_slider_get_value(slider);
|
||||
v = 1000 * 100 / v;
|
||||
lv_chart_set_range(chart, 0, v);
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DEMO_SLIDE_SHOW
|
||||
/****************************************************************************
|
||||
* Name: tab_switcher
|
||||
*
|
||||
* Description:
|
||||
* Cycle to the next tab in a tab view.
|
||||
*
|
||||
* Input Parameters:
|
||||
* tv - The tab view object to cycle
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Assumes only 3 tabs in the tab view.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Called periodically (lv_task) to switch to the next tab
|
||||
*/
|
||||
|
||||
static void tab_switcher(lv_task_t *task)
|
||||
{
|
||||
static uint8_t tab = 0;
|
||||
lv_obj_t *tv = task->user_data;
|
||||
tab++;
|
||||
if (tab >= 3)
|
||||
tab = 0;
|
||||
lv_tabview_set_tab_act(tv, tab, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: demo_create
|
||||
*
|
||||
* Description:
|
||||
* Initialize the LVGL demo screen
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void demo_create(void)
|
||||
{
|
||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
#if LV_DEMO_WALLPAPER
|
||||
lv_obj_t *wp = lv_img_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
lv_img_set_src(wp, &img_bubble_pattern);
|
||||
lv_obj_set_width(wp, hres * 4);
|
||||
lv_obj_set_protect(wp, LV_PROTECT_POS);
|
||||
#endif
|
||||
|
||||
static lv_style_t style_tv_btn_bg;
|
||||
lv_style_copy(&style_tv_btn_bg, &lv_style_plain);
|
||||
style_tv_btn_bg.body.main_color = lv_color_hex(0x487fb7);
|
||||
style_tv_btn_bg.body.grad_color = lv_color_hex(0x487fb7);
|
||||
style_tv_btn_bg.body.padding.top = 0;
|
||||
style_tv_btn_bg.body.padding.bottom = 0;
|
||||
|
||||
static lv_style_t style_tv_btn_rel;
|
||||
lv_style_copy(&style_tv_btn_rel, &lv_style_btn_rel);
|
||||
style_tv_btn_rel.body.opa = LV_OPA_TRANSP;
|
||||
style_tv_btn_rel.body.border.width = 0;
|
||||
|
||||
static lv_style_t style_tv_btn_pr;
|
||||
lv_style_copy(&style_tv_btn_pr, &lv_style_btn_pr);
|
||||
style_tv_btn_pr.body.radius = 0;
|
||||
style_tv_btn_pr.body.opa = LV_OPA_50;
|
||||
style_tv_btn_pr.body.main_color = LV_COLOR_WHITE;
|
||||
style_tv_btn_pr.body.grad_color = LV_COLOR_WHITE;
|
||||
style_tv_btn_pr.body.border.width = 0;
|
||||
style_tv_btn_pr.text.color = LV_COLOR_GRAY;
|
||||
|
||||
lv_obj_t *tv = lv_tabview_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
lv_obj_set_size(tv, hres, vres);
|
||||
|
||||
#if LV_DEMO_WALLPAPER
|
||||
lv_obj_set_parent(wp, ((lv_tabview_ext_t *)tv->ext_attr)->content);
|
||||
lv_obj_set_pos(wp, 0, -5);
|
||||
#endif
|
||||
|
||||
lv_obj_t *tab1 = lv_tabview_add_tab(tv, "Write");
|
||||
lv_obj_t *tab2 = lv_tabview_add_tab(tv, "List");
|
||||
lv_obj_t *tab3 = lv_tabview_add_tab(tv, "Chart");
|
||||
|
||||
#if LV_DEMO_WALLPAPER == 0
|
||||
/* Blue bg instead of wallpaper */
|
||||
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BG, &style_tv_btn_bg);
|
||||
#endif
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_BG, &style_tv_btn_bg);
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_INDIC, &lv_style_plain);
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_REL, &style_tv_btn_rel);
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_PR, &style_tv_btn_pr);
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_TGL_REL, &style_tv_btn_rel);
|
||||
lv_tabview_set_style(tv, LV_TABVIEW_STYLE_BTN_TGL_PR, &style_tv_btn_pr);
|
||||
|
||||
write_create(tab1);
|
||||
list_create(tab2);
|
||||
chart_create(tab3);
|
||||
|
||||
#if LV_DEMO_SLIDE_SHOW
|
||||
lv_task_create(tab_switcher, 3000, LV_TASK_PRIO_MID, tv);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_SIMPLE */
|
@ -1,95 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/demo.h
|
||||
*
|
||||
* Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_DEMO_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_DEMO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_SIMPLE
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
|
||||
# define LV_DEMO_WALLPAPER 1
|
||||
#else
|
||||
# define LV_DEMO_WALLPAPER 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_SLIDE_SHOW
|
||||
# define LV_DEMO_SLIDE_SHOW 1
|
||||
#else
|
||||
# define LV_DEMO_SLIDE_SHOW 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: demo_create
|
||||
*
|
||||
* Description:
|
||||
* Initialize the LVGL demo screen
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void demo_create(void);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_SIMPLE */
|
||||
#endif /* __APPS_EXAMPLES_LVGLDEMO_DEMO_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,469 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/lv_test_theme_1.c
|
||||
*
|
||||
* Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#include "lv_test_theme_1.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_THEME_1
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void create_tab1(FAR lv_obj_t *parent);
|
||||
static void create_tab2(FAR lv_obj_t *parent);
|
||||
static void create_tab3(FAR lv_obj_t *parent);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: create_tab1
|
||||
*
|
||||
* Description:
|
||||
* Create a tab with a pile of different widgets/controls/objects
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - a page container object to contain the view
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void create_tab1(lv_obj_t * parent)
|
||||
{
|
||||
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
|
||||
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
|
||||
static lv_style_t h_style;
|
||||
lv_style_copy(&h_style, &lv_style_transp);
|
||||
h_style.body.padding.inner = LV_DPI / 10;
|
||||
h_style.body.padding.left = LV_DPI / 4;
|
||||
h_style.body.padding.right = LV_DPI / 4;
|
||||
h_style.body.padding.top = LV_DPI / 10;
|
||||
h_style.body.padding.bottom = LV_DPI / 10;
|
||||
|
||||
lv_obj_t * h = lv_cont_create(parent, NULL);
|
||||
lv_obj_set_style(h, &h_style);
|
||||
lv_obj_set_click(h, false);
|
||||
lv_cont_set_fit(h, LV_FIT_TIGHT);
|
||||
lv_cont_set_layout(h, LV_LAYOUT_COL_M);
|
||||
|
||||
lv_obj_t * btn = lv_btn_create(h, NULL);
|
||||
lv_btn_set_fit(btn, LV_FIT_TIGHT);
|
||||
lv_btn_set_toggle(btn, true);
|
||||
lv_obj_t * btn_label = lv_label_create(btn, NULL);
|
||||
lv_label_set_text(btn_label, "Button");
|
||||
|
||||
btn = lv_btn_create(h, btn);
|
||||
lv_btn_toggle(btn);
|
||||
btn_label = lv_label_create(btn, NULL);
|
||||
lv_label_set_text(btn_label, "Toggled");
|
||||
|
||||
btn = lv_btn_create(h, btn);
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_INA);
|
||||
btn_label = lv_label_create(btn, NULL);
|
||||
lv_label_set_text(btn_label, "Inactive");
|
||||
|
||||
lv_obj_t * label = lv_label_create(h, NULL);
|
||||
lv_label_set_text(label, "Primary");
|
||||
lv_obj_set_style(label, th->style.label.prim);
|
||||
|
||||
label = lv_label_create(h, NULL);
|
||||
lv_label_set_text(label, "Secondary");
|
||||
lv_obj_set_style(label, th->style.label.sec);
|
||||
|
||||
label = lv_label_create(h, NULL);
|
||||
lv_label_set_text(label, "Hint");
|
||||
lv_obj_set_style(label, th->style.label.hint);
|
||||
|
||||
static const char * btnm_str[] =
|
||||
{
|
||||
"1", "2", "3", LV_SYMBOL_OK, LV_SYMBOL_CLOSE, ""
|
||||
};
|
||||
|
||||
lv_obj_t * btnm = lv_btnm_create(h, NULL);
|
||||
lv_obj_set_size(btnm, lv_disp_get_hor_res(NULL) / 4, 2 * LV_DPI / 3);
|
||||
lv_btnm_set_map(btnm, btnm_str);
|
||||
lv_btnm_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_TGL_ENABLE);
|
||||
lv_btnm_set_one_toggle(btnm, true);
|
||||
|
||||
lv_obj_t * table = lv_table_create(h, NULL);
|
||||
lv_table_set_col_cnt(table, 3);
|
||||
lv_table_set_row_cnt(table, 4);
|
||||
lv_table_set_col_width(table, 0, LV_DPI / 3);
|
||||
lv_table_set_col_width(table, 1, LV_DPI / 2);
|
||||
lv_table_set_col_width(table, 2, LV_DPI / 2);
|
||||
lv_table_set_cell_merge_right(table, 0, 0, true);
|
||||
lv_table_set_cell_merge_right(table, 0, 1, true);
|
||||
|
||||
lv_table_set_cell_value(table, 0, 0, "Table");
|
||||
lv_table_set_cell_align(table, 0, 0, LV_LABEL_ALIGN_CENTER);
|
||||
|
||||
lv_table_set_cell_value(table, 1, 0, "1");
|
||||
lv_table_set_cell_value(table, 1, 1, "13");
|
||||
lv_table_set_cell_align(table, 1, 1, LV_LABEL_ALIGN_RIGHT);
|
||||
lv_table_set_cell_value(table, 1, 2, "ms");
|
||||
|
||||
lv_table_set_cell_value(table, 2, 0, "2");
|
||||
lv_table_set_cell_value(table, 2, 1, "46");
|
||||
lv_table_set_cell_align(table, 2, 1, LV_LABEL_ALIGN_RIGHT);
|
||||
lv_table_set_cell_value(table, 2, 2, "ms");
|
||||
|
||||
lv_table_set_cell_value(table, 3, 0, "3");
|
||||
lv_table_set_cell_value(table, 3, 1, "61");
|
||||
lv_table_set_cell_align(table, 3, 1, LV_LABEL_ALIGN_RIGHT);
|
||||
lv_table_set_cell_value(table, 3, 2, "ms");
|
||||
|
||||
h = lv_cont_create(parent, h);
|
||||
|
||||
lv_obj_t * sw_h = lv_cont_create(h, NULL);
|
||||
lv_cont_set_style(sw_h, LV_CONT_STYLE_MAIN, &lv_style_transp);
|
||||
lv_cont_set_fit2(sw_h, LV_FIT_NONE, LV_FIT_TIGHT);
|
||||
lv_obj_set_width(sw_h, LV_HOR_RES / 4);
|
||||
lv_cont_set_layout(sw_h, LV_LAYOUT_PRETTY);
|
||||
|
||||
lv_obj_t * sw = lv_sw_create(sw_h, NULL);
|
||||
lv_sw_set_anim_time(sw, 250);
|
||||
|
||||
sw = lv_sw_create(sw_h, sw);
|
||||
lv_sw_on(sw, LV_ANIM_OFF);
|
||||
|
||||
lv_obj_t * bar = lv_bar_create(h, NULL);
|
||||
lv_bar_set_value(bar, 70, false);
|
||||
|
||||
lv_obj_t * slider = lv_slider_create(h, NULL);
|
||||
lv_bar_set_value(slider, 70, false);
|
||||
|
||||
lv_obj_t * line = lv_line_create(h, NULL);
|
||||
static lv_point_t line_p[2];
|
||||
line_p[0].x = 0;
|
||||
line_p[0].y = 0;
|
||||
line_p[1].x = lv_disp_get_hor_res(NULL) / 5;
|
||||
line_p[1].y = 0;
|
||||
|
||||
lv_line_set_points(line, line_p, 2);
|
||||
lv_line_set_style(line, LV_LINE_STYLE_MAIN, th->style.line.decor);
|
||||
|
||||
lv_obj_t * cb = lv_cb_create(h, NULL);
|
||||
|
||||
cb = lv_cb_create(h, cb);
|
||||
lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL);
|
||||
|
||||
lv_obj_t * ddlist = lv_ddlist_create(h, NULL);
|
||||
lv_ddlist_set_fix_width(ddlist, lv_obj_get_width(ddlist) + LV_DPI / 2);
|
||||
lv_ddlist_set_draw_arrow(ddlist, true);
|
||||
|
||||
h = lv_cont_create(parent, h);
|
||||
|
||||
lv_obj_t * list = lv_list_create(h, NULL);
|
||||
lv_obj_set_size(list,
|
||||
lv_disp_get_hor_res(NULL) / 4,
|
||||
lv_disp_get_ver_res(NULL) / 2);
|
||||
lv_obj_t * list_btn;
|
||||
list_btn = lv_list_add_btn(list, LV_SYMBOL_GPS, "GPS");
|
||||
lv_btn_set_toggle(list_btn, true);
|
||||
|
||||
lv_list_add_btn(list, LV_SYMBOL_WIFI, "WiFi");
|
||||
lv_list_add_btn(list, LV_SYMBOL_GPS, "GPS");
|
||||
lv_list_add_btn(list, LV_SYMBOL_AUDIO, "Audio");
|
||||
lv_list_add_btn(list, LV_SYMBOL_VIDEO, "Video");
|
||||
lv_list_add_btn(list, LV_SYMBOL_CALL, "Call");
|
||||
lv_list_add_btn(list, LV_SYMBOL_BELL, "Bell");
|
||||
lv_list_add_btn(list, LV_SYMBOL_FILE, "File");
|
||||
lv_list_add_btn(list, LV_SYMBOL_EDIT, "Edit");
|
||||
lv_list_add_btn(list, LV_SYMBOL_CUT, "Cut");
|
||||
lv_list_add_btn(list, LV_SYMBOL_COPY, "Copy");
|
||||
|
||||
lv_obj_t * roller = lv_roller_create(h, NULL);
|
||||
lv_roller_set_options(roller,
|
||||
"Monday\n"
|
||||
"Tuesday\n"
|
||||
"Wednesday\n"
|
||||
"Thursday\n"
|
||||
"Friday\n"
|
||||
"Saturday\n"
|
||||
"Sunday",
|
||||
true);
|
||||
lv_roller_set_selected(roller, 1, false);
|
||||
lv_roller_set_visible_row_count(roller, 3);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: create_tab2
|
||||
*
|
||||
* Description:
|
||||
* Create a tab with a pile of different widgets/controls/objects
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - a page container object to contain the view
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void create_tab2(lv_obj_t * parent)
|
||||
{
|
||||
lv_coord_t w = lv_page_get_scrl_width(parent);
|
||||
|
||||
lv_obj_t * chart = lv_chart_create(parent, NULL);
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_AREA);
|
||||
lv_obj_set_size(chart, w / 3, lv_disp_get_ver_res(NULL) / 3);
|
||||
lv_obj_set_pos(chart, LV_DPI / 10, LV_DPI / 10);
|
||||
lv_chart_series_t * s1 = lv_chart_add_series(chart, LV_COLOR_RED);
|
||||
lv_chart_set_next(chart, s1, 30);
|
||||
lv_chart_set_next(chart, s1, 20);
|
||||
lv_chart_set_next(chart, s1, 10);
|
||||
lv_chart_set_next(chart, s1, 12);
|
||||
lv_chart_set_next(chart, s1, 20);
|
||||
lv_chart_set_next(chart, s1, 27);
|
||||
lv_chart_set_next(chart, s1, 35);
|
||||
lv_chart_set_next(chart, s1, 55);
|
||||
lv_chart_set_next(chart, s1, 70);
|
||||
lv_chart_set_next(chart, s1, 75);
|
||||
|
||||
lv_obj_t * gauge = lv_gauge_create(parent, NULL);
|
||||
lv_gauge_set_value(gauge, 0, 40);
|
||||
lv_obj_set_size(gauge, w / 4, w / 4);
|
||||
lv_obj_align(gauge, chart, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 4);
|
||||
|
||||
lv_obj_t * arc = lv_arc_create(parent, NULL);
|
||||
lv_obj_align(arc, gauge, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 8);
|
||||
|
||||
lv_obj_t * ta = lv_ta_create(parent, NULL);
|
||||
lv_obj_set_size(ta, w / 3, lv_disp_get_ver_res(NULL) / 4);
|
||||
lv_obj_align(ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -LV_DPI / 10, LV_DPI / 10);
|
||||
lv_ta_set_cursor_type(ta, LV_CURSOR_BLOCK);
|
||||
|
||||
lv_obj_t * kb = lv_kb_create(parent, NULL);
|
||||
lv_obj_set_size(kb, 2 * w / 3, lv_disp_get_ver_res(NULL) / 3);
|
||||
lv_obj_align(kb, ta, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI);
|
||||
lv_kb_set_ta(kb, ta);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_obj_t * loader = lv_preload_create(parent, NULL);
|
||||
lv_obj_align(loader, NULL, LV_ALIGN_CENTER, 0, - LV_DPI);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: create_tab3
|
||||
*
|
||||
* Description:
|
||||
* Create a tab with a pile of different widgets/controls/objects
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent - a page container object to contain the view
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void create_tab3(lv_obj_t *parent)
|
||||
{
|
||||
/* Create a Window */
|
||||
|
||||
lv_obj_t *win = lv_win_create(parent, NULL);
|
||||
lv_obj_t *win_btn = lv_win_add_btn(win, LV_SYMBOL_CLOSE);
|
||||
lv_obj_set_event_cb(win_btn, lv_win_close_event_cb);
|
||||
lv_win_add_btn(win, LV_SYMBOL_DOWN);
|
||||
lv_obj_set_size(win, lv_disp_get_hor_res(NULL) / 2,
|
||||
lv_disp_get_ver_res(NULL) / 2);
|
||||
lv_obj_set_pos(win, LV_DPI / 20, LV_DPI / 20);
|
||||
lv_obj_set_top(win, true);
|
||||
|
||||
/* Create a Label in the Window */
|
||||
|
||||
lv_obj_t *label = lv_label_create(win, NULL);
|
||||
lv_label_set_text(label, "Label in the window");
|
||||
|
||||
/* Create a Line meter in the Window */
|
||||
|
||||
lv_obj_t *lmeter = lv_lmeter_create(win, NULL);
|
||||
lv_obj_align(lmeter, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
|
||||
lv_lmeter_set_value(lmeter, 70);
|
||||
|
||||
/* Create a 2 LEDs in the Window */
|
||||
|
||||
lv_obj_t *led1 = lv_led_create(win, NULL);
|
||||
lv_obj_align(led1, lmeter, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
||||
lv_led_on(led1);
|
||||
|
||||
lv_obj_t *led2 = lv_led_create(win, NULL);
|
||||
lv_obj_align(led2, led1, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
||||
lv_led_off(led2);
|
||||
|
||||
/* Create a Page */
|
||||
|
||||
lv_obj_t *page = lv_page_create(parent, NULL);
|
||||
lv_obj_set_size(page, lv_disp_get_hor_res(NULL) / 3,
|
||||
lv_disp_get_ver_res(NULL) / 2);
|
||||
lv_obj_set_top(page, true);
|
||||
lv_obj_align(page, win, LV_ALIGN_IN_TOP_RIGHT, LV_DPI, LV_DPI);
|
||||
|
||||
label = lv_label_create(page, NULL);
|
||||
lv_label_set_text(label,
|
||||
"Lorem ipsum dolor sit amet, "
|
||||
"repudiare voluptatibus pri cu.\n"
|
||||
"Ei mundi pertinax posidonium eum,"
|
||||
" cum tempor maiorum at,\n"
|
||||
"mea fuisset assentior ad. "
|
||||
"Usu cu suas civibus iudicabit.\n"
|
||||
"Eum eu congue tempor facilisi. "
|
||||
"Tale hinc unum te vim.\n"
|
||||
"Te cum populo animal eruditi,"
|
||||
"labitur inciderint at nec.\n\n"
|
||||
"Eius corpora et quo. Everti"
|
||||
"voluptaria instructior est id,\n"
|
||||
"vel in falli primis."
|
||||
"Mea ei porro essent admodum,\n"
|
||||
"his ei malis quodsi, te quis aeterno his.\n"
|
||||
"Qui tritani recusabo reprehendunt ne,\n"
|
||||
"per duis explicari at."
|
||||
" Simul mediocritatem mei et.");
|
||||
|
||||
/* Create a Calendar */
|
||||
|
||||
lv_obj_t *cal = lv_calendar_create(parent, NULL);
|
||||
lv_obj_set_size(cal, 5 * LV_DPI / 2, 5 * LV_DPI / 2);
|
||||
lv_obj_align(cal, page, LV_ALIGN_OUT_RIGHT_TOP, -LV_DPI / 2, LV_DPI / 3);
|
||||
lv_obj_set_top(cal, true);
|
||||
|
||||
static lv_calendar_date_t highlighted_days[2];
|
||||
highlighted_days[0].day = 5;
|
||||
highlighted_days[0].month = 5;
|
||||
highlighted_days[0].year = 2018;
|
||||
|
||||
highlighted_days[1].day = 8;
|
||||
highlighted_days[1].month = 5;
|
||||
highlighted_days[1].year = 2018;
|
||||
|
||||
lv_calendar_set_highlighted_dates(cal, highlighted_days, 2);
|
||||
lv_calendar_set_today_date(cal, &highlighted_days[0]);
|
||||
lv_calendar_set_showed_date(cal, &highlighted_days[0]);
|
||||
|
||||
/* Create a Message box */
|
||||
|
||||
static const char *mbox_btn_map[] =
|
||||
{
|
||||
" ", "Got it!", " ", ""
|
||||
};
|
||||
|
||||
lv_obj_t *mbox = lv_mbox_create(parent, NULL);
|
||||
lv_mbox_set_text(mbox,
|
||||
"Click on the window or the page"
|
||||
" to bring it to the foreground");
|
||||
lv_mbox_add_btns(mbox, mbox_btn_map);
|
||||
lv_btnm_set_btn_ctrl(lv_mbox_get_btnm(mbox), 0, LV_BTNM_CTRL_HIDDEN);
|
||||
lv_btnm_set_btn_width(lv_mbox_get_btnm(mbox), 1, 7);
|
||||
lv_btnm_set_btn_ctrl(lv_mbox_get_btnm(mbox), 2, LV_BTNM_CTRL_HIDDEN);
|
||||
lv_obj_set_top(mbox, true);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lv_test_theme_1
|
||||
*
|
||||
* Description:
|
||||
* Create a test screen with a lot objects and apply
|
||||
* the given theme on them
|
||||
*
|
||||
* Input Parameters:
|
||||
* th - pointer to a theme
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lv_test_theme_1(lv_theme_t * th)
|
||||
{
|
||||
lv_theme_set_current(th);
|
||||
|
||||
/* If `LV_THEME_LIVE_UPDATE 1` `th` is not used directly
|
||||
* so get the real theme after set
|
||||
*/
|
||||
|
||||
th = lv_theme_get_current();
|
||||
FAR lv_obj_t * scr = lv_cont_create(NULL, NULL);
|
||||
lv_disp_load_scr(scr);
|
||||
|
||||
FAR lv_obj_t * tv = lv_tabview_create(scr, NULL);
|
||||
lv_obj_set_size(tv, lv_disp_get_hor_res(NULL),
|
||||
lv_disp_get_ver_res(NULL));
|
||||
FAR lv_obj_t * tab1 = lv_tabview_add_tab(tv, "Tab 1");
|
||||
FAR lv_obj_t * tab2 = lv_tabview_add_tab(tv, "Tab 2");
|
||||
FAR lv_obj_t * tab3 = lv_tabview_add_tab(tv, "Tab 3");
|
||||
|
||||
create_tab1(tab1);
|
||||
create_tab2(tab2);
|
||||
create_tab3(tab3);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_1 */
|
@ -1,89 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/lv_test_theme_1.h
|
||||
*
|
||||
* Copyright (C) 2016 2016 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_LV_TEST_THEME_1_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_LV_TEST_THEME_1_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_THEME_1
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_THEME_1_HUE
|
||||
# define EXAMPLES_LVGLDEMO_THEME_1_HUE CONFIG_EXAMPLES_LVGLDEMO_THEME_1_HUE
|
||||
#else
|
||||
# define EXAMPLES_LVGLDEMO_THEME_1_HUE 30
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Create a test screen with a lot objects and apply the given theme on them
|
||||
* @param th pointer to a theme
|
||||
*/
|
||||
void lv_test_theme_1(lv_theme_t *th);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_1 */
|
||||
#endif /* __APPS_EXAMPLES_LVGLDEMO_LVGL_DEMO */
|
@ -1,547 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/lv_test_theme_2.c
|
||||
*
|
||||
* Copyright (C) 2016 2016 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#include "lv_test_theme_2.h"
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_THEME_2
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void header_create(void);
|
||||
static void sb_create(void);
|
||||
static void content_create(void);
|
||||
static void theme_select_event_handler(lv_obj_t *roller, lv_event_t event);
|
||||
static void hue_select_event_cb(lv_obj_t *roller, lv_event_t event);
|
||||
static void init_all_themes(uint16_t hue);
|
||||
static void bar_set_value(lv_obj_t *bar, int16_t value);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static lv_obj_t *header;
|
||||
static lv_obj_t *sb;
|
||||
static lv_obj_t *content;
|
||||
static lv_theme_t *th_act;
|
||||
|
||||
static const char *th_options =
|
||||
{
|
||||
#if LV_USE_THEME_NIGHT
|
||||
"Night"
|
||||
#endif
|
||||
#if LV_USE_THEME_MATERIAL
|
||||
"\nMaterial"
|
||||
#endif
|
||||
#if LV_USE_THEME_ALIEN
|
||||
"\nAlien"
|
||||
#endif
|
||||
#if LV_USE_THEME_ZEN
|
||||
"\nZen"
|
||||
#endif
|
||||
#if LV_USE_THEME_NEMO
|
||||
"\nNemo"
|
||||
#endif
|
||||
#if LV_USE_THEME_MONO
|
||||
"\nMono"
|
||||
#endif
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
"\nDefault"
|
||||
#endif
|
||||
""
|
||||
};
|
||||
|
||||
static lv_theme_t *themes[8];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: header_create
|
||||
*
|
||||
* Description:
|
||||
* Initialize the global header object, populating with various icons
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void header_create(void)
|
||||
{
|
||||
header = lv_cont_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
lv_obj_set_width(header, lv_disp_get_hor_res(NULL));
|
||||
|
||||
lv_obj_t *sym = lv_label_create(header, NULL);
|
||||
lv_label_set_text(sym,
|
||||
LV_SYMBOL_GPS
|
||||
LV_SYMBOL_WIFI
|
||||
LV_SYMBOL_BLUETOOTH
|
||||
LV_SYMBOL_VOLUME_MAX);
|
||||
lv_obj_align(sym, NULL, LV_ALIGN_IN_RIGHT_MID, -LV_DPI / 10, 0);
|
||||
|
||||
lv_obj_t *clock = lv_label_create(header, NULL);
|
||||
lv_label_set_text(clock, "14:21");
|
||||
lv_obj_align(clock, NULL, LV_ALIGN_IN_LEFT_MID, LV_DPI / 10, 0);
|
||||
|
||||
lv_cont_set_fit2(header, LV_FIT_NONE, LV_FIT_TIGHT);
|
||||
lv_obj_set_pos(header, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sb_create
|
||||
*
|
||||
* Description:
|
||||
* Initialize the global sb (sidebar) object.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void sb_create(void)
|
||||
{
|
||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
sb = lv_page_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
lv_page_set_scrl_layout(sb, LV_LAYOUT_COL_M);
|
||||
lv_page_set_style(sb, LV_PAGE_STYLE_BG, &lv_style_transp_tight);
|
||||
lv_page_set_style(sb, LV_PAGE_STYLE_SCRL, &lv_style_transp);
|
||||
|
||||
lv_obj_t *th_label = lv_label_create(sb, NULL);
|
||||
lv_label_set_text(th_label, "Theme");
|
||||
|
||||
lv_obj_t *th_roller = lv_roller_create(sb, NULL);
|
||||
lv_roller_set_options(th_roller, th_options, true);
|
||||
lv_obj_set_event_cb(th_roller, theme_select_event_handler);
|
||||
|
||||
lv_obj_t *hue_label = lv_label_create(sb, NULL);
|
||||
lv_label_set_text(hue_label, "\nColor");
|
||||
|
||||
lv_obj_t *hue_roller = lv_roller_create(sb, NULL);
|
||||
lv_roller_set_options(hue_roller, "0\n30\n60\n90\n120\n150\n"
|
||||
"180\n210\n240\n270\n300\n330", true);
|
||||
lv_obj_set_event_cb(hue_roller, hue_select_event_cb);
|
||||
|
||||
if (hres > vres)
|
||||
{
|
||||
lv_obj_set_height(sb, vres - lv_obj_get_height(header));
|
||||
lv_cont_set_fit2(sb, LV_FIT_TIGHT, LV_FIT_NONE);
|
||||
lv_obj_align(sb, header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
lv_page_set_sb_mode(sb, LV_SB_MODE_DRAG);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_size(sb, hres, vres / 2 - lv_obj_get_height(header));
|
||||
lv_obj_align(sb, header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
lv_page_set_sb_mode(sb, LV_SB_MODE_AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: content_create
|
||||
*
|
||||
* Description:
|
||||
* Initialize the global content object, create a number of objects
|
||||
* within it
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void content_create(void)
|
||||
{
|
||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
content = lv_page_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
|
||||
if (hres > vres)
|
||||
{
|
||||
lv_obj_set_size(content,
|
||||
hres - lv_obj_get_width(sb),
|
||||
vres - lv_obj_get_height(header));
|
||||
lv_obj_set_pos(content,
|
||||
lv_obj_get_width(sb),
|
||||
lv_obj_get_height(header));
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_size(content, hres, vres / 2);
|
||||
lv_obj_set_pos(content, 0, vres / 2);
|
||||
}
|
||||
|
||||
lv_page_set_scrl_layout(content, LV_LAYOUT_PRETTY);
|
||||
lv_page_set_scrl_fit2(content, LV_FIT_FLOOD, LV_FIT_TIGHT);
|
||||
|
||||
lv_coord_t max_w = lv_page_get_fit_width(content);
|
||||
|
||||
/* Button */
|
||||
|
||||
lv_obj_t *btn = lv_btn_create(content, NULL);
|
||||
lv_btn_set_ink_in_time(btn, 200);
|
||||
lv_btn_set_ink_wait_time(btn, 100);
|
||||
lv_btn_set_ink_out_time(btn, 500);
|
||||
lv_obj_t *label = lv_label_create(btn, NULL);
|
||||
lv_label_set_text(label, "Button");
|
||||
|
||||
/* Switch */
|
||||
|
||||
lv_obj_t *sw = lv_sw_create(content, NULL);
|
||||
lv_sw_set_anim_time(sw, 250);
|
||||
|
||||
/* Check box */
|
||||
|
||||
lv_cb_create(content, NULL);
|
||||
|
||||
/* Bar */
|
||||
|
||||
lv_obj_t *bar = lv_bar_create(content, NULL);
|
||||
lv_obj_set_width(bar, LV_MATH_MIN(max_w, 3 * LV_DPI / 2));
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
a.var = bar;
|
||||
a.start = 0;
|
||||
a.end = 100;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)bar_set_value;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 1000;
|
||||
a.playback = 1;
|
||||
a.playback_pause = 100;
|
||||
a.repeat = 1;
|
||||
a.repeat_pause = 100;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
||||
/* Slider */
|
||||
|
||||
lv_obj_t *slider = lv_slider_create(content, NULL);
|
||||
lv_obj_set_width(slider, LV_MATH_MIN(max_w, 3 * LV_DPI / 2));
|
||||
lv_slider_set_value(slider, 30, false);
|
||||
|
||||
/* Roller */
|
||||
|
||||
static const char *days = "Monday\nTuesday\nWednesday\n"
|
||||
"Thursday\nFriday\nSaturday\nSunday";
|
||||
lv_obj_t *roller = lv_roller_create(content, NULL);
|
||||
lv_roller_set_options(roller, days, false);
|
||||
|
||||
/* Drop down list */
|
||||
|
||||
static const char *nums = "One\nTwo\nThree\nFour";
|
||||
lv_obj_t *ddlist = lv_ddlist_create(content, NULL);
|
||||
lv_ddlist_set_options(ddlist, nums);
|
||||
|
||||
/* Line meter */
|
||||
|
||||
lv_obj_t *lmeter = lv_lmeter_create(content, NULL);
|
||||
lv_obj_set_click(lmeter, false);
|
||||
#if LV_USE_ANIMATION
|
||||
a.var = lmeter;
|
||||
a.start = 0;
|
||||
a.end = 100;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_lmeter_set_value;
|
||||
a.path_cb = lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 1000;
|
||||
a.playback = 1;
|
||||
a.playback_pause = 100;
|
||||
a.repeat = 1;
|
||||
a.repeat_pause = 100;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
|
||||
/* Gauge */
|
||||
|
||||
lv_obj_t *gauge = lv_gauge_create(content, NULL);
|
||||
lv_gauge_set_value(gauge, 0, 47);
|
||||
lv_obj_set_size(gauge, LV_MATH_MIN(max_w, LV_DPI * 3 / 2),
|
||||
LV_MATH_MIN(max_w, LV_DPI * 3 / 2));
|
||||
lv_obj_set_click(gauge, false);
|
||||
|
||||
/* Text area */
|
||||
|
||||
lv_obj_t *ta = lv_ta_create(content, NULL);
|
||||
lv_obj_set_width(ta, LV_MATH_MIN(max_w, LV_DPI * 3 / 2));
|
||||
lv_ta_set_one_line(ta, true);
|
||||
lv_ta_set_text(ta, "Type...");
|
||||
|
||||
/* Keyboard */
|
||||
|
||||
lv_obj_t *kb = lv_kb_create(content, NULL);
|
||||
lv_obj_set_width(kb, max_w - LV_DPI / 4);
|
||||
lv_kb_set_ta(kb, ta);
|
||||
|
||||
lv_obj_t *mbox = lv_mbox_create(lv_disp_get_scr_act(NULL), NULL);
|
||||
lv_obj_set_drag(mbox, true);
|
||||
lv_mbox_set_text(mbox, "Choose a theme and a color on the left!");
|
||||
|
||||
static const char *mbox_btns[] =
|
||||
{
|
||||
"Ok", ""
|
||||
};
|
||||
|
||||
lv_mbox_add_btns(mbox, mbox_btns);
|
||||
|
||||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: theme_select_event_handler
|
||||
*
|
||||
* Description:
|
||||
* Callback for the theme selection event
|
||||
*
|
||||
* Input Parameters:
|
||||
* roller - the roller object that triggered the action
|
||||
* event - the theme select evnet type
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void theme_select_event_handler(lv_obj_t *roller, lv_event_t event)
|
||||
{
|
||||
if (event == LV_EVENT_VALUE_CHANGED)
|
||||
{
|
||||
lv_coord_t hres = lv_disp_get_hor_res(NULL);
|
||||
lv_coord_t vres = lv_disp_get_ver_res(NULL);
|
||||
|
||||
uint16_t opt = lv_roller_get_selected(roller);
|
||||
th_act = themes[opt];
|
||||
lv_theme_set_current(th_act);
|
||||
|
||||
lv_obj_align(header, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
|
||||
lv_obj_align(sb, header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
|
||||
if (hres > vres)
|
||||
{
|
||||
lv_obj_set_size(content,
|
||||
hres - lv_obj_get_width(sb),
|
||||
vres - lv_obj_get_height(header));
|
||||
lv_obj_set_pos(content,
|
||||
lv_obj_get_width(sb),
|
||||
lv_obj_get_height(header));
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_set_size(content, hres, vres / 2);
|
||||
lv_obj_set_pos(content, 0, vres / 2);
|
||||
}
|
||||
|
||||
lv_page_focus(sb, roller, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hue_select_event_cb
|
||||
*
|
||||
* Description:
|
||||
* Callback for the hue selection event
|
||||
*
|
||||
* Input Parameters:
|
||||
* roller - the roller object that triggered the action
|
||||
* event - the hue select evnet type
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void hue_select_event_cb(lv_obj_t *roller, lv_event_t event)
|
||||
{
|
||||
if (event == LV_EVENT_VALUE_CHANGED)
|
||||
{
|
||||
uint16_t hue = lv_roller_get_selected(roller) * 30;
|
||||
|
||||
init_all_themes(hue);
|
||||
|
||||
lv_theme_set_current(th_act);
|
||||
|
||||
lv_page_focus(sb, roller, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: init_all_themes
|
||||
*
|
||||
* Description:
|
||||
* Initialize all compiled-in themes to a hue
|
||||
*
|
||||
* Input Parameters:
|
||||
* hue - The HSV hue to use for the theme's color
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* This must be adjusted if more themes are added.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void init_all_themes(uint16_t hue)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* Disalbe warning when no theme selected. */
|
||||
|
||||
UNUSED(i);
|
||||
#if LV_USE_THEME_NIGHT
|
||||
themes[i++] = lv_theme_night_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_MATERIAL
|
||||
themes[i++] = lv_theme_material_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_ALIEN
|
||||
themes[i++] = lv_theme_alien_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_ZEN
|
||||
themes[i++] = lv_theme_zen_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_NEMO
|
||||
themes[i++] = lv_theme_nemo_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_MONO
|
||||
themes[i++] = lv_theme_mono_init(hue, NULL);
|
||||
#endif
|
||||
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
themes[i++] = lv_theme_default_init(hue, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: bar_set_value
|
||||
*
|
||||
* Description:
|
||||
* Initialize all compiled-in themes to a hue
|
||||
*
|
||||
* Input Parameters:
|
||||
* bar - bar instance
|
||||
* value - value of bar
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void bar_set_value(lv_obj_t *bar, int16_t value)
|
||||
{
|
||||
lv_bar_set_value(bar, value, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lv_test_theme_2
|
||||
*
|
||||
* Description:
|
||||
* Setup the theme-switching demo application objects
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lv_test_theme_2(void)
|
||||
{
|
||||
/* By doing this, we hide the first (empty) option. */
|
||||
|
||||
if (th_options[0] == '\n')
|
||||
th_options++;
|
||||
|
||||
init_all_themes(0);
|
||||
th_act = themes[0];
|
||||
if (th_act == NULL)
|
||||
{
|
||||
LV_LOG_WARN("lv_test_theme_2: no theme is enabled. Check lv_conf.h");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_theme_set_current(th_act);
|
||||
|
||||
lv_obj_t *scr = lv_obj_create(NULL, NULL);
|
||||
lv_disp_load_scr(scr);
|
||||
|
||||
header_create();
|
||||
sb_create();
|
||||
content_create();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_2 */
|
@ -1,81 +0,0 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/lv_test_theme_2.h
|
||||
*
|
||||
* Copyright (C) 2016 2016 Gábor Kiss-Vámosi. All rights reserved.
|
||||
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
|
||||
*
|
||||
* Released under the following BSD-compatible MIT license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the “Software”), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_LV_TEST_THEME_2_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_LV_TEST_THEME_2_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_THEME_2
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Test run time theme change */
|
||||
|
||||
void lv_test_theme_2(void);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_2 */
|
||||
#endif /* __APPS_EXAMPLES_LVGLDEMO_LV_TEST_THEME_2_H */
|
@ -51,9 +51,6 @@
|
||||
#include "fbdev.h"
|
||||
#include "tp.h"
|
||||
#include "tp_cal.h"
|
||||
#include "demo.h"
|
||||
#include "lv_test_theme_1.h"
|
||||
#include "lv_test_theme_2.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -223,42 +220,6 @@ int main(int argc, FAR char *argv[])
|
||||
indev_drv.read_cb = tp_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Demo initialization */
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_LVGLDEMO_SIMPLE)
|
||||
|
||||
demo_create();
|
||||
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1)
|
||||
|
||||
lv_theme_t *theme = NULL;
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_DEFAULT)
|
||||
theme = lv_theme_default_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ALIEN)
|
||||
theme = lv_theme_alien_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NIGHT)
|
||||
theme = lv_theme_night_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MONO)
|
||||
theme = lv_theme_mono_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_MATERIAL)
|
||||
theme = lv_theme_material_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_ZEN)
|
||||
theme = lv_theme_zen_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_1_NEMO)
|
||||
theme = lv_theme_nemo_init(EXAMPLES_LVGLDEMO_THEME_1_HUE, NULL);
|
||||
#else
|
||||
# error "No theme selected for this application"
|
||||
#endif
|
||||
|
||||
lv_test_theme_1(theme);
|
||||
|
||||
#elif defined(CONFIG_EXAMPLES_LVGLDEMO_THEME_2)
|
||||
lv_test_theme_2();
|
||||
#else
|
||||
# error "No LVGL demo selected"
|
||||
#endif
|
||||
|
||||
/* Start TP calibration */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_CALIBRATE
|
||||
|
@ -125,25 +125,13 @@ static void btn_click_action(FAR lv_obj_t *scr, lv_event_t event)
|
||||
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
a.var = circ_area;
|
||||
a.start = 0;
|
||||
a.end = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_x;
|
||||
a.path_cb = (lv_anim_path_cb_t)lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 200;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
a.start = 0;
|
||||
a.end = 0;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
|
||||
a.ready_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, circ_area);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
lv_anim_set_time(&a, 500);
|
||||
lv_anim_set_values(&a, 0, LV_HOR_RES - CIRCLE_SIZE);
|
||||
lv_anim_set_delay(&a, 200);
|
||||
lv_anim_start(&a);
|
||||
#else
|
||||
lv_obj_set_pos(circ_area, LV_HOR_RES - CIRCLE_SIZE, 0);
|
||||
#endif
|
||||
@ -176,26 +164,18 @@ static void btn_click_action(FAR lv_obj_t *scr, lv_event_t event)
|
||||
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.end = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_x;
|
||||
a.path_cb = (lv_anim_path_cb_t)lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 200;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, circ_area);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
lv_anim_set_time(&a, 500);
|
||||
lv_anim_set_values(&a, LV_HOR_RES - CIRCLE_SIZE,
|
||||
LV_HOR_RES - CIRCLE_SIZE);
|
||||
lv_anim_set_delay(&a, 200);
|
||||
lv_anim_start(&a);
|
||||
|
||||
a.start = 0;
|
||||
a.end = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
|
||||
a.ready_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_set_values(&a, 0, LV_VER_RES - CIRCLE_SIZE);
|
||||
lv_anim_start(&a);
|
||||
#else
|
||||
lv_obj_set_pos(circ_area,
|
||||
LV_HOR_RES - CIRCLE_SIZE, LV_VER_RES - CIRCLE_SIZE);
|
||||
@ -227,26 +207,18 @@ static void btn_click_action(FAR lv_obj_t *scr, lv_event_t event)
|
||||
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.end = 0;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_x;
|
||||
a.path_cb = (lv_anim_path_cb_t)lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = 200;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, circ_area);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
lv_anim_set_time(&a, 500);
|
||||
lv_anim_set_values(&a, LV_HOR_RES - CIRCLE_SIZE, 0);
|
||||
lv_anim_set_delay(&a, 200);
|
||||
lv_anim_start(&a);
|
||||
|
||||
a.start = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.end = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t) lv_obj_set_y;
|
||||
a.ready_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_set_values(&a, LV_VER_RES - CIRCLE_SIZE,
|
||||
LV_VER_RES - CIRCLE_SIZE);
|
||||
lv_anim_start(&a);
|
||||
#else
|
||||
lv_obj_set_pos(circ_area, 0, LV_VER_RES - CIRCLE_SIZE);
|
||||
#endif
|
||||
@ -310,6 +282,7 @@ static void btn_click_action(FAR lv_obj_t *scr, lv_event_t event)
|
||||
void tp_cal_create(void)
|
||||
{
|
||||
static lv_style_t style_circ;
|
||||
static lv_style_t style_big_btn;
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t a;
|
||||
#endif
|
||||
@ -326,8 +299,13 @@ void tp_cal_create(void)
|
||||
|
||||
big_btn = lv_btn_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(big_btn, TP_MAX_VALUE, TP_MAX_VALUE);
|
||||
lv_btn_set_style(big_btn, LV_BTN_STYLE_REL, &lv_style_transp);
|
||||
lv_btn_set_style(big_btn, LV_BTN_STYLE_PR, &lv_style_transp);
|
||||
|
||||
lv_style_init(&style_big_btn);
|
||||
|
||||
lv_style_set_bg_opa(&style_big_btn, LV_STATE_DEFAULT | LV_STATE_PRESSED,
|
||||
LV_OPA_TRANSP);
|
||||
lv_obj_add_style(big_btn, LV_BTN_PART_MAIN, &style_big_btn);
|
||||
|
||||
lv_obj_set_event_cb(big_btn, btn_click_action);
|
||||
lv_btn_set_layout(big_btn, LV_LAYOUT_OFF);
|
||||
|
||||
@ -339,35 +317,28 @@ void tp_cal_create(void)
|
||||
lv_obj_set_pos(label_main, (LV_HOR_RES - lv_obj_get_width(label_main)) / 2,
|
||||
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
|
||||
|
||||
lv_style_copy(&style_circ, &lv_style_pretty_color);
|
||||
style_circ.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_style_init(&style_circ);
|
||||
lv_style_set_radius(&style_circ, LV_STATE_DEFAULT,
|
||||
LV_RADIUS_CIRCLE);
|
||||
lv_style_set_bg_color(&style_circ, LV_STATE_DEFAULT,
|
||||
LV_COLOR_BLUE);
|
||||
circ_area = lv_obj_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(circ_area, CIRCLE_SIZE, CIRCLE_SIZE);
|
||||
lv_obj_set_style(circ_area, &style_circ);
|
||||
lv_obj_add_style(circ_area, LV_OBJ_PART_MAIN, &style_circ);
|
||||
lv_obj_set_click(circ_area, false);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES / 2;
|
||||
a.end = 0;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_x;
|
||||
a.path_cb = (lv_anim_path_cb_t)lv_anim_path_linear;
|
||||
a.ready_cb = NULL;
|
||||
a.act_time = -500;
|
||||
a.time = 200;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, circ_area);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
|
||||
lv_anim_set_time(&a, 200);
|
||||
lv_anim_set_values(&a, LV_HOR_RES / 2, 0);
|
||||
lv_anim_set_delay(&a, 200);
|
||||
lv_anim_start(&a);
|
||||
|
||||
a.start = LV_VER_RES / 2;
|
||||
a.end = 0;
|
||||
a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
|
||||
a.ready_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
|
||||
lv_anim_set_values(&a, LV_VER_RES / 2, 0);
|
||||
lv_anim_start(&a);
|
||||
#endif
|
||||
state = TP_CAL_STATE_WAIT_TOP_LEFT;
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
diff -ur lvgl-6.1.2/src/lv_draw/lv_draw_basic.c lvgl/src/lv_draw/lv_draw_basic.c
|
||||
--- lvgl-6.1.2/src/lv_draw/lv_draw_basic.c 2020-02-26 22:35:12.000000000 +0000
|
||||
+++ lvgl/src/lv_draw/lv_draw_basic.c 2020-04-16 09:24:53.015257341 +0000
|
||||
@@ -530,7 +530,7 @@
|
||||
else {
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
#if LV_USE_GPU
|
||||
- if(disp->driver.gpu_blend_cb == false) {
|
||||
+ if(disp->driver.gpu_blend_cb == NULL) {
|
||||
sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
|
||||
} else {
|
||||
disp->driver.gpu_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa);
|
||||
diff -ur lvgl-6.1.2/src/lv_objx/lv_img.c lvgl/src/lv_objx/lv_img.c
|
||||
--- lvgl-6.1.2/src/lv_objx/lv_img.c 2020-02-26 22:35:12.000000000 +0000
|
||||
+++ lvgl/src/lv_objx/lv_img.c 2020-04-16 09:24:23.419691790 +0000
|
||||
@@ -355,8 +355,8 @@
|
||||
|
||||
if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) cover = lv_area_is_in(mask, &img->coords);
|
||||
|
||||
- const lv_style_t * style = lv_img_get_style(img, LV_IMG_STYLE_MAIN);
|
||||
- if(style->image.opa < LV_OPA_MAX) return false;
|
||||
+ const lv_style_t * style_ = lv_img_get_style(img, LV_IMG_STYLE_MAIN);
|
||||
+ if(style_->image.opa < LV_OPA_MAX) return false;
|
||||
|
||||
return cover;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
menuconfig GRAPHICS_LVGL
|
||||
bool "Littlev Graphic Library (LVGL)"
|
||||
bool "Light and Versatile Graphic Library (LVGL)"
|
||||
default n
|
||||
---help---
|
||||
Enable support for the LVGL GUI library.
|
||||
@ -44,53 +44,13 @@ config LV_DPI
|
||||
---help---
|
||||
Number of pixels in 1 inch
|
||||
|
||||
config LV_VDB_SIZE
|
||||
int "Size of the internal graphics buffer (VDB) (0: no buffering)"
|
||||
default 10240
|
||||
|
||||
if LV_VDB_SIZE != 0
|
||||
|
||||
config LV_VDB_ADR
|
||||
int "Internal buffer's (VDB) memory address. 0: allocate automatically"
|
||||
default 0
|
||||
---help---
|
||||
You can place the graphics buffer int a specific memory location.
|
||||
E.g. into a mapped external RAM
|
||||
Zero to allocate automatically into the RAM
|
||||
Note: it's slower to access the data from a external memory
|
||||
|
||||
config LV_VDB_DOUBLE
|
||||
bool "Use 2 internal buffers. One to render and an other to flush data to frame buffer in background"
|
||||
default n
|
||||
---help---
|
||||
Enable to use one buffer for rendering an other to flush the
|
||||
ready content to the frame buffer.
|
||||
The flushing should be done by a hardware module (e.g. DMA) to
|
||||
make rendering and flushing parallel
|
||||
|
||||
if LV_VDB_DOUBLE
|
||||
|
||||
config LV_VDB2_ADR
|
||||
int "Second internal buffer's (VDB) memory address. 0: allocate automatically"
|
||||
default 0
|
||||
---help---
|
||||
Similarly to LV_VDB_ADR. the second VDB address can be specified as well.
|
||||
|
||||
config LV_VDB_TRUE_DOUBLE_BUFFERED
|
||||
bool "Use true double buffering"
|
||||
default 0
|
||||
|
||||
endif # LV_VDB_DOUBLE
|
||||
|
||||
config LV_ANTIALIAS
|
||||
bool "Anti aliasing of the screen"
|
||||
default n
|
||||
|
||||
endif # LV_VDB_SIZE != 0
|
||||
|
||||
config LV_DISP_DEF_REFR_PERIOD
|
||||
int "Default refresh period in milliseconds"
|
||||
default 50
|
||||
default 30
|
||||
---help---
|
||||
The graphics library will check for invalid areas an refresh
|
||||
them with this period time
|
||||
@ -108,7 +68,7 @@ menu "Input device settings"
|
||||
|
||||
config LV_INDEV_DEF_READ_PERIOD
|
||||
int "Input device default read period in milliseconds"
|
||||
default 50
|
||||
default 30
|
||||
|
||||
config LV_INDEV_POINT_MARKER
|
||||
int "Mark the pressed points on the screen"
|
||||
@ -130,6 +90,14 @@ config LV_INDEV_DEF_LONG_PRESS_REP_TIME
|
||||
int "Default repeated trigger period in long press [ms]"
|
||||
default 100
|
||||
|
||||
config LV_INDEV_DEF_GESTURE_LIMIT
|
||||
int "Gesture threshold in pixels"
|
||||
default 50
|
||||
|
||||
config LV_INDEV_DEF_GESTURE_MIN_VELOCITY
|
||||
int "Gesture min velocity at release before swipe (pixels)"
|
||||
default 3
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Color settings"
|
||||
@ -263,26 +231,10 @@ endmenu
|
||||
|
||||
menu "Theme usage"
|
||||
|
||||
config LV_THEME_LIVE_UPDATE
|
||||
bool "Allow theme switching at run time. Uses 8..10 kB of RAM"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_TEMPL
|
||||
bool "Use Template theme: just for test"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_DEFAULT
|
||||
bool "Use Default theme: uses the built-in style"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_ALIEN
|
||||
bool "Use Alien theme: dark futuristic theme"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_NIGHT
|
||||
bool "Use Night theme: dark elegant theme"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_MONO
|
||||
bool "Use Mono theme: mono color theme"
|
||||
default n
|
||||
@ -291,64 +243,6 @@ config LV_USE_THEME_MATERIAL
|
||||
bool "Use Material theme: material theme with bold colors"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_ZEN
|
||||
bool "Use Zen theme: light, peaceful theme"
|
||||
default n
|
||||
|
||||
config LV_USE_THEME_NEMO
|
||||
bool "Use Nemo theme: Water-like theme based on the movie 'Finding Nemo'"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Font usage"
|
||||
|
||||
config USE_LV_FONT_ROBOTO_12
|
||||
bool "Roboto 12 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_ROBOTO_16
|
||||
bool "Roboto 16 px"
|
||||
default y
|
||||
|
||||
config USE_LV_FONT_ROBOTO_22
|
||||
bool "Roboto 22 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_ROBOTO_28
|
||||
bool "Roboto 28 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_UNSCII_8
|
||||
bool "Monospace 8 px"
|
||||
default n
|
||||
|
||||
choice
|
||||
prompt "Default Font"
|
||||
default LV_FONT_DEFAULT_ROBOTO_16
|
||||
|
||||
config LV_FONT_DEFAULT_ROBOTO_12
|
||||
bool "Roboto 12 px"
|
||||
depends on USE_LV_FONT_ROBOTO_12 != 0
|
||||
|
||||
config LV_FONT_DEFAULT_ROBOTO_16
|
||||
bool "Roboto 16 px"
|
||||
depends on USE_LV_FONT_ROBOTO_16 != 0
|
||||
|
||||
config LV_FONT_DEFAULT_ROBOTO_22
|
||||
bool "Roboto 22 px"
|
||||
depends on USE_LV_FONT_ROBOTO_22 != 0
|
||||
|
||||
config LV_FONT_DEFAULT_ROBOTO_28
|
||||
bool "Roboto 28 px"
|
||||
depends on USE_LV_FONT_ROBOTO_28 != 0
|
||||
|
||||
config LV_FONT_DEFAULT_UNSCII_8
|
||||
bool "Monospace 8 px"
|
||||
depends on USE_LV_FONT_UNSCII_8 != 0
|
||||
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Base object settings"
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# apps/graphics/littlevgl/Make.defs
|
||||
# apps/graphics/lvgl/Make.defs
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -34,5 +34,5 @@
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_GRAPHICS_LVGL),y)
|
||||
CONFIGURED_APPS += $(APPDIR)/graphics/littlevgl
|
||||
CONFIGURED_APPS += $(APPDIR)/graphics/lvgl
|
||||
endif
|
@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# apps/graphics/littlevgl/Makefile
|
||||
# apps/graphics/lvgl/Makefile
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@ -38,36 +38,35 @@ include $(TOPDIR)/Make.defs
|
||||
# LVGL graphic library
|
||||
|
||||
LVGL_DIR = .
|
||||
LVGL_DIR_NAME = lvgl
|
||||
|
||||
# LVGL Libraries
|
||||
|
||||
-include ./lvgl/src/lv_core/lv_core.mk
|
||||
-include ./lvgl/src/lv_hal/lv_hal.mk
|
||||
-include ./lvgl/src/lv_objx/lv_objx.mk
|
||||
-include ./lvgl/src/lv_widgets/lv_widgets.mk
|
||||
-include ./lvgl/src/lv_font/lv_font.mk
|
||||
-include ./lvgl/src/lv_misc/lv_misc.mk
|
||||
-include ./lvgl/src/lv_themes/lv_themes.mk
|
||||
-include ./lvgl/src/lv_draw/lv_draw.mk
|
||||
-include ./lvgl/src/lv_gpu/lv_gpu.mk
|
||||
|
||||
# Set up build configuration and environment
|
||||
|
||||
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
|
||||
|
||||
CONFIG_GRAPH_LVGL_URL ?= "https://github.com/littlevgl/lvgl/archive"
|
||||
CONFIG_GRAPH_LVGL_URL ?= "https://github.com/lvgl/lvgl/archive"
|
||||
|
||||
LVGL_VERSION ?= 6.1.2
|
||||
LVGL_VERSION ?= 7.0.2
|
||||
LVGL_TARBALL = v$(LVGL_VERSION).zip
|
||||
WGET ?= wget
|
||||
|
||||
LVGL_UNPACKNAME = lvgl
|
||||
UNPACK ?= unzip -o
|
||||
|
||||
PATCH_FILES = lv_fix_warning.patch
|
||||
PATCH ?= patch -p0
|
||||
|
||||
LVGL_UNPACKDIR = $(WD)/$(LVGL_UNPACKNAME)
|
||||
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/graphics/littlevgl}
|
||||
CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/graphics/lvgl}
|
||||
|
||||
$(LVGL_TARBALL):
|
||||
@echo "Downloading: $(LVGL_TARBALL)"
|
||||
@ -79,13 +78,9 @@ $(LVGL_UNPACKNAME): $(LVGL_TARBALL)
|
||||
$(Q) mv lvgl-$(LVGL_VERSION) $(LVGL_UNPACKNAME)
|
||||
$(Q) touch $(LVGL_UNPACKNAME)
|
||||
|
||||
$(LVGL_UNPACKNAME)/.patched: $(LVGL_UNPACKNAME) $(PATCH_FILES)
|
||||
$(Q) cat $(PATCH_FILES) | $(PATCH)
|
||||
$(Q) touch $(LVGL_UNPACKNAME)/.patched
|
||||
|
||||
lvgl/lvgl.h: $(LVGL_UNPACKNAME)
|
||||
|
||||
$(APPDIR)/include/graphics/lvgl.h: lvgl/lvgl.h $(LVGL_UNPACKNAME)/.patched
|
||||
$(APPDIR)/include/graphics/lvgl.h: lvgl/lvgl.h
|
||||
@echo "CP: lvgl/lvgl.h"
|
||||
$(Q) cp lvgl/lvgl.h $(APPDIR)/include/graphics/lvgl.h
|
||||
|
@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_GRAPHICS_LITTLEVGL_LV_CONF_H
|
||||
#define __APPS_GRAPHICS_LITTLEVGL_LV_CONF_H
|
||||
#ifndef __APPS_GRAPHICS_LVGL_LV_CONF_H
|
||||
#define __APPS_GRAPHICS_LVGL_LV_CONF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@ -125,6 +125,18 @@ typedef int16_t lv_coord_t;
|
||||
|
||||
#define LV_DPI CONFIG_LV_DPI /* [px] */
|
||||
|
||||
/* The the real width of the display changes some default values:
|
||||
* default object sizes, layout of examples, etc.
|
||||
* According to the width of the display (hor. res. / dpi)
|
||||
* the displays fall in 4 categories.
|
||||
* The 4th is extra large which has no upper limit so not listed here
|
||||
* The upper limit of the categories are set below in 0.1 inch unit.
|
||||
*/
|
||||
|
||||
#define LV_DISP_SMALL_LIMIT 30
|
||||
#define LV_DISP_MEDIUM_LIMIT 50
|
||||
#define LV_DISP_LARGE_LIMIT 70
|
||||
|
||||
/****************************************************************************
|
||||
* Memory manager settings
|
||||
****************************************************************************/
|
||||
@ -207,7 +219,17 @@ typedef int16_t lv_coord_t;
|
||||
* Time between `LV_EVENT_LONG_PRESSED_REPEAT
|
||||
*/
|
||||
|
||||
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME CONFIG_LV_INDEV_DEF_LONG_PRESS_REP_TIME
|
||||
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME \
|
||||
CONFIG_LV_INDEV_DEF_LONG_PRESS_REP_TIME
|
||||
|
||||
/* Gesture threshold in pixels */
|
||||
|
||||
#define LV_INDEV_DEF_GESTURE_LIMIT CONFIG_LV_INDEV_DEF_GESTURE_LIMIT
|
||||
|
||||
/* Gesture min velocity at release before swipe (pixels) */
|
||||
|
||||
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY \
|
||||
CONFIG_LV_INDEV_DEF_GESTURE_MIN_VELOCITY
|
||||
|
||||
/****************************************************************************
|
||||
* Feature usage
|
||||
@ -239,6 +261,30 @@ typedef void * lv_anim_user_data_t;
|
||||
#define LV_USE_SHADOW 0
|
||||
#endif
|
||||
|
||||
#if LV_USE_SHADOW
|
||||
/* Allow buffering some shadow calculation
|
||||
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer,
|
||||
* where shadow size is `shadow_width + radius`
|
||||
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost
|
||||
*/
|
||||
|
||||
# define LV_SHADOW_CACHE_SIZE 0
|
||||
#endif
|
||||
|
||||
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`) */
|
||||
|
||||
#define LV_USE_BLEND_MODES 1
|
||||
|
||||
/* 1: Use the `opa_scale` style property to set the opacity
|
||||
* of an object and its children at once
|
||||
*/
|
||||
|
||||
#define LV_USE_OPA_SCALE 1
|
||||
|
||||
/* 1: Use image zoom and rotation */
|
||||
|
||||
#define LV_USE_IMG_TRANSFORM 1
|
||||
|
||||
/* 1: Enable object groups (for keyboard/encoder navigation) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_GROUP
|
||||
@ -282,6 +328,14 @@ typedef void * lv_fs_drv_user_data_t;
|
||||
#define LV_USE_USER_DATA 0
|
||||
#endif
|
||||
|
||||
/* 1: Show CPU usage and FPS count in the right bottom corner */
|
||||
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
|
||||
/* 1: Use the functions and types from the older API if possible */
|
||||
|
||||
#define LV_USE_API_EXTENSION_V6 1
|
||||
|
||||
/****************************************************************************
|
||||
* Image decoder and cache
|
||||
****************************************************************************/
|
||||
@ -346,6 +400,12 @@ typedef void * lv_img_decoder_user_data_t;
|
||||
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
|
||||
/* Prefix performance critical functions to place them into a
|
||||
* faster memory (e.g RAM). Uses 15-20 kB extra memory
|
||||
*/
|
||||
|
||||
#define LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
/* Export integer constant to binding.
|
||||
* This macro is used with constants in the form of LV_<CONST> that
|
||||
* should also appear on lvgl binding API such as Micropython
|
||||
@ -438,13 +498,11 @@ typedef void * lv_indev_drv_user_data_t; /* Type of user data in the
|
||||
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_USE_DEBUG
|
||||
#define LV_USE_DEBUG CONFIG_LV_USE_DEBUG
|
||||
#else
|
||||
#define LV_USE_DEBUG 0
|
||||
#ifndef CONFIG_LV_USE_DEBUG
|
||||
#define CONFIG_LV_USE_DEBUG 0
|
||||
#endif
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
#define LV_USE_DEBUG CONFIG_LV_USE_DEBUG
|
||||
|
||||
/* Check if the parameter is NULL. (Quite fast) */
|
||||
|
||||
@ -462,6 +520,10 @@ typedef void * lv_indev_drv_user_data_t; /* Type of user data in the
|
||||
#define LV_USE_ASSERT_MEM 0
|
||||
#endif
|
||||
|
||||
/* Check the integrity of `lv_mem` after critical operations. (Slow) */
|
||||
|
||||
#define LV_USE_ASSERT_MEM_INTEGRITY 0
|
||||
|
||||
/* Check the strings.
|
||||
* Search for NULL, very long strings, invalid characters,
|
||||
* and unnatural repetitions. (Slow)
|
||||
@ -494,109 +556,95 @@ typedef void * lv_indev_drv_user_data_t; /* Type of user data in the
|
||||
#define LV_USE_ASSERT_STYLE 0
|
||||
#endif
|
||||
|
||||
#endif /* LV_USE_DEBUG */
|
||||
|
||||
/****************************************************************************
|
||||
* THEME USAGE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LV_THEME_LIVE_UPDATE
|
||||
#define LV_THEME_LIVE_UPDATE CONFIG_LV_THEME_LIVE_UPDATE
|
||||
#else
|
||||
#define LV_THEME_LIVE_UPDATE 0 /* 1: Allow theme switching at run time. Uses 8..10 kB of RAM */
|
||||
#endif
|
||||
/* Always enable at least on theme */
|
||||
|
||||
#ifdef CONFIG_LV_THEME_LIVE_TEMPL
|
||||
#define LV_USE_THEME_TEMPL CONFIG_LV_USE_THEME_TEMPL
|
||||
#else
|
||||
#define LV_USE_THEME_TEMPL 0 /* Just for test */
|
||||
#endif
|
||||
/* No theme, you can apply your styles as you need
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_DEFAULT
|
||||
#define LV_USE_THEME_DEFAULT CONFIG_LV_USE_THEME_DEFAULT
|
||||
#else
|
||||
#define LV_USE_THEME_DEFAULT 0 /* Built mainly from the built-in styles. Consumes very few RAM */
|
||||
#endif
|
||||
#define LV_USE_THEME_EMPTY 1
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_ALIEN
|
||||
#define LV_USE_THEME_ALIEN CONFIG_LV_USE_THEME_ALIEN
|
||||
#else
|
||||
#define LV_USE_THEME_ALIEN 0 /* Dark futuristic theme */
|
||||
#endif
|
||||
/* Simple to the create your theme based on it
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_NIGHT
|
||||
#define LV_USE_THEME_NIGHT CONFIG_LV_USE_THEME_NIGHT
|
||||
#else
|
||||
#define LV_USE_THEME_NIGHT 0 /* Dark elegant theme */
|
||||
#endif
|
||||
#define LV_USE_THEME_TEMPLATE 1
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_MONO
|
||||
#define LV_USE_THEME_MONO CONFIG_LV_USE_THEME_MONO
|
||||
#else
|
||||
#define LV_USE_THEME_MONO 0 /* Mono color theme for monochrome displays */
|
||||
#endif
|
||||
/* A fast and impressive theme.
|
||||
* Flags:
|
||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_MATERIAL
|
||||
#define LV_USE_THEME_MATERIAL CONFIG_LV_USE_THEME_MATERIAL
|
||||
#else
|
||||
#define LV_USE_THEME_MATERIAL 0 /* Flat theme with bold colors and light shadows */
|
||||
#endif
|
||||
#define LV_USE_THEME_MATERIAL 1
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_ZEN
|
||||
#define LV_USE_THEME_ZEN CONFIG_LV_USE_THEME_ZEN
|
||||
#else
|
||||
#define LV_USE_THEME_ZEN 0 /* Peaceful, mainly light theme */
|
||||
#endif
|
||||
/* Mono-color theme for monochrome displays.
|
||||
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
|
||||
* texts and borders will be black and the background will be
|
||||
* white. Else the colors are inverted.
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_USE_THEME_NEMO
|
||||
#define LV_USE_THEME_NEMO CONFIG_LV_USE_THEME_NEMO
|
||||
#else
|
||||
#define LV_USE_THEME_NEMO 0 /* Water-like theme based on the movie "Finding Nemo" */
|
||||
#endif
|
||||
#define LV_USE_THEME_MONO 1
|
||||
|
||||
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /* Include a header for the init. function */
|
||||
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
||||
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
|
||||
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
|
||||
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
|
||||
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_16
|
||||
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
|
||||
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_16
|
||||
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_16
|
||||
|
||||
/****************************************************************************
|
||||
* FONT USAGE
|
||||
****************************************************************************/
|
||||
|
||||
/* The built-in fonts contains the ASCII range and
|
||||
* some Symbols with 4 bit-per-pixel.
|
||||
/* The built-in fonts contains the ASCII range and some Symbols
|
||||
* with 4 bit-per-pixel.
|
||||
* The symbols are available via `LV_SYMBOL_...` defines
|
||||
* More info about fonts: https://docs.littlevgl.com/#Fonts
|
||||
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
|
||||
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
|
||||
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||
*/
|
||||
|
||||
/* Robot fonts with bpp = 4
|
||||
* https://fonts.google.com/specimen/Roboto
|
||||
/* Montserrat fonts with bpp = 4
|
||||
* https://fonts.google.com/specimen/Montserrat
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_ROBOTO_12
|
||||
#define LV_FONT_ROBOTO_12 CONFIG_USE_LV_FONT_ROBOTO_12
|
||||
#else
|
||||
#define LV_FONT_ROBOTO_12 0
|
||||
#endif
|
||||
/* They only take up storage space after being used,
|
||||
* so we can enable them all by default
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_ROBOTO_16
|
||||
#define LV_FONT_ROBOTO_16 CONFIG_USE_LV_FONT_ROBOTO_16
|
||||
#else
|
||||
#define LV_FONT_ROBOTO_16 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_ROBOTO_22
|
||||
#define LV_FONT_ROBOTO_22 CONFIG_USE_LV_FONT_ROBOTO_22
|
||||
#else
|
||||
#define LV_FONT_ROBOTO_22 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_ROBOTO_28
|
||||
#define LV_FONT_ROBOTO_28 CONFIG_USE_LV_FONT_ROBOTO_28
|
||||
#else
|
||||
#define LV_FONT_ROBOTO_28 0
|
||||
#endif
|
||||
#define LV_FONT_MONTSERRAT_12 1
|
||||
#define LV_FONT_MONTSERRAT_14 1
|
||||
#define LV_FONT_MONTSERRAT_16 1
|
||||
#define LV_FONT_MONTSERRAT_18 1
|
||||
#define LV_FONT_MONTSERRAT_20 1
|
||||
#define LV_FONT_MONTSERRAT_22 1
|
||||
#define LV_FONT_MONTSERRAT_24 1
|
||||
#define LV_FONT_MONTSERRAT_26 1
|
||||
#define LV_FONT_MONTSERRAT_28 1
|
||||
#define LV_FONT_MONTSERRAT_30 1
|
||||
#define LV_FONT_MONTSERRAT_32 1
|
||||
#define LV_FONT_MONTSERRAT_34 1
|
||||
#define LV_FONT_MONTSERRAT_36 1
|
||||
#define LV_FONT_MONTSERRAT_38 1
|
||||
#define LV_FONT_MONTSERRAT_40 1
|
||||
#define LV_FONT_MONTSERRAT_42 1
|
||||
#define LV_FONT_MONTSERRAT_44 1
|
||||
#define LV_FONT_MONTSERRAT_46 1
|
||||
#define LV_FONT_MONTSERRAT_48 1
|
||||
|
||||
/* Demonstrate special features */
|
||||
|
||||
#define LV_FONT_ROBOTO_12_SUBPX 1
|
||||
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /* bpp = 3 */
|
||||
#define LV_FONT_MONTSERRAT_12_SUBPX 0
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /* bpp = 3 */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /* Hebrew, Arabic, PErisan letters and all their forms */
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /* 1000 most common CJK radicals */
|
||||
|
||||
/* Pixel perfect monospace font
|
||||
* http://pelulamu.net/unscii/
|
||||
@ -617,28 +665,6 @@ typedef void * lv_indev_drv_user_data_t; /* Type of user data in the
|
||||
|
||||
#define LV_FONT_CUSTOM_DECLARE
|
||||
|
||||
/* Always set a default font from the built-in fonts */
|
||||
|
||||
#ifdef CONFIG_LV_FONT_DEFAULT_ROBOTO_12
|
||||
#define LV_FONT_DEFAULT &lv_font_roboto_12
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_FONT_DEFAULT_ROBOTO_16
|
||||
#define LV_FONT_DEFAULT &lv_font_roboto_16
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_FONT_DEFAULT_ROBOTO_22
|
||||
#define LV_FONT_DEFAULT &lv_font_roboto_22
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_FONT_DEFAULT_ROBOTO_28
|
||||
#define LV_FONT_DEFAULT &lv_font_roboto_28
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LV_FONT_DEFAULT_UNSCII_8
|
||||
#define LV_FONT_DEFAULT &lv_font_unscii_8
|
||||
#endif
|
||||
|
||||
/* Enable it if you have fonts with a lot of characters.
|
||||
* The limit depends on the font size, font face and bpp
|
||||
* but with > 10,000 characters if you see issues probably you need
|
||||
@ -680,7 +706,7 @@ typedef void * lv_font_user_data_t;
|
||||
* To disable, set to a value <= 0
|
||||
*/
|
||||
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 12
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 0
|
||||
|
||||
/* Minimum number of characters in a long word to put
|
||||
* on a line before a break.
|
||||
@ -718,6 +744,13 @@ typedef void * lv_font_user_data_t;
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/* Enable Arabic/Persian processing
|
||||
* In these languages characters should be replaced with
|
||||
* an other form based on their position in the text
|
||||
*/
|
||||
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
|
||||
/* Change the built in (v)snprintf functions */
|
||||
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
@ -753,7 +786,7 @@ typedef void * lv_obj_user_data_t;
|
||||
* in all 4 directions (-32k..+32k px)
|
||||
*/
|
||||
|
||||
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF
|
||||
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
|
||||
|
||||
/****************************************************************************
|
||||
* LV OBJ X USAGE
|
||||
@ -1027,12 +1060,4 @@ typedef void * lv_obj_user_data_t;
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/* Be sure every define has a default value */
|
||||
|
||||
#include "lvgl/src/lv_conf_checker.h"
|
||||
|
||||
#endif /* __APPS_GRAPHICS_LITTLEVGL_LV_CONF_H */
|
||||
#endif /* __APPS_GRAPHICS_LVGL_LV_CONF_H */
|
Loading…
x
Reference in New Issue
Block a user