Squashed commit of the following:

Add note to file header of MIT-licensed code
    Compat for older kconfig
    Fixup OOB build experience
    Apply coding standards to imported code
    Upgrade littlevgl to 5.3 - demo
    Upgrade littlevgl to 5.3
This commit is contained in:
Matthew Koch 2019-04-08 06:57:42 -06:00 committed by Gregory Nutt
parent aec954b9ec
commit f09bc1a01b
16 changed files with 44960 additions and 25767 deletions

@ -11,10 +11,77 @@ menuconfig EXAMPLES_LVGLDEMO
if EXAMPLES_LVGLDEMO
choice
prompt "Select a demo application"
default EXAMPLES_LVGLDEMO_SIMPLE
config EXAMPLES_LVGLDEMO_SIMPLE
bool "Simple"
config EXAMPLES_LVGLDEMO_THEME_1
bool "Single Theme"
---help---
Create a test screen with a lot objects and apply
the given theme on them
config EXAMPLES_LVGLDEMO_THEME_2
bool "Multiple Themes"
select LV_THEME_LIVE_UPDATE
---help---
Switch themes on the fly to demonstrate each different
themes. Configure multiple themes in the littlevgl
settings to use.
endchoice
config EXAMPLES_LVGLDEMO_WALLPAPER
bool "Use wallpaper"
depends on EXAMPLES_LVGLDEMO_SIMPLE
default y
choice
prompt "Selected Theme"
depends on EXAMPLES_LVGLDEMO_THEME_1
default EXAMPLES_LVGLDEMO_THEME_1_DEFAULT
config EXAMPLES_LVGLDEMO_THEME_1_DEFAULT
bool "Default Theme"
select USE_LV_THEME_DEFAULT
config EXAMPLES_LVGLDEMO_THEME_1_ALIEN
bool "Alien"
select USE_LV_THEME_ALIEN
config EXAMPLES_LVGLDEMO_THEME_1_NIGHT
bool "Night"
select USE_LV_THEME_NIGHT
config EXAMPLES_LVGLDEMO_THEME_1_MONO
bool "Mono"
select USE_LV_THEME_MONO
config EXAMPLES_LVGLDEMO_THEME_1_MATERIAL
bool "Material"
select USE_LV_THEME_MATERIAL
config EXAMPLES_LVGLDEMO_THEME_1_ZEN
bool "Zen"
select USE_LV_THEME_ZEN
config EXAMPLES_LVGLDEMO_THEME_1_NEMO
bool "Nemo"
select USE_LV_THEME_NEMO
endchoice
config EXAMPLES_LVGLDEMO_THEME_1_HUE
int "Theme hue"
range 0 360
depends on EXAMPLES_LVGLDEMO_THEME_1
default 30
---help---
Choose a hue color from the HSV color space
config EXAMPLES_LVGLDEMO_PRIORITY
int "lvgl task priority"
default 100

@ -47,7 +47,18 @@ STACKSIZE = $(CONFIG_EXAMPLES_LVGLDEMO_STACKSIZE)
# LittleVGL demo Example
ASRCS =
CSRCS += fbdev.c demo.c img_bubble_pattern.c tp.c tp_cal.c
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
CONFIG_EXAMPLES_LVGLDEMO_PROGNAME ?= lvgldemo$(EXEEXT)

@ -1,35 +1,31 @@
/****************************************************************************
* apps/examples/lvgldemo/demo.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* Released under the following BSD-compatible MIT license:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
* 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:
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* 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.
*
****************************************************************************/
@ -39,36 +35,55 @@
#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 lv_res_t keyboard_open_close(lv_obj_t * ta);
static lv_res_t keyboard_hide_action(lv_obj_t * keyboard);
static void list_create(lv_obj_t * parent);
static void chart_create(lv_obj_t * parent);
static lv_res_t slider_action(lv_obj_t * slider);
static lv_res_t list_btn_action(lv_obj_t * slider);
static void write_create(lv_obj_t *parent);
static lv_res_t keyboard_open_close(lv_obj_t *ta);
static lv_res_t keyboard_hide_action(lv_obj_t *keyboard);
static void kb_hide_anim_end(lv_obj_t *keyboard);
static void list_create(lv_obj_t *parent);
static void chart_create(lv_obj_t *parent);
static lv_res_t slider_action(lv_obj_t *slider);
static lv_res_t list_btn_action(lv_obj_t *slider);
#if LV_DEMO_SLIDE_SHOW
static void tab_switcher(void * tv);
static void tab_switcher(void *tv);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
static lv_obj_t * chart;
static lv_obj_t * ta;
static lv_obj_t * kb;
FAR static lv_obj_t *chart;
FAR static lv_obj_t *ta;
FAR static lv_obj_t *kb;
static lv_style_t style_kb;
static lv_style_t style_kb_rel;
static lv_style_t style_kb_pr;
#ifdef CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
#if LV_DEMO_WALLPAPER
LV_IMG_DECLARE(img_bubble_pattern);
#endif
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@ -77,12 +92,17 @@ LV_IMG_DECLARE(img_bubble_pattern);
* Name: write_create
*
* Description:
* Create a text-area and keyboard, each composing half of the
* parent container.
*
* Input Parameters:
* parent
* parent - the lv_page_t* container to create the "write" page within
*
* Returned Value:
* None
* none
*
* Assumptions/Limitations:
*
*
****************************************************************************/
@ -96,53 +116,74 @@ static void write_create(lv_obj_t *parent)
lv_page_set_sb_mode(parent, LV_SB_MODE_OFF);
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);
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_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_page_set_rel_action(ta, keyboard_open_close);
lv_style_copy(&style_kb, &lv_style_plain);
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.hor = 0;
style_kb.body.padding.ver = 0;
style_kb.body.padding.inner = 0;
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.hor = 0;
style_kb.body.padding.ver = 0;
style_kb.body.padding.inner = 0;
lv_style_copy(&style_kb_rel, &lv_style_plain);
style_kb_rel.body.empty = 1;
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;
/* Recommended if LV_VDB_SIZE == 0 and bpp > 1 fonts are used */
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;
style_kb_rel.body.empty = 1;
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.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;
keyboard_open_close(ta);
}
static lv_res_t keyboard_open_close(lv_obj_t * text_area)
{
/* Test area is on scrollable part of the page but we need the page itself */
/****************************************************************************
* Name: keyboard_open_close
*
* Description:
* Toggle the display of the keyboard on the "Write" tab
*
* Input Parameters:
* text_area - a pointer to the lv_obj_t text area for the keyboard
*
* Returned Value:
* LV_RES_OK on success, some other LV_RES_ value otherwise.
*
* Assumptions/Limitations:
*
*
****************************************************************************/
lv_obj_t * parent = lv_obj_get_parent(lv_obj_get_parent(ta));
static lv_res_t keyboard_open_close(lv_obj_t *text_area)
{
lv_obj_t *parent;
(void)text_area; /* Unused */
/* Text area is on the scrollable part of the page but we need
* the page itself
*/
parent = lv_obj_get_parent(lv_obj_get_parent(ta));
if (kb)
{
@ -151,13 +192,17 @@ static lv_res_t keyboard_open_close(lv_obj_t * text_area)
else
{
kb = lv_kb_create(parent, NULL);
lv_obj_set_size(kb, lv_page_get_scrl_width(parent),
lv_obj_get_height(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_kb_set_hide_action(kb, keyboard_hide_action);
lv_kb_set_ok_action(kb, keyboard_hide_action);
@ -169,23 +214,32 @@ static lv_res_t keyboard_open_close(lv_obj_t * text_area)
}
/****************************************************************************
* Name: list_create
* Name: keyboard_hide_action
*
* Description:
* Called when the close or ok button is pressed on the keyboard
* Called when the close or ok button is pressed on the keyboard
*
* Input Parameters:
* keyboard pointer to the keyboard
* keyboard - pointer to the keyboard, but unused
*
* Returned Value:
* None
* LV_RES_OK if the *kb object was not deleted (freed),
* LV_RES_INV if it was deleted.
*
* Assumptions/Limitations:
* The animation routine will call kb_hide_anim_end() to delete (free)
* the object. The global lv_obj_t *kb is set to NULL after whether
* deleted or not. Assume *kb is valid entering this function.
*
****************************************************************************/
static lv_res_t keyboard_hide_action(lv_obj_t * keyboard)
static lv_res_t keyboard_hide_action(lv_obj_t *keyboard)
{
(void)keyboard; /* Unused */
#if USE_LV_ANIMATION
lv_obj_animate(kb, LV_ANIM_FLOAT_BOTTOM | LV_ANIM_OUT, 300, 0,
(void(*)(lv_obj_t *))lv_obj_del);
kb_hide_anim_end);
kb = NULL;
return LV_RES_OK;
#else
@ -195,25 +249,57 @@ static lv_res_t keyboard_hide_action(lv_obj_t * keyboard)
#endif
}
/****************************************************************************
* Name: kb_hide_anim_end
*
* Description:
* A callback to delete (free) the object passed as a parameter.
*
* Input Parameters:
* keyboard - An lv_obj_t * to be deleted.
*
* Returned Value:
* None
*
* Assumptions/Limitations:
*
*
****************************************************************************/
static void kb_hide_anim_end(lv_obj_t *keyboard)
{
lv_obj_del(keyboard);
}
/****************************************************************************
* Name: list_create
*
* Description:
* Create a list object within a parent page, populating it with sample
* data.
*
* Input Parameters:
* parent
* parent - The parent lv_page
*
* Returned Value:
* None
*
* Assumptions/Limitations:
*
*
****************************************************************************/
static void list_create(lv_obj_t *parent)
{
static lv_style_t style_btn_rel;
static lv_style_t style_btn_pr;
static const char *mbox_btns[] = {"Got it", ""};
FAR lv_obj_t *list;
FAR lv_obj_t *mbox;
FAR static const char *mbox_btns[] = {
"Got it", ""
};
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);
@ -225,52 +311,89 @@ static void list_create(lv_obj_t *parent)
/* Create styles for the buttons */
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;
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);
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);
list = lv_list_create(parent, NULL);
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_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_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_list_add(list, SYMBOL_FILE, "New", list_btn_action);
lv_list_add(list, SYMBOL_DIRECTORY, "Open", list_btn_action);
lv_list_add(list, SYMBOL_TRASH, "Delete", list_btn_action);
lv_list_add(list, SYMBOL_EDIT, "Edit", list_btn_action);
lv_list_add(list, SYMBOL_SAVE, "Save", list_btn_action);
lv_list_add(list, SYMBOL_WIFI, "WiFi", list_btn_action);
lv_list_add(list, SYMBOL_GPS, "GPS", list_btn_action);
lv_list_add(list, SYMBOL_FILE, "New", list_btn_action);
lv_list_add(list, SYMBOL_DIRECTORY, "Open", list_btn_action);
lv_list_add(list, SYMBOL_TRASH, "Delete", list_btn_action);
lv_list_add(list, SYMBOL_EDIT, "Edit", list_btn_action);
lv_list_add(list, SYMBOL_SAVE, "Save", list_btn_action);
lv_list_add(list, SYMBOL_WIFI, "WiFi", list_btn_action);
lv_list_add(list, SYMBOL_GPS, "GPS", list_btn_action);
mbox = lv_mbox_create(parent, NULL);
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, LV_HOR_RES - LV_DPI);
lv_mbox_add_btns(mbox, mbox_btns, NULL); /*The default action is close*/
/* The default action is close */
lv_mbox_add_btns(mbox, mbox_btns, NULL);
lv_obj_align(mbox, parent, LV_ALIGN_IN_TOP_MID, 0, LV_DPI / 2);
}
/****************************************************************************
* Name: list_btn_action
*
* 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
*
* Returned Value:
* LV_RES_OK - the object is still valid
*
* Assumptions/Limitations:
*
*
****************************************************************************/
static lv_res_t list_btn_action(lv_obj_t *btn)
{
lv_ta_add_text(ta, lv_list_get_btn_text(btn));
lv_ta_add_char(ta, '\n');
return LV_RES_OK;
}
/****************************************************************************
* 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
* parent - The parent lv_page
*
* Returned Value:
* None
* None
*
* Assumptions/Limitations:
*
*
****************************************************************************/
@ -281,25 +404,32 @@ static void chart_create(lv_obj_t *parent)
static lv_style_t style_indic;
static lv_style_t style_knob;
lv_page_set_style(parent, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
FAR lv_chart_series_t *ser1;
FAR lv_obj_t *slider;
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);
/* Make the parent a fixed size */
lv_page_set_scrl_fit(parent, false, false);
lv_page_set_scrl_height(parent, lv_obj_get_height(parent));
lv_page_set_sb_mode(parent, LV_SB_MODE_OFF);
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;
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_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, &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);
@ -310,49 +440,51 @@ static void chart_create(lv_obj_t *parent)
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 */
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.hor = 0;
style_bar.body.padding.ver = LV_DPI / 10;
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.hor = 0;
style_bar.body.padding.ver = LV_DPI / 10;
lv_style_copy(&style_indic, &lv_style_pretty);
style_indic.body.grad_color = LV_COLOR_MARRON;
style_indic.body.main_color = LV_COLOR_RED;
style_indic.body.radius = LV_RADIUS_CIRCLE;
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.hor = LV_DPI / 30;
style_indic.body.padding.ver = LV_DPI / 30;
style_indic.body.padding.hor = LV_DPI / 30;
style_indic.body.padding.ver = 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;
style_knob.body.radius = LV_RADIUS_CIRCLE;
style_knob.body.opa = LV_OPA_70;
/* Create a second slider */
/* Create a second slider, align to bottom of the chart */
slider = lv_slider_create(parent, NULL);
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);
/* Align to below the chart */
lv_obj_align(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0,
(LV_VER_RES - chart->coords.y2 - lv_obj_get_height(slider)) / 2);
(LV_VER_RES - chart->coords.y2 - lv_obj_get_height(slider)) / 2);
/* Simulate a user value set the refresh the chart */
lv_slider_set_action(slider, slider_action);
lv_slider_set_range(slider, 10, 1000);
lv_slider_set_value(slider, 700);
/* Simulate a user value set the refresh the chart */
slider_action(slider);
}
@ -360,13 +492,16 @@ static void chart_create(lv_obj_t *parent)
* Name: slider_action
*
* Description:
* alled when a new value on the slider on the Chart tab is set
* Callback of the slider on the chart page. Adjusts the Y-axis range
*
* Input Parameters:
* slider - Pointer to the slider
* slider - the slider object that triggered this action
*
* Returned Value:
* LV_RES_OK because the slider is not deleted in the function
* LV_RES_OK - the object is still valid
*
* Assumptions/Limitations:
* Anything else that one might need to know to use this function.
*
****************************************************************************/
@ -374,44 +509,57 @@ static lv_res_t slider_action(lv_obj_t *slider)
{
int16_t v = lv_slider_get_value(slider);
/* Convert to range modify values linearly */
v = 1000 * 100 / v;
v = 1000 * 100 / v; /* Convert to range modify values linearly */
lv_chart_set_range(chart, 0, v);
return LV_RES_OK;
}
#if LV_DEMO_SLIDE_SHOW
/****************************************************************************
* Name: list_btn_action
* Name: tab_switcher
*
* Description:
* Called when a a list button is clicked on the List tab
* Cycle to the next tab in a tab view.
*
* Input Parameters:
* btn - Pointer to a list button
* tv - The tab view object to cycle
*
* Returned Value:
* LV_RES_OK because the button is not deleted in the function
* None
*
* Assumptions/Limitations:
* Assumes only 3 tabs in the tab view.
*
****************************************************************************/
static lv_res_t list_btn_action(lv_obj_t *btn)
{
lv_ta_add_char(ta, '\n');
lv_ta_add_text(ta, lv_list_get_btn_text(btn));
/**
* Called periodically (lv_task) to switch to the next tab
*/
return LV_RES_OK;
static void tab_switcher(void *tv)
{
static uint8_t tab = 0;
tab++;
if (tab >= 3)
{
tab = 0;
}
lv_tabview_set_tab_act(tv, tab, true);
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: demo_init
* Name: demo_create
*
* Description:
* Initialize the LVGL demo screen
*
* Input Parameters:
* None
@ -419,55 +567,64 @@ static lv_res_t list_btn_action(lv_obj_t *btn)
* Returned Value:
* None
*
* Assumptions/Limitations:
*
*
****************************************************************************/
void demo_init(void)
void demo_create(void)
{
static lv_style_t style_tv_btn_bg;
static lv_style_t style_tv_btn_rel;
static lv_style_t style_tv_btn_pr;
#if CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
lv_obj_t * wp = lv_img_create(lv_scr_act(), NULL);
FAR lv_obj_t *tv;
FAR lv_obj_t *tab1;
FAR lv_obj_t *tab2;
FAR lv_obj_t *tab3;
#if LV_DEMO_WALLPAPER
FAR lv_obj_t *wp;
wp = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(wp, &img_bubble_pattern);
lv_obj_set_width(wp, LV_HOR_RES * 4);
lv_obj_set_protect(wp, LV_PROTECT_POS);
#endif
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.ver = 0;
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.ver = 0;
lv_style_copy(&style_tv_btn_rel, &lv_style_btn_rel);
style_tv_btn_rel.body.empty = 1;
style_tv_btn_rel.body.border.width = 0;
style_tv_btn_rel.body.empty = 1;
style_tv_btn_rel.body.border.width = 0;
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.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;
style_tv_btn_pr.text.color = LV_COLOR_GRAY;
lv_obj_t * tv = lv_tabview_create(lv_scr_act(), NULL);
tv = lv_tabview_create(lv_scr_act(), NULL);
#if CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
lv_obj_set_parent(wp, ((lv_tabview_ext_t *) tv->ext_attr)->content);
#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");
tab1 = lv_tabview_add_tab(tv, "Write");
tab2 = lv_tabview_add_tab(tv, "List");
tab3 = lv_tabview_add_tab(tv, "Chart");
#if CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER == 0
#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);
@ -483,3 +640,5 @@ void demo_init(void)
lv_task_create(tab_switcher, 3000, LV_TASK_PRIO_MID, tv);
#endif
}
#endif /* CONFIG_EXAMPLES_LVGLDEMO_SIMPLE */

@ -1,54 +1,89 @@
/****************************************************************************
* apps/examples/lvgldemo/demo.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2019 Gábor Kiss-Vámosi. All rights reserved.
* Author: Gábor Kiss-Vámosi <kisvegabor@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* Released under the following BSD-compatible MIT license:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
* 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:
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* 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
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
void demo_init(void);
/****************************************************************************
* 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
} /* extern "C" */
}
#endif
#endif /*__APPS_EXAMPLES_LVGLDEMO_DEMO_H */
#endif /* CONFIG_EXAMPLES_LVGLDEMO_SIMPLE */
#endif /* __APPS_EXAMPLES_LVGLDEMO_DEMO_H */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,504 @@
/****************************************************************************
* 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(FAR lv_obj_t *parent)
{
FAR lv_theme_t *th;
FAR lv_obj_t *h;
FAR lv_obj_t *btn;
FAR lv_obj_t *btn_label;
FAR lv_obj_t *label;
FAR lv_obj_t *btnm;
FAR lv_obj_t *table;
FAR lv_obj_t *sw_h;
FAR lv_obj_t *sw;
FAR lv_obj_t *bar;
FAR lv_obj_t *slider;
FAR lv_obj_t *line;
FAR lv_obj_t *cb;
FAR lv_obj_t *list_btn;
FAR lv_obj_t *list;
FAR lv_obj_t *roller;
static lv_style_t h_style;
static const char *btnm_str[] =
{
"1", "2", "3", SYMBOL_OK, SYMBOL_CLOSE, ""
};
static const lv_point_t line_p[] =
{
{ 0, 0 }, { LV_HOR_RES / 5, 0 }
};
lv_page_set_scrl_layout(parent, LV_LAYOUT_PRETTY);
th = lv_theme_get_current();
lv_style_copy(&h_style, &lv_style_transp);
h_style.body.padding.inner = LV_DPI / 4;
h_style.body.padding.hor = LV_DPI / 4;
h_style.body.padding.ver = LV_DPI / 6;
h = lv_cont_create(parent, NULL);
lv_obj_set_style(h, &h_style);
lv_obj_set_click(h, false);
lv_cont_set_fit(h, true, true);
lv_cont_set_layout(h, LV_LAYOUT_COL_M);
btn = lv_btn_create(h, NULL);
lv_btn_set_style(btn, LV_BTN_STYLE_REL, th->btn.rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, th->btn.pr);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_REL, th->btn.tgl_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_TGL_PR, th->btn.tgl_pr);
lv_btn_set_style(btn, LV_BTN_STYLE_INA, th->btn.ina);
lv_btn_set_fit(btn, true, true);
lv_btn_set_toggle(btn, true);
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");
label = lv_label_create(h, NULL);
lv_label_set_text(label, "Primary");
lv_obj_set_style(label, th->label.prim);
label = lv_label_create(h, NULL);
lv_label_set_text(label, "Secondary");
lv_obj_set_style(label, th->label.sec);
label = lv_label_create(h, NULL);
lv_label_set_text(label, "Hint");
lv_obj_set_style(label, th->label.hint);
btnm = lv_btnm_create(h, NULL);
lv_obj_set_size(btnm, LV_HOR_RES / 4, 2 * LV_DPI / 3);
lv_btnm_set_map(btnm, btnm_str);
lv_btnm_set_toggle(btnm, true, 3);
#if LVGL_VERSION_MAJOR == 5 && LVGL_VERSION_MINOR >= 3
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");
#endif
h = lv_cont_create(parent, h);
sw_h = lv_cont_create(h, NULL);
lv_cont_set_style(sw_h, &lv_style_transp);
lv_cont_set_fit(sw_h, false, true);
lv_obj_set_width(sw_h, LV_HOR_RES / 4);
lv_cont_set_layout(sw_h, LV_LAYOUT_PRETTY);
sw = lv_sw_create(sw_h, NULL);
#if LVGL_VERSION_MAJOR == 5 && LVGL_VERSION_MINOR >= 3
lv_sw_set_anim_time(sw, 250);
#endif
sw = lv_sw_create(sw_h, sw);
lv_sw_on(sw);
bar = lv_bar_create(h, NULL);
lv_bar_set_value(bar, 70);
slider = lv_slider_create(h, NULL);
lv_bar_set_value(slider, 70);
line = lv_line_create(h, NULL);
lv_line_set_points(line, line_p, 2);
lv_line_set_style(line, th->line.decor);
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_open(ddlist, false);
lv_ddlist_set_selected(ddlist, 1);
h = lv_cont_create(parent, h);
list = lv_list_create(h, NULL);
list_btn = lv_list_add(list, SYMBOL_GPS, "GPS", NULL);
lv_obj_set_size(list, LV_HOR_RES / 4, LV_VER_RES / 2);
lv_btn_set_toggle(list_btn, true);
lv_list_add(list, SYMBOL_WIFI, "WiFi", NULL);
lv_list_add(list, SYMBOL_GPS, "GPS", NULL);
lv_list_add(list, SYMBOL_AUDIO, "Audio", NULL);
lv_list_add(list, SYMBOL_VIDEO, "Video", NULL);
lv_list_add(list, SYMBOL_CALL, "Call", NULL);
lv_list_add(list, SYMBOL_BELL, "Bell", NULL);
lv_list_add(list, SYMBOL_FILE, "File", NULL);
lv_list_add(list, SYMBOL_EDIT, "Edit", NULL);
lv_list_add(list, SYMBOL_CUT, "Cut", NULL);
lv_list_add(list, SYMBOL_COPY, "Copy", NULL);
roller = lv_roller_create(h, NULL);
lv_roller_set_options(roller,
"Monday\n"
"Tuesday\n"
"Wednesday\n"
"Thursday\n"
"Friday\n"
"Saturday\n"
"Sunday");
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_obj_t *chart;
lv_chart_series_t *s1;
lv_obj_t *gauge;
lv_obj_t *arc;
lv_obj_t *ta;
lv_obj_t *kb;
#if USE_LV_ANIMATION
lv_obj_t *loader;
#endif
w = lv_page_get_scrl_width(parent);
chart = lv_chart_create(parent, NULL);
lv_obj_set_size(chart, w / 3, LV_VER_RES / 3);
lv_obj_set_pos(chart, LV_DPI / 10, LV_DPI / 10);
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);
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);
arc = lv_arc_create(parent, NULL);
lv_obj_align(arc, gauge, LV_ALIGN_OUT_BOTTOM_MID, 0, LV_DPI / 8);
ta = lv_ta_create(parent, NULL);
lv_obj_set_size(ta, w / 3, LV_VER_RES / 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);
kb = lv_kb_create(parent, NULL);
lv_obj_set_size(kb, 2 * w / 3, LV_VER_RES / 3);
lv_obj_align(kb, ta, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, LV_DPI);
lv_kb_set_ta(kb, ta);
#if USE_LV_ANIMATION
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)
{
FAR lv_obj_t *win;
FAR lv_obj_t *label;
FAR lv_obj_t *lmeter;
FAR lv_obj_t *led1;
FAR lv_obj_t *led2;
FAR lv_obj_t *page;
FAR lv_obj_t *cal;
FAR lv_obj_t *mbox;
static lv_calendar_date_t highlighted_days[2];
static const char *mbox_btn_map[] =
{
"\211", "\222Got it!", "\211", ""
};
/* Create a Window */
win = lv_win_create(parent, NULL);
lv_win_add_btn(win, SYMBOL_CLOSE, lv_win_close_action);
lv_win_add_btn(win, SYMBOL_DOWN, NULL);
lv_obj_set_size(win, LV_HOR_RES / 2, LV_VER_RES / 2);
lv_obj_set_pos(win, LV_DPI / 20, LV_DPI / 20);
lv_obj_set_top(win, true);
/* Create a Label in the Window */
label = lv_label_create(win, NULL);
lv_label_set_text(label, "Label in the window");
/* Create a Line meter in the Window */
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 2 LEDs in the Window */
led1 = lv_led_create(win, NULL);
lv_obj_align(led1, lmeter, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
lv_led_on(led1);
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 */
page = lv_page_create(parent, NULL);
lv_obj_set_size(page, LV_HOR_RES / 3, LV_VER_RES / 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.");
lv_page_set_scrl_fit(page, true, true);
/* Create a Calendar */
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);
highlighted_days[0].day = 5;
highlighted_days[0].month = 5;
highlighted_days[0].year = 2019;
highlighted_days[1].day = 8;
highlighted_days[1].month = 5;
highlighted_days[1].year = 2019;
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 */
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, NULL);
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)
{
FAR lv_obj_t *scr;
FAR lv_obj_t *tv;
FAR lv_obj_t *tab1;
FAR lv_obj_t *tab2;
FAR lv_obj_t *tab3;
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();
scr = lv_cont_create(NULL, NULL);
lv_scr_load(scr);
lv_cont_set_style(scr, th->bg);
tv = lv_tabview_create(scr, NULL);
lv_obj_set_size(tv, LV_HOR_RES, LV_VER_RES);
tab1 = lv_tabview_add_tab(tv, "Tab 1");
tab2 = lv_tabview_add_tab(tv, "Tab 2");
tab3 = lv_tabview_add_tab(tv, "Tab 3");
create_tab1(tab1);
create_tab2(tab2);
create_tab3(tab3);
}
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_1 */

@ -0,0 +1,89 @@
/****************************************************************************
* 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 */

@ -0,0 +1,558 @@
/****************************************************************************
* 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"
#include "lv_misc/lv_math.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 lv_res_t theme_select_action(lv_obj_t *roller);
static lv_res_t hue_select_action(lv_obj_t *roller);
static void init_all_themes(uint16_t hue);
/****************************************************************************
* 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 USE_LV_THEME_NIGHT
"Night"
#endif
#if USE_LV_THEME_MATERIAL
"\nMaterial"
#endif
#if USE_LV_THEME_ALIEN
"\nAlien"
#endif
#if USE_LV_THEME_ZEN
"\nZen"
#endif
#if USE_LV_THEME_NEMO
"\nNemo"
#endif
#if USE_LV_THEME_MONO
"\nMono"
#endif
#if USE_LV_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)
{
lv_obj_t *sym;
lv_obj_t *clock;
/* Create the global header object */
header = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_width(header, LV_HOR_RES);
/* Add a few symbols */
sym = lv_label_create(header, NULL);
lv_label_set_text(sym,
SYMBOL_GPS " "
SYMBOL_WIFI " "
SYMBOL_BLUETOOTH " "
SYMBOL_VOLUME_MAX);
lv_obj_align(sym, NULL, LV_ALIGN_IN_RIGHT_MID, -LV_DPI / 10, 0);
/* Create a fake clock */
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);
/* Let the height set automatically */
lv_cont_set_fit(header, false, true);
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_obj_t *th_label;
lv_obj_t *th_roller;
lv_obj_t *hue_label;
lv_obj_t *hue_roller;
sb = lv_page_create(lv_scr_act(), 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);
th_label = lv_label_create(sb, NULL);
lv_label_set_text(th_label, "Theme");
th_roller = lv_roller_create(sb, NULL);
lv_roller_set_options(th_roller, th_options);
lv_roller_set_action(th_roller, theme_select_action);
hue_label = lv_label_create(sb, NULL);
lv_label_set_text(hue_label, "\nColor");
hue_roller = lv_roller_create(sb, NULL);
lv_roller_set_options(hue_roller,
"0\n30\n60\n90\n120\n150\n180\n210\n240\n270\n300\n330");
lv_roller_set_action(hue_roller, hue_select_action);
#if LV_HOR_RES > LV_VER_RES
lv_obj_set_height(sb, LV_VER_RES - lv_obj_get_height(header));
lv_cont_set_fit(sb, true, false);
lv_page_set_scrl_fit(sb, true, false);
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, LV_HOR_RES, LV_VER_RES / 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);
#endif
}
/****************************************************************************
* 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)
{
FAR lv_obj_t *btn;
FAR lv_obj_t *label;
FAR lv_obj_t *sw;
FAR lv_obj_t *bar;
FAR lv_obj_t *slider;
FAR lv_obj_t *lmeter;
FAR lv_obj_t *gauge;
FAR lv_obj_t *ta;
FAR lv_obj_t *ddlist;
FAR lv_obj_t *kb;
FAR lv_obj_t *mbox;
FAR lv_obj_t *roller;
lv_coord_t max_w;
lv_anim_t a;
static const char *nums = "One\nTwo\nThree\nFour";
static const char *days =
"Monday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday";
static const char *mbox_btns[] =
{
"Ok", ""
};
content = lv_page_create(lv_scr_act(), NULL);
#if LV_HOR_RES > LV_VER_RES
lv_obj_set_size(content, LV_HOR_RES - lv_obj_get_width(
sb), LV_VER_RES - 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, LV_HOR_RES, LV_VER_RES / 2);
lv_obj_set_pos(content, 0, LV_VER_RES / 2);
#endif
lv_page_set_scrl_layout(content, LV_LAYOUT_PRETTY);
max_w = lv_page_get_fit_width(content);
/* Button */
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);
label = lv_label_create(btn, NULL);
lv_label_set_text(label, "Button");
/* Switch */
sw = lv_sw_create(content, NULL);
#if USE_LV_ANIMATION
#if LVGL_VERSION_MAJOR == 5 && LVGL_VERSION_MINOR >= 3
lv_sw_set_anim_time(sw, 250);
#endif
#endif
/* Check box */
lv_cb_create(content, NULL);
/* Bar */
bar = lv_bar_create(content, NULL);
lv_obj_set_width(bar, LV_MATH_MIN(max_w, 3 * LV_DPI / 2));
#if USE_LV_ANIMATION
a.var = bar;
a.start = 0;
a.end = 100;
a.fp = (lv_anim_fp_t)lv_bar_set_value;
a.path = lv_anim_path_linear;
a.end_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 */
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);
/* Roller */
roller = lv_roller_create(content, NULL);
lv_roller_set_options(roller, days);
/* Drop down list */
ddlist = lv_ddlist_create(content, NULL);
lv_ddlist_set_options(ddlist, nums);
/* Line meter */
lmeter = lv_lmeter_create(content, NULL);
lv_obj_set_click(lmeter, false);
#if USE_LV_ANIMATION
a.var = lmeter;
a.start = 0;
a.end = 100;
a.fp = (lv_anim_fp_t)lv_lmeter_set_value;
a.path = lv_anim_path_linear;
a.end_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 */
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 */
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 */
kb = lv_kb_create(content, NULL);
lv_obj_set_width(kb, LV_MATH_MIN(max_w, LV_DPI * 3));
lv_kb_set_ta(kb, ta);
/* Message Box */
mbox = lv_mbox_create(lv_scr_act(), NULL);
lv_obj_set_drag(mbox, true);
lv_mbox_set_text(mbox, "Choose a theme and a color on the left!");
lv_mbox_add_btns(mbox, mbox_btns, NULL);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
}
/****************************************************************************
* Name: theme_select_action
*
* Description:
* Callback for the theme selection roller
*
* Input Parameters:
* roller - the roller object that triggered the action
*
* Returned Value:
* LV_RES_OK in all cases
*
* Assumptions/Limitations:
*
****************************************************************************/
static lv_res_t theme_select_action(lv_obj_t *roller)
{
uint16_t opt;
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 LV_HOR_RES > LV_VER_RES
lv_obj_set_size(content,
LV_HOR_RES - lv_obj_get_width(sb),
LV_VER_RES - 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, LV_HOR_RES, LV_VER_RES / 2);
lv_obj_set_pos(content, 0, LV_VER_RES / 2);
#endif
lv_page_focus(sb, roller, 200);
return LV_RES_OK;
}
/****************************************************************************
* Name: hue_select_action
*
* Description:
* Callback for the hue roller object upon selection change
*
* Input Parameters:
* roller - the roller object that triggered the action
*
* Returned Value:
* LV_RES_OK in all cases
*
* Assumptions/Limitations:
*
****************************************************************************/
static lv_res_t hue_select_action(lv_obj_t * roller)
{
uint16_t hue;
hue = lv_roller_get_selected(roller) * 30;
init_all_themes(hue);
lv_theme_set_current(th_act);
lv_page_focus(sb, roller, 200);
return LV_RES_OK;
}
/****************************************************************************
* 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;
#if USE_LV_THEME_NIGHT
themes[i++] = lv_theme_night_init(hue, NULL);
#endif
#if USE_LV_THEME_MATERIAL
themes[i++] = lv_theme_material_init(hue, NULL);
#endif
#if USE_LV_THEME_ALIEN
themes[i++] = lv_theme_alien_init(hue, NULL);
#endif
#if USE_LV_THEME_ZEN
themes[i++] = lv_theme_zen_init(hue, NULL);
#endif
#if USE_LV_THEME_NEMO
themes[i++] = lv_theme_nemo_init(hue, NULL);
#endif
#if USE_LV_THEME_MONO
themes[i++] = lv_theme_mono_init(hue, NULL);
#endif
#if USE_LV_THEME_DEFAULT
themes[i++] = lv_theme_default_init(hue, NULL);
#endif
}
/****************************************************************************
* 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)
{
lv_obj_t *scr;
/* 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);
scr = lv_obj_create(NULL, NULL);
lv_scr_load(scr);
header_create();
sb_create();
content_create();
}
#endif /* CONFIG_EXAMPLES_LVGLDEMO_THEME_2 */

@ -0,0 +1,81 @@
/****************************************************************************
* 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 */

@ -1,7 +1,7 @@
/****************************************************************************
* examples/lvgdemo/lvgldemo.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -50,8 +50,10 @@
#include "fbdev.h"
#include "tp.h"
#include "demo.h"
#include "tp_cal.h"
#include "demo.h"
#include "lv_test_theme_1.h"
#include "lv_test_theme_2.h"
/****************************************************************************
* Pre-processor Definitions
@ -81,6 +83,7 @@
* Name: tick_func
*
* Description:
* Calls lv_tick_inc(...) every 5ms.
*
* Input Parameters:
* data
@ -196,7 +199,39 @@ int lvgldemo_main(int argc, char *argv[])
/* Demo initialization */
demo_init();
#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 */

@ -104,7 +104,9 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
{
lv_indev_t *indev = lv_indev_get_act();
char buf[64];
#if USE_LV_ANIMATION
lv_anim_t a;
#endif
lv_indev_get_point(indev, &p[0]);
@ -119,6 +121,7 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
(LV_HOR_RES - lv_obj_get_width(label_main)) / 2,
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
#if USE_LV_ANIMATION
a.var = circ_area;
a.start = 0;
a.end = LV_HOR_RES - CIRCLE_SIZE;
@ -132,13 +135,15 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
a.repeat = 0;
a.repeat_pause = 0;
lv_anim_create(&a);
a.start = 0;
a.end = 0;
a.fp = (lv_anim_fp_t)lv_obj_set_y;
a.end_cb = NULL;
a.time = 200;
lv_anim_create(&a);
#else
lv_obj_set_pos(circ_area, LV_HOR_RES - CIRCLE_SIZE, 0);
#endif
state = TP_CAL_STATE_WAIT_TOP_RIGHT;
}
@ -146,7 +151,10 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
{
lv_indev_t *indev = lv_indev_get_act();
char buf[64];
#if USE_LV_ANIMATION
lv_anim_t a;
#endif
lv_indev_get_point(indev, &p[1]);
@ -162,7 +170,7 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
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);
#if USE_LV_ANIMATION
a.var = circ_area;
a.start = LV_HOR_RES - CIRCLE_SIZE;
a.end = LV_HOR_RES - CIRCLE_SIZE;
@ -183,6 +191,9 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
a.end_cb = NULL;
a.time = 200;
lv_anim_create(&a);
#else
lv_obj_set_pos(circ_area, LV_HOR_RES - CIRCLE_SIZE, LV_VER_RES - CIRCLE_SIZE);
#endif
state = TP_CAL_STATE_WAIT_BOTTOM_RIGHT;
}
@ -190,8 +201,9 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
{
lv_indev_t *indev = lv_indev_get_act();
char buf[64];
#if USE_LV_ANIMATION
lv_anim_t a;
#endif
lv_indev_get_point(indev, &p[2]);
sprintf(buf, "x: %d\ny: %d", p[2].x, p[2].y);
@ -207,6 +219,7 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
(LV_HOR_RES - lv_obj_get_width(label_main)) / 2,
(LV_VER_RES - lv_obj_get_height(label_main)) / 2);
#if USE_LV_ANIMATION
a.var = circ_area;
a.start = LV_HOR_RES - CIRCLE_SIZE;
a.end = 0;
@ -227,6 +240,9 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
a.end_cb = NULL;
a.time = 200;
lv_anim_create(&a);
#else
lv_obj_set_pos(circ_area, 0, LV_VER_RES - CIRCLE_SIZE);
#endif
state = TP_CAL_STATE_WAIT_BOTTOM_LEFT;
}
@ -289,7 +305,9 @@ static lv_res_t btn_click_action(FAR lv_obj_t *scr)
void tp_cal_create(void)
{
static lv_style_t style_circ;
#if USE_LV_ANIMATION
lv_anim_t a;
#endif
state = TP_CAL_STATE_INIT;
@ -324,6 +342,7 @@ void tp_cal_create(void)
lv_obj_set_style(circ_area, &style_circ);
lv_obj_set_click(circ_area, false);
#if USE_LV_ANIMATION
a.var = circ_area;
a.start = LV_HOR_RES / 2;
a.end = 0;
@ -344,6 +363,6 @@ void tp_cal_create(void)
a.end_cb = NULL;
a.time = 200;
lv_anim_create(&a);
#endif
state = TP_CAL_STATE_WAIT_TOP_LEFT;
}

@ -1,3 +1,3 @@
/lvgl
/*tar.gz
/*.zip

@ -69,6 +69,11 @@ config LV_VDB2_ADR
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
@ -127,6 +132,15 @@ config LV_COLOR_DEPTH
int "Color depth (8/16/24)"
default 16
config LV_COLOR_16_SWAP
bool "Swap the 2 bytes of RGB565 color"
depends on LV_COLOR_DEPTH = 16
default 0
config LV_COLOR_SCREEN_TRANSP
bool "Enable screen transparency."
default 0
config LV_COLOR_TRANSP
hex "Chroma key color (pixels with this color will be transparent on images)"
default 0x00ff00
@ -163,16 +177,57 @@ config USE_LV_GPU
default y
config USE_LV_REAL_DRAW
bool "Enable function which draw directly to the frame buffer instead of VDB"
bool "Enable function which draws directly to the frame buffer instead of VDB"
default y
config USE_LV_FILESYSTEM
bool "Enable filesystem (required for images, lv_img)"
default y
config USE_LV_MULTI_LANG
int "Number of languages for labels to store (0 to disable)"
default 0
endmenu
menu "Log usage"
config USE_LV_LOG
bool "Enable/disable the log module"
default n
choice
prompt "Log level"
depends on USE_LV_LOG
default LV_LOG_LEVEL_WARN
config LV_LOG_LEVEL_TRACE
bool "Trace"
config LV_LOG_LEVEL_INFO
bool "Info"
config LV_LOG_LEVEL_WARN
bool "Warn"
config LV_LOG_LEVEL_ERROR
bool "Error"
endchoice
config LV_LOG_PRINTF
bool "Use printf() for logging"
depends on USE_LV_LOG
default y
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 USE_LV_THEME_TEMPL
bool "Use Template theme: just for test"
default n
@ -194,11 +249,15 @@ config USE_LV_THEME_MONO
default n
config USE_LV_THEME_MATERIAL
bool "Use Mono theme: material theme with bold colors"
bool "Use Material theme: material theme with bold colors"
default n
config USE_LV_THEME_ZEN
bool "Use Mono theme: light, peaceful theme"
bool "Use Zen theme: light, peaceful theme"
default n
config USE_LV_THEME_NEMO
bool "Use Nemo theme: Water-like theme based on the movie 'Finding Nemo'"
default n
endmenu
@ -372,6 +431,43 @@ config USE_LV_FONT_SYMBOL_40
2: 2 bit-per-pixel
4: 4 bit-per-pixel
8: 8 bit-per-pixel
config USE_LV_FONT_MONOSPACE_8
int "Monospace 8 px"
default 0
---help---
0: disable
1: 1 bit-per-pixel
2: 2 bit-per-pixel
4: 4 bit-per-pixel
8: 8 bit-per-pixel
choice
prompt "Default Font"
default LV_FONT_DEFAULT_DEJAVU_20
config LV_FONT_DEFAULT_DEJAVU_10
bool "Dejavu 10 px"
depends on USE_LV_FONT_DEJAVU_10 != 0
config LV_FONT_DEFAULT_DEJAVU_20
bool "Dejavu 20 px"
depends on USE_LV_FONT_DEJAVU_20 != 0
config LV_FONT_DEFAULT_DEJAVU_30
bool "Dejavu 30 px"
depends on USE_LV_FONT_DEJAVU_30 != 0
config LV_FONT_DEFAULT_DEJAVU_40
bool "Dejavu 40 px"
depends on USE_LV_FONT_DEJAVU_40 != 0
config LV_FONT_DEFAULT_MONOSPACE_8
bool "Monospace 8 px"
depends on USE_LV_FONT_MONOSPACE_8 != 0
endchoice
endmenu
menu "Base object settings"
@ -380,6 +476,10 @@ config LV_OBJ_FREE_PTR
bool "Free pointer enable/disable"
default y
config LV_OBJ_REALIGN
bool "Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters"
default y
endmenu
menu "Object type usage settings"
@ -388,88 +488,210 @@ config USE_LV_LABEL
bool "Label usage"
default y
config LV_LABEL_SCROLL_SPEED
int "Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_SCROLL/ROLL' mode"
depends on USE_LV_LABEL
default 25
config USE_LV_IMG
bool "Image usage"
default y
config LV_IMG_CF_INDEXED
bool "Enable indexed (palette) images"
depends on USE_LV_IMG
default y
config LV_IMG_CF_ALPHA
bool "Enable alpha indexed images"
depends on USE_LV_IMG
default y
config USE_LV_LINE
bool "Line usage"
default y
config USE_LV_ARC
bool "Arc usage"
default y
config USE_LV_CONT
bool "Container usage"
default y
config USE_LV_PAGE
depends on USE_LV_CONT
bool "Page usage"
default y
config USE_LV_WIN
depends on USE_LV_PAGE && USE_LV_LABEL && USE_LV_IMG && USE_LV_BTN
bool "Window usage"
default y
config USE_LV_TABVIEW
depends on USE_LV_PAGE && USE_LV_BTNM
bool "Tabview usage"
default y
config LV_TABVIEW_ANIM_TIME
int "Time of slide animation [ms] (0: no animation)"
depends on USE_LV_TABVIEW
default 300
config USE_LV_TILEVIEW
depends on USE_LV_CONT && USE_LV_PAGE
bool "Tileview usage"
default y
config LV_TILEVIEW_ANIM_TIME
int "Time of slide animation [ms] (0: no animation)"
depends on USE_LV_TILEVIEW
default 300
config USE_LV_BAR
bool "Bar usage"
default y
config USE_LV_LMETER
depends on USE_LV_BAR
bool "Line meter usage"
default y
config USE_LV_GAUGE
depends on USE_LV_BAR && USE_LV_LMETER
bool "Gauge usage"
default y
config USE_LV_CHART
bool "Chart usage"
default y
config USE_LV_TABLE
bool "Table usage"
depends on USE_LV_LABEL
default y
config LV_TABLE_COL_MAX
int "Maximum number of table columns"
depends on USE_LV_TABLE
default 12
config USE_LV_LED
bool "LED usage"
default y
config USE_LV_MBOX
bool "Messagebox usage"
depends on USE_LV_BTNM && USE_LV_LABEL
default y
config USE_LV_TA
bool "Text area usage"
depends on USE_LV_LABEL && USE_LV_PAGE
default y
config USE_LV_SPINBOX
bool "Spinbox usage"
depends on USE_LV_TA
default y
config USE_LV_CALENDAR
bool "Calendar usage"
default y
config USE_LV_PRELOAD
bool "Preload usage"
depends on USE_LV_ARC
default y
config LV_PRELOAD_DEF_ARC_LENGTH
int "Degrees of arc length (default)"
range 0 360
depends on USE_LV_PRELOAD
default 60
config LV_PRELOAD_DEF_SPIN_TIME
int "Time (ms) preload spins (default)"
depends on USE_LV_PRELOAD
default 1000
choice
prompt "Default preload animation"
depends on USE_LV_PRELOAD
default LV_PRELOAD_DEF_ANIM_SPINNING_ARC
config LV_PRELOAD_DEF_ANIM_SPINNING_ARC
bool "Spinning Arc"
config LV_PRELOAD_DEF_ANIM_FILLSPIN_ARC
bool "Fillspin Arc"
endchoice
config USE_LV_CANVAS
bool "Canvas usage"
depends on USE_LV_IMG
default n
config USE_LV_BTN
bool "Button usage"
depends on USE_LV_CONT
default y
config LV_BTN_INK_EFFECT
bool "Enable button-state animations"
depends on USE_LV_BTN && USE_LV_ANIMATION
default y
config USE_LV_IMGBTN
depends on USE_LV_BTN
bool "Image button usage"
default y
config LV_IMGBTN_TILED
bool "Tiled image button"
depends on USE_LV_IMGBTN
---help---
The imgbtn requires left, mid and right parts and the width can be set freely
config USE_LV_BTNM
bool "Button matrix usage"
default y
config USE_LV_KB
bool "Keyboard"
depends on USE_LV_BTNM
default y
config USE_LV_CB
bool "Chekbox usage"
depends on USE_LV_BTN
default y
config USE_LV_SW
bool "Switch usage"
depends on USE_LV_BTN
default y
config USE_LV_LIST
bool "List usage"
depends on USE_LV_BTN && USE_LV_PAGE
default y
config USE_LV_DDLIST
bool "Drop down list usage"
depends on USE_LV_PAGE && USE_LV_LABEL
default y
config USE_LV_ROLLER
bool "Roller usage"
depends on USE_LV_DDLIST
default y
config USE_LV_SLIDER
bool "Slider usage"
depends on USE_LV_BAR
default y
endmenu

@ -41,12 +41,14 @@ ASRCS =
CSRCS =
VPATH =
LVGL_DIR = .
# LVGL Libraries
-include ./lvgl/lv_core/lv_core.mk
-include ./lvgl/lv_hal/lv_hal.mk
-include ./lvgl/lv_objx/lv_objx.mk
-include ./lvgl/lv_misc/lv_fonts/lv_fonts.mk
-include ./lvgl/lv_fonts/lv_fonts.mk
-include ./lvgl/lv_misc/lv_misc.mk
-include ./lvgl/lv_themes/lv_themes.mk
-include ./lvgl/lv_draw/lv_draw.mk
@ -57,12 +59,15 @@ WD := ${shell pwd | sed -e 's/ /\\ /g'}
CONFIG_GRAPH_LVGL_URL ?= "https://littlevgl.com/download/"
LVGL_VERSION ?= v5_1_1
LVGL_TARBALL = lvgl_$(LVGL_VERSION).tar.gz
LVGL_VERSION ?= v5_3
LVGL_TARBALL = lvgl_$(LVGL_VERSION).zip
WGET ?= wget
LVGL_UNPACKNAME = lvgl
UNPACK ?= tar -zxf
UNPACK ?= unzip -o
PATCH_FILES = lv_symbol_def.patch
PATCH ?= patch -p0
LVGL_UNPACKDIR = $(WD)/$(LVGL_UNPACKNAME)
@ -77,7 +82,11 @@ $(LVGL_UNPACKNAME): $(LVGL_TARBALL)
$(Q) $(UNPACK) $(LVGL_TARBALL)
$(Q) touch $(LVGL_UNPACKNAME)
$(APPDIR)/include/graphics/lvgl.h: $(LVGL_UNPACKNAME) lvgl/lvgl.h
$(LVGL_UNPACKNAME)/.patched: $(LVGL_UNPACKNAME) $(PATCH_FILES)
$(Q) cat $(PATCH_FILES) | $(PATCH)
$(Q) touch $(LVGL_UNPACKNAME)/.patched
$(APPDIR)/include/graphics/lvgl.h: $(LVGL_UNPACKNAME) $(LVGL_UNPACKNAME)/.patched lvgl/lvgl.h
@echo "CP: lvgl/lvgl.h"
$(Q) cp lvgl/lvgl.h $(APPDIR)/include/graphics/lvgl.h

@ -54,9 +54,12 @@
#define LV_MEM_CUSTOM 0
#define LV_MEM_SIZE CONFIG_LV_MEM_SIZE
#define LV_MEM_ADR 0
#define LV_MEM_AUTO_DEFRAG 1 /* Automatically defrag on free */
#define LV_MEM_ATTR
#define LV_ENABLE_GC 0
/* Graphical settings */
#define LV_DEMO_SLIDE_SHOW 0
@ -93,7 +96,13 @@
* (0: allocate into RAM)
*/
#define LV_VDB2_ADR CONFIG_VDB2_ADR
#define LV_VDB2_ADR CONFIG_LV_VDB2_ADR
#ifdef CONFIG_LV_VDB_TRUE_DOUBLE_BUFFERED
# define LV_VDB_TRUE_DOUBLE_BUFFERED CONFIG_LV_VDB_TRUE_DOUBLE_BUFFERED
#else
# define LV_VDB_TRUE_DOUBLE_BUFFERED 0
#endif
/* Enable anti aliasing
*/
@ -145,6 +154,19 @@
*/
#define LV_COLOR_DEPTH CONFIG_LV_COLOR_DEPTH
#ifdef CONFIG_LV_COLOR_16_SWAP
# define LV_COLOR_16_SWAP CONFIG_LV_COLOR_16_SWAP
#else
# define LV_COLOR_16_SWAP 0
#endif
#ifdef CONFIG_LV_COLOR_SCREEN_TRANSP
# define LV_COLOR_SCREEN_TRANSP CONFIG_LV_COLOR_SCREEN_TRANSP
#else
# define LV_COLOR_SCREEN_TRANSP 0
#endif
#define LV_COLOR_TRANSP LV_COLOR_HEX(CONFIG_LV_COLOR_TRANSP)
/* Text settings
@ -192,15 +214,55 @@
# define USE_LV_REAL_DRAW 0
#endif
#ifdef CONFIG_USE_LV_FILESYSTEM
# define USE_LV_FILESYSTEM CONFIG_USE_LV_FILESYSTEM
#else
# define USE_LV_FILESYSTEM 0
#endif
/* Number of languages for labels to store (0: to disable this feature) */
#ifdef CONFIG_USE_LV_MULTI_LANG
# define USE_LV_MULTI_LANG CONFIG_USE_LV_MULTI_LANG
#else
# define USE_LV_MULTI_LANG 0
#endif
/* 1: use a custom tick source (removing the need to manually update the
* tick with `lv_tick_inc`)
*/
#define LV_TICK_CUSTOM 0
/* LOG USAGE*/
#ifdef CONFIG_USE_LV_LOG
# define USE_LV_LOG CONFIG_USE_LV_LOG
# if defined(CONFIG_LV_LOG_LEVEL_TRACE)
# define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
# elif defined(CONFIG_LV_LOG_LEVEL_INFO)
# define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
# elif defined(CONFIG_LV_LOG_LEVEL_WARN)
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
# elif defined(CONFIG_LV_LOG_LEVEL_ERROR)
# define LV_LOG_LEVEL LV_LOG_LEVEL_ERROR
# else
# error "Unknown log level selected"
# endif
# define LV_LOG_PRINTF 1 /* TODO: find a NuttX way to do logging */
#else
# define USE_LV_LOG 0
# define LV_LOG_LEVEL 0
# define LV_LOG_PRINTF 0
#endif
/* THEME USAGE */
/* Just for test */
#ifdef CONFIG_LV_THEME_LIVE_UPDATE
# define LV_THEME_LIVE_UPDATE CONFIG_LV_THEME_LIVE_UPDATE
#else
# define LV_THEME_LIVE_UPDATE 0
#endif
#ifdef CONFIG_USE_LV_THEME_TEMPL
# define USE_LV_THEME_TEMPL CONFIG_USE_LV_THEME_TEMPL
@ -256,13 +318,18 @@
# define USE_LV_THEME_ZEN 0
#endif
/* Water-like theme based on the movie "Finding Nemo" */
#ifdef CONFIG_USE_LV_THEME_NEMO
# define USE_LV_THEME_NEMO CONFIG_USE_LV_THEME_NEMO
#else
# define USE_LV_THEME_NEMO 0
#endif
/* FONT USAGE */
#ifdef CONFIG_USE_LV_FONT_DEJAVU_10
# define USE_LV_FONT_DEJAVU_10 CONFIG_USE_LV_FONT_DEJAVU_10
# if USE_LV_FONT_DEJAVU_10
# define LV_FONT_DEFAULT &lv_font_dejavu_10
# endif
#else
# define USE_LV_FONT_DEJAVU_10 0
#endif
@ -289,9 +356,6 @@
#ifdef CONFIG_USE_LV_FONT_DEJAVU_20
# define USE_LV_FONT_DEJAVU_20 CONFIG_USE_LV_FONT_DEJAVU_20
# if USE_LV_FONT_DEJAVU_20
# define LV_FONT_DEFAULT &lv_font_dejavu_20
# endif
#else
# define USE_LV_FONT_DEJAVU_20 0
#endif
@ -318,11 +382,6 @@
#ifdef CONFIG_USE_LV_FONT_DEJAVU_30
# define USE_LV_FONT_DEJAVU_30 CONFIG_USE_LV_FONT_DEJAVU_30
# if USE_LV_FONT_DEJAVU_30
# ifndef LV_FONT_DEFAULT
# define LV_FONT_DEFAULT &lv_font_dejavu_30
# endif
# endif
#else
# define USE_LV_FONT_DEJAVU_30 0
#endif
@ -348,11 +407,6 @@
/*Size 40*/
#ifdef CONFIG_USE_LV_FONT_DEJAVU_40
# define USE_LV_FONT_DEJAVU_40 CONFIG_USE_LV_FONT_DEJAVU_40
# if USE_LV_FONT_DEJAVU_40
# ifndef LV_FONT_DEFAULT
# define LV_FONT_DEFAULT &lv_font_dejavu_40
# endif
# endif
#else
# define USE_LV_FONT_DEJAVU_40 0
#endif
@ -375,13 +429,33 @@
# define USE_LV_FONT_DEJAVU_40_CYRILLIC 0
#endif
#ifdef CONFIG_USE_LV_FONT_MONOSPACE_8
# define USE_LV_FONT_MONOSPACE_8 CONFIG_USE_LV_FONT_MONOSPACE_8
#else
# define USE_LV_FONT_MONOSPACE_8 0
#endif
#if defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_10)
# define LV_FONT_DEFAULT &lv_font_dejavu_10
#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_20)
# define LV_FONT_DEFAULT &lv_font_dejavu_20
#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_30)
# define LV_FONT_DEFAULT &lv_font_dejavu_30
#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_40)
# define LV_FONT_DEFAULT &lv_font_dejavu_40
#elif defined(CONFIG_LV_FONT_DEFAULT_MONOSPACE_8)
# define LV_FONT_DEFAULT &lv_font_monospace_8
#else
# error "At least one font must be defined and selected as the default font"
#endif
/* LV_OBJ SETTINGS
*
* LV_OBJ_FREE_NUM_TYPE - Type of free number attribute (comment out disable free number)
* LV_OBJ_FREE_PTR - Enable the free pointer attribut
* LV_OBJ_FREE_PTR - Enable the free pointer attribute
*/
#define LV_OBJ_FREE_NUM_TYPE int
#define LV_OBJ_FREE_NUM_TYPE uint32_t
#ifdef CONFIG_LV_OBJ_FREE_PTR
# define LV_OBJ_FREE_PTR CONFIG_LV_OBJ_FREE_PTR
@ -389,19 +463,24 @@
# define LV_OBJ_FREE_PTR 0
#endif
#ifdef CONFIG_LV_OBJ_REALIGN
# define LV_OBJ_REALIGN CONFIG_LV_OBJ_REALIGN
#else
# define LV_OBJ_REALIGN 0
#endif
/* LV OBJ X USAGE */
/* Simple object */
#ifdef CONFIG_USE_LV_LABEL
# define USE_LV_LABEL CONFIG_USE_LV_LABEL
#else
# define USE_LV_LABEL 0
#endif
/* Label (dependencies: - */
#ifdef CONFIG_USE_LV_LABEL
# define USE_LV_LABEL CONFIG_USE_LV_LABEL
# ifdef CONFIG_LV_LABEL_SCROLL_SPEED
# define LV_LABEL_SCROLL_SPEED CONFIG_LV_LABEL_SCROLL_SPEED
# else
# define LV_LABEL_SCROLL_SPEED 25
# endif
#else
# define USE_LV_LABEL 0
#endif
@ -416,6 +495,18 @@
# define USE_LV_IMG 0
#endif
#ifdef CONFIG_LV_IMG_CF_INDEXED
# define LV_IMG_CF_INDEXED CONFIG_LV_IMG_CF_INDEXED
#else
# define LV_IMG_CF_INDEXED 0
#endif
#ifdef CONFIG_LV_IMG_CF_ALPHA
# define LV_IMG_CF_ALPHA CONFIG_LV_IMG_CF_ALPHA
#else
# define LV_IMG_CF_ALPHA 0
#endif
/* Line (dependencies: - */
#ifdef CONFIG_USE_LV_LINE
@ -424,6 +515,12 @@
# define USE_LV_LINE 0
#endif
#ifdef CONFIG_USE_LV_ARC
# define USE_LV_ARC CONFIG_USE_LV_ARC
#else
# define USE_LV_ARC 0
#endif
/* Container objects */
/* Container (dependencies: - */
@ -453,8 +550,27 @@
#ifdef CONFIG_USE_LV_TABVIEW
# define USE_LV_TABVIEW CONFIG_USE_LV_TABVIEW
# ifdef CONFIG_LV_TABVIEW_ANIM_TIME
# define LV_TABVIEW_ANIM_TIME CONFIG_LV_TABVIEW_ANIM_TIME
# else
# define LV_TABVIEW_ANIM_TIME 0
# endif
#else
# define USE_LV_TABVIEW 0
#
#endif
/* Titleview (dependencies: lv_page) */
#ifdef CONFIG_USE_LV_TILEVIEW
# define USE_LV_TILEVIEW CONFIG_USE_LV_TILEVIEW
# ifdef CONFIG_LV_TILEVIEW_ANIM_TIME
# define LV_TILEVIEW_ANIM_TIME CONFIG_LV_TILEVIEW_ANIM_TIME
# else
# define LV_TILEVIEW_ANIM_TIME 0
# endif
#else
# define USE_LV_TILEVIEW 0
#endif
/* Data visualizer objects */
@ -490,6 +606,19 @@
# define USE_LV_CHART 0
#endif
/* Table (dependencies: lv_label) */
#ifdef CONFIG_USE_LV_TABLE
# define USE_LV_TABLE CONFIG_USE_LV_TABLE
# if defined(CONFIG_LV_TABLE_COL_MAX) && CONFIG_LV_TABLE_COL_MAX > 0
# define LV_TABLE_COL_MAX CONFIG_LV_TABLE_COL_MAX
# else
# error "LV_TABLE_COL_MAX must be greater than 0"
# endif
#else
# define USE_LV_TABLE 0
#endif
/* LED (dependencies: -) */
#ifdef CONFIG_USE_LV_LED
@ -514,7 +643,47 @@
# define USE_LV_TA 0
#endif
/* Spinbox (dependencies: lv_ta) */
#ifdef CONFIG_USE_LV_SPINBOX
# define USE_LV_SPINBOX CONFIG_USE_LV_SPINBOX
#else
# define USE_LV_SPINBOX 0
#endif
/* Calendar (dependencies: -) */
#ifdef CONFIG_USE_LV_CALENDAR
# define USE_LV_CALENDAR CONFIG_USE_LV_CALENDAR
#else
# define USE_LV_CALENDAR 0
#endif
/* Preload (dependencies: lv_arc) */
#ifdef CONFIG_USE_LV_PRELOAD
# define USE_LV_PRELOAD CONFIG_USE_LV_PRELOAD
# define LV_PRELOAD_DEF_ARC_LENGTH CONFIG_LV_PRELOAD_DEF_ARC_LENGTH
# define LV_PRELOAD_DEF_SPIN_TIME CONFIG_LV_PRELOAD_DEF_SPIN_TIME
# ifdef CONFIG_LV_PRELOAD_DEF_ANIM_SPINNING_ARC
# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
# elif CONFIG_LV_PRELOAD-DEF_ANIM_FILLSPIN_ARC
# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_FILLSPIN_ARC
# endif
#else
# define USE_LV_PRELOAD 0
#endif
/*Canvas (dependencies: lv_img)*/
#ifdef CONFIG_USE_LV_CANVAS
# define USE_LV_CANVAS CONFIG_USE_LV_CANVAS
#else
# define USE_LV_CANVAS 0
#endif
/* User input objects */
/* Button (dependencies: lv_cont */
#ifdef CONFIG_USE_LV_BTN
@ -523,8 +692,28 @@
# define USE_LV_BTN 0
#endif
/* Button matrix (dependencies: -) */
/* Enable button-state animations - draw a circle on click (dependencies: USE_LV_ANIMATION) */
#ifdef CONFIG_LV_BTN_INK_EFFECT
# define LV_BTN_INK_EFFECT CONFIG_LV_BTN_INK_EFFECT
#else
# define LV_BTN_INK_EFFECT 0
#endif
/* Image Button (dependencies: lv_btn */
#ifdef CONFIG_USE_LV_IMGBTN
# define USE_LV_IMGBTN CONFIG_USE_LV_IMGBTN
# ifdef CONFIG_LV_IMGBTN_TILED
# define LV_IMGBTN_TILED CONFIG_LV_IMGBTN_TILED
# else
# define LV_IMGBTN_TILED 0
# endif
#else
# define CONFIG)USE_LV_IMGBTN 0
#endif
/* Button matrix (dependencies: -) */
#ifdef CONFIG_USE_LV_BTNM
# define USE_LV_BTNM CONFIG_USE_LV_BTNM
#else
@ -587,6 +776,6 @@
# define USE_LV_SLIDER CONFIG_USE_LV_SLIDER
#else
# define USE_LV_SLIDER 0
#endif
#endif
#endif /*__APPS_GRAPHICS_LITTLEVGL_LV_CONF_H*/

@ -0,0 +1,12 @@
diff -Naur lvgl/lv_misc/lv_symbol_def.h lvgl.fix/lv_misc/lv_symbol_def.h
--- lvgl/lv_misc/lv_symbol_def.h 2019-01-31 20:08:33.000000000 -0800
+++ lvgl.fix/lv_misc/lv_symbol_def.h 2019-03-17 17:43:52.780724618 -0700
@@ -73,7 +73,7 @@
#define SYMBOL_BATTERY_EMPTY _SYMBOL_VALUE1(F0)
#define SYMBOL_BLUETOOTH _SYMBOL_VALUE1(F1)
#define LV_SYMBOL_GLYPH_LAST 0xF1
-#define SYMBOL_DUMMY _SYMBOL_VALUE1(xFF) /*Invalid symbol. If written before a string then `lv_img` will show it as a label*/
+#define SYMBOL_DUMMY _SYMBOL_VALUE1(FF) /*Invalid symbol. If written before a string then `lv_img` will show it as a label*/
#else
#define LV_SYMBOL_GLYPH_FIRST 0xF800