mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
Merge remote-tracking branch 'origin/master' into dev-6.0
This commit is contained in:
commit
7e60fcb298
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@ -7,7 +7,7 @@ exemptLabels:
|
||||
- architecture
|
||||
- pinned
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue or pull request has been automatically marked as stale because it has not had
|
||||
|
@ -62,15 +62,15 @@ The easiest way to get started with LittlevGL is to run it in a simulator on you
|
||||
|
||||
Choose a project with your favourite IDE:
|
||||
|
||||
| Eclipse | CodeBlock | Visual Studio | PlatformIO | Qt Creator |
|
||||
|-------------|----------- |---------------|-----------|------------|
|
||||
| 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 |
|
||||
|
||||
### Porting to an embedded hardware
|
||||
In the most simple case you need to do these steps:
|
||||
1. Copy `lv_conf_templ.h` as `lv_conf.h` next to `lvgl` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`.
|
||||
2. Call `lv_tick_inc(x)` every `x` milliseconds in a Timer or Task (`x` should be between 1 and 10)
|
||||
2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10)
|
||||
3. Call `lv_init()`
|
||||
4. Register a function which can **copy a pixel array** to an area of the screen:
|
||||
```c
|
||||
|
@ -184,7 +184,7 @@ extern lv_style_t lv_style_pretty_color;
|
||||
extern lv_style_t lv_style_btn_rel;
|
||||
extern lv_style_t lv_style_btn_pr;
|
||||
extern lv_style_t lv_style_btn_tgl_rel;
|
||||
extern lv_style_t lv_style_btn_tgl_pr;;
|
||||
extern lv_style_t lv_style_btn_tgl_pr;
|
||||
extern lv_style_t lv_style_btn_ina;
|
||||
|
||||
/**********************
|
||||
|
@ -300,7 +300,9 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn)
|
||||
}
|
||||
|
||||
ext->selected_btn = btn;
|
||||
ext->last_sel = btn;
|
||||
if( btn != NULL ) {
|
||||
ext->last_sel = btn;
|
||||
}
|
||||
|
||||
if(ext->selected_btn) {
|
||||
lv_btn_state_t s = lv_btn_get_state(ext->selected_btn);
|
||||
|
@ -456,10 +456,8 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
/* Be sure there is no position changing animation in progress
|
||||
* because it can overide the current changes*/
|
||||
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_y);
|
||||
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_x);
|
||||
lv_anim_del(page, (lv_anim_fp_t)lv_obj_set_pos);
|
||||
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_y);
|
||||
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_x);
|
||||
lv_anim_del(ext->scrl, (lv_anim_fp_t)lv_obj_set_pos);
|
||||
#endif
|
||||
|
||||
@ -471,15 +469,8 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
lv_coord_t scrlable_y = lv_obj_get_y(ext->scrl);
|
||||
lv_coord_t page_h = lv_obj_get_height(page);
|
||||
|
||||
lv_coord_t obj_x = obj->coords.x1 - ext->scrl->coords.x1;
|
||||
lv_coord_t obj_w = lv_obj_get_width(obj);
|
||||
lv_coord_t scrlable_x = lv_obj_get_x(ext->scrl);
|
||||
lv_coord_t page_w = lv_obj_get_width(page);
|
||||
|
||||
lv_coord_t top_err = -(scrlable_y + obj_y);
|
||||
lv_coord_t bot_err = scrlable_y + obj_y + obj_h - page_h;
|
||||
lv_coord_t left_err = -(scrlable_x + obj_x);
|
||||
lv_coord_t right_err = scrlable_x + obj_x + obj_w - page_w;
|
||||
|
||||
/*If obj is higher then the page focus where the "error" is smaller*/
|
||||
|
||||
@ -497,21 +488,6 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
scrlable_y = -(obj_y + style_scrl->body.padding.ver + style->body.padding.ver);
|
||||
scrlable_y -= style_scrl->body.padding.ver;
|
||||
scrlable_y += page_h - obj_h;
|
||||
}
|
||||
/*Out of the page on the left*/
|
||||
if((obj_w <= page_w && left_err > 0) ||
|
||||
(obj_w > page_w && left_err < right_err)) {
|
||||
/*Calculate a new position and let some space above*/
|
||||
scrlable_x = -(obj_x - style_scrl->body.padding.ver - style->body.padding.ver);
|
||||
scrlable_x += style_scrl->body.padding.ver;
|
||||
}
|
||||
/*Out of the page on the right*/
|
||||
else if((obj_w <= page_w && right_err > 0) ||
|
||||
(obj_w > page_w && left_err >= right_err)) {
|
||||
/*Calculate a new position and let some space below*/
|
||||
scrlable_x = -(obj_x + style_scrl->body.padding.ver + style->body.padding.ver);
|
||||
scrlable_x -= style_scrl->body.padding.ver;
|
||||
scrlable_x += page_w - obj_w;
|
||||
} else {
|
||||
/*Already in focus*/
|
||||
return;
|
||||
@ -519,7 +495,6 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
|
||||
if(anim_time == 0) {
|
||||
lv_obj_set_y(ext->scrl, scrlable_y);
|
||||
lv_obj_set_x(ext->scrl, scrlable_x);
|
||||
#if USE_LV_ANIMATION
|
||||
} else {
|
||||
lv_anim_t a;
|
||||
@ -534,12 +509,6 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
|
||||
a.path = lv_anim_path_linear;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_y;
|
||||
lv_anim_create(&a);
|
||||
|
||||
a.start = lv_obj_get_x(ext->scrl);
|
||||
a.end = scrlable_x;
|
||||
a.var = ext->scrl;
|
||||
a.fp = (lv_anim_fp_t) lv_obj_set_x;
|
||||
lv_anim_create(&a);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user