Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #30 from Pablo2048/feature/lvgl6.1
Browse files Browse the repository at this point in the history
Feature/lvgl6.1
  • Loading branch information
Pablo2048 authored Dec 27, 2019
2 parents ee758d0 + 3ae9a78 commit 0e11c3a
Show file tree
Hide file tree
Showing 130 changed files with 23,241 additions and 11,131 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This library allows to use LittlevGL (v6.x) as an Arduino library. Library can b

There is simple example which uses https://github.com/Bodmer/TFT_eSPI library as an TFT driver to simplify testing. To get all this to work you have to setup TFT_eSPI to work with your TFT display type via editing the `User_Setup.h` file in TFT_eSPI library folder, or by selecting your own configurtion in the `User_Setup_Select.h` file in TFT_eSPI library folder.

LittlevGL library has its own configuration file in `lv_conf.h` file, which is locatd in LittlevGL library folder. Please get in mind to check that corresponding resolutions in LVGL configuration match the ones in TFT_eSPI and with physical resolution of your display.
LittlevGL library has its own configuration file in `lv_conf.h` file, which is locatd in LittlevGL library folder. Please get in mind to check that the corresponding resolutions in LVGL configuration match the ones in TFT_eSPI and with the physical resolution of your display.

Example result should look like this:

Expand All @@ -21,7 +21,7 @@ Tested with:

## Debugging

In case of trouble there are debug information inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug information to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:
In case of trouble there are debug informations inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug informations to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:

```c
/*Log settings*/
Expand All @@ -36,4 +36,4 @@ In case of trouble there are debug information inside LVGL. In the `ESP32_TFT_eS
# define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
```
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to he `Serial` port @ 115200 Bd. After each line sent there is 100ms delay to allow the serial transfer to finish. This delay can be commented out in `my_print` method.
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to the `Serial` port @ 115200 Bd. After each line sent there is 100ms delay to allow the serial transfer to finish. This delay can be commented out in `my_print` method.
2 changes: 1 addition & 1 deletion examples/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void setup() {

/* Create simple label */
lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "Hello Arduino! (V6.0)");
lv_label_set_text(label, "Hello Arduino! (V6.1)");
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
}

Expand Down
6 changes: 3 additions & 3 deletions examples/ESP32_TFT_eSPI_Slider/Setup.ino
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void setup() {

/* Create simple label */
lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "Hello Arduino! (V6.0)");
lv_label_set_text(label, "Hello Arduino! (V6.1)");
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, -50);

/* Create a slider in the center of the display */
Expand All @@ -68,12 +68,12 @@ void setup() {
lv_obj_set_height(slider, 50);
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/
lv_obj_set_event_cb(slider, slider_event_cb); /*Assign an event function*/

/* Create a label below the slider */
slider_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(slider_label, "0");
lv_obj_set_auto_realign(slider, true);
lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);

}

2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/littlevgl/arduino"
},
"version": "2.0.3",
"version": "2.1.4",
"license": "MIT",
"frameworks": "arduino",
"build": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=lv_arduino
version=2.0.3
version=2.1.4
author=Gabor Kiss-Vamosi
maintainer=Pavel Brychta <[email protected]>
sentence=Full-featured Graphics Library for embedded systems
Expand Down
14 changes: 8 additions & 6 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<p align="center">
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
<a href="https://github.com/littlevgl/lvgl/releases/tag/v6.0"><img src="https://img.shields.io/badge/version-6.0-blue.svg"></a>
<br>
</p>

<p align="center">
<img src="https://littlevgl.com/github/cover_ori_reduced_2.gif">
</p>

Expand Down Expand Up @@ -81,7 +83,7 @@ Choose a project with your favourite IDE:
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|-------------|-------------|---------------|-----------|------------|
| [![Eclipse](https://littlevgl.com/logo/ide/eclipse.jpg)](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [![CodeBlocks](https://littlevgl.com/logo/ide/codeblocks.jpg)](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [![VisualStudio](https://littlevgl.com/logo/ide/visualstudio.jpg)](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [![PlatformIO](https://littlevgl.com/logo/ide/platformio.jpg)](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [![QtCreator](https://littlevgl.com/logo/ide/qtcreator.jpg)](https://blog.littlevgl.com/2019-01-03/qt-creator) |
| Cross-platform<br>with SDL | Native Windows | Cross-platform<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
| Cross-platform<br>with SDL<br>(Recommended on<br>Linux and Mac) | Native Windows | Windows<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |


## Add LittlevGL to your project
Expand All @@ -91,7 +93,7 @@ You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-s

1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library
2. Copy the `lvgl` folder into your project
3. Copy `lvgl/lv_conf_templ.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`.
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`.
4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions.
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL.
6. Call `lv_init()`
Expand Down Expand Up @@ -130,7 +132,7 @@ indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/

bool my_touchpad_read(lv_indev_t * indev, lv_indev_data_t * data)
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
Expand Down Expand Up @@ -186,8 +188,8 @@ Styles can be assigned to the objects to changed their appearance. A style descr

You can create a new style like this:
```c
static lv_style_t style1; /*Declare a new style. Should be `static`*/
lv_style_copy(&style1, &lv_style_plain); /*Copy a buil-in style*/
static lv_style_t style1; /*Declare a new style. Should be `static`*/
lv_style_copy(&style1, &lv_style_plain); /*Copy a built-in style*/
style1.body.main_color = LV_COLOR_RED; /*Main color*/
style1.body.grad_color = lv_color_hex(0xffd83c) /*Gradient color (orange)*/
style1.body.radius = 3;
Expand Down
2 changes: 1 addition & 1 deletion src/docs/CODING_STYLE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

## File format
Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/lv_misc/lv_templ.h)
Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.h)

## Naming conventions
* Words are separated by '_'
Expand Down
14 changes: 14 additions & 0 deletions src/library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "lvgl",
"version": "6.1.1",
"keywords": "graphics, gui, embedded, littlevgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository":
{
"type": "git",
"url": "https://github.com/littlevgl/lvgl.git"
},
"build": {
"includeDir": "."
}
}
98 changes: 97 additions & 1 deletion src/lv_conf_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
/*Images pixels with this color will not be drawn (with chroma keying)*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/

/* Enable chroma keying for indexed images. */
#define LV_INDEXED_CHROMA 1

/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#define LV_ANTIALIAS 1

Expand Down Expand Up @@ -193,6 +196,14 @@ typedef void * lv_img_decoder_user_data_t;
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST

/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning

/*===================
* HAL settings
*==================*/
Expand Down Expand Up @@ -225,10 +236,46 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN

/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print`*/
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/

/*=================
* Debug settings
*================*/

/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG

/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1

/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1

/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0

/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0

/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 1

#endif /*LV_USE_DEBUG*/

/*================
* THEME USAGE
*================*/
Expand Down Expand Up @@ -260,6 +307,10 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
#define LV_FONT_ROBOTO_22 0
#define LV_FONT_ROBOTO_28 0

/* Demonstrate special features */
#define LV_FONT_ROBOTO_12_SUBPX 1
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/

/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
Expand All @@ -280,6 +331,12 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 0

/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0

/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_font_user_data_t;

Expand All @@ -297,6 +354,42 @@ typedef void * lv_font_user_data_t;
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"

/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 12

/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3

/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3

/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"

/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif

/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#endif /*LV_SPRINTF_CUSTOM*/

/*===================
* LV_OBJ SETTINGS
*==================*/
Expand Down Expand Up @@ -355,6 +448,9 @@ typedef void * lv_obj_user_data_t;
/*Container (dependencies: -*/
#define LV_USE_CONT 1

/*Color picker (dependencies: -*/
#define LV_USE_CPICKER 1

/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DDLIST 1
#if LV_USE_DDLIST != 0
Expand Down
5 changes: 5 additions & 0 deletions src/lvgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ extern "C" {

#include "src/lv_core/lv_obj.h"
#include "src/lv_core/lv_group.h"
#include "src/lv_core/lv_indev.h"

#include "src/lv_core/lv_refr.h"
#include "src/lv_core/lv_disp.h"
#include "src/lv_core/lv_debug.h"

#include "src/lv_themes/lv_theme.h"

#include "src/lv_font/lv_font.h"
#include "src/lv_font/lv_font_fmt_txt.h"
#include "src/lv_misc/lv_bidi.h"
#include "src/lv_misc/lv_printf.h"

#include "src/lv_objx/lv_btn.h"
#include "src/lv_objx/lv_imgbtn.h"
Expand All @@ -45,6 +49,7 @@ extern "C" {
#include "src/lv_objx/lv_chart.h"
#include "src/lv_objx/lv_table.h"
#include "src/lv_objx/lv_cb.h"
#include "src/lv_objx/lv_cpicker.h"
#include "src/lv_objx/lv_bar.h"
#include "src/lv_objx/lv_slider.h"
#include "src/lv_objx/lv_led.h"
Expand Down
8 changes: 8 additions & 0 deletions src/lvgl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk
include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk
include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk
include $(LVGL_DIR)/lvgl/src/lv_font/lv_font.mk
include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk
include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk
include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk

Binary file not shown.
4 changes: 2 additions & 2 deletions src/scripts/built_in_font/built_in_font_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
compr = ""

#Built in symbols
syms = "61441,61448,61451,61452,61453,61457,61459,61460,61461,61465,61468,61473,61478,61479,61480,61502,61504,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62099"
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"

#Run the command
cmd = "lv_font_conv {} --bpp {} --size {} --font ./Roboto-Regular.woff -r {} --font FontAwesome.ttf -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
cmd = "lv_font_conv {} --bpp {} --size {} --font Roboto-Regular.woff -r {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output)
os.system(cmd)
6 changes: 5 additions & 1 deletion src/scripts/lv_conf_checker.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3.6

'''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
Expand Down Expand Up @@ -34,9 +36,11 @@
if '/*--END OF LV_CONF_H--*/' in i: break

r = re.search(r'^ *# *define ([^\s]+).*$', i)

if r:
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
fout.write(
f'#ifndef {r[1]}\n'
f'#ifndef {line}\n'
f'{i}\n'
'#endif\n'
)
Expand Down
Loading

0 comments on commit 0e11c3a

Please sign in to comment.