LittleVgl: implement screen transitions like on PineTime

Move lvgl display init from main.cpp into LittleVgl.cpp to be closer to
InfiniTime, where display initialization is also done in LitteVgl.cpp.

Enable the original FlushDisplay code to get the screen
transition animations like on the real PineTime.

Also slow down the rendering, to actually be able to see the screen
flushing.

For the Up and Down screen transitions implement the screen movement.
When moving Down, move the the whole screen content down, and then draw
the new part of the new screen at the top of the display. Repeat until
screen transition is finished.

Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/13
This commit is contained in:
Reinhold Gschweicher
2022-06-13 20:46:03 +02:00
committed by NeroBurner
parent 53d765bbd8
commit 04c923bd82
2 changed files with 183 additions and 111 deletions

View File

@@ -863,21 +863,21 @@ static void hal_init(void)
SDL_CreateThread(tick_thread, "tick", NULL);
// use pinetime_theme
lv_theme_t* th = lv_pinetime_theme_init(
LV_COLOR_WHITE, LV_COLOR_SILVER, 0, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20);
lv_theme_set_act(th);
//lv_theme_t* th = lv_pinetime_theme_init(
// LV_COLOR_WHITE, LV_COLOR_SILVER, 0, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20);
//lv_theme_set_act(th);
/*Create a display buffer*/
static lv_disp_buf_t disp_buf1;
static lv_color_t buf1_1[LV_HOR_RES_MAX * 120];
lv_disp_buf_init(&disp_buf1, buf1_1, NULL, LV_HOR_RES_MAX * 120);
///*Create a display buffer*/
//static lv_disp_buf_t disp_buf1;
//static lv_color_t buf1_1[LV_HOR_RES_MAX * 120];
//lv_disp_buf_init(&disp_buf1, buf1_1, NULL, LV_HOR_RES_MAX * 120);
/*Create a display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.buffer = &disp_buf1;
disp_drv.flush_cb = monitor_flush;
lv_disp_drv_register(&disp_drv);
///*Create a display*/
//lv_disp_drv_t disp_drv;
//lv_disp_drv_init(&disp_drv); /*Basic initialization*/
//disp_drv.buffer = &disp_buf1;
//disp_drv.flush_cb = monitor_flush;
//lv_disp_drv_register(&disp_drv);
/* Add the mouse as input device
* Use the 'mouse' driver which reads the PC's mouse*/