Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5bacff2fa | ||
|
|
5a6da9a2ef | ||
|
|
d99ea10213 | ||
|
|
5566935a5d | ||
|
|
b947465da1 | ||
|
|
d44b8d47d3 | ||
|
|
96e0de063a | ||
|
|
81ec2d1b10 | ||
|
|
55d05c2eb3 | ||
|
|
e236cf7f73 | ||
|
|
38cf5c0b3e | ||
|
|
e2183750f2 | ||
|
|
c55b165150 | ||
|
|
50b5e3c477 | ||
|
|
1b3e1c4331 | ||
|
|
3f36139469 | ||
|
|
125e6e95f6 | ||
|
|
c683a3612d | ||
|
|
50594851f6 | ||
|
|
a2685363e8 | ||
|
|
8b7ffccd64 | ||
|
|
81884401d2 | ||
|
|
b87d16fc6e | ||
|
|
b1c43d329d | ||
|
|
710ec7d417 | ||
|
|
176eb9fd46 | ||
|
|
a6150ea78f | ||
|
|
35c7197d1c | ||
|
|
15e692d596 | ||
|
|
1ab87eda09 | ||
|
|
804c3c7994 | ||
|
|
0596088544 | ||
|
|
85bd12a794 | ||
|
|
4613811c45 | ||
|
|
03c3838605 | ||
|
|
fb6e7deadf | ||
|
|
d941461052 | ||
|
|
3d32290ee4 | ||
|
|
6932b6c1da | ||
|
|
6d7bd355ed | ||
|
|
1906a623fb | ||
|
|
ca9c36e081 | ||
|
|
b7baa01bc1 | ||
|
|
5ee4d14788 | ||
|
|
5d02b27b1f | ||
|
|
eb7f0d8eeb | ||
|
|
d4e40fce63 | ||
|
|
6e000c97f8 | ||
|
|
8df8700bed | ||
|
|
c17f2f7e84 | ||
|
|
c3953f478f | ||
|
|
cb5faa64ac | ||
|
|
832000ad34 | ||
|
|
6772ceb7e2 | ||
|
|
d9afdb5316 | ||
|
|
350269c3d4 | ||
|
|
7ca806ddff | ||
|
|
c8be0df768 | ||
|
|
36433c2144 | ||
|
|
2224ce95cb | ||
|
|
9a2d2b5392 | ||
|
|
3ea4418727 | ||
|
|
12b1f1f590 | ||
|
|
a1f47e9051 | ||
|
|
ff357db938 | ||
|
|
2f26d0a511 | ||
|
|
5f35e46be8 | ||
|
|
75a0a5e6d6 | ||
|
|
fef3a069d6 | ||
|
|
24c2921c21 | ||
|
|
001fabbb18 | ||
|
|
41d093ea76 | ||
|
|
8990544b42 | ||
|
|
148e6d12fd | ||
|
|
187f4be2ee | ||
|
|
6023bb4372 |
42
.github/workflows/build_micropython.yml
vendored
Normal file
42
.github/workflows/build_micropython.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
name: Build Micropython with LVGL submodule
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install SDL
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||||
|
sudo apt-get update -y -qq
|
||||||
|
sudo apt-get install libsdl2-dev
|
||||||
|
- name: Clone lv_micropython
|
||||||
|
run: git clone https://github.com/lvgl/lv_micropython.git .
|
||||||
|
- name: Update submodules
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
- name: Checkout LVGL submodule
|
||||||
|
working-directory: ./lib/lv_bindings/lvgl
|
||||||
|
run: |
|
||||||
|
git fetch --force ${{ github.event.repository.git_url }} "+refs/heads/*:refs/remotes/origin/*"
|
||||||
|
git fetch --force ${{ github.event.repository.git_url }} "+refs/pull/*/head:refs/remotes/origin/pr/*"
|
||||||
|
git checkout ${{ github.sha }} || git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
|
git submodule update --init --recursive
|
||||||
|
- name: Build mpy-cross
|
||||||
|
run: make -j $(nproc) -C mpy-cross
|
||||||
|
- name: Build the unix port
|
||||||
|
run: make -j $(nproc) -C ports/unix
|
||||||
|
- name: Run advanced_demo
|
||||||
|
run: >
|
||||||
|
echo "import gc,utime;
|
||||||
|
utime.sleep(5);
|
||||||
|
gc.collect();
|
||||||
|
utime.sleep(5)" |
|
||||||
|
ports/unix/micropython -i lib/lv_bindings/examples/advanced_demo.py
|
||||||
|
|
||||||
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,5 +1,21 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v7.5.0 (planned at 15.09.2020)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
- Add `clean_dcache_cb` and `lv_disp_clean_dcache` to enable users to use their own cache management function
|
||||||
|
- Add `gpu_wait_cb` to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed.
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- Fix unexpeted DEFOCUS on lv_page when clicking to bg after the scrollable
|
||||||
|
- Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion.
|
||||||
|
- Adjust button matrix button width to include padding when spanning multiple units.
|
||||||
|
- Add rounding to btnmatrix line height calculation
|
||||||
|
- Add `decmopr_buf` to GC roots
|
||||||
|
- Fix divisioin by zero in draw_pattern (lv_draw_rect.c) if the image or letter is not found
|
||||||
|
- Fix drawing images with 1 px height or width
|
||||||
|
- Fix selectiion of options with non-ASCII letters in dropdown list
|
||||||
|
|
||||||
## v7.4.0 (01.09.2020)
|
## v7.4.0 (01.09.2020)
|
||||||
|
|
||||||
The main new features of v7.4 are run-time font loading, style caching and arc knob with value setting by click.
|
The main new features of v7.4 are run-time font loading, style caching and arc knob with value setting by click.
|
||||||
@@ -10,7 +26,7 @@ The main new features of v7.4 are run-time font loading, style caching and arc k
|
|||||||
- Add style caching to reduce acces time of properties with default value
|
- Add style caching to reduce acces time of properties with default value
|
||||||
- arc: add set value by click feature
|
- arc: add set value by click feature
|
||||||
- arc: add `LV_ARC_PART_KNOB` similarly to slider
|
- arc: add `LV_ARC_PART_KNOB` similarly to slider
|
||||||
- send gestures even is the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function.
|
- send gestures even if the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Fix color bleeding on border drawing
|
- Fix color bleeding on border drawing
|
||||||
|
|||||||
@@ -12,23 +12,27 @@ Planned to September/October 2020
|
|||||||
- Support "elastic" scrolling when scrolled in
|
- Support "elastic" scrolling when scrolled in
|
||||||
- Support scroll chaining among any objects types (not only `lv_pages`s)
|
- Support scroll chaining among any objects types (not only `lv_pages`s)
|
||||||
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
|
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
|
||||||
- Add snapping?
|
- Add snapping
|
||||||
|
- Add snap stop to scroll max 1 snap point
|
||||||
- Already working
|
- Already working
|
||||||
- New layouts:
|
- New layouts:
|
||||||
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
|
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
|
||||||
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
|
- [CSS Grid](https://css-tricks.com/snippets/css/a-guide-to-grid/)-like layout support
|
||||||
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
|
|
||||||
- Work in progress
|
- Work in progress
|
||||||
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
|
||||||
- Work in progress
|
- Work in progress
|
||||||
- Remove the align parameter from `lv_canvas_draw_text`
|
- Remove the align parameter from `lv_canvas_draw_text`
|
||||||
|
- RGB888 support [#1722](https://github.com/lvgl/lvgl/issues/1722)
|
||||||
|
|
||||||
|
## v8.1
|
||||||
|
- Add radio button widget
|
||||||
|
|
||||||
## v9
|
## v9
|
||||||
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
|
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).7
|
||||||
|
|
||||||
## Ideas
|
|
||||||
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
|
||||||
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
|
||||||
|
|
||||||
|
## Ideas
|
||||||
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
|
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
|
||||||
- Optmize font decompression
|
- Optmize font decompression
|
||||||
- Switch to RGBA colors in styles
|
- Switch to RGBA colors in styles
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ void lv_port_disp_init(void)
|
|||||||
* Create a buffer for drawing
|
* Create a buffer for drawing
|
||||||
*----------------------------*/
|
*----------------------------*/
|
||||||
|
|
||||||
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
|
/* LVGL requires a buffer where it internally draws the widgets.
|
||||||
|
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your dispay.
|
||||||
|
* The buffer has to be greater than 1 display row
|
||||||
*
|
*
|
||||||
* There are three buffering configurations:
|
* There are three buffering configurations:
|
||||||
* 1. Create ONE buffer with some rows:
|
* 1. Create ONE buffer with some rows:
|
||||||
@@ -73,21 +75,21 @@ void lv_port_disp_init(void)
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
/* Example for 1) */
|
/* Example for 1) */
|
||||||
static lv_disp_buf_t disp_buf_1;
|
static lv_disp_buf_t draw_buf_dsc_1;
|
||||||
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
static lv_color_t draw_buf_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||||
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
lv_disp_buf_init(&draw_buf_dsc_1, draw_buf_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||||
|
|
||||||
/* Example for 2) */
|
/* Example for 2) */
|
||||||
static lv_disp_buf_t disp_buf_2;
|
static lv_disp_buf_t draw_buf_dsc_2;
|
||||||
static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
|
||||||
static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
|
||||||
lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
lv_disp_buf_init(&draw_buf_dsc_2, draw_buf_2_1, draw_buf_2_1, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
|
||||||
|
|
||||||
/* Example for 3) */
|
/* Example for 3) */
|
||||||
static lv_disp_buf_t disp_buf_3;
|
static lv_disp_buf_t draw_buf_dsc_3;
|
||||||
static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
|
||||||
static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
|
||||||
lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
lv_disp_buf_init(&draw_buf_dsc_3, draw_buf_3_1, draw_buf_3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------
|
/*-----------------------------------
|
||||||
@@ -107,7 +109,7 @@ void lv_port_disp_init(void)
|
|||||||
disp_drv.flush_cb = disp_flush;
|
disp_drv.flush_cb = disp_flush;
|
||||||
|
|
||||||
/*Set a display buffer*/
|
/*Set a display buffer*/
|
||||||
disp_drv.buffer = &disp_buf_2;
|
disp_drv.buffer = &draw_buf_dsc_1;
|
||||||
|
|
||||||
#if LV_USE_GPU
|
#if LV_USE_GPU
|
||||||
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
|
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lvgl",
|
"name": "lvgl",
|
||||||
"version": "7.4.0",
|
"version": "7.5.0",
|
||||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||||
"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.",
|
"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": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name=lvgl
|
name=lvgl
|
||||||
version=7.4.0
|
version=7.5.0
|
||||||
author=kisvegabor
|
author=kisvegabor
|
||||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||||
sentence=Full-featured Graphics Library for Embedded Systems
|
sentence=Full-featured Graphics Library for Embedded Systems
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file lv_conf.h
|
* @file lv_conf.h
|
||||||
* Configuration file for v7.4.0-dev
|
* Configuration file for v7.5.0-dev
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -653,7 +653,7 @@ typedef void * lv_obj_user_data_t;
|
|||||||
* 1: Some extra precision
|
* 1: Some extra precision
|
||||||
* 2: Best precision
|
* 2: Best precision
|
||||||
*/
|
*/
|
||||||
# define LV_LINEMETER_PRECISE 0
|
# define LV_LINEMETER_PRECISE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Mask (dependencies: -)*/
|
/*Mask (dependencies: -)*/
|
||||||
@@ -687,9 +687,6 @@ typedef void * lv_obj_user_data_t;
|
|||||||
# define LV_ROLLER_INF_PAGES 7
|
# define LV_ROLLER_INF_PAGES 7
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Rotary (dependencies: lv_arc, lv_btn)*/
|
|
||||||
#define LV_USE_ROTARY 1
|
|
||||||
|
|
||||||
/*Slider (dependencies: lv_bar)*/
|
/*Slider (dependencies: lv_bar)*/
|
||||||
#define LV_USE_SLIDER 1
|
#define LV_USE_SLIDER 1
|
||||||
|
|
||||||
|
|||||||
2
lvgl.h
2
lvgl.h
@@ -15,7 +15,7 @@ extern "C" {
|
|||||||
* CURRENT VERSION OF LVGL
|
* CURRENT VERSION OF LVGL
|
||||||
***************************/
|
***************************/
|
||||||
#define LVGL_VERSION_MAJOR 7
|
#define LVGL_VERSION_MAJOR 7
|
||||||
#define LVGL_VERSION_MINOR 4
|
#define LVGL_VERSION_MINOR 5
|
||||||
#define LVGL_VERSION_PATCH 0
|
#define LVGL_VERSION_PATCH 0
|
||||||
#define LVGL_VERSION_INFO ""
|
#define LVGL_VERSION_INFO ""
|
||||||
|
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ def publish_master():
|
|||||||
cmd("git checkout dev")
|
cmd("git checkout dev")
|
||||||
cmd("git merge master -X theirs")
|
cmd("git merge master -X theirs")
|
||||||
cmd("git add .")
|
cmd("git add .")
|
||||||
cmd("git commit -am 'Merge master'")
|
cmd("git commit -am 'Merge master'", False)
|
||||||
cmd("git push origin dev")
|
cmd("git push origin dev")
|
||||||
cmd("git checkout master")
|
cmd("git checkout master")
|
||||||
os.chdir("../")
|
os.chdir("../")
|
||||||
@@ -323,7 +323,7 @@ def publish_master():
|
|||||||
|
|
||||||
pub_cmd = "git push origin latest; git push origin " + ver_str
|
pub_cmd = "git push origin latest; git push origin " + ver_str
|
||||||
cmd("cd docs; " + pub_cmd)
|
cmd("cd docs; " + pub_cmd)
|
||||||
cmd("cd docs; git checkout master; ./update.py " + release_br)
|
cmd("cd docs; git checkout master; python 2.7 ./update.py " + release_br)
|
||||||
|
|
||||||
pub_cmd = "git push origin master"
|
pub_cmd = "git push origin master"
|
||||||
cmd("cd blog; " + pub_cmd)
|
cmd("cd blog; " + pub_cmd)
|
||||||
@@ -384,9 +384,9 @@ def lvgl_update_dev_version():
|
|||||||
os.chdir("./lvgl")
|
os.chdir("./lvgl")
|
||||||
|
|
||||||
cmd("git checkout dev")
|
cmd("git checkout dev")
|
||||||
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
|
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver_major))
|
||||||
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
|
define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver_minor))
|
||||||
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
|
define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver_patch))
|
||||||
define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"")
|
define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"")
|
||||||
|
|
||||||
templ = fnmatch.filter(os.listdir('.'), '*templ*')
|
templ = fnmatch.filter(os.listdir('.'), '*templ*')
|
||||||
@@ -418,7 +418,7 @@ def publish_dev_and_master():
|
|||||||
pub_cmd = "git checkout master; git push origin master"
|
pub_cmd = "git checkout master; git push origin master"
|
||||||
cmd("cd lvgl; " + pub_cmd)
|
cmd("cd lvgl; " + pub_cmd)
|
||||||
|
|
||||||
cmd("cd docs; git checkout master; ./update.py latest dev")
|
cmd("cd docs; git checkout master; python 2.7 ./update.py latest dev")
|
||||||
|
|
||||||
def projs_update():
|
def projs_update():
|
||||||
global proj_list, release_br, ver_str
|
global proj_list, release_br, ver_str
|
||||||
@@ -509,9 +509,9 @@ if __name__ == '__main__':
|
|||||||
ver_minor = "0"
|
ver_minor = "0"
|
||||||
ver_patch = "0"
|
ver_patch = "0"
|
||||||
|
|
||||||
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
|
dev_ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev"
|
||||||
|
|
||||||
print("Prepare minor version " + ver_str)
|
print("Prepare minor version " + dev_ver_str)
|
||||||
|
|
||||||
merge_to_dev()
|
merge_to_dev()
|
||||||
merge_from_dev()
|
merge_from_dev()
|
||||||
|
|||||||
@@ -990,7 +990,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
|||||||
* 2: Best precision
|
* 2: Best precision
|
||||||
*/
|
*/
|
||||||
#ifndef LV_LINEMETER_PRECISE
|
#ifndef LV_LINEMETER_PRECISE
|
||||||
# define LV_LINEMETER_PRECISE 0
|
# define LV_LINEMETER_PRECISE 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1047,11 +1047,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Rotary (dependencies: lv_arc, lv_btn)*/
|
|
||||||
#ifndef LV_USE_ROTARY
|
|
||||||
#define LV_USE_ROTARY 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*Slider (dependencies: lv_bar)*/
|
/*Slider (dependencies: lv_bar)*/
|
||||||
#ifndef LV_USE_SLIDER
|
#ifndef LV_USE_SLIDER
|
||||||
#define LV_USE_SLIDER 1
|
#define LV_USE_SLIDER 1
|
||||||
|
|||||||
@@ -352,6 +352,21 @@ void lv_disp_trig_activity(lv_disp_t * disp)
|
|||||||
disp->last_activity_time = lv_tick_get();
|
disp->last_activity_time = lv_tick_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean any CPU cache that is related to the display.
|
||||||
|
* @param disp pointer to an display (NULL to use the default display)
|
||||||
|
*/
|
||||||
|
void lv_disp_clean_dcache(lv_disp_t * disp)
|
||||||
|
{
|
||||||
|
if(!disp) disp = lv_disp_get_default();
|
||||||
|
if(!disp) {
|
||||||
|
LV_LOG_WARN("lv_disp_clean_dcache: no display registered");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(disp->driver.clean_dcache_cb)
|
||||||
|
disp->driver.clean_dcache_cb(&disp->driver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a pointer to the screen refresher task to
|
* Get a pointer to the screen refresher task to
|
||||||
|
|||||||
@@ -133,6 +133,12 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
|
|||||||
*/
|
*/
|
||||||
void lv_disp_trig_activity(lv_disp_t * disp);
|
void lv_disp_trig_activity(lv_disp_t * disp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean any CPU cache that is related to the display.
|
||||||
|
* @param disp pointer to an display (NULL to use the default display)
|
||||||
|
*/
|
||||||
|
void lv_disp_clean_dcache(lv_disp_t * disp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a pointer to the screen refresher task to
|
* Get a pointer to the screen refresher task to
|
||||||
* modify its parameters with `lv_task_...` functions.
|
* modify its parameters with `lv_task_...` functions.
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
|||||||
|
|
||||||
if(g->frozen != 0) return;
|
if(g->frozen != 0) return;
|
||||||
|
|
||||||
if(obj == *g->obj_focus) return;
|
if(g->obj_focus != NULL && obj == *g->obj_focus) return;
|
||||||
|
|
||||||
/*On defocus edit mode must be leaved*/
|
/*On defocus edit mode must be leaved*/
|
||||||
lv_group_set_editing(g, false);
|
lv_group_set_editing(g, false);
|
||||||
@@ -332,9 +332,9 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
|
|||||||
focused->signal_cb(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
|
focused->signal_cb(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/
|
||||||
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
|
||||||
if(res != LV_RES_OK) return;
|
if(res != LV_RES_OK) return;
|
||||||
}
|
|
||||||
|
|
||||||
lv_obj_invalidate(focused);
|
lv_obj_invalidate(focused);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1181,9 +1181,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
|||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1222,9 +1222,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
|||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||||
if(indev_reset_check(proc)) return;
|
if(indev_reset_check(proc)) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ static void obj_del_core(lv_obj_t * obj);
|
|||||||
static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop);
|
static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop);
|
||||||
static void update_style_cache_children(lv_obj_t * obj);
|
static void update_style_cache_children(lv_obj_t * obj);
|
||||||
static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -392,6 +393,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
|||||||
|
|
||||||
new_obj->protect = copy->protect;
|
new_obj->protect = copy->protect;
|
||||||
new_obj->gesture_parent = copy->gesture_parent;
|
new_obj->gesture_parent = copy->gesture_parent;
|
||||||
|
new_obj->focus_parent = copy->focus_parent;
|
||||||
|
|
||||||
#if LV_USE_GROUP
|
#if LV_USE_GROUP
|
||||||
/*Add to the same group*/
|
/*Add to the same group*/
|
||||||
@@ -485,13 +487,9 @@ void lv_obj_clean(lv_obj_t * obj)
|
|||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||||
lv_obj_t * child_next;
|
|
||||||
while(child) {
|
while(child) {
|
||||||
/* Read the next child before deleting the current
|
|
||||||
* because the next couldn't be read from a deleted (invalid) node*/
|
|
||||||
child_next = lv_obj_get_child(obj, child);
|
|
||||||
lv_obj_del(child);
|
lv_obj_del(child);
|
||||||
child = child_next;
|
child = lv_obj_get_child(obj, NULL); /*Get the new first child*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +984,7 @@ void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_
|
|||||||
|
|
||||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||||
|
|
||||||
obj_align_core(obj, base, align, true, false, 0, y_ofs);
|
obj_align_core(obj, base, align, false, true, 0, y_ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1060,7 +1058,7 @@ void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
|
|||||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
|
||||||
obj_align_mid_core(obj, base, align, true, false, 0, y_ofs);
|
obj_align_mid_core(obj, base, align, false, true, 0, y_ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1674,8 +1672,8 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
|||||||
#else
|
#else
|
||||||
lv_state_t prev_state = obj->state;
|
lv_state_t prev_state = obj->state;
|
||||||
obj->state = new_state;
|
obj->state = new_state;
|
||||||
|
|
||||||
uint8_t part;
|
uint8_t part;
|
||||||
|
|
||||||
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
|
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
|
||||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||||
if(style_list == NULL) break; /*No more style lists*/
|
if(style_list == NULL) break; /*No more style lists*/
|
||||||
@@ -1724,8 +1722,6 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
|||||||
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3709,17 +3705,13 @@ static void obj_del_core(lv_obj_t * obj)
|
|||||||
|
|
||||||
/*Recursively delete the children*/
|
/*Recursively delete the children*/
|
||||||
lv_obj_t * i;
|
lv_obj_t * i;
|
||||||
lv_obj_t * i_next;
|
|
||||||
i = _lv_ll_get_head(&(obj->child_ll));
|
i = _lv_ll_get_head(&(obj->child_ll));
|
||||||
while(i != NULL) {
|
while(i != NULL) {
|
||||||
/*Get the next object before delete this*/
|
/*Call the recursive delete to the child too*/
|
||||||
i_next = _lv_ll_get_next(&(obj->child_ll), i);
|
|
||||||
|
|
||||||
/*Call the recursive del to the child too*/
|
|
||||||
obj_del_core(i);
|
obj_del_core(i);
|
||||||
|
|
||||||
/*Set i to the next node*/
|
/*Set i to the new head node*/
|
||||||
i = i_next;
|
i = _lv_ll_get_head(&(obj->child_ll));
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_event_mark_deleted(obj);
|
lv_event_mark_deleted(obj);
|
||||||
@@ -3822,8 +3814,21 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
|
|||||||
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||||
|
|
||||||
lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN);
|
lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN);
|
||||||
|
/* If it has border make the clip area 1 px smaller to avoid color bleeding
|
||||||
|
* The border will cover the minimal issue on the edges*/
|
||||||
|
if(draw_dsc.border_post && draw_dsc.border_opa >= LV_OPA_MIN && draw_dsc.border_width > 0) {
|
||||||
|
lv_area_t cc_area;
|
||||||
|
cc_area.x1 = obj->coords.x1 + 1;
|
||||||
|
cc_area.y1 = obj->coords.y1 + 1;
|
||||||
|
cc_area.x2 = obj->coords.x2 - 1;
|
||||||
|
cc_area.y2 = obj->coords.y2 - 1;
|
||||||
|
lv_draw_mask_radius_init(mp, &cc_area, r, false);
|
||||||
|
}
|
||||||
|
/*If no border use the full size.*/
|
||||||
|
else {
|
||||||
lv_draw_mask_radius_init(mp, &obj->coords, r, false);
|
lv_draw_mask_radius_init(mp, &obj->coords, r, false);
|
||||||
|
}
|
||||||
|
|
||||||
/*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/
|
/*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/
|
||||||
lv_draw_mask_add(mp, obj + 8);
|
lv_draw_mask_add(mp, obj + 8);
|
||||||
}
|
}
|
||||||
@@ -4665,4 +4670,3 @@ static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_proper
|
|||||||
child = lv_obj_get_child(obj, child);
|
child = lv_obj_get_child(obj, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -746,6 +746,8 @@ static void lv_refr_vdb_flush(void)
|
|||||||
|
|
||||||
/*Flush the rendered content to the display*/
|
/*Flush the rendered content to the display*/
|
||||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||||
|
if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||||
|
|
||||||
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
|
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
|
||||||
|
|
||||||
if(vdb->buf1 && vdb->buf2) {
|
if(vdb->buf1 && vdb->buf2) {
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_
|
|||||||
const lv_area_t * disp_area = &vdb->area;
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
lv_color_t * disp_buf = vdb->buf_act;
|
lv_color_t * disp_buf = vdb->buf_act;
|
||||||
|
|
||||||
|
if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||||
|
|
||||||
/* Get clipped fill area which is the real draw area.
|
/* Get clipped fill area which is the real draw area.
|
||||||
* It is always the same or inside `fill_area` */
|
* It is always the same or inside `fill_area` */
|
||||||
@@ -212,6 +213,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
|||||||
const lv_area_t * disp_area = &vdb->area;
|
const lv_area_t * disp_area = &vdb->area;
|
||||||
lv_color_t * disp_buf = vdb->buf_act;
|
lv_color_t * disp_buf = vdb->buf_act;
|
||||||
|
|
||||||
|
if(disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver);
|
||||||
|
|
||||||
/* Now `draw_area` has absolute coordinates.
|
/* Now `draw_area` has absolute coordinates.
|
||||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||||
draw_area.x1 -= disp_area->x1;
|
draw_area.x1 -= disp_area->x1;
|
||||||
|
|||||||
@@ -1229,6 +1229,9 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Can't draw zero sized images*/
|
||||||
|
if(img_w == 0 || img_h == 0) return;
|
||||||
|
|
||||||
lv_area_t coords_tmp;
|
lv_area_t coords_tmp;
|
||||||
|
|
||||||
if(dsc->pattern_repeat) {
|
if(dsc->pattern_repeat) {
|
||||||
|
|||||||
@@ -11,10 +11,15 @@
|
|||||||
#include "../lv_misc/lv_debug.h"
|
#include "../lv_misc/lv_debug.h"
|
||||||
#include "../lv_draw/lv_draw.h"
|
#include "../lv_draw/lv_draw.h"
|
||||||
#include "../lv_misc/lv_types.h"
|
#include "../lv_misc/lv_types.h"
|
||||||
|
#include "../lv_misc/lv_gc.h"
|
||||||
#include "../lv_misc/lv_log.h"
|
#include "../lv_misc/lv_log.h"
|
||||||
#include "../lv_misc/lv_utils.h"
|
#include "../lv_misc/lv_utils.h"
|
||||||
#include "../lv_misc/lv_mem.h"
|
#include "../lv_misc/lv_mem.h"
|
||||||
|
|
||||||
|
#if defined(LV_GC_INCLUDE)
|
||||||
|
#include LV_GC_INCLUDE
|
||||||
|
#endif /* LV_ENABLE_GC */
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@@ -47,7 +52,6 @@ static inline uint8_t rle_next(void);
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static uint8_t * decompr_buf;
|
|
||||||
static uint32_t rle_rdp;
|
static uint32_t rle_rdp;
|
||||||
static const uint8_t * rle_in;
|
static const uint8_t * rle_in;
|
||||||
static uint8_t rle_bpp;
|
static uint8_t rle_bpp;
|
||||||
@@ -109,16 +113,17 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_lv_mem_get_size(decompr_buf) < buf_size) {
|
if(_lv_mem_get_size(LV_GC_ROOT(_lv_font_decompr_buf)) < buf_size) {
|
||||||
decompr_buf = lv_mem_realloc(decompr_buf, buf_size);
|
LV_GC_ROOT(_lv_font_decompr_buf) = lv_mem_realloc(LV_GC_ROOT(_lv_font_decompr_buf), buf_size);
|
||||||
LV_ASSERT_MEM(decompr_buf);
|
LV_ASSERT_MEM(LV_GC_ROOT(_lv_font_decompr_buf));
|
||||||
if(decompr_buf == NULL) return NULL;
|
if(LV_GC_ROOT(_lv_font_decompr_buf) == NULL) return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
|
bool prefilter = fdsc->bitmap_format == LV_FONT_FMT_TXT_COMPRESSED ? true : false;
|
||||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp,
|
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], LV_GC_ROOT(_lv_font_decompr_buf), gdsc->box_w, gdsc->box_h,
|
||||||
|
(uint8_t)fdsc->bpp,
|
||||||
prefilter);
|
prefilter);
|
||||||
return decompr_buf;
|
return LV_GC_ROOT(_lv_font_decompr_buf);
|
||||||
#else /* !LV_USE_FONT_COMPRESSED */
|
#else /* !LV_USE_FONT_COMPRESSED */
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -184,9 +189,9 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
|
|||||||
*/
|
*/
|
||||||
void _lv_font_clean_up_fmt_txt(void)
|
void _lv_font_clean_up_fmt_txt(void)
|
||||||
{
|
{
|
||||||
if(decompr_buf) {
|
if(LV_GC_ROOT(_lv_font_decompr_buf)) {
|
||||||
lv_mem_free(decompr_buf);
|
lv_mem_free(LV_GC_ROOT(_lv_font_decompr_buf));
|
||||||
decompr_buf = NULL;
|
LV_GC_ROOT(_lv_font_decompr_buf) = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
#include "lv_gpu_stm32_dma2d.h"
|
#include "lv_gpu_stm32_dma2d.h"
|
||||||
|
#include "../lv_core/lv_disp.h"
|
||||||
#include "../lv_core/lv_refr.h"
|
#include "../lv_core/lv_refr.h"
|
||||||
|
|
||||||
#if LV_USE_GPU_STM32_DMA2D
|
#if LV_USE_GPU_STM32_DMA2D
|
||||||
@@ -216,11 +217,10 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
|||||||
|
|
||||||
static void invalidate_cache(void)
|
static void invalidate_cache(void)
|
||||||
{
|
{
|
||||||
#if __DCACHE_PRESENT
|
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||||
if(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) {
|
if(disp->driver.clean_dcache_cb) disp->driver.clean_dcache_cb(&disp->driver);
|
||||||
|
else
|
||||||
SCB_CleanInvalidateDCache();
|
SCB_CleanInvalidateDCache();
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dma2d_wait(void)
|
static void dma2d_wait(void)
|
||||||
|
|||||||
@@ -111,7 +111,14 @@ typedef struct _disp_drv_t {
|
|||||||
* User can execute very simple tasks here or yield the task */
|
* User can execute very simple tasks here or yield the task */
|
||||||
void (*wait_cb)(struct _disp_drv_t * disp_drv);
|
void (*wait_cb)(struct _disp_drv_t * disp_drv);
|
||||||
|
|
||||||
|
/** OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned */
|
||||||
|
void (*clean_dcache_cb)(struct _disp_drv_t * disp_drv);
|
||||||
|
|
||||||
|
/** OPTIONAL: called to wait while the gpu is working */
|
||||||
|
void (*gpu_wait_cb)(struct _disp_drv_t * disp_drv);
|
||||||
|
|
||||||
#if LV_USE_GPU
|
#if LV_USE_GPU
|
||||||
|
|
||||||
/** OPTIONAL: Blend two memories using opacity (GPU only)*/
|
/** OPTIONAL: Blend two memories using opacity (GPU only)*/
|
||||||
void (*gpu_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length,
|
void (*gpu_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length,
|
||||||
lv_opa_t opa);
|
lv_opa_t opa);
|
||||||
|
|||||||
@@ -596,8 +596,29 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
|||||||
return (uint8_t)(bright >> 3);
|
return (uint8_t)(bright >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if defined(__cplusplus) && !defined(_LV_COLOR_HAS_MODERN_CPP)
|
||||||
/* Fix of msvc 2019 compiler error C4576 inside C++ code */
|
/**
|
||||||
|
* MSVC compiler's definition of the __cplusplus indicating 199711L regardless to C++ standard version
|
||||||
|
* see https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-cplusplus
|
||||||
|
* so we use _MSC_VER macro unstead of __cplusplus
|
||||||
|
*/
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 1900 /* Visual Studio 2015 */
|
||||||
|
#define _LV_COLOR_HAS_MODERN_CPP 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
#define _LV_COLOR_HAS_MODERN_CPP 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#ifndef _LV_COLOR_HAS_MODERN_CPP
|
||||||
|
#define _LV_COLOR_HAS_MODERN_CPP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _LV_COLOR_HAS_MODERN_CPP
|
||||||
|
/* Fix msvc compiler error C4576 inside C++ code */
|
||||||
#define _LV_COLOR_MAKE_TYPE_HELPER lv_color_t
|
#define _LV_COLOR_MAKE_TYPE_HELPER lv_color_t
|
||||||
#else
|
#else
|
||||||
#define _LV_COLOR_MAKE_TYPE_HELPER (lv_color_t)
|
#define _LV_COLOR_MAKE_TYPE_HELPER (lv_color_t)
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ extern "C" {
|
|||||||
f(void * , _lv_theme_template_styles) \
|
f(void * , _lv_theme_template_styles) \
|
||||||
f(void * , _lv_theme_mono_styles) \
|
f(void * , _lv_theme_mono_styles) \
|
||||||
f(void * , _lv_theme_empty_styles) \
|
f(void * , _lv_theme_empty_styles) \
|
||||||
|
f(uint8_t *, _lv_font_decompr_buf) \
|
||||||
|
|
||||||
|
|
||||||
#define LV_DEFINE_ROOT(root_type, root_name) root_type root_name;
|
#define LV_DEFINE_ROOT(root_type, root_name) root_type root_name;
|
||||||
#define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT)
|
#define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT)
|
||||||
|
|||||||
@@ -109,9 +109,6 @@ typedef enum {
|
|||||||
#if LV_USE_ROLLER
|
#if LV_USE_ROLLER
|
||||||
LV_THEME_ROLLER,
|
LV_THEME_ROLLER,
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_ROTARY
|
|
||||||
LV_THEME_ROTARY,
|
|
||||||
#endif
|
|
||||||
#if LV_USE_SLIDER
|
#if LV_USE_SLIDER
|
||||||
LV_THEME_SLIDER,
|
LV_THEME_SLIDER,
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
|
|||||||
static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_arc_part_t part);
|
static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_arc_part_t part);
|
||||||
static void get_center(lv_obj_t * arc, lv_point_t * center, lv_coord_t * arc_r);
|
static void get_center(lv_obj_t * arc, lv_point_t * center, lv_coord_t * arc_r);
|
||||||
static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area);
|
static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area);
|
||||||
|
static void value_update(lv_obj_t * arc);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@@ -87,6 +88,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->min_value = 0;
|
ext->min_value = 0;
|
||||||
ext->max_value = 100;
|
ext->max_value = 100;
|
||||||
ext->dragging = false;
|
ext->dragging = false;
|
||||||
|
ext->adjustable = false;
|
||||||
ext->chg_rate = 540;
|
ext->chg_rate = 540;
|
||||||
ext->last_tick = lv_tick_get();
|
ext->last_tick = lv_tick_get();
|
||||||
ext->last_angle = ext->arc_angle_end;
|
ext->last_angle = ext->arc_angle_end;
|
||||||
@@ -119,6 +121,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->min_value = copy_ext->min_value;
|
ext->min_value = copy_ext->min_value;
|
||||||
ext->max_value = copy_ext->max_value;
|
ext->max_value = copy_ext->max_value;
|
||||||
ext->dragging = copy_ext->dragging;
|
ext->dragging = copy_ext->dragging;
|
||||||
|
ext->adjustable = copy_ext->adjustable;
|
||||||
ext->chg_rate = copy_ext->chg_rate;
|
ext->chg_rate = copy_ext->chg_rate;
|
||||||
ext->last_tick = copy_ext->last_tick;
|
ext->last_tick = copy_ext->last_tick;
|
||||||
ext->last_angle = copy_ext->last_angle;
|
ext->last_angle = copy_ext->last_angle;
|
||||||
@@ -397,36 +400,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
|||||||
if(ext->cur_value == new_value) return;
|
if(ext->cur_value == new_value) return;
|
||||||
ext->cur_value = new_value;
|
ext->cur_value = new_value;
|
||||||
|
|
||||||
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
value_update(arc);
|
||||||
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
|
||||||
|
|
||||||
int16_t angle;
|
|
||||||
switch(ext->type) {
|
|
||||||
case LV_ARC_TYPE_SYMMETRIC:
|
|
||||||
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
|
||||||
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
|
||||||
|
|
||||||
if(ext->cur_value < range_midpoint) {
|
|
||||||
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
|
||||||
lv_arc_set_start_angle(arc, angle);
|
|
||||||
lv_arc_set_end_angle(arc, bg_midpoint);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
|
||||||
lv_arc_set_start_angle(arc, bg_midpoint);
|
|
||||||
lv_arc_set_end_angle(arc, angle);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LV_ARC_TYPE_REVERSE:
|
|
||||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
|
||||||
lv_arc_set_start_angle(arc, angle);
|
|
||||||
break;
|
|
||||||
default: /** LV_ARC_TYPE_NORMAL*/
|
|
||||||
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
|
||||||
lv_arc_set_start_angle(arc, ext->bg_angle_start);
|
|
||||||
lv_arc_set_end_angle(arc, angle);
|
|
||||||
}
|
|
||||||
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -452,7 +426,7 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max)
|
|||||||
ext->cur_value = max;
|
ext->cur_value = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_arc_set_value(arc, ext->cur_value);
|
value_update(arc); /* value has changed relative to the new range */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -469,6 +443,24 @@ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t rate)
|
|||||||
ext->chg_rate = rate;
|
ext->chg_rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the arc is adjustable.
|
||||||
|
* @param arc pointer to a arc object
|
||||||
|
* @param adjustable whether the arc has a knob that can be dragged
|
||||||
|
*/
|
||||||
|
void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable)
|
||||||
|
{
|
||||||
|
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||||
|
if(ext->adjustable == adjustable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ext->adjustable = adjustable;
|
||||||
|
if(!adjustable)
|
||||||
|
ext->dragging = false;
|
||||||
|
lv_obj_invalidate(arc);
|
||||||
|
}
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
@@ -596,6 +588,19 @@ lv_arc_type_t lv_arc_get_type(const lv_obj_t * arc)
|
|||||||
return ext->type;
|
return ext->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the arc is adjustable.
|
||||||
|
* @param arc pointer to a arc object
|
||||||
|
* @return whether the arc has a knob that can be dragged
|
||||||
|
*/
|
||||||
|
bool lv_arc_get_adjustable(lv_obj_t * arc)
|
||||||
|
{
|
||||||
|
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||||
|
|
||||||
|
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||||
|
return ext->adjustable;
|
||||||
|
}
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Other functions
|
* Other functions
|
||||||
*====================*/
|
*====================*/
|
||||||
@@ -666,6 +671,7 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
|||||||
&arc_dsc);
|
&arc_dsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ext->adjustable) {
|
||||||
lv_area_t knob_area;
|
lv_area_t knob_area;
|
||||||
get_knob_area(arc, ¢er, arc_r, &knob_area);
|
get_knob_area(arc, ¢er, arc_r, &knob_area);
|
||||||
|
|
||||||
@@ -674,6 +680,7 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
|||||||
lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc);
|
lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc);
|
||||||
|
|
||||||
lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc);
|
lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*Post draw when the children are drawn*/
|
/*Post draw when the children are drawn*/
|
||||||
@@ -709,6 +716,9 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
|||||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||||
|
|
||||||
if(sign == LV_SIGNAL_PRESSING) {
|
if(sign == LV_SIGNAL_PRESSING) {
|
||||||
|
/* Only adjustable arcs can be dragged */
|
||||||
|
if(!ext->adjustable) return res;
|
||||||
|
|
||||||
lv_indev_t * indev = lv_indev_get_act();
|
lv_indev_t * indev = lv_indev_get_act();
|
||||||
if(indev == NULL) return res;
|
if(indev == NULL) return res;
|
||||||
|
|
||||||
@@ -804,6 +814,8 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_CONTROL) {
|
else if(sign == LV_SIGNAL_CONTROL) {
|
||||||
|
if(!ext->adjustable) return res;
|
||||||
|
|
||||||
char c = *((char *)param);
|
char c = *((char *)param);
|
||||||
|
|
||||||
int16_t old_value = ext->cur_value;
|
int16_t old_value = ext->cur_value;
|
||||||
@@ -1035,4 +1047,43 @@ static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t
|
|||||||
knob_area->y2 = center->y + knob_y + bottom_knob + indic_width_half;
|
knob_area->y2 = center->y + knob_y + bottom_knob + indic_width_half;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used internally to update arc angles after a value change
|
||||||
|
* @param arc pointer to a arc object
|
||||||
|
*/
|
||||||
|
static void value_update(lv_obj_t * arc)
|
||||||
|
{
|
||||||
|
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||||
|
|
||||||
|
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
||||||
|
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||||
|
|
||||||
|
int16_t angle;
|
||||||
|
switch(ext->type) {
|
||||||
|
case LV_ARC_TYPE_SYMMETRIC:
|
||||||
|
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
||||||
|
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||||
|
|
||||||
|
if(ext->cur_value < range_midpoint) {
|
||||||
|
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
||||||
|
lv_arc_set_start_angle(arc, angle);
|
||||||
|
lv_arc_set_end_angle(arc, bg_midpoint);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
||||||
|
lv_arc_set_start_angle(arc, bg_midpoint);
|
||||||
|
lv_arc_set_end_angle(arc, angle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LV_ARC_TYPE_REVERSE:
|
||||||
|
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||||
|
lv_arc_set_start_angle(arc, angle);
|
||||||
|
break;
|
||||||
|
default: /** LV_ARC_TYPE_NORMAL*/
|
||||||
|
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
|
||||||
|
lv_arc_set_end_angle(arc, angle);
|
||||||
|
}
|
||||||
|
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ typedef struct {
|
|||||||
int16_t max_value; /*Maximum value of the arc*/
|
int16_t max_value; /*Maximum value of the arc*/
|
||||||
uint16_t dragging : 1;
|
uint16_t dragging : 1;
|
||||||
uint16_t type : 2;
|
uint16_t type : 2;
|
||||||
|
uint16_t adjustable : 1;
|
||||||
uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/
|
uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/
|
||||||
uint32_t last_tick; /*Last dragging event timestamp of the arc*/
|
uint32_t last_tick; /*Last dragging event timestamp of the arc*/
|
||||||
int16_t last_angle; /*Last dragging angle of the arc*/
|
int16_t last_angle; /*Last dragging angle of the arc*/
|
||||||
@@ -167,6 +168,13 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max);
|
|||||||
*/
|
*/
|
||||||
void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold);
|
void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether the arc is adjustable.
|
||||||
|
* @param arc pointer to a arc object
|
||||||
|
* @param adjustable whether the arc has a knob that can be dragged
|
||||||
|
*/
|
||||||
|
void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable);
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
*====================*/
|
*====================*/
|
||||||
@@ -234,6 +242,13 @@ int16_t lv_arc_get_max_value(const lv_obj_t * arc);
|
|||||||
*/
|
*/
|
||||||
bool lv_arc_is_dragged(const lv_obj_t * arc);
|
bool lv_arc_is_dragged(const lv_obj_t * arc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether the arc is adjustable.
|
||||||
|
* @param arc pointer to a arc object
|
||||||
|
* @return whether the arc has a knob that can be dragged
|
||||||
|
*/
|
||||||
|
bool lv_arc_get_adjustable(lv_obj_t * arc);
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Other functions
|
* Other functions
|
||||||
*====================*/
|
*====================*/
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
lv_coord_t btn_h = max_h - ((line_cnt - 1) * inner);
|
lv_coord_t btn_h = max_h - ((line_cnt - 1) * inner);
|
||||||
btn_h = btn_h / line_cnt;
|
btn_h = (btn_h + line_cnt / 2) / line_cnt;
|
||||||
btn_h--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
|
btn_h--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
|
||||||
|
|
||||||
/* Count the units and the buttons in a line
|
/* Count the units and the buttons in a line
|
||||||
@@ -208,7 +208,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
|||||||
/*Only deal with the non empty lines*/
|
/*Only deal with the non empty lines*/
|
||||||
if(btn_cnt != 0) {
|
if(btn_cnt != 0) {
|
||||||
/*Calculate the width of all units*/
|
/*Calculate the width of all units*/
|
||||||
lv_coord_t all_unit_w = max_w - ((btn_cnt - 1) * inner);
|
lv_coord_t all_unit_w = max_w - ((unit_cnt - 1) * inner);
|
||||||
|
|
||||||
/*Set the button size and positions and set the texts*/
|
/*Set the button size and positions and set the texts*/
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
@@ -216,19 +216,20 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
|||||||
|
|
||||||
unit_act_cnt = 0;
|
unit_act_cnt = 0;
|
||||||
for(i = 0; i < btn_cnt; i++) {
|
for(i = 0; i < btn_cnt; i++) {
|
||||||
|
uint8_t btn_unit_w = get_button_width(ext->ctrl_bits[btn_i]);
|
||||||
/* one_unit_w = all_unit_w / unit_cnt
|
/* one_unit_w = all_unit_w / unit_cnt
|
||||||
* act_unit_w = one_unit_w * button_width
|
* act_unit_w = one_unit_w * button_width
|
||||||
* do this two operations but the multiply first to divide a greater number */
|
* do this two operations but the multiply first to divide a greater number */
|
||||||
lv_coord_t act_unit_w = (all_unit_w * get_button_width(ext->ctrl_bits[btn_i])) / unit_cnt;
|
lv_coord_t act_unit_w = (all_unit_w * btn_unit_w) / unit_cnt + inner * (btn_unit_w - 1);
|
||||||
act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/
|
act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/
|
||||||
|
|
||||||
/*Always recalculate act_x because of rounding errors */
|
/*Always recalculate act_x because of rounding errors */
|
||||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner;
|
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner;
|
||||||
act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1;
|
act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner +
|
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner +
|
||||||
left;
|
left;
|
||||||
}
|
}
|
||||||
/* Set the button's area.
|
/* Set the button's area.
|
||||||
@@ -243,7 +244,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
|
|||||||
lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h);
|
lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
unit_act_cnt += get_button_width(ext->ctrl_bits[btn_i]);
|
unit_act_cnt += btn_unit_w;
|
||||||
|
|
||||||
i_tot++;
|
i_tot++;
|
||||||
btn_i++;
|
btn_i++;
|
||||||
|
|||||||
@@ -1281,10 +1281,12 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t x, lv_coord_t y)
|
|||||||
y -= label->coords.y1;
|
y -= label->coords.y1;
|
||||||
uint32_t letter_i;
|
uint32_t letter_i;
|
||||||
|
|
||||||
|
const char * txt = lv_label_get_text(label);
|
||||||
|
|
||||||
lv_point_t p = {x, y};
|
lv_point_t p = {x, y};
|
||||||
letter_i = lv_label_get_letter_on(label, &p);
|
letter_i = lv_label_get_letter_on(label, &p);
|
||||||
|
uint32_t letter_i_byte_pos = _lv_txt_encoded_get_byte_id(txt, letter_i);
|
||||||
uint16_t opt = 0;
|
uint16_t opt = 0;
|
||||||
const char * txt = lv_label_get_text(label);
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
uint32_t i_prev = 0;
|
uint32_t i_prev = 0;
|
||||||
|
|
||||||
@@ -1293,7 +1295,7 @@ static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t x, lv_coord_t y)
|
|||||||
uint32_t letter = _lv_txt_encoded_next(txt, &i);
|
uint32_t letter = _lv_txt_encoded_next(txt, &i);
|
||||||
/*Count the lines to reach the clicked letter. But ignore the last '\n' because it
|
/*Count the lines to reach the clicked letter. But ignore the last '\n' because it
|
||||||
* still belongs to the clicked line*/
|
* still belongs to the clicked line*/
|
||||||
if(letter == '\n' && i_prev != letter_i) opt++;
|
if(letter == '\n' && i_prev != letter_i_byte_pos) opt++;
|
||||||
i_prev = i;
|
i_prev = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -706,10 +706,10 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
|||||||
coords_tmp.y1 = zommed_coords.y1;
|
coords_tmp.y1 = zommed_coords.y1;
|
||||||
coords_tmp.y2 = zommed_coords.y1 + ext->h - 1;
|
coords_tmp.y2 = zommed_coords.y1 + ext->h - 1;
|
||||||
|
|
||||||
for(; coords_tmp.y1 < zommed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
|
for(; coords_tmp.y1 <= zommed_coords.y2; coords_tmp.y1 += zoomed_src_h, coords_tmp.y2 += zoomed_src_h) {
|
||||||
coords_tmp.x1 = zommed_coords.x1;
|
coords_tmp.x1 = zommed_coords.x1;
|
||||||
coords_tmp.x2 = zommed_coords.x1 + ext->w - 1;
|
coords_tmp.x2 = zommed_coords.x1 + ext->w - 1;
|
||||||
for(; coords_tmp.x1 < zommed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
|
for(; coords_tmp.x1 <= zommed_coords.x2; coords_tmp.x1 += zoomed_src_w, coords_tmp.x2 += zoomed_src_w) {
|
||||||
lv_draw_img(&coords_tmp, &clip_real, ext->src, &img_dsc);
|
lv_draw_img(&coords_tmp, &clip_real, ext->src, &img_dsc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
|
|||||||
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const default_kb_map_spec[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n",
|
static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n",
|
||||||
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||||
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
|
||||||
|
|||||||
@@ -688,10 +688,14 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t char_id, lv_point_
|
|||||||
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
|
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
|
||||||
* Expressed in character index and not byte index (different in UTF-8)
|
* Expressed in character index and not byte index (different in UTF-8)
|
||||||
*/
|
*/
|
||||||
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos_in)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
|
||||||
LV_ASSERT_NULL(pos);
|
LV_ASSERT_NULL(pos_in);
|
||||||
|
|
||||||
|
lv_point_t pos;
|
||||||
|
pos.x = pos_in->x - lv_obj_get_style_pad_left(label, LV_LABEL_PART_MAIN);
|
||||||
|
pos.y = pos_in->y - lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN);
|
||||||
|
|
||||||
lv_area_t txt_coords;
|
lv_area_t txt_coords;
|
||||||
get_txt_coords(label, &txt_coords);
|
get_txt_coords(label, &txt_coords);
|
||||||
@@ -721,7 +725,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
|||||||
while(txt[line_start] != '\0') {
|
while(txt[line_start] != '\0') {
|
||||||
new_line_start += _lv_txt_get_next_line(&txt[line_start], font, letter_space, max_w, flag);
|
new_line_start += _lv_txt_get_next_line(&txt[line_start], font, letter_space, max_w, flag);
|
||||||
|
|
||||||
if(pos->y <= y + letter_height) {
|
if(pos.y <= y + letter_height) {
|
||||||
/*The line is found (stored in 'line_start')*/
|
/*The line is found (stored in 'line_start')*/
|
||||||
/* Include the NULL terminator in the last line */
|
/* Include the NULL terminator in the last line */
|
||||||
uint32_t tmp = new_line_start;
|
uint32_t tmp = new_line_start;
|
||||||
@@ -780,7 +784,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
|
|||||||
lv_coord_t gw = lv_font_get_glyph_width(font, letter, letter_next);
|
lv_coord_t gw = lv_font_get_glyph_width(font, letter, letter_next);
|
||||||
|
|
||||||
/*Finish if the x position or the last char of the next line is reached*/
|
/*Finish if the x position or the last char of the next line is reached*/
|
||||||
if(pos->x < x + (gw >> 1) || i + line_start == new_line_start || txt[i_act + line_start] == '\0') {
|
if(pos.x < x + gw || i + line_start == new_line_start || txt[i_act + line_start] == '\0') {
|
||||||
i = i_act;
|
i = i_act;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->line_cnt = 18;
|
ext->line_cnt = 18;
|
||||||
ext->scale_angle = 240;
|
ext->scale_angle = 240;
|
||||||
ext->angle_ofs = 0;
|
ext->angle_ofs = 0;
|
||||||
|
ext->mirrored = 0;
|
||||||
|
|
||||||
/*The signal and design functions are not copied so set them here*/
|
/*The signal and design functions are not copied so set them here*/
|
||||||
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
|
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
/*Init the new page object*/
|
/*Init the new page object*/
|
||||||
if(copy == NULL) {
|
if(copy == NULL) {
|
||||||
ext->scrl = lv_cont_create(page, NULL);
|
ext->scrl = lv_cont_create(page, NULL);
|
||||||
|
lv_obj_set_focus_parent(ext->scrl, true);
|
||||||
lv_obj_set_drag(ext->scrl, true);
|
lv_obj_set_drag(ext->scrl, true);
|
||||||
lv_obj_set_drag_throw(ext->scrl, true);
|
lv_obj_set_drag_throw(ext->scrl, true);
|
||||||
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
|
||||||
@@ -131,6 +132,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
lv_obj_set_signal_cb(page, lv_page_signal);
|
lv_obj_set_signal_cb(page, lv_page_signal);
|
||||||
lv_obj_set_design_cb(page, lv_page_design);
|
lv_obj_set_design_cb(page, lv_page_design);
|
||||||
|
|
||||||
|
|
||||||
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
|
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
|
||||||
|
|
||||||
lv_theme_apply(page, LV_THEME_PAGE);
|
lv_theme_apply(page, LV_THEME_PAGE);
|
||||||
@@ -1043,32 +1045,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sign == LV_SIGNAL_FOCUS) {
|
|
||||||
#if LV_USE_GROUP
|
|
||||||
if(lv_obj_get_group(page)) {
|
|
||||||
lv_group_focus_obj(page);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
|
|
||||||
if(res != LV_RES_OK) return res;
|
|
||||||
res = lv_event_send(page, LV_EVENT_FOCUSED, NULL);
|
|
||||||
if(res != LV_RES_OK) return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(sign == LV_SIGNAL_DEFOCUS) {
|
|
||||||
bool in_group = false;
|
|
||||||
#if LV_USE_GROUP
|
|
||||||
in_group = lv_obj_get_group(page) ? true : false;
|
|
||||||
#endif
|
|
||||||
if(in_group == false) {
|
|
||||||
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
|
|
||||||
if(res != LV_RES_OK) return res;
|
|
||||||
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
|
|
||||||
if(res != LV_RES_OK) return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||||
page_ext->scrl = NULL;
|
page_ext->scrl = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,10 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
|
|||||||
|
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
/*Auto hide characters*/
|
/*Auto hide characters*/
|
||||||
|
if(ext->pwd_show_time == 0) {
|
||||||
|
pwd_char_hider(ta);
|
||||||
|
}
|
||||||
|
else {
|
||||||
lv_anim_path_t path;
|
lv_anim_path_t path;
|
||||||
lv_anim_path_init(&path);
|
lv_anim_path_init(&path);
|
||||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||||
@@ -299,6 +303,7 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
|
|||||||
lv_anim_set_path(&a, &path);
|
lv_anim_set_path(&a, &path);
|
||||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
pwd_char_hider(ta);
|
pwd_char_hider(ta);
|
||||||
@@ -364,9 +369,14 @@ void lv_textarea_add_text(lv_obj_t * ta, const char * txt)
|
|||||||
|
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
/*Auto hide characters*/
|
/*Auto hide characters*/
|
||||||
|
if(ext->pwd_show_time == 0) {
|
||||||
|
pwd_char_hider(ta);
|
||||||
|
}
|
||||||
|
else {
|
||||||
lv_anim_path_t path;
|
lv_anim_path_t path;
|
||||||
lv_anim_path_init(&path);
|
lv_anim_path_init(&path);
|
||||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||||
|
|
||||||
lv_anim_t a;
|
lv_anim_t a;
|
||||||
lv_anim_init(&a);
|
lv_anim_init(&a);
|
||||||
lv_anim_set_var(&a, ta);
|
lv_anim_set_var(&a, ta);
|
||||||
@@ -376,6 +386,7 @@ void lv_textarea_add_text(lv_obj_t * ta, const char * txt)
|
|||||||
lv_anim_set_path(&a, &path);
|
lv_anim_set_path(&a, &path);
|
||||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
pwd_char_hider(ta);
|
pwd_char_hider(ta);
|
||||||
#endif
|
#endif
|
||||||
@@ -516,6 +527,10 @@ void lv_textarea_set_text(lv_obj_t * ta, const char * txt)
|
|||||||
|
|
||||||
#if LV_USE_ANIMATION
|
#if LV_USE_ANIMATION
|
||||||
/*Auto hide characters*/
|
/*Auto hide characters*/
|
||||||
|
if(ext->pwd_show_time == 0) {
|
||||||
|
pwd_char_hider(ta);
|
||||||
|
}
|
||||||
|
else {
|
||||||
lv_anim_path_t path;
|
lv_anim_path_t path;
|
||||||
lv_anim_path_init(&path);
|
lv_anim_path_init(&path);
|
||||||
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
lv_anim_path_set_cb(&path, lv_anim_path_step);
|
||||||
@@ -529,6 +544,7 @@ void lv_textarea_set_text(lv_obj_t * ta, const char * txt)
|
|||||||
lv_anim_set_path(&a, &path);
|
lv_anim_set_path(&a, &path);
|
||||||
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
pwd_char_hider(ta);
|
pwd_char_hider(ta);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ minimal_monochrome = {
|
|||||||
"LV_USE_PAGE":0,
|
"LV_USE_PAGE":0,
|
||||||
"LV_USE_SPINNER":0,
|
"LV_USE_SPINNER":0,
|
||||||
"LV_USE_ROLLER":0,
|
"LV_USE_ROLLER":0,
|
||||||
"LV_USE_ROTARY":0,
|
|
||||||
"LV_USE_SLIDER":0,
|
"LV_USE_SLIDER":0,
|
||||||
"LV_USE_SPINBOX":0,
|
"LV_USE_SPINBOX":0,
|
||||||
"LV_USE_SWITCH":0,
|
"LV_USE_SWITCH":0,
|
||||||
@@ -197,7 +196,6 @@ all_obj_minimal_features = {
|
|||||||
"LV_USE_PAGE":1,
|
"LV_USE_PAGE":1,
|
||||||
"LV_USE_SPINNER":0, #Disabled beacsue needs anim
|
"LV_USE_SPINNER":0, #Disabled beacsue needs anim
|
||||||
"LV_USE_ROLLER":1,
|
"LV_USE_ROLLER":1,
|
||||||
"LV_USE_ROTARY":1,
|
|
||||||
"LV_USE_SLIDER":1,
|
"LV_USE_SLIDER":1,
|
||||||
"LV_USE_SPINBOX":1,
|
"LV_USE_SPINBOX":1,
|
||||||
"LV_USE_SWITCH":1,
|
"LV_USE_SWITCH":1,
|
||||||
@@ -276,7 +274,6 @@ all_obj_all_features = {
|
|||||||
"LV_USE_PAGE":1,
|
"LV_USE_PAGE":1,
|
||||||
"LV_USE_SPINNER":1,
|
"LV_USE_SPINNER":1,
|
||||||
"LV_USE_ROLLER":1,
|
"LV_USE_ROLLER":1,
|
||||||
"LV_USE_ROTARY":1,
|
|
||||||
"LV_USE_SLIDER":1,
|
"LV_USE_SLIDER":1,
|
||||||
"LV_USE_SPINBOX":1,
|
"LV_USE_SPINBOX":1,
|
||||||
"LV_USE_SWITCH":1,
|
"LV_USE_SWITCH":1,
|
||||||
@@ -365,7 +362,6 @@ advanced_features = {
|
|||||||
"LV_USE_PAGE":1,
|
"LV_USE_PAGE":1,
|
||||||
"LV_USE_SPINNER":1,
|
"LV_USE_SPINNER":1,
|
||||||
"LV_USE_ROLLER":1,
|
"LV_USE_ROLLER":1,
|
||||||
"LV_USE_ROTARY":1,
|
|
||||||
"LV_USE_SLIDER":1,
|
"LV_USE_SLIDER":1,
|
||||||
"LV_USE_SPINBOX":1,
|
"LV_USE_SPINBOX":1,
|
||||||
"LV_USE_SWITCH":1,
|
"LV_USE_SWITCH":1,
|
||||||
|
|||||||
Reference in New Issue
Block a user