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

Commit fd0c472

Browse files
committed
WIP: just add lvgl6.1
1 parent ee758d0 commit fd0c472

File tree

122 files changed

+23115
-11002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+23115
-11002
lines changed

src/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<p align="center">
33
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
44
<a href="https://github.com/littlevgl/lvgl/releases/tag/v6.0"><img src="https://img.shields.io/badge/version-6.0-blue.svg"></a>
5-
<br>
5+
</p>
6+
7+
<p align="center">
68
<img src="https://littlevgl.com/github/cover_ori_reduced_2.gif">
79
</p>
810

@@ -81,7 +83,7 @@ Choose a project with your favourite IDE:
8183
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
8284
|-------------|-------------|---------------|-----------|------------|
8385
| [![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) |
84-
| Cross-platform<br>with SDL | Native Windows | Cross-platform<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
86+
| 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 |
8587

8688

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

9294
1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library
9395
2. Copy the `lvgl` folder into your project
94-
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`.
96+
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`.
9597
4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions.
9698
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.
9799
6. Call `lv_init()`
@@ -130,7 +132,7 @@ indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*
130132
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
131133
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
132134

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

187189
You can create a new style like this:
188190
```c
189-
static lv_style_t style1; /*Declare a new style. Should be `static`*/
190-
lv_style_copy(&style1, &lv_style_plain); /*Copy a buil-in style*/
191+
static lv_style_t style1; /*Declare a new style. Should be `static`*/
192+
lv_style_copy(&style1, &lv_style_plain); /*Copy a built-in style*/
191193
style1.body.main_color = LV_COLOR_RED; /*Main color*/
192194
style1.body.grad_color = lv_color_hex(0xffd83c) /*Gradient color (orange)*/
193195
style1.body.radius = 3;

src/docs/CODING_STYLE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
## File format
3-
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)
3+
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)
44

55
## Naming conventions
66
* Words are separated by '_'

src/library.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "lvgl",
3+
"version": "6.0.2",
4+
"keywords": "graphics, gui, embedded, littlevgl",
5+
"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.",
6+
"repository":
7+
{
8+
"type": "git",
9+
"url": "https://github.com/littlevgl/lvgl.git"
10+
},
11+
"build": {
12+
"includeDir": "."
13+
}
14+
}

src/lv_conf_template.h

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
/*Images pixels with this color will not be drawn (with chroma keying)*/
4444
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
4545

46+
/* Enable chroma keying for indexed images. */
47+
#define LV_INDEXED_CHROMA 1
48+
4649
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
4750
#define LV_ANTIALIAS 1
4851

@@ -193,6 +196,14 @@ typedef void * lv_img_decoder_user_data_t;
193196
* font's bitmaps */
194197
#define LV_ATTRIBUTE_LARGE_CONST
195198

199+
/* Export integer constant to binding.
200+
* This macro is used with constants in the form of LV_<CONST> that
201+
* should also appear on lvgl binding API such as Micropython
202+
*
203+
* The default value just prevents a GCC warning.
204+
*/
205+
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
206+
196207
/*===================
197208
* HAL settings
198209
*==================*/
@@ -225,10 +236,46 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
225236
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
226237

227238
/* 1: Print the log with 'printf';
228-
* 0: user need to register a callback with `lv_log_register_print`*/
239+
* 0: user need to register a callback with `lv_log_register_print_cb`*/
229240
# define LV_LOG_PRINTF 0
230241
#endif /*LV_USE_LOG*/
231242

243+
/*=================
244+
* Debug settings
245+
*================*/
246+
247+
/* If Debug is enabled LittelvGL validates the parameters of the functions.
248+
* If an invalid parameter is found an error log message is printed and
249+
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
250+
* If you are debugging the MCU you can pause
251+
* the debugger to see exactly where the issue is.
252+
*
253+
* The behavior of asserts can be overwritten by redefining them here.
254+
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
255+
*/
256+
#define LV_USE_DEBUG 1
257+
#if LV_USE_DEBUG
258+
259+
/*Check if the parameter is NULL. (Quite fast) */
260+
#define LV_USE_ASSERT_NULL 1
261+
262+
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
263+
#define LV_USE_ASSERT_MEM 1
264+
265+
/* Check the strings.
266+
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
267+
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
268+
#define LV_USE_ASSERT_STR 0
269+
270+
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
271+
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
272+
#define LV_USE_ASSERT_OBJ 0
273+
274+
/*Check if the styles are properly initialized. (Fast)*/
275+
#define LV_USE_ASSERT_STYLE 1
276+
277+
#endif /*LV_USE_DEBUG*/
278+
232279
/*================
233280
* THEME USAGE
234281
*================*/
@@ -260,6 +307,10 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
260307
#define LV_FONT_ROBOTO_22 0
261308
#define LV_FONT_ROBOTO_28 0
262309

310+
/* Demonstrate special features */
311+
#define LV_FONT_ROBOTO_12_SUBPX 1
312+
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/
313+
263314
/*Pixel perfect monospace font
264315
* http://pelulamu.net/unscii/ */
265316
#define LV_FONT_UNSCII_8 0
@@ -280,6 +331,12 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
280331
* but with > 10,000 characters if you see issues probably you need to enable it.*/
281332
#define LV_FONT_FMT_TXT_LARGE 0
282333

334+
/* Set the pixel order of the display.
335+
* Important only if "subpx fonts" are used.
336+
* With "normal" font it doesn't matter.
337+
*/
338+
#define LV_FONT_SUBPX_BGR 0
339+
283340
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
284341
typedef void * lv_font_user_data_t;
285342

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

357+
/* If a word is at least this long, will break wherever "prettiest"
358+
* To disable, set to a value <= 0 */
359+
#define LV_TXT_LINE_BREAK_LONG_LEN 12
360+
361+
/* Minimum number of characters in a long word to put on a line before a break.
362+
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
363+
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
364+
365+
/* Minimum number of characters in a long word to put on a line after a break.
366+
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
367+
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
368+
369+
/* The control character to use for signalling text recoloring. */
370+
#define LV_TXT_COLOR_CMD "#"
371+
372+
/* Support bidirectional texts.
373+
* Allows mixing Left-to-Right and Right-to-Left texts.
374+
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
375+
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
376+
#define LV_USE_BIDI 0
377+
#if LV_USE_BIDI
378+
/* Set the default direction. Supported values:
379+
* `LV_BIDI_DIR_LTR` Left-to-Right
380+
* `LV_BIDI_DIR_RTL` Right-to-Left
381+
* `LV_BIDI_DIR_AUTO` detect texts base direction */
382+
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
383+
#endif
384+
385+
/*Change the built in (v)snprintf functions*/
386+
#define LV_SPRINTF_CUSTOM 0
387+
#if LV_SPRINTF_CUSTOM
388+
# define LV_SPRINTF_INCLUDE <stdio.h>
389+
# define lv_snprintf snprintf
390+
# define lv_vsnprintf vsnprintf
391+
#endif /*LV_SPRINTF_CUSTOM*/
392+
300393
/*===================
301394
* LV_OBJ SETTINGS
302395
*==================*/
@@ -355,6 +448,9 @@ typedef void * lv_obj_user_data_t;
355448
/*Container (dependencies: -*/
356449
#define LV_USE_CONT 1
357450

451+
/*Color picker (dependencies: -*/
452+
#define LV_USE_CPICKER 1
453+
358454
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
359455
#define LV_USE_DDLIST 1
360456
#if LV_USE_DDLIST != 0

src/lvgl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ extern "C" {
2525

2626
#include "src/lv_core/lv_obj.h"
2727
#include "src/lv_core/lv_group.h"
28+
#include "src/lv_core/lv_indev.h"
2829

2930
#include "src/lv_core/lv_refr.h"
3031
#include "src/lv_core/lv_disp.h"
32+
#include "src/lv_core/lv_debug.h"
3133

3234
#include "src/lv_themes/lv_theme.h"
3335

3436
#include "src/lv_font/lv_font.h"
3537
#include "src/lv_font/lv_font_fmt_txt.h"
38+
#include "src/lv_misc/lv_bidi.h"
39+
#include "src/lv_misc/lv_printf.h"
3640

3741
#include "src/lv_objx/lv_btn.h"
3842
#include "src/lv_objx/lv_imgbtn.h"
@@ -45,6 +49,7 @@ extern "C" {
4549
#include "src/lv_objx/lv_chart.h"
4650
#include "src/lv_objx/lv_table.h"
4751
#include "src/lv_objx/lv_cb.h"
52+
#include "src/lv_objx/lv_cpicker.h"
4853
#include "src/lv_objx/lv_bar.h"
4954
#include "src/lv_objx/lv_slider.h"
5055
#include "src/lv_objx/lv_led.h"

src/lvgl.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk
2+
include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk
3+
include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk
4+
include $(LVGL_DIR)/lvgl/src/lv_font/lv_font.mk
5+
include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk
6+
include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk
7+
include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk
8+
Binary file not shown.

src/scripts/built_in_font/built_in_font_gen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
compr = ""
4141

4242
#Built in symbols
43-
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"
43+
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"
4444

4545
#Run the command
46-
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)
46+
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)
4747
os.system(cmd)

src/scripts/lv_conf_checker.py

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3.6
2+
13
'''
24
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
35
'''
@@ -34,9 +36,11 @@
3436
if '/*--END OF LV_CONF_H--*/' in i: break
3537

3638
r = re.search(r'^ *# *define ([^\s]+).*$', i)
39+
3740
if r:
41+
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
3842
fout.write(
39-
f'#ifndef {r[1]}\n'
43+
f'#ifndef {line}\n'
4044
f'{i}\n'
4145
'#endif\n'
4246
)

0 commit comments

Comments
 (0)