Update LittleVGL to v8, close #2.

This commit is contained in:
imi415 2021-06-22 23:04:41 +08:00
parent b58046f006
commit fbca0dd77e
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
5 changed files with 384 additions and 631 deletions

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit 524709472757405ac0eef8d6d002632526430df3
Subproject commit f2c6f5dc9c35c7af76e9745bf08f7888c72a958d

View File

@ -30,5 +30,6 @@ void user_lvgl_impl_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, l
}
void user_lvgl_impl_deinit(void) {
st7789_lcd_display(&g_lcd, 0);
user_st7789_impl_deinit(&g_lcd_impl);
}

View File

@ -39,22 +39,21 @@ void *user_clock_task(void *arguments) {
while(g_running && !g_lvgl_ready) {
sleep(1);
}
lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(label1, LV_LABEL_LONG_BREAK); /*Break the long lines*/
lv_obj_t * label1 = lv_label_create(lv_scr_act());
lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP); /*Break the long lines*/
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
lv_label_set_align(label1, LV_LABEL_ALIGN_CENTER); /*Center aligned lines*/
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label "
"and wrap long text automatically.");
lv_obj_set_width(label1, 320);
lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, -30);
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label, align the lines to the center "
"and wrap long text automatically.");
lv_obj_set_width(label1, 150); /*Set smaller width to make the lines wrap*/
lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/
lv_obj_set_width(label2, 320);
lv_obj_t * label2 = lv_label_create(lv_scr_act());
lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
lv_obj_set_width(label2, 150);
lv_label_set_text(label2, "It is a circularly scrolling text. ");
lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 30);
lv_obj_align(label2, LV_ALIGN_CENTER, 0, 40);
while(g_running) {
sleep(1);
}

View File

@ -18,8 +18,9 @@ uint8_t g_lvgl_ready = 0;
pthread_t user_lv_task_thread;
pthread_t user_lv_tick_thread;
static lv_disp_buf_t s_disp_buf;
static lv_disp_draw_buf_t s_disp_buf;
static lv_color_t s_pix_buf[2][PIXBUF_SIZE];
static lv_disp_drv_t s_disp_drv;
void *user_lv_task(void *arguments);
void *user_lv_tick(void *arguments);
@ -33,13 +34,15 @@ int user_lvgl_task_init(void) {
lv_init();
lv_disp_buf_init(&s_disp_buf, s_pix_buf[0], s_pix_buf[1], PIXBUF_SIZE);
lv_disp_draw_buf_init(&s_disp_buf, s_pix_buf[0], s_pix_buf[1], PIXBUF_SIZE);
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &s_disp_buf;
disp_drv.flush_cb = user_lvgl_impl_flush_cb;
lv_disp_t *disp = lv_disp_drv_register(&disp_drv);
lv_disp_drv_init(&s_disp_drv);
s_disp_drv.draw_buf = &s_disp_buf;
s_disp_drv.hor_res = 320;
s_disp_drv.ver_res = 240;
s_disp_drv.flush_cb = user_lvgl_impl_flush_cb;
lv_disp_t *disp = lv_disp_drv_register(&s_disp_drv);
ret = pthread_create(&user_lv_task_thread, NULL, user_lv_task, NULL);
if(ret) return ret;
@ -70,7 +73,7 @@ void *user_lv_task(void *arguments) {
while(g_running) {
usleep(30 * 1000);
lv_task_handler();
lv_timer_handler();
}
return NULL;