mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
marge master
This commit is contained in:
commit
d9874ae0f4
16
README.md
16
README.md
@ -71,7 +71,7 @@ Choose a project with your favourite IDE:
|
|||||||
### Porting to an embedded hardware
|
### Porting to an embedded hardware
|
||||||
In the most simple case you need to do these steps:
|
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`.
|
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). It is required for the internal timing of LittlevGL.
|
||||||
3. Call `lv_init()`
|
3. Call `lv_init()`
|
||||||
4. Create a buffer for LittlevGL
|
4. Create a buffer for LittlevGL
|
||||||
```c
|
```c
|
||||||
@ -126,7 +126,11 @@ bool my_touchpad_read(lv_indev_t * indev, lv_indev_data_t * data)
|
|||||||
return false; /*Return `false` because we are not buffering and no more data to read*/
|
return false; /*Return `false` because we are not buffering and no more data to read*/
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
<<<<<<< HEAD
|
||||||
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in a Timer interrupt or in an Operation system task.
|
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in a Timer interrupt or in an Operation system task.
|
||||||
|
=======
|
||||||
|
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. It will redraw the screen if required, handle input devices etc.
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting examples](https://github.com/littlevgl/lvgl/tree/multi-disp/lv_porting).
|
For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting examples](https://github.com/littlevgl/lvgl/tree/multi-disp/lv_porting).
|
||||||
|
|
||||||
@ -189,9 +193,7 @@ lv_btn_set_ink_out_time(btn, 300);
|
|||||||
|
|
||||||
#### Use LittlevGL from Micropython
|
#### Use LittlevGL from Micropython
|
||||||
```python
|
```python
|
||||||
|
|
||||||
# Create a Button and a Label
|
# Create a Button and a Label
|
||||||
|
|
||||||
scr = lv.obj()
|
scr = lv.obj()
|
||||||
btn = lv.btn(scr)
|
btn = lv.btn(scr)
|
||||||
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
|
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
|
||||||
@ -199,16 +201,16 @@ label = lv.label(btn)
|
|||||||
label.set_text("Button")
|
label.set_text("Button")
|
||||||
|
|
||||||
# Load the screen
|
# Load the screen
|
||||||
|
|
||||||
lv.scr_load(scr)
|
lv.scr_load(scr)
|
||||||
```
|
```
|
||||||
|
|
||||||
Check out the [Documentation](https://docs.littlevgl.com/) for more!
|
Check out the [Documentation](https://docs.littlevgl.com/) for more!
|
||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
To ask questions and discuss topics we use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
|
To ask questions please use the [Forum](https://forum.littlevgl.com).
|
||||||
You contribute in several ways:
|
FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
|
||||||
- **Answer other's question** click the Watch button on the top to get notified about the issues
|
You can contribute in several ways:
|
||||||
|
- **Answer other's question** in the Forum
|
||||||
- **Report and/or fix bugs** using the issue tracker and in Pull-request
|
- **Report and/or fix bugs** using the issue tracker and in Pull-request
|
||||||
- **Suggest and/or implement new features** using the issue tracker and in Pull-request
|
- **Suggest and/or implement new features** using the issue tracker and in Pull-request
|
||||||
- **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs)
|
- **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs)
|
||||||
|
@ -28,6 +28,9 @@ static void style_mod_edit_def(lv_style_t * style);
|
|||||||
static void refresh_theme(lv_group_t * g, lv_theme_t * th);
|
static void refresh_theme(lv_group_t * g, lv_theme_t * th);
|
||||||
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *));
|
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *));
|
||||||
static void lv_group_refocus(lv_group_t * g);
|
static void lv_group_refocus(lv_group_t * g);
|
||||||
|
static void obj_to_foreground(lv_obj_t * obj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
@ -196,6 +199,9 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
|||||||
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||||
if(g->focus_cb) g->focus_cb(g);
|
if(g->focus_cb) g->focus_cb(g);
|
||||||
lv_obj_invalidate(*g->obj_focus);
|
lv_obj_invalidate(*g->obj_focus);
|
||||||
|
|
||||||
|
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||||
|
obj_to_foreground(*g->obj_focus);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -575,9 +581,32 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
|
|||||||
group->obj_focus = obj_next;
|
group->obj_focus = obj_next;
|
||||||
|
|
||||||
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||||
|
|
||||||
|
/*If the object or its parent has `top == true` bring it to the foregorund*/
|
||||||
|
obj_to_foreground(*group->obj_focus);
|
||||||
|
|
||||||
lv_obj_invalidate(*group->obj_focus);
|
lv_obj_invalidate(*group->obj_focus);
|
||||||
|
|
||||||
if(group->focus_cb) group->focus_cb(group);
|
if(group->focus_cb) group->focus_cb(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void obj_to_foreground(lv_obj_t * obj)
|
||||||
|
{
|
||||||
|
/*Search for 'top' attribute*/
|
||||||
|
lv_obj_t * i = obj;
|
||||||
|
lv_obj_t * last_top = NULL;
|
||||||
|
while(i != NULL) {
|
||||||
|
if(i->top != 0) last_top = i;
|
||||||
|
i = lv_obj_get_parent(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_top != NULL) {
|
||||||
|
/*Move the last_top object to the foreground*/
|
||||||
|
lv_obj_t * par = lv_obj_get_parent(last_top);
|
||||||
|
/*After list change it will be the new head*/
|
||||||
|
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
|
||||||
|
lv_obj_invalidate(last_top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /*USE_LV_GROUP != 0*/
|
#endif /*USE_LV_GROUP != 0*/
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
|
/* "free" is used as a function pointer (in lv_fs_drv_t).
|
||||||
|
* We must make sure "free" was not defined to a platform specific
|
||||||
|
* free function, otherwise compilation would fail.
|
||||||
|
*/
|
||||||
|
#ifdef free
|
||||||
|
#undef free
|
||||||
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
@ -88,6 +88,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
|||||||
ext->action = NULL;
|
ext->action = NULL;
|
||||||
ext->map_p = NULL;
|
ext->map_p = NULL;
|
||||||
ext->toggle = 0;
|
ext->toggle = 0;
|
||||||
|
ext->recolor = 0;
|
||||||
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
|
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
|
||||||
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
|
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
|
||||||
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
|
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
|
||||||
|
@ -1202,6 +1202,7 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
|
|
||||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||||
|
|
||||||
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||||
/*Set ext. size because the cursor might be out of this object*/
|
/*Set ext. size because the cursor might be out of this object*/
|
||||||
lv_style_t * style_label = lv_obj_get_style(ext->label);
|
lv_style_t * style_label = lv_obj_get_style(ext->label);
|
||||||
@ -1213,6 +1214,9 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
if(ext->label) {
|
if(ext->label) {
|
||||||
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
|
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
|
||||||
lv_obj_get_height(ta) != lv_area_get_height(param)) {
|
lv_obj_get_height(ta) != lv_area_get_height(param)) {
|
||||||
|
|
||||||
|
lv_obj_t * scrl = lv_page_get_scrl(ta);
|
||||||
|
|
||||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
||||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
|
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
|
||||||
@ -1226,7 +1230,6 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
update_cursor_position_on_click(ta, (lv_indev_t *)param);
|
update_cursor_position_on_click(ta, (lv_indev_t *)param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +334,8 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
if(res != LV_RES_OK) return res;
|
if(res != LV_RES_OK) return res;
|
||||||
|
|
||||||
lv_obj_t * tileview = lv_obj_get_parent(scrl);
|
lv_obj_t * tileview = lv_obj_get_parent(scrl);
|
||||||
|
lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_BG);
|
||||||
|
|
||||||
|
|
||||||
/*Apply constraint on moving of the tileview*/
|
/*Apply constraint on moving of the tileview*/
|
||||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||||
@ -377,7 +379,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
lv_page_start_edge_flash(tileview);
|
lv_page_start_edge_flash(tileview);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_y(scrl, -ext->act_id.y * h);
|
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ext->drag_bottom_en == 0 && indev->proc.types.pointer.vect.y < 0 && ext->drag_hor == 0) {
|
if(ext->drag_bottom_en == 0 && indev->proc.types.pointer.vect.y < 0 && ext->drag_hor == 0) {
|
||||||
@ -390,7 +392,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_y(scrl, -ext->act_id.y * h);
|
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
|
||||||
}
|
}
|
||||||
if(ext->drag_left_en == 0) {
|
if(ext->drag_left_en == 0) {
|
||||||
if(x > -(ext->act_id.x * w) && indev->proc.types.pointer.vect.x > 0 && ext->drag_ver == 0) {
|
if(x > -(ext->act_id.x * w) && indev->proc.types.pointer.vect.x > 0 && ext->drag_ver == 0) {
|
||||||
@ -401,7 +403,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
lv_page_start_edge_flash(tileview);
|
lv_page_start_edge_flash(tileview);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_x(scrl, -ext->act_id.x * w);
|
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ext->drag_right_en == 0 && indev->proc.types.pointer.vect.x < 0 && ext->drag_ver == 0) {
|
if(ext->drag_right_en == 0 && indev->proc.types.pointer.vect.x < 0 && ext->drag_ver == 0) {
|
||||||
@ -414,12 +416,12 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_set_x(scrl, -ext->act_id.x * w);
|
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Apply the drag constraints*/
|
/*Apply the drag constraints*/
|
||||||
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview));
|
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview) + style_bg->body.padding.ver);
|
||||||
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview));
|
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview) + style_bg->body.padding.hor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user