Squashed commit of the following:
apps/examples/lvgldemo: Fix up some include paths apps/examples/lvgldemo: The last final now conforms to the NuttX coding style. apps/graphics/littlevgl: Two more files are closer to the NuttX coding style. apps/graphics/littlevgl: Two more files are closer to the NuttX coding style. apps/examples/lvgldemo: Three more files are closer to the NuttX coding style. apps/examples/lvgldemo: Two more files are closer to the NuttX coding style. apps/examples/lvgldemo: Two more files are closer to the NuttX coding style. Add include/graphics/.gitignore apps/include/graphics: Remove lvgl.h. graphics/littlevgl/Makefile now copies the file into position. apps/graphics/littlevgl: Add .gitignore file apps/graphics/littlevgl: Most of these files follow the coding style now. apps/graphics/littlevgl: This gets a couple of files closer to the NuttX coding style. apps/examples/lvgldemo: Add lvgldemo example apps/graphics/littlevgl: Add littlevgl library
This commit is contained in:
parent
da4472a978
commit
f2028411bf
48
examples/lvgldemo/Kconfig
Normal file
48
examples/lvgldemo/Kconfig
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
menuconfig EXAMPLES_LVGLDEMO
|
||||
bool "Littlev Graphics Library Demo"
|
||||
default n
|
||||
---help---
|
||||
Enable build the Littlev Graphics Library Demo programs
|
||||
|
||||
if EXAMPLES_LVGLDEMO
|
||||
|
||||
config EXAMPLES_LVGLDEMO_WALLPAPER
|
||||
bool "Use wallpaper"
|
||||
default y
|
||||
|
||||
config EXAMPLES_LVGLDEMO_PRIORITY
|
||||
int "lvgl task priority"
|
||||
default 100
|
||||
|
||||
config EXAMPLES_LVGLDEMO_STACKSIZE
|
||||
int "lvgldemo stack size"
|
||||
default 16384
|
||||
|
||||
config EXAMPLES_LGVLDEMO_MINOR
|
||||
int "Touchscreen minor device number"
|
||||
default 0
|
||||
---help---
|
||||
The minor device number. Minor=N corresponds to touchscreen device
|
||||
/dev/inputN. Note this value must with EXAMPLES_LGVLDEMO_DEVPATH.
|
||||
Default 0.
|
||||
|
||||
config EXAMPLES_LGVLDEMO_DEVPATH
|
||||
string "Touchscreen device path"
|
||||
default "/dev/input0"
|
||||
---help---
|
||||
The path to the touchscreen device. This must be consistent with
|
||||
EXAMPLES_LGVLDEMO_MINOR. Default: "/dev/input0"
|
||||
|
||||
config EXAMPLES_LGVLDEMO_MOUSE
|
||||
bool "Mouse interface"
|
||||
default n
|
||||
---help---
|
||||
The LittleVGL demo can also be configured to work with a mouse
|
||||
driver by setting this option.
|
||||
|
||||
endif
|
39
examples/lvgldemo/Make.defs
Normal file
39
examples/lvgldemo/Make.defs
Normal file
@ -0,0 +1,39 @@
|
||||
############################################################################
|
||||
# apps/examples/lvgdemo/Make.defs
|
||||
# Adds selected applications to apps/ build
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_LVGLDEMO),y)
|
||||
CONFIGURED_APPS += examples/lvgldemo
|
||||
endif
|
60
examples/lvgldemo/Makefile
Normal file
60
examples/lvgldemo/Makefile
Normal file
@ -0,0 +1,60 @@
|
||||
############################################################################
|
||||
# apps/examples/lgvldemo/Makefile
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
# LittleVGL demo built-in application info
|
||||
|
||||
CONFIG_EXAMPLES_LVGLDEMO_PRIORITY ?= SCHED_PRIORITY_DEFAULT
|
||||
CONFIG_EXAMPLES_LVGLDEMO_STACKSIZE ?= 32768
|
||||
|
||||
APPNAME = lvgldemo
|
||||
PRIORITY = $(CONFIG_EXAMPLES_LVGLDEMO_PRIORITY)
|
||||
STACKSIZE = $(CONFIG_EXAMPLES_LVGLDEMO_STACKSIZE)
|
||||
|
||||
# LittleVGL demo Example
|
||||
|
||||
ASRCS =
|
||||
CSRCS += fbdev.c demo.c img_bubble_pattern.c tp.c tp_cal.c
|
||||
MAINSRC = lvgldemo.c
|
||||
|
||||
CONFIG_EXAMPLES_LVGLDEMO_PROGNAME ?= lvgldemo$(EXEEXT)
|
||||
PROGNAME = $(CONFIG_EXAMPLES_LVGLDEMO_PROGNAME)
|
||||
|
||||
LVGLDIR=$(APPDIR)/graphics/littlevgl/lvgl
|
||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(LVGLDIR)"}
|
||||
CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" "$(LVGLDIR)"}
|
||||
|
||||
include $(APPDIR)/Application.mk
|
409
examples/lvgldemo/demo.c
Normal file
409
examples/lvgldemo/demo.c
Normal file
@ -0,0 +1,409 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/demo.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void write_create(lv_obj_t *parent);
|
||||
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);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static lv_obj_t *chart;
|
||||
static lv_obj_t *ta;
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
|
||||
LV_IMG_DECLARE(img_bubble_pattern);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: write_create
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void write_create(lv_obj_t *parent)
|
||||
{
|
||||
static lv_style_t style_ta;
|
||||
static lv_style_t style_kb;
|
||||
static lv_style_t style_kb_rel;
|
||||
static lv_style_t style_kb_pr;
|
||||
|
||||
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_WHITE;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
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_t *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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: list_create
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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", ""};
|
||||
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
|
||||
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_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_obj_t *mbox= lv_mbox_create(parent, NULL);
|
||||
lv_obj_set_width(mbox, LV_HOR_RES - LV_DPI / 2);
|
||||
lv_mbox_set_text(mbox, "Click a button to copy its text to the Text area ");
|
||||
|
||||
/* 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: chart_create
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* parent
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void chart_create(lv_obj_t *parent)
|
||||
{
|
||||
static lv_style_t style_chart;
|
||||
static lv_style_t style_bar;
|
||||
static lv_style_t style_indic;
|
||||
static lv_style_t style_knob;
|
||||
|
||||
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;
|
||||
|
||||
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, &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);
|
||||
|
||||
/* 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 / 6;
|
||||
|
||||
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.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;
|
||||
|
||||
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(parent) / 2, LV_DPI / 2);
|
||||
|
||||
/* Align below the slider */
|
||||
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, - LV_DPI / 4);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: slider_action
|
||||
*
|
||||
* Description:
|
||||
* alled when a new value on the slider on the Chart tab is set
|
||||
*
|
||||
* Input Parameters:
|
||||
* slider - Pointer to the slider
|
||||
*
|
||||
* Returned Value:
|
||||
* LV_RES_OK because the slider is not deleted in the function
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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;
|
||||
lv_chart_set_range(chart, 0, v);
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: list_btn_action
|
||||
*
|
||||
* Description:
|
||||
* Called when a a list button is clicked on the List tab
|
||||
*
|
||||
* Input Parameters:
|
||||
* btn - Pointer to a list button
|
||||
*
|
||||
* Returned Value:
|
||||
* LV_RES_OK because the button is not deleted in the function
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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));
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: demo_init
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void demo_init(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;
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
|
||||
lv_img_create_file("bg", img_bubble_pattern);
|
||||
lv_obj_t *wp = lv_img_create(lv_scr_act(), NULL);
|
||||
lv_img_set_upscale(wp, true);
|
||||
lv_img_set_file(wp, "U:/bg");
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
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_scr_act(), NULL);
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LVGLDEMO_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_page_set_style(tab1, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
|
||||
lv_obj_t *tab2 = lv_tabview_add_tab(tv, "List");
|
||||
lv_obj_t *tab3 = lv_tabview_add_tab(tv, "Chart");
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_LVGLDEMO_WALLPAPER
|
||||
/* 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);
|
||||
}
|
54
examples/lvgldemo/demo.h
Normal file
54
examples/lvgldemo/demo.h
Normal file
@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/demo.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_DEMO_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_DEMO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void demo_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*__APPS_EXAMPLES_LVGLDEMO_DEMO_H */
|
573
examples/lvgldemo/fbdev.c
Normal file
573
examples/lvgldemo/fbdev.c
Normal file
@ -0,0 +1,573 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/fbdev.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "fbdev.h"
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
#include <nuttx/video/rgbcolors.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef FBDEV_PATH
|
||||
# define FBDEV_PATH "/dev/fb0"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct fb_state_s
|
||||
{
|
||||
int fd;
|
||||
struct fb_videoinfo_s vinfo;
|
||||
struct fb_planeinfo_s pinfo;
|
||||
FAR void *fbmem;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
struct fb_state_s state;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fbdev_init
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int fbdev_init(void)
|
||||
{
|
||||
FAR const char *fbdev = "/dev/fb0";
|
||||
int ret;
|
||||
|
||||
/* Open the framebuffer driver */
|
||||
|
||||
state.fd = open(fbdev, O_RDWR);
|
||||
if (state.fd < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
fprintf(stderr, "ERROR: Failed to open %s: %d\n", fbdev, errcode);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* Get the characteristics of the framebuffer */
|
||||
|
||||
ret = ioctl(state.fd, FBIOGET_VIDEOINFO,
|
||||
(unsigned long)((uintptr_t)&state.vinfo));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
|
||||
fprintf(stderr, "ERROR: ioctl(FBIOGET_VIDEOINFO) failed: %d\n",
|
||||
errcode);
|
||||
close(state.fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("VideoInfo:\n");
|
||||
printf(" fmt: %u\n", state.vinfo.fmt);
|
||||
printf(" xres: %u\n", state.vinfo.xres);
|
||||
printf(" yres: %u\n", state.vinfo.yres);
|
||||
printf(" nplanes: %u\n", state.vinfo.nplanes);
|
||||
|
||||
ret = ioctl(state.fd, FBIOGET_PLANEINFO,
|
||||
(unsigned long)((uintptr_t)&state.pinfo));
|
||||
if (ret < 0)
|
||||
{
|
||||
int errcode = errno;
|
||||
fprintf(stderr, "ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n",
|
||||
errcode);
|
||||
close(state.fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("PlaneInfo (plane 0):\n");
|
||||
printf(" fbmem: %p\n", state.pinfo.fbmem);
|
||||
printf(" fblen: %lu\n", (unsigned long)state.pinfo.fblen);
|
||||
printf(" stride: %u\n", state.pinfo.stride);
|
||||
printf(" display: %u\n", state.pinfo.display);
|
||||
printf(" bpp: %u\n", state.pinfo.bpp);
|
||||
|
||||
/* Only these pixel depths are supported. viinfo.fmt is ignored, only
|
||||
* certain color formats are supported.
|
||||
*/
|
||||
|
||||
if (state.pinfo.bpp != 32 && state.pinfo.bpp != 16 &&
|
||||
state.pinfo.bpp != 8 && state.pinfo.bpp != 1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: bpp=%u not supported\n", state.pinfo.bpp);
|
||||
close(state.fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* mmap() the framebuffer.
|
||||
*
|
||||
* NOTE: In the FLAT build the frame buffer address returned by the
|
||||
* FBIOGET_PLANEINFO IOCTL command will be the same as the framebuffer
|
||||
* address. mmap(), however, is the preferred way to get the framebuffer
|
||||
* address because in the KERNEL build, it will perform the necessary
|
||||
* address mapping to make the memory accessible to the application.
|
||||
*/
|
||||
|
||||
state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ|PROT_WRITE,
|
||||
MAP_SHARED|MAP_FILE, state.fd, 0);
|
||||
if (state.fbmem == MAP_FAILED)
|
||||
{
|
||||
int errcode = errno;
|
||||
fprintf(stderr, "ERROR: ioctl(FBIOGET_PLANEINFO) failed: %d\n",
|
||||
errcode);
|
||||
close(state.fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("Mapped FB: %p\n", state.fbmem);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fbdev_flush
|
||||
*
|
||||
* Description:
|
||||
* Flush a buffer to the marked area
|
||||
*
|
||||
* Input Parameters:
|
||||
* x1 - Left coordinate
|
||||
* y1 - Top coordinate
|
||||
* x2 - Right coordinate
|
||||
* y2 - Bottom coordinate
|
||||
* color_p - A n array of colors
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
FAR const lv_color_t *color_p)
|
||||
{
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
struct nxgl_rect_s rect;
|
||||
#endif
|
||||
int32_t act_x1;
|
||||
int32_t act_y1;
|
||||
int32_t act_x2;
|
||||
int32_t act_y2;
|
||||
long int location = 0;
|
||||
|
||||
if (state.fbmem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return if the area is out the screen */
|
||||
|
||||
if (x2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x1 > state.vinfo.xres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y1 > state.vinfo.yres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Truncate the area to the screen */
|
||||
|
||||
act_x1 = x1 < 0 ? 0 : x1;
|
||||
act_y1 = y1 < 0 ? 0 : y1;
|
||||
act_x2 = x2 > state.vinfo.xres - 1 ? state.vinfo.xres - 1 : x2;
|
||||
act_y2 = y2 > state.vinfo.yres - 1 ? state.vinfo.yres - 1 : y2;
|
||||
|
||||
if (state.pinfo.bpp == 8)
|
||||
{
|
||||
uint8_t *fbp8 = (uint8_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp8[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 16)
|
||||
{
|
||||
uint16_t *fbp16 = (uint16_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp16[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
|
||||
{
|
||||
uint32_t *fbp32 = (uint32_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp32[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
rect.pt1.x = act_x1;
|
||||
rect.pt1.y = act_y1;
|
||||
rect.pt2.x = act_x2;
|
||||
rect.pt2.y = act_y2;
|
||||
ioctl(state.fd, FBIO_UPDATE, (unsigned long)((uintptr_t)&rect));
|
||||
#endif
|
||||
|
||||
/* Tell the flushing is ready */
|
||||
|
||||
lv_flush_ready();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fbdev_fill
|
||||
*
|
||||
* Description:
|
||||
* Fill an area with a color
|
||||
*
|
||||
* Input Parameters:
|
||||
* x1 - Left coordinate
|
||||
* y1 - Top coordinate
|
||||
* x2 - Right coordinate
|
||||
* y2 - Bottom coordinate
|
||||
* color - The fill color
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
lv_color_t color)
|
||||
{
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
struct nxgl_rect_s rect;
|
||||
#endif
|
||||
int32_t act_x1;
|
||||
int32_t act_y1;
|
||||
int32_t act_x2;
|
||||
int32_t act_y2;
|
||||
long int location = 0;
|
||||
|
||||
if (state.fbmem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return if the area is out the screen */
|
||||
|
||||
if (x2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x1 > state.vinfo.xres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y1 > state.vinfo.yres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Truncate the area to the screen */
|
||||
|
||||
act_x1 = x1 < 0 ? 0 : x1;
|
||||
act_y1 = y1 < 0 ? 0 : y1;
|
||||
act_x2 = x2 > state.vinfo.xres - 1 ? state.vinfo.xres - 1 : x2;
|
||||
act_y2 = y2 > state.vinfo.yres - 1 ? state.vinfo.yres - 1 : y2;
|
||||
|
||||
if (state.pinfo.bpp == 8)
|
||||
{
|
||||
uint8_t *fbp8 = (uint8_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp8[location] = color.full;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 16)
|
||||
{
|
||||
uint16_t *fbp16 = (uint16_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp16[location] = color.full;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
|
||||
{
|
||||
uint32_t *fbp32 = (uint32_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp32[location] = color.full;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
rect.pt1.x = act_x1;
|
||||
rect.pt1.y = act_y1;
|
||||
rect.pt2.x = act_x2;
|
||||
rect.pt2.y = act_y2;
|
||||
ioctl(state.fd, FBIO_UPDATE, (unsigned long)((uintptr_t)&rect));
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fbdev_map
|
||||
*
|
||||
* Description:
|
||||
* Write an array of pixels (like an image) to the marked area
|
||||
*
|
||||
* Input Parameters:
|
||||
* x1 - Left coordinate
|
||||
* y1 - Top coordinate
|
||||
* x2 - Right coordinate
|
||||
* y2 - Bottom coordinate
|
||||
* color_p - An array of colors
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
FAR const lv_color_t *color_p)
|
||||
{
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
struct nxgl_rect_s rect;
|
||||
#endif
|
||||
int32_t act_x1;
|
||||
int32_t act_y1;
|
||||
int32_t act_x2;
|
||||
int32_t act_y2;
|
||||
long int location = 0;
|
||||
|
||||
if (state.fbmem == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return if the area is out the screen */
|
||||
|
||||
if (x2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y2 < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (x1 > state.vinfo.xres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (y1 > state.vinfo.yres - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Truncate the area to the screen */
|
||||
|
||||
act_x1 = x1 < 0 ? 0 : x1;
|
||||
act_y1 = y1 < 0 ? 0 : y1;
|
||||
act_x2 = x2 > state.vinfo.xres - 1 ? state.vinfo.xres - 1 : x2;
|
||||
act_y2 = y2 > state.vinfo.yres - 1 ? state.vinfo.yres - 1 : y2;
|
||||
|
||||
if (state.pinfo.bpp == 8)
|
||||
{
|
||||
uint8_t *fbp8 = (uint8_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp8[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 16)
|
||||
{
|
||||
uint16_t *fbp16 = (uint16_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp16[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
|
||||
{
|
||||
uint32_t *fbp32 = (uint32_t*)state.fbmem;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = x + (y * state.vinfo.xres);
|
||||
fbp32[location] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LCD_UPDATE
|
||||
rect.pt1.x = act_x1;
|
||||
rect.pt1.y = act_y1;
|
||||
rect.pt2.x = act_x2;
|
||||
rect.pt2.y = act_y2;
|
||||
ioctl(state.fd, FBIO_UPDATE, (unsigned long)((uintptr_t)&rect));
|
||||
#endif
|
||||
}
|
66
examples/lvgldemo/fbdev.h
Normal file
66
examples/lvgldemo/fbdev.h
Normal file
@ -0,0 +1,66 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/demo.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_FBDEV_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_FBDEV_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int fbdev_init(void);
|
||||
void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
FAR const lv_color_t *color_p);
|
||||
void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
||||
void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
FAR const lv_color_t *color_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*__APPS_EXAMPLES_LVGLDEMO_FBDEV_H*/
|
30884
examples/lvgldemo/img_bubble_pattern.c
Normal file
30884
examples/lvgldemo/img_bubble_pattern.c
Normal file
File diff suppressed because it is too large
Load Diff
177
examples/lvgldemo/lvgldemo.c
Normal file
177
examples/lvgldemo/lvgldemo.c
Normal file
@ -0,0 +1,177 @@
|
||||
/****************************************************************************
|
||||
* examples/lvgdemo/lvgldemo.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "fbdev.h"
|
||||
#include "tp.h"
|
||||
#include "demo.h"
|
||||
#include "tp_cal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tick_func
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* data
|
||||
*
|
||||
* Returned Value:
|
||||
* NULL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static FAR void *tick_func(void *data)
|
||||
{
|
||||
static long last_ms;
|
||||
long ms;
|
||||
struct timespec spec;
|
||||
|
||||
while (1)
|
||||
{
|
||||
long diff;
|
||||
|
||||
/* Calculate how much time elapsed */
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &spec);
|
||||
ms = (long)spec.tv_nsec / 1000000;
|
||||
diff = ms - last_ms;
|
||||
|
||||
/* Handle overflow */
|
||||
|
||||
if (diff < 0)
|
||||
{
|
||||
diff = 1000 + diff;
|
||||
}
|
||||
|
||||
lv_tick_inc(diff);
|
||||
usleep(5000);
|
||||
|
||||
last_ms = ms;
|
||||
}
|
||||
|
||||
/* Never will reach here */
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: main or lvgldemo_main
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* Standard argc and argv
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on success; a positive, non-zero value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_KERNEL
|
||||
int main(int argc, FAR char *argv[])
|
||||
#else
|
||||
int lvgldemo_main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
lv_init();
|
||||
|
||||
/* DISPLAY INTERFACE INIT */
|
||||
|
||||
fbdev_init();
|
||||
|
||||
/* Basic initialization */
|
||||
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
disp_drv.disp_flush = fbdev_flush;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
/* TICK INTERFACE INIT */
|
||||
|
||||
pthread_t tick_thread;
|
||||
pthread_create(&tick_thread, NULL, tick_func, NULL);
|
||||
|
||||
/* Touchpad Initialization */
|
||||
|
||||
tp_init();
|
||||
lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
|
||||
/* This function will be called periodically (by the library) to get the
|
||||
* mouse position and state.
|
||||
*/
|
||||
|
||||
indev_drv.read_fp = tp_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Demo initialization */
|
||||
|
||||
demo_init();
|
||||
|
||||
/* Start TP calibration */
|
||||
|
||||
tp_cal_create();
|
||||
|
||||
/* Handle LittlevGL tasks */
|
||||
|
||||
while (1)
|
||||
{
|
||||
lv_task_handler();
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
314
examples/lvgldemo/tp.c
Normal file
314
examples/lvgldemo/tp.c
Normal file
@ -0,0 +1,314 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/lvgldemo/tp.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/boardctl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LGVLDEMO_MOUSE
|
||||
# include <nuttx/input/mouse.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
|
||||
#include "tp.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static int fd;static bool calibrated = false;
|
||||
static int x_range;
|
||||
static int y_range;
|
||||
static int x_offset;
|
||||
static int y_offset;
|
||||
static bool xy_inv;
|
||||
static bool x_inv;
|
||||
static bool y_inv;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize The Touch pad
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a positive error code on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int tp_init(void)
|
||||
{
|
||||
int ret;
|
||||
int errval = 0;
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_LGVLDEMO_ARCHINIT
|
||||
/* Initialization of the touchscreen hardware is performed by logic
|
||||
* external to this test.
|
||||
*/
|
||||
|
||||
printf("tc_main: Initializing external touchscreen device\n");
|
||||
|
||||
ret = boardctl(BOARDIOC_TSCTEST_SETUP, CONFIG_EXAMPLES_LGVLDEMO_MINOR);
|
||||
if (ret != OK)
|
||||
{
|
||||
printf("tc_main: board_tsc_setup failed: %d\n", errno);
|
||||
errval = 1;
|
||||
goto errout;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Open the touchscreen device for reading */
|
||||
|
||||
printf("tc_main: Opening %s\n", CONFIG_EXAMPLES_LGVLDEMO_DEVPATH);
|
||||
fd = open(CONFIG_EXAMPLES_LGVLDEMO_DEVPATH, O_RDONLY | O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
{
|
||||
printf("tc_main: open %s failed: %d\n",
|
||||
CONFIG_EXAMPLES_LGVLDEMO_DEVPATH, errno);
|
||||
errval = 2;
|
||||
goto errout_with_tc;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
errout_with_tc:
|
||||
#ifdef CONFIG_EXAMPLES_LGVLDEMO_ARCHINIT
|
||||
boardctl(BOARDIOC_TSCTEST_TEARDOWN, 0);
|
||||
|
||||
errout:
|
||||
#endif
|
||||
printf("Terminating!\n");
|
||||
fflush(stdout);
|
||||
return errval;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_read
|
||||
*
|
||||
* Description:
|
||||
* Read a TP data and store in 'data' argument
|
||||
*
|
||||
* Input Parameters:
|
||||
* data - Store the x, y and state information here
|
||||
*
|
||||
* Returned Value:
|
||||
* false: no more data to read; true: there are more data to read.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool tp_read(FAR lv_indev_data_t *data)
|
||||
{
|
||||
struct touch_sample_s sample;
|
||||
int nbytes;
|
||||
static int last_x = 0;
|
||||
static int last_y = 0;
|
||||
static lv_indev_state_t last_state = LV_INDEV_STATE_REL;
|
||||
|
||||
/* Be sure at least the previous state is set */
|
||||
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
data->state = last_state;
|
||||
|
||||
/* Read one sample */
|
||||
|
||||
nbytes = read(fd, &sample, sizeof(struct touch_sample_s));
|
||||
|
||||
/* Handle unexpected return values */
|
||||
|
||||
if (nbytes < 0 || nbytes != sizeof(struct touch_sample_s))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sample.point[0].flags & TOUCH_DOWN || sample.point[0].flags & TOUCH_MOVE)
|
||||
{
|
||||
if (calibrated)
|
||||
{
|
||||
if (xy_inv)
|
||||
{
|
||||
last_x = sample.point[0].y;
|
||||
last_y = sample.point[0].x;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
last_x = sample.point[0].x;
|
||||
last_y = sample.point[0].y;
|
||||
}
|
||||
|
||||
/* Remove offset */
|
||||
|
||||
last_x -= x_offset;
|
||||
last_y -= y_offset;
|
||||
|
||||
last_x = (int)((int)last_x * LV_HOR_RES) / x_range;
|
||||
last_y = (int)((int)last_y * LV_VER_RES) / y_range;
|
||||
|
||||
|
||||
if (x_inv)
|
||||
{
|
||||
last_x = LV_HOR_RES - last_x;
|
||||
}
|
||||
|
||||
if (y_inv)
|
||||
{
|
||||
last_y = LV_VER_RES - last_y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
last_x = sample.point[0].x;
|
||||
last_y = sample.point[0].y;
|
||||
}
|
||||
|
||||
last_state = LV_INDEV_STATE_PR;
|
||||
}
|
||||
else if (sample.point[0].flags & TOUCH_UP)
|
||||
{
|
||||
last_state = LV_INDEV_STATE_REL;
|
||||
}
|
||||
else if (sample.point[0].flags & TOUCH_UP)
|
||||
{
|
||||
last_state = LV_INDEV_STATE_REL;
|
||||
}
|
||||
|
||||
/* Update touchpad data */
|
||||
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
data->state = last_state;
|
||||
|
||||
fflush(stdout);
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_read
|
||||
*
|
||||
* Description:
|
||||
* Set calibration data
|
||||
*
|
||||
* Input Parameters:
|
||||
* ul - Upper left hand corner TP value
|
||||
* ur - Upper right hand corner TP value
|
||||
* lr - Lower right hand corner TP value
|
||||
* ll - Lower left hand corner TP value
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tp_set_cal_values(FAR lv_point_t *ul, FAR lv_point_t *ur,
|
||||
FAR lv_point_t *lr, FAR lv_point_t *ll)
|
||||
{
|
||||
/* Is x/y inverted? */
|
||||
|
||||
if (abs(ul->x - ur->x) < LV_HOR_RES / 2)
|
||||
{
|
||||
xy_inv = true; /*No real change in x horizontally*/
|
||||
}
|
||||
|
||||
if (xy_inv)
|
||||
{
|
||||
/* Is x inverted */
|
||||
|
||||
if (ur->y < ul->y)
|
||||
{
|
||||
x_inv = true;
|
||||
}
|
||||
|
||||
/* Is y inverted */
|
||||
|
||||
if (ll->x < ul->x)
|
||||
{
|
||||
y_inv = true;
|
||||
}
|
||||
|
||||
x_range = abs(ul->y - ur->y);
|
||||
y_range = abs(ul->x - ll->x);
|
||||
x_offset = x_inv ? ur->y : ul->y;
|
||||
y_offset = y_inv ? ll->x : ul->x;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Is x inverted */
|
||||
|
||||
if (ur->x < ul->x)
|
||||
{
|
||||
x_inv = true;
|
||||
}
|
||||
|
||||
/* Is y inverted */
|
||||
|
||||
if (ll->y < ul->y)
|
||||
{
|
||||
y_inv = true;
|
||||
}
|
||||
|
||||
x_range = abs(ul->x - ur->x);
|
||||
y_range = abs(ul->y - ll->y);
|
||||
x_offset = x_inv ? ur->x : ul->x;
|
||||
y_offset = y_inv ? ll->y : ul->y;
|
||||
}
|
||||
|
||||
calibrated = true;
|
||||
|
||||
printf("tp_cal result\n");
|
||||
printf("offset x:%d, y:%d\n",x_offset, y_offset);
|
||||
printf("range x:%d, y:%d\n",x_range, y_range);
|
||||
printf("invert x/y:%d, x:%d, y:%d\n\n", xy_inv,x_inv,y_inv);
|
||||
}
|
142
examples/lvgldemo/tp.h
Normal file
142
examples/lvgldemo/tp.h
Normal file
@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
* examples/touchscreen/tc.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_TP_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_TP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <graphics/lvgl.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
/* CONFIG_NSH_BUILTIN_APPS - Build the touchscreen test as
|
||||
* an NSH built-in function. Default: Built as a standalone problem
|
||||
* CONFIG_EXAMPLES_LGVLDEMO_MINOR - The minor device number. Minor=N
|
||||
* corresponds to touchscreen device /dev/input0. Note this value must
|
||||
* with CONFIG_EXAMPLES_LGVLDEMO_DEVPATH. Default 0.
|
||||
* CONFIG_EXAMPLES_LGVLDEMO_DEVPATH - The path to the touchscreen
|
||||
* device. This must be consistent with CONFIG_EXAMPLES_LGVLDEMO_MINOR.
|
||||
* Default: "/dev/input0"
|
||||
* CONFIG_EXAMPLES_LGVLDEMO_MOUSE - The touchscreen test can also be
|
||||
* configured to work with a mouse driver by setting this option.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_INPUT
|
||||
# error "Input device support is not enabled (CONFIG_INPUT)"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_LGVLDEMO_MINOR
|
||||
# undef CONFIG_EXAMPLES_LGVLDEMO_DEVPATH
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_MINOR 0
|
||||
# ifdef CONFIG_EXAMPLES_LGVLDEMO_MOUSE
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_DEVPATH "/dev/mouse0"
|
||||
# else
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_DEVPATH "/dev/input0"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_LGVLDEMO_DEVPATH
|
||||
# undef CONFIG_EXAMPLES_LGVLDEMO_MINOR
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_MINOR 0
|
||||
# ifdef CONFIG_EXAMPLES_LGVLDEMO_MOUSE
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_DEVPATH "/dev/mouse0"
|
||||
# else
|
||||
# define CONFIG_EXAMPLES_LGVLDEMO_DEVPATH "/dev/input0"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize The Touch pad
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a positive error code on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int tp_init(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_read
|
||||
*
|
||||
* Description:
|
||||
* Read a TP data and store in 'data' argument
|
||||
*
|
||||
* Input Parameters:
|
||||
* data - Store the x, y and state information here
|
||||
*
|
||||
* Returned Value:
|
||||
* false: no more data to read; true: there are more data to read.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool tp_read(FAR lv_indev_data_t *data);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_read
|
||||
*
|
||||
* Description:
|
||||
* Set calibration data
|
||||
*
|
||||
* Input Parameters:
|
||||
* ul - Upper left hand corner TP value
|
||||
* ur - Upper right hand corner TP value
|
||||
* lr - Lower right hand corner TP value
|
||||
* ll - Lower left hand corner TP value
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tp_set_cal_values(FAR lv_point_t *ul, FAR lv_point_t *ur,
|
||||
FAR lv_point_t *lr, FAR lv_point_t *ll);
|
||||
|
||||
#endif /* __APPS_EXAMPLES_LVGLDEMO_TP_H */
|
349
examples/lvgldemo/tp_cal.c
Normal file
349
examples/lvgldemo/tp_cal.c
Normal file
@ -0,0 +1,349 @@
|
||||
/****************************************************************************
|
||||
* examples/touchscreen/tp_cal.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <graphics/lvgl.h>
|
||||
#include "tp.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CIRCLE_SIZE 20
|
||||
#define TP_MAX_VALUE 5000
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
enum tp_cal_state_e
|
||||
{
|
||||
TP_CAL_STATE_INIT,
|
||||
TP_CAL_STATE_WAIT_TOP_LEFT,
|
||||
TP_CAL_STATE_WAIT_TOP_RIGHT,
|
||||
TP_CAL_STATE_WAIT_BOTTOM_RIGHT,
|
||||
TP_CAL_STATE_WAIT_BOTTOM_LEFT,
|
||||
TP_CAL_STATE_WAIT_LEAVE,
|
||||
TP_CAL_STATE_READY,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static lv_res_t btn_click_action(lv_obj_t * scr);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static enum tp_cal_state_e state;
|
||||
static lv_point_t p[4];
|
||||
static lv_obj_t *prev_scr;
|
||||
static lv_obj_t *big_btn;
|
||||
static lv_obj_t *label_main;
|
||||
static lv_obj_t *circ_area;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: btn_click_action
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Input Parameters:
|
||||
* scr
|
||||
*
|
||||
* Returned Value:
|
||||
* ?
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static lv_res_t btn_click_action(FAR lv_obj_t *scr)
|
||||
{
|
||||
if (state == TP_CAL_STATE_WAIT_TOP_LEFT)
|
||||
{
|
||||
lv_indev_t *indev = lv_indev_get_act();
|
||||
char buf[64];
|
||||
lv_anim_t a;
|
||||
|
||||
lv_indev_get_point(indev, &p[0]);
|
||||
|
||||
sprintf(buf, "x: %d\ny: %d", p[0].x, p[0].y);
|
||||
lv_obj_t *label_coord = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_coord, buf);
|
||||
|
||||
lv_label_set_text(label_main, "Click the circle in\n"
|
||||
"upper right-hand corner");
|
||||
|
||||
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);
|
||||
|
||||
a.var = circ_area;
|
||||
a.start = 0;
|
||||
a.end = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.end_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.fp = (lv_anim_fp_t)lv_obj_set_y;
|
||||
a.end_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
|
||||
state = TP_CAL_STATE_WAIT_TOP_RIGHT;
|
||||
}
|
||||
else if (state == TP_CAL_STATE_WAIT_TOP_RIGHT)
|
||||
{
|
||||
lv_indev_t *indev = lv_indev_get_act();
|
||||
char buf[64];
|
||||
lv_anim_t a;
|
||||
|
||||
lv_indev_get_point(indev, &p[1]);
|
||||
|
||||
sprintf(buf, "x: %d\ny: %d", p[1].x, p[1].y);
|
||||
lv_obj_t *label_coord = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_coord, buf);
|
||||
lv_obj_set_pos(label_coord, LV_HOR_RES - lv_obj_get_width(label_coord),
|
||||
0);
|
||||
|
||||
lv_label_set_text(label_main, "Click the circle in\n"
|
||||
"lower right-hand corner");
|
||||
|
||||
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);
|
||||
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.end = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.end_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 = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_y;
|
||||
a.end_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
|
||||
state = TP_CAL_STATE_WAIT_BOTTOM_RIGHT;
|
||||
}
|
||||
else if (state == TP_CAL_STATE_WAIT_BOTTOM_RIGHT)
|
||||
{
|
||||
lv_indev_t *indev = lv_indev_get_act();
|
||||
char buf[64];
|
||||
lv_anim_t a;
|
||||
|
||||
lv_indev_get_point(indev, &p[2]);
|
||||
|
||||
sprintf(buf, "x: %d\ny: %d", p[2].x, p[2].y);
|
||||
lv_obj_t *label_coord = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_coord, buf);
|
||||
lv_obj_set_pos(label_coord, LV_HOR_RES - lv_obj_get_width(label_coord),
|
||||
LV_VER_RES - lv_obj_get_height(label_coord));
|
||||
|
||||
lv_label_set_text(label_main, "Click the circle in\n"
|
||||
"lower left-hand corner");
|
||||
|
||||
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);
|
||||
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES - CIRCLE_SIZE;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t)lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.end_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 = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.end = LV_VER_RES - CIRCLE_SIZE;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_y;
|
||||
a.end_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
|
||||
state = TP_CAL_STATE_WAIT_BOTTOM_LEFT;
|
||||
}
|
||||
|
||||
else if (state == TP_CAL_STATE_WAIT_BOTTOM_LEFT)
|
||||
{
|
||||
lv_indev_t *indev = lv_indev_get_act();
|
||||
char buf[64];
|
||||
|
||||
lv_indev_get_point(indev, &p[3]);
|
||||
|
||||
lv_label_set_text(label_main, "Click the screen\n"
|
||||
"to leave calibration");
|
||||
|
||||
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);
|
||||
|
||||
sprintf(buf, "x: %d\ny: %d", p[3].x, p[3].y);
|
||||
lv_obj_t *label_coord = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_coord, buf);
|
||||
lv_obj_set_pos(label_coord, 0,
|
||||
LV_VER_RES - lv_obj_get_height(label_coord));
|
||||
|
||||
lv_obj_del(circ_area);
|
||||
|
||||
state = TP_CAL_STATE_WAIT_LEAVE;
|
||||
}
|
||||
else if (state == TP_CAL_STATE_WAIT_LEAVE)
|
||||
{
|
||||
lv_scr_load(prev_scr);
|
||||
tp_set_cal_values(&p[0], &p[1], &p[2], &p[3]);
|
||||
state = TP_CAL_STATE_READY;
|
||||
}
|
||||
else if (state == TP_CAL_STATE_READY)
|
||||
{
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_cal_create
|
||||
*
|
||||
* Description:
|
||||
* Create a touchpad calibration screen
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tp_cal_create(void)
|
||||
{
|
||||
static lv_style_t style_circ;
|
||||
lv_anim_t a;
|
||||
|
||||
state = TP_CAL_STATE_INIT;
|
||||
|
||||
prev_scr = lv_scr_act();
|
||||
|
||||
lv_obj_t *scr = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_size(scr, TP_MAX_VALUE, TP_MAX_VALUE);
|
||||
lv_scr_load(scr);
|
||||
|
||||
/* Create a big transparent button screen to receive clicks */
|
||||
|
||||
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_btn_set_action(big_btn, LV_BTN_ACTION_REL, btn_click_action);
|
||||
lv_btn_set_layout(big_btn, LV_LAYOUT_OFF);
|
||||
|
||||
label_main = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label_main, "Click the circle in\n"
|
||||
"upper left-hand corner");
|
||||
lv_label_set_align(label_main, LV_LABEL_ALIGN_CENTER);
|
||||
|
||||
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;
|
||||
|
||||
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_set_click(circ_area, false);
|
||||
|
||||
a.var = circ_area;
|
||||
a.start = LV_HOR_RES / 2;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_x;
|
||||
a.path = lv_anim_get_path(LV_ANIM_PATH_LIN);
|
||||
a.end_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);
|
||||
|
||||
a.start = LV_VER_RES / 2;
|
||||
a.end = 0;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_y;
|
||||
a.end_cb = NULL;
|
||||
a.time = 200;
|
||||
lv_anim_create(&a);
|
||||
|
||||
state = TP_CAL_STATE_WAIT_TOP_LEFT;
|
||||
}
|
68
examples/lvgldemo/tp_cal.h
Normal file
68
examples/lvgldemo/tp_cal.h
Normal file
@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* examples/touchscreen/tp_cal.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_EXAMPLES_LVGLDEMO_TP_CAL_H
|
||||
#define __APPS_EXAMPLES_LVGLDEMO_TP_CAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: tp_cal_create
|
||||
*
|
||||
* Description:
|
||||
* Create a touchpad calibration screen
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void tp_cal_create(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*__APPS_EXAMPLES_LVGLDEMO_TP_CAL_H*/
|
3
graphics/littlevgl/.gitignore
vendored
Normal file
3
graphics/littlevgl/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/lvgl
|
||||
/*tar.gz
|
||||
|
513
graphics/littlevgl/Kconfig
Normal file
513
graphics/littlevgl/Kconfig
Normal file
@ -0,0 +1,513 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
menuconfig GRAPHICS_LVGL
|
||||
bool "Littlev Graphic Library (LVGL)"
|
||||
default n
|
||||
---help---
|
||||
Enable support for the LVGL GUI libray.
|
||||
|
||||
if GRAPHICS_LVGL
|
||||
|
||||
config LV_MEM_SIZE
|
||||
int "Heap size of the graphics library"
|
||||
default 32768
|
||||
---help---
|
||||
The size of a memory pool where the grapohisc library dynamically allocates data
|
||||
|
||||
menu "Graphics settings"
|
||||
|
||||
config LV_HOR_RES
|
||||
int "Horizontal resolution."
|
||||
default 320
|
||||
---help---
|
||||
Number of pixels in horizontally.
|
||||
|
||||
config LV_VER_RES
|
||||
int "Vertical resolution."
|
||||
default 240
|
||||
---help---
|
||||
Number of pixels vertically. Double it if anti aliasing is used
|
||||
|
||||
config LV_DPI
|
||||
int "DPI (px/inch)"
|
||||
default 100
|
||||
---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 modul (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.
|
||||
endif # LV_VDB_DOUBLE
|
||||
config LV_ANTIALIAS
|
||||
bool "Anti aliasing of the screen"
|
||||
default n
|
||||
---help---
|
||||
Render everything in double size and filter to half to get a smoother result.
|
||||
You need to use double sized fonts and images to get the same result
|
||||
|
||||
endif # LV_VDB_SIZE != 0
|
||||
|
||||
config LV_FONT_ANTIALIAS
|
||||
bool "Anti aliasing of fonts"
|
||||
default y
|
||||
---help---
|
||||
Downscale the fonts with a filter to get smoother letters.
|
||||
|
||||
config LV_REFR_PERIOD
|
||||
int "Refresh period in milliseconds"
|
||||
default 50
|
||||
---help---
|
||||
The graphics library will check for invalid areas an refresh them with this period time
|
||||
|
||||
config LV_INV_FIFO_SIZE
|
||||
int "Average number of object on the screen"
|
||||
default 32
|
||||
---help---
|
||||
If too much area is invalidated (greater then this number) then the whole screen will be refreshed
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Input device settings"
|
||||
|
||||
config LV_INDEV_READ_PERIOD
|
||||
int "Input device read period in milliseconds"
|
||||
default 50
|
||||
|
||||
config LV_INDEV_POINT_MARKER
|
||||
int "Mark the pressed points on the screen"
|
||||
default 0
|
||||
|
||||
config LV_INDEV_DRAG_LIMIT
|
||||
int "Drag limit in pixels"
|
||||
default 10
|
||||
|
||||
config LV_INDEV_DRAG_THROW
|
||||
int "Slow down ration when throwing on object by drag [%]"
|
||||
default 20
|
||||
|
||||
config LV_INDEV_LONG_PRESS_TIME
|
||||
int "Long press time [ms]"
|
||||
default 400
|
||||
|
||||
config LV_INDEV_LONG_PRESS_REP_TIME
|
||||
int "Repeated trigger period in long press [ms]"
|
||||
default 100
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Color settings"
|
||||
|
||||
config LV_COLOR_DEPTH
|
||||
int "Color depth (8/16/24)"
|
||||
default 16
|
||||
|
||||
config LV_COLOR_TRANSP
|
||||
hex "Chroma key color (pixels with this color will be transparent on images)"
|
||||
default 0x00ff00
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Text (font) settings"
|
||||
|
||||
config LV_TXT_UTF8
|
||||
bool "Unicode support"
|
||||
default n
|
||||
|
||||
config LV_TXT_BREAK_CHARS
|
||||
string "Characters where the words/line cab be wrapped"
|
||||
default " ,.;:-_"
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Feature usage"
|
||||
config USE_LV_ANIMATION
|
||||
bool "Enable animations"
|
||||
default y
|
||||
|
||||
config USE_LV_SHADOW
|
||||
bool "Enable shadows"
|
||||
default y
|
||||
|
||||
config USE_LV_GROUP
|
||||
bool "Enable object groups (for keyboard)"
|
||||
default y
|
||||
|
||||
config USE_LV_GPU
|
||||
bool "Enable GPU (hardware acceleration) API"
|
||||
default y
|
||||
|
||||
config USE_LV_FILESYSTEM
|
||||
bool "Enable filesystem (required for images, lv_img)"
|
||||
default y
|
||||
endmenu
|
||||
|
||||
menu "Theme usage"
|
||||
|
||||
config USE_LV_THEME_TEMPL
|
||||
bool "Use Template theme: just for test"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_DEFAULT
|
||||
bool "Use Default theme: uses the built-in style"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_ALIEN
|
||||
bool "Use Alien theme: dark futuristic theme"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_NIGHT
|
||||
bool "Use Night theme: dark elegant theme"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_MONO
|
||||
bool "Use Mono theme: mono color theme"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_MATERIAL
|
||||
bool "Use Mono theme: material theme with bold colors"
|
||||
default n
|
||||
|
||||
config USE_LV_THEME_ZEN
|
||||
bool "Use Mono theme: light, peaceful theme"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Font usage"
|
||||
|
||||
# 10 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_10
|
||||
bool "Dejavu 10 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_10_SUP
|
||||
bool "Dejavu 10 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_10_LATIN_EXT_A
|
||||
bool "Dejavu 10 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_10_LATIN_EXT_B
|
||||
bool "Dejavu 10 px - latin extanded B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_10_CYRILLIC
|
||||
bool "Dejavu 10 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_10_BASIC
|
||||
bool "Symbol 10 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_10_FILE
|
||||
bool "Symbol 10 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_10_FEEDBACK
|
||||
bool "Symbol 10 px - feedback"
|
||||
default n
|
||||
|
||||
#20 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_20
|
||||
bool "Dejavu 20 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_20_SUP
|
||||
bool "Dejavu 20 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_20_LATIN_EXT_A
|
||||
bool "Dejavu 20 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_20_LATIN_EXT_B
|
||||
bool "Dejavu 20 px - latin extanded B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_20_CYRILLIC
|
||||
bool "Dejavu 20 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_20_BASIC
|
||||
bool "Symbol 20 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_20_FILE
|
||||
bool "Symbol 20 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_20_FEEDBACK
|
||||
bool "Symbol 20 px - feedback"
|
||||
default n
|
||||
|
||||
#30 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_30
|
||||
bool "Dejavu 30 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_30_SUP
|
||||
bool "Dejavu 30 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_30_LATIN_EXT_A
|
||||
bool "Dejavu 30 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_30_LATIN_EXT_B
|
||||
bool "Dejavu 30 px - latin extended B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_30_CYRILLIC
|
||||
bool "Dejavu 30 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_30_BASIC
|
||||
bool "Symbol 30 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_30_FILE
|
||||
bool "Symbol 30 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_30_FEEDBACK
|
||||
bool "Symbol 30 px - feedback"
|
||||
default n
|
||||
|
||||
#40 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_40
|
||||
bool "Dejavu 40 px"
|
||||
default y
|
||||
|
||||
config USE_LV_FONT_DEJAVU_40_SUP
|
||||
bool "Dejavu 40 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_40_LATIN_EXT_A
|
||||
bool "Dejavu 40 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_40_LATIN_EXT_B
|
||||
bool "Dejavu 40 px - latin extended B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_40_CYRILLIC
|
||||
bool "Dejavu 40 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_40_BASIC
|
||||
bool "Symbol 40 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_40_FILE
|
||||
bool "Symbol 40 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_40_FEEDBACK
|
||||
bool "Symbol 40 px - feedback"
|
||||
default n
|
||||
|
||||
#60 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_60
|
||||
bool "Dejavu 60 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_60_SUP
|
||||
bool "Dejavu 60 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_60_LATIN_EXT_A
|
||||
bool "Dejavu 60 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_60_LATIN_EXT_B
|
||||
bool "Dejavu 60 px - latin extanded B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_60_CYRILLIC
|
||||
bool "Dejavu 60 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_60_BASIC
|
||||
bool "Symbol 60 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_60_FILE
|
||||
bool "Symbol 60 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_60_FEEDBACK
|
||||
bool "Symbol 60 px - feedback"
|
||||
default n
|
||||
|
||||
#80 PX FONTS
|
||||
|
||||
config USE_LV_FONT_DEJAVU_80
|
||||
bool "Dejavu 80 px"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_80_SUP
|
||||
bool "Dejavu 80 px - latin supplement"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_80_LATIN_EXT_A
|
||||
bool "Dejavu 80 px - latin extended A"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_80_LATIN_EXT_B
|
||||
bool "Dejavu 80 px - latin extended B"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_DEJAVU_80_CYRILLIC
|
||||
bool "Dejavu 80 px - cyrillic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_80_BASIC
|
||||
bool "Symbol 80 px - basic"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_80_FILE
|
||||
bool "Symbol 80 px - file"
|
||||
default n
|
||||
|
||||
config USE_LV_FONT_SYMBOL_80_FEEDBACK
|
||||
bool "Symbol 80 px - feedback"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Base object settings"
|
||||
|
||||
config LV_OBJ_FREE_PTR
|
||||
bool "Free pointer enable/disable"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Object type usage settings"
|
||||
|
||||
config USE_LV_LABEL
|
||||
bool "Label usage"
|
||||
default y
|
||||
|
||||
config USE_LV_IMG
|
||||
bool "Image usage"
|
||||
default y
|
||||
|
||||
config USE_LV_LINE
|
||||
bool "Line usage"
|
||||
default y
|
||||
|
||||
config USE_LV_CONT
|
||||
bool "Container usage"
|
||||
default y
|
||||
|
||||
config USE_LV_PAGE
|
||||
bool "Page usage"
|
||||
default y
|
||||
|
||||
config USE_LV_WIN
|
||||
bool "Window usage"
|
||||
default y
|
||||
|
||||
config USE_LV_TABVIEW
|
||||
bool "Tabview usage"
|
||||
default y
|
||||
|
||||
config USE_LV_BAR
|
||||
bool "Bar usage"
|
||||
default y
|
||||
|
||||
config USE_LV_LMETER
|
||||
bool "Line meter usage"
|
||||
default y
|
||||
|
||||
config USE_LV_CHART
|
||||
bool "Chart usage"
|
||||
default y
|
||||
|
||||
config USE_LV_LED
|
||||
bool "LED usage"
|
||||
default y
|
||||
|
||||
config USE_LV_MBOX
|
||||
bool "Messagebox usage"
|
||||
default y
|
||||
|
||||
config USE_LV_TA
|
||||
bool "Text area usage"
|
||||
default y
|
||||
|
||||
config USE_LV_BTN
|
||||
bool "Button usage"
|
||||
default y
|
||||
|
||||
config USE_LV_BTNM
|
||||
bool "Button matrix usage"
|
||||
default y
|
||||
|
||||
config USE_LV_KB
|
||||
bool "Keyboard"
|
||||
default y
|
||||
|
||||
config USE_LV_CB
|
||||
bool "Chekbox usage"
|
||||
default y
|
||||
|
||||
config USE_LV_SW
|
||||
bool "Switch usage"
|
||||
default y
|
||||
|
||||
config USE_LV_LIST
|
||||
bool "List usage"
|
||||
default y
|
||||
|
||||
config USE_LV_DDLIST
|
||||
bool "Drop down list usage"
|
||||
default y
|
||||
|
||||
config USE_LV_ROLLER
|
||||
bool "Roller usage"
|
||||
default y
|
||||
|
||||
config USE_LV_SLIDER
|
||||
bool "Slider usage"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
endif # GRAPHICS_LVGL
|
38
graphics/littlevgl/Make.defs
Normal file
38
graphics/littlevgl/Make.defs
Normal file
@ -0,0 +1,38 @@
|
||||
############################################################################
|
||||
# apps/graphics/littlevgl/Make.defs
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_GRAPHICS_LVGL),y)
|
||||
CONFIGURED_APPS += graphics/littlevgl
|
||||
endif
|
143
graphics/littlevgl/Makefile
Normal file
143
graphics/littlevgl/Makefile
Normal file
@ -0,0 +1,143 @@
|
||||
############################################################################
|
||||
# apps/graphics/littlevgl/Makefile
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# LVGL graphic library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
VPATH =
|
||||
DEPPATH = --dep-path .
|
||||
|
||||
# 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_misc/lv_misc.mk
|
||||
-include ./lvgl/lv_themes/lv_themes.mk
|
||||
-include ./lvgl/lv_draw/lv_draw.mk
|
||||
|
||||
# Set up build configuration and environment
|
||||
|
||||
WD := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||
|
||||
CONFIG_GRAPH_LVGL_URL ?= "https://archive.org/download/lvgl4.tar"
|
||||
|
||||
LVGL_VERSION ?= 4
|
||||
LVGL_TARBALL = lvgl$(LVGL_VERSION).tar.gz
|
||||
WGET ?= wget
|
||||
|
||||
LVGL_UNPACKNAME = lvgl
|
||||
UNPACK ?= tar -zxf
|
||||
|
||||
LVGL_UNPACKDIR = $(WD)/$(LVGL_UNPACKNAME)
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
BIN = ..\..\libapps$(LIBEXT)
|
||||
else
|
||||
ifeq ($(WINTOOL),y)
|
||||
BIN = ..\\..\\libapps$(LIBEXT)
|
||||
else
|
||||
BIN = ../../libapps$(LIBEXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/graphics/littlevgl}
|
||||
|
||||
# Common build
|
||||
|
||||
all: .built
|
||||
.PHONY: context clean depend distclean preconfig
|
||||
.PRECIOUS: ../../libapps$(LIBEXT)
|
||||
|
||||
$(LVGL_TARBALL):
|
||||
@echo "Downloading: $(LVGL_TARBALL)"
|
||||
$(Q) $(WGET) $(CONFIG_GRAPH_LVGL_URL)/$(LVGL_TARBALL)
|
||||
|
||||
$(LVGL_UNPACKNAME): $(LVGL_TARBALL)
|
||||
@echo "Unpacking: $(LVGL_TARBALL) -> $(LVGL_UNPACKNAME)"
|
||||
$(Q) $(UNPACK) $(LVGL_TARBALL)
|
||||
$(Q) touch $(LVGL_UNPACKNAME)
|
||||
|
||||
$(APPDIR)/include/graphics/lvgl.h: $(LVGL_UNPACKNAME) lvgl/lvgl.h
|
||||
@echo "CP: lvgl/lvgl.h"
|
||||
$(Q) cp -a lvgl/lvgl.h $(APPDIR)/include/graphics/lvgl.h
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
.built: $(OBJS)
|
||||
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||
$(Q) touch .built
|
||||
|
||||
install:
|
||||
|
||||
context: $(LVGL_UNPACKNAME) $(APPDIR)/include/graphics/lvgl.h
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELDIR, build)
|
||||
$(call DELFILE, .built)
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
$(call DELDIR, $(LVGL_UNPACKNAME))
|
||||
$(call DELFILE, $(LVGL_TARBALL))
|
||||
$(call DELFILE, $(APPDIR)/include/graphics/lvgl.h)
|
||||
|
||||
preconfig:
|
||||
|
||||
-include Make.dep
|
796
graphics/littlevgl/lv_conf.h
Normal file
796
graphics/littlevgl/lv_conf.h
Normal file
@ -0,0 +1,796 @@
|
||||
/****************************************************************************
|
||||
* apps/graphics/littlevgl/lv_conf.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. 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:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __APPS_GRAPHICS_LITTLEVGL_LV_CONF_H
|
||||
#define __APPS_GRAPHICS_LITTLEVGL_LV_CONF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Dynamic memory */
|
||||
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#define LV_MEM_SIZE CONFIG_LV_MEM_SIZE
|
||||
#define LV_MEM_AUTO_DEFRAG 1 /* Automatically defrag on free */
|
||||
#define LV_MEM_ATTR
|
||||
|
||||
/* Graphical settings */
|
||||
/* Horizontal and vertical resolution of the library.*/
|
||||
|
||||
#define LV_HOR_RES CONFIG_LV_HOR_RES
|
||||
#define LV_VER_RES CONFIG_LV_VER_RES
|
||||
#define LV_DPI CONFIG_LV_DPI
|
||||
|
||||
/* Buffered rendering:
|
||||
*
|
||||
* No antialasing >= LV_HOR_RES
|
||||
* Anti aliasing >= 4 * LV_HOR_RES
|
||||
*
|
||||
* Place VDB to a specific address (e.g. in external RAM) (0: allocate into
|
||||
* RAM)
|
||||
*/
|
||||
|
||||
#define LV_VDB_SIZE CONFIG_LV_VDB_SIZE
|
||||
#define LV_VDB_ADR CONFIG_LV_VDB_ADR
|
||||
|
||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing
|
||||
* The flushing should use DMA to write the frame buffer in the background,
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_VDB_DOUBLE
|
||||
# define LV_VDB_DOUBLE CONFIG_LV_VDB_DOUBLE
|
||||
#else
|
||||
# define LV_VDB_DOUBLE 0
|
||||
#endif
|
||||
|
||||
/* LV_VDB2_ADR - Place VDB2 to a specific address (e.g. in external RAM)
|
||||
* (0: allocate into RAM)
|
||||
*/
|
||||
|
||||
#define LV_VDB2_ADR CONFIG_VDB2_ADR
|
||||
|
||||
/* Enable anti aliasing
|
||||
*
|
||||
* If enabled everything will be rendered in double size and filtered to
|
||||
* normal size
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_ANTIALIAS
|
||||
# define LV_ANTIALIAS CONFIG_LV_ANTIALIAS
|
||||
#else
|
||||
# define LV_ANTIALIAS 0
|
||||
#endif
|
||||
|
||||
/* Enable anti aliasing only for fonts (texts)
|
||||
*
|
||||
* It half the size of the letters so you should use double sized fonts
|
||||
* Much faster then normal anti aliasing.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_FONT_ANTIALIAS
|
||||
# define LV_FONT_ANTIALIAS CONFIG_LV_FONT_ANTIALIAS
|
||||
#else
|
||||
# define LV_FONT_ANTIALIAS 0
|
||||
#endif
|
||||
|
||||
/* Screen refresh settings
|
||||
*
|
||||
* LV_REFR_PERIOD - Screen refresh period in milliseconds
|
||||
* LV_INV_FIFO_SIZE - The average count of objects on a screen
|
||||
*/
|
||||
|
||||
#define LV_REFR_PERIOD CONFIG_LV_REFR_PERIOD
|
||||
#define LV_INV_FIFO_SIZE CONFIG_LV_INV_FIFO_SIZE
|
||||
|
||||
/* Misc. settings */
|
||||
/* Input device settings
|
||||
*
|
||||
* LV_INDEV_READ_PERIOD - Input device read period in milliseconds
|
||||
* LV_INDEV_POINT_MARKER - Mark the pressed points
|
||||
* LV_INDEV_DRAG_LIMIT - Drag threshold in pixels
|
||||
* LV_INDEV_DRAG_THROW - Drag throw slow-down in [%]. Greater value
|
||||
* means faster slow-down
|
||||
* LV_INDEV_LONG_PRESS_TIME - Long press time in milliseconds
|
||||
* LV_INDEV_LONG_PRESS_REP_TIME - Repeated trigger period in long press [ms]
|
||||
*/
|
||||
|
||||
#define LV_INDEV_READ_PERIOD CONFIG_LV_INDEV_READ_PERIOD
|
||||
|
||||
#ifdef CONFIG_LV_INDEV_POINT_MARKER
|
||||
# define LV_INDEV_POINT_MARKER CONFIG_LV_INDEV_POINT_MARKER
|
||||
#else
|
||||
# define LV_INDEV_POINT_MARKER 0
|
||||
#endif
|
||||
|
||||
#define LV_INDEV_DRAG_LIMIT CONFIG_LV_INDEV_DRAG_LIMIT
|
||||
#define LV_INDEV_DRAG_THROW CONFIG_LV_INDEV_DRAG_THROW
|
||||
#define LV_INDEV_LONG_PRESS_TIME CONFIG_LV_INDEV_LONG_PRESS_TIME
|
||||
#define LV_INDEV_LONG_PRESS_REP_TIME CONFIG_LV_INDEV_LONG_PRESS_REP_TIME
|
||||
|
||||
/* Color settings
|
||||
*
|
||||
* LV_COLOR_TRANSP - Images pixels with this color will not be drawn (chroma
|
||||
* keying)
|
||||
*/
|
||||
|
||||
#define LV_COLOR_DEPTH CONFIG_LV_COLOR_DEPTH
|
||||
#define LV_COLOR_TRANSP LV_COLOR_HEX(CONFIG_LV_COLOR_TRANSP)
|
||||
|
||||
/* Text settings
|
||||
*
|
||||
* LV_TXT_BREAK_CHARS - Can break texts on these chars
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LV_TXT_UTF8
|
||||
# define LV_TXT_UTF8 CONFIG_LV_TXT_UTF8
|
||||
#else
|
||||
# define LV_TXT_UTF8 0
|
||||
#endif
|
||||
|
||||
#define LV_TXT_BREAK_CHARS CONFIG_LV_TXT_BREAK_CHARS
|
||||
|
||||
/* Graphics feature usage */
|
||||
|
||||
#ifdef CONFIG_USE_LV_ANIMATION
|
||||
# define USE_LV_ANIMATION CONFIG_USE_LV_ANIMATION
|
||||
#else
|
||||
# define USE_LV_ANIMATION 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_SHADOW
|
||||
# define USE_LV_SHADOW CONFIG_USE_LV_SHADOW
|
||||
#else
|
||||
# define USE_LV_SHADOW 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_GROUP
|
||||
#define USE_LV_GROUP CONFIG_USE_LV_GROUP
|
||||
#else
|
||||
# define USE_LV_GROUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_GPU
|
||||
# define USE_LV_GPU CONFIG_USE_LV_GPU
|
||||
#else
|
||||
# define USE_LV_GPU 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_USE_LV_FILESYSTEM
|
||||
# define USE_LV_FILESYSTEM CONFIG_USE_LV_FILESYSTEM
|
||||
#else
|
||||
# define USE_LV_FILESYSTEM 0
|
||||
#endif
|
||||
|
||||
/* THEME USAGE */
|
||||
/* Just for test */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_TEMPL
|
||||
# define USE_LV_THEME_TEMPL CONFIG_USE_LV_THEME_TEMPL
|
||||
#else
|
||||
# define USE_LV_THEME_TEMPL 0
|
||||
#endif
|
||||
|
||||
/* Built mainly from the built-in styles. Consumes very few RAM */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_DEFAULT
|
||||
# define USE_LV_THEME_DEFAULT CONFIG_USE_LV_THEME_DEFAULT
|
||||
#else
|
||||
# define USE_LV_THEME_DEFAULT 0
|
||||
#endif
|
||||
|
||||
/* Dark futuristic theme */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_ALIEN
|
||||
# define USE_LV_THEME_ALIEN CONFIG_USE_LV_THEME_ALIEN
|
||||
#else
|
||||
# define USE_LV_THEME_ALIEN 0
|
||||
#endif
|
||||
|
||||
/* Dark elegant theme */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_NIGHT
|
||||
# define USE_LV_THEME_NIGHT CONFIG_USE_LV_THEME_NIGHT
|
||||
#else
|
||||
# define USE_LV_THEME_NIGHT 0
|
||||
#endif
|
||||
|
||||
/* Mono color theme for monochrome displays */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_MONO
|
||||
# define USE_LV_THEME_MONO CONFIG_USE_LV_THEME_MONO
|
||||
#else
|
||||
# define USE_LV_THEME_MONO 0
|
||||
#endif
|
||||
|
||||
/* Flat theme with bold colors and light shadows (Planned) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_MATERIAL
|
||||
# define USE_LV_THEME_MATERIAL CONFIG_USE_LV_THEME_MATERIAL
|
||||
#else
|
||||
# define USE_LV_THEME_MATERIAL 0
|
||||
#endif
|
||||
|
||||
/* Peaceful, mainly black and white theme (Planned) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_THEME_ZEN
|
||||
# define USE_LV_THEME_ZEN CONFIG_USE_LV_THEME_ZEN
|
||||
#else
|
||||
# define USE_LV_THEME_ZEN 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
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_10_SUP
|
||||
# define USE_LV_FONT_DEJAVU_10_SUP CONFIG_USE_LV_FONT_DEJAVU_10_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_10_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_10_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_10_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_10_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_10_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_10_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_10_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_10_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_10_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_10_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_10_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_10_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_10_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_10_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_10_BASIC CONFIG_USE_LV_FONT_SYMBOL_10_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_10_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_10_FILE
|
||||
# define USE_LV_FONT_SYMBOL_10_FILE CONFIG_USE_LV_FONT_SYMBOL_10_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_10_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_10_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_10_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_10_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_10_FEEDBACK 0
|
||||
#endif
|
||||
|
||||
/* Size 20 */
|
||||
|
||||
#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
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_20_SUP
|
||||
# define USE_LV_FONT_DEJAVU_20_SUP CONFIG_USE_LV_FONT_DEJAVU_20_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_20_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_20_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_20_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_20_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_20_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_20_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_20_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_20_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_20_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_20_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_20_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_20_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_20_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_20_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_20_BASIC CONFIG_USE_LV_FONT_SYMBOL_20_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_20_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_20_FILE
|
||||
# define USE_LV_FONT_SYMBOL_20_FILE CONFIG_USE_LV_FONT_SYMBOL_20_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_20_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_20_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_20_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_20_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_20_FEEDBACK 0
|
||||
#endif
|
||||
|
||||
/* Size 30 */
|
||||
|
||||
#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
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_30_SUP
|
||||
# define USE_LV_FONT_DEJAVU_30_SUP CONFIG_USE_LV_FONT_DEJAVU_30_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_30_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_30_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_30_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_30_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_30_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_30_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_30_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_30_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_30_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_30_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_30_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_30_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_30_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_30_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_30_BASIC CONFIG_USE_LV_FONT_SYMBOL_30_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_30_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_30_FILE
|
||||
# define USE_LV_FONT_SYMBOL_30_FILE CONFIG_USE_LV_FONT_SYMBOL_30_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_30_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_30_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_30_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_30_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_30_FEEDBACK 0
|
||||
#endif
|
||||
|
||||
/*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
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_40_SUP
|
||||
# define USE_LV_FONT_DEJAVU_40_SUP CONFIG_USE_LV_FONT_DEJAVU_40_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_40_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_40_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_40_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_40_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_40_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_40_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_40_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_40_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_40_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_40_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_40_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_40_BASIC CONFIG_USE_LV_FONT_SYMBOL_40_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_40_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_40_FILE
|
||||
# define USE_LV_FONT_SYMBOL_40_FILE CONFIG_USE_LV_FONT_SYMBOL_40_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_40_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_40_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_40_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_40_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_40_FEEDBACK 0
|
||||
#endif
|
||||
|
||||
/* Size 60 */
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_60
|
||||
# define USE_LV_FONT_DEJAVU_60 CONFIG_USE_LV_FONT_DEJAVU_60
|
||||
# if USE_LV_FONT_DEJAVU_60
|
||||
# define LV_FONT_DEFAULT &lv_font_dejavu_60
|
||||
# endif
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_60 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_60_SUP
|
||||
# define USE_LV_FONT_DEJAVU_60_SUP CONFIG_USE_LV_FONT_DEJAVU_60_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_60_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_60_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_60_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_60_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_60_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_60_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_60_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_60_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_60_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_60_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_60_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_60_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_60_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_60_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_60_BASIC CONFIG_USE_LV_FONT_SYMBOL_60_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_60_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_60_FILE
|
||||
# define USE_LV_FONT_SYMBOL_60_FILE CONFIG_USE_LV_FONT_SYMBOL_60_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_60_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_60_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_60_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_60_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_60_FEEDBACK 0
|
||||
#endif
|
||||
|
||||
/* Size 80 */
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_80
|
||||
# define USE_LV_FONT_DEJAVU_80 CONFIG_USE_LV_FONT_DEJAVU_80
|
||||
# if USE_LV_FONT_DEJAVU_80
|
||||
# define LV_FONT_DEFAULT &lv_font_dejavu_80
|
||||
# endif
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_80 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_80_SUP
|
||||
# define USE_LV_FONT_DEJAVU_80_SUP CONFIG_USE_LV_FONT_DEJAVU_80_SUP
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_80_SUP 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_80_LATIN_EXT_A
|
||||
# define USE_LV_FONT_DEJAVU_80_LATIN_EXT_A CONFIG_USE_LV_FONT_DEJAVU_80_LATIN_EXT_A
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_80_LATIN_EXT_A 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_80_LATIN_EXT_B
|
||||
# define USE_LV_FONT_DEJAVU_80_LATIN_EXT_B CONFIG_USE_LV_FONT_DEJAVU_80_LATIN_EXT_B
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_80_LATIN_EXT_B 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_DEJAVU_80_CYRILLIC
|
||||
# define USE_LV_FONT_DEJAVU_80_CYRILLIC CONFIG_USE_LV_FONT_DEJAVU_80_CYRILLIC
|
||||
#else
|
||||
# define USE_LV_FONT_DEJAVU_80_CYRILLIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_80_BASIC
|
||||
# define USE_LV_FONT_SYMBOL_80_BASIC CONFIG_USE_LV_FONT_SYMBOL_80_BASIC
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_80_BASIC 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_80_FILE
|
||||
# define USE_LV_FONT_SYMBOL_80_FILE CONFIG_USE_LV_FONT_SYMBOL_80_FILE
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_80_FILE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_LV_FONT_SYMBOL_80_FEEDBACK
|
||||
# define USE_LV_FONT_SYMBOL_80_FEEDBACK CONFIG_USE_LV_FONT_SYMBOL_80_FEEDBACK
|
||||
#else
|
||||
# define USE_LV_FONT_SYMBOL_80_FEEDBACK 0
|
||||
#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
|
||||
*/
|
||||
|
||||
#define LV_OBJ_FREE_NUM_TYPE int
|
||||
|
||||
#ifdef CONFIG_LV_OBJ_FREE_PTR
|
||||
# define LV_OBJ_FREE_PTR CONFIG_LV_OBJ_FREE_PTR
|
||||
#else
|
||||
# define LV_OBJ_FREE_PTR 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
|
||||
#else
|
||||
# define USE_LV_LABEL 0
|
||||
#endif
|
||||
|
||||
/* Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT,
|
||||
* UFS)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USE_LV_IMG
|
||||
# define USE_LV_IMG CONFIG_USE_LV_IMG
|
||||
#else
|
||||
# define USE_LV_IMG 0
|
||||
#endif
|
||||
|
||||
/* Line (dependencies: - */
|
||||
|
||||
#ifdef CONFIG_USE_LV_LINE
|
||||
# define USE_LV_LINE CONFIG_USE_LV_LINE
|
||||
#else
|
||||
# define USE_LV_LINE 0
|
||||
#endif
|
||||
|
||||
/* Container objects */
|
||||
/* Container (dependencies: - */
|
||||
|
||||
#ifdef CONFIG_USE_LV_CONT
|
||||
# define USE_LV_CONT CONFIG_USE_LV_CONT
|
||||
#else
|
||||
# define USE_LV_CONT 0
|
||||
#endif
|
||||
|
||||
/* Page (dependencies: lv_cont) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_PAGE
|
||||
# define USE_LV_PAGE CONFIG_USE_LV_PAGE
|
||||
#else
|
||||
# define USE_LV_PAGE 0
|
||||
#endif
|
||||
|
||||
/* Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_WIN
|
||||
# define USE_LV_WIN CONFIG_USE_LV_WIN
|
||||
#else
|
||||
# define USE_LV_WIN 0
|
||||
#endif
|
||||
|
||||
/* Tab (dependencies: lv_page, lv_btnm) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_TABVIEW
|
||||
# define USE_LV_TABVIEW CONFIG_USE_LV_TABVIEW
|
||||
#else
|
||||
# define USE_LV_TABVIEW 0
|
||||
#endif
|
||||
|
||||
/* Data visualizer objects */
|
||||
/* Bar (dependencies: -) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_BAR
|
||||
# define USE_LV_BAR CONFIG_USE_LV_BAR
|
||||
#else
|
||||
# define USE_LV_BAR 0
|
||||
#endif
|
||||
|
||||
/* Line meter (dependencies: bar; misc: trigo) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_LMETER
|
||||
# define USE_LV_LMETER CONFIG_USE_LV_LMETER
|
||||
#else
|
||||
# define USE_LV_LMETER 0
|
||||
#endif
|
||||
|
||||
/* Gauge (dependencies:bar, lmeter; misc: trigo) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_GAUGE
|
||||
# define USE_LV_GAUGE CONFIG_USE_LV_GAUGE
|
||||
#else
|
||||
# define USE_LV_GAUGE 0
|
||||
#endif
|
||||
|
||||
/* Chart (dependencies: -) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_CHART
|
||||
# define USE_LV_CHART CONFIG_USE_LV_CHART
|
||||
#else
|
||||
# define USE_LV_CHART 0
|
||||
#endif
|
||||
|
||||
/* LED (dependencies: -) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_LED
|
||||
# define USE_LV_LED CONFIG_USE_LV_LED
|
||||
#else
|
||||
# define USE_LV_LED 0
|
||||
#endif
|
||||
|
||||
/* Message box (dependencies: lv_rect, lv_btnm, lv_label) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_MBOX
|
||||
# define USE_LV_MBOX CONFIG_USE_LV_MBOX
|
||||
#else
|
||||
# define USE_LV_MBOX 0
|
||||
#endif
|
||||
|
||||
/* Text area (dependencies: lv_label, lv_page) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_TA
|
||||
# define USE_LV_TA CONFIG_USE_LV_TA
|
||||
#else
|
||||
# define USE_LV_TA 0
|
||||
#endif
|
||||
|
||||
/* User input objects */
|
||||
/* Button (dependencies: lv_cont */
|
||||
|
||||
#ifdef CONFIG_USE_LV_BTN
|
||||
# define USE_LV_BTN CONFIG_USE_LV_BTN
|
||||
#else
|
||||
# define USE_LV_BTN 0
|
||||
#endif
|
||||
|
||||
/* Button matrix (dependencies: -) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_BTNM
|
||||
# define USE_LV_BTNM CONFIG_USE_LV_BTNM
|
||||
#else
|
||||
# define USE_LV_BTNM 0
|
||||
#endif
|
||||
|
||||
/* Keyboard (dependencies: lv_btnm) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_KB
|
||||
# define USE_LV_KB CONFIG_USE_LV_KB
|
||||
#else
|
||||
# define USE_LV_KB 0
|
||||
#endif
|
||||
|
||||
/* Check box (dependencies: lv_btn, lv_label) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_CB
|
||||
# define USE_LV_CB CONFIG_USE_LV_CB
|
||||
#else
|
||||
# define USE_LV_CB 0
|
||||
#endif
|
||||
|
||||
/* Switch (dependencies: lv_slider) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_SW
|
||||
# define USE_LV_SW CONFIG_USE_LV_SW
|
||||
#else
|
||||
# define USE_LV_SW 0
|
||||
#endif
|
||||
|
||||
/* List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for
|
||||
* icons))
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_USE_LV_LIST
|
||||
# define USE_LV_LIST CONFIG_USE_LV_LIST
|
||||
#else
|
||||
# define USE_LV_LIST 0
|
||||
#endif
|
||||
|
||||
/* Drop down list (dependencies: lv_page, lv_label) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_DDLIST
|
||||
# define USE_LV_DDLIST CONFIG_USE_LV_DDLIST
|
||||
#else
|
||||
# define USE_LV_DDLIST 0
|
||||
#endif
|
||||
|
||||
/* Roller (dependencies: lv_ddlist) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_ROLLER
|
||||
# define USE_LV_ROLLER CONFIG_USE_LV_ROLLER
|
||||
#else
|
||||
# define USE_LV_ROLLER 0
|
||||
#endif
|
||||
|
||||
/* Slider (dependencies: lv_bar) */
|
||||
|
||||
#ifdef CONFIG_USE_LV_SLIDER
|
||||
# define USE_LV_SLIDER CONFIG_USE_LV_SLIDER
|
||||
#else
|
||||
# define USE_LV_SLIDER 0
|
||||
#endif
|
||||
|
||||
#endif /*__APPS_GRAPHICS_LITTLEVGL_LV_CONF_H*/
|
2
include/graphics/.gitignore
vendored
Normal file
2
include/graphics/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/lvgl.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user