Skip to content

samples/modules: Add LVGL demo sample #62904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

faxe1008
Copy link
Collaborator

@faxe1008 faxe1008 commented Sep 21, 2023

Adds a sample which allows to build the LVGL upstream demo applications (music, benchmark, stress).

Resolves #62744.

The other samples still need some work to be added:

  • Keypad and encoder: Currently we are lacking the keypad pseudo device
  • Widgets: The demo build fails because of the symbol LV_MEM_SIZE being too low. Issue is that we are not reusing the symbol provided by lvgl when setting up the heap used for memory management. This needs to be addressed seperately.

@faxe1008 faxe1008 requested a review from nashif as a code owner September 21, 2023 08:16
@faxe1008 faxe1008 added area: Samples Samples area: LVGL Light and Versatile Graphics Library Support labels Sep 21, 2023
@faxe1008 faxe1008 force-pushed the lvgl_demo_sample branch 2 times, most recently from d7fd8fe to 20faa87 Compare September 21, 2023 09:52
Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cool, thanks for this!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs an additional sub-directory, i.e. samples/modules/lvgl/demos, like other modules/ samples, and in case there are more sample added over time.
Also, the other "basic" LVGL sample lives in subsys/display/lvgl, so I don't know if we would maybe want all LVGL samples in the same place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely this can be moved, when working on this one I felt that it was kind of an odd choice to begin with to have the lvgl sample in the display subsys. I guess its the easiest way to show something on the display. Fine with moving the basic sample here also.

Will move this one to the demo subdir as suggested.

@faxe1008 faxe1008 force-pushed the lvgl_demo_sample branch 3 times, most recently from c527caa to 76a71ea Compare September 21, 2023 10:45
pdgendt
pdgendt previously approved these changes Sep 21, 2023
@faxe1008 faxe1008 requested a review from kartben September 21, 2023 12:21
Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested successfully on M5Stack Core2 and Wio Terminal (music is too big for this one though), this will be a very cool addition.

See couple addition comments re: README, and an open question re: enabling CONFIG_INPUT in prj.conf.

Adds a sample which allows to build the LVGL upstream demo applications
(music, benchmark, stress).

Resolves issue zephyrproject-rtos#62744.

Signed-off-by: Fabian Blatz <[email protected]>
Comment on lines +12 to +17
* Music
The music player demo shows what kind of modern, smartphone-like user interfaces can be created on LVGL.
* Benchmark
The benchmark demo tests the performance in various cases. For example rectangle, border, shadow, text, image blending, image transformation, blending modes, etc.
* Stress
A stress test for LVGL. It contains a lot of object creation, deletion, animations, styles usage, and so on. It can be used if there is any memory corruption during heavy usage or any memory leaks.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should these be wrapping on 80 columns or something? @kartben @gmarull not sure if it's a rule or guideline or just not a thing for doc files but usually everything in the repo is bounded it seems


#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(app);
Copy link
Member

@fabiobaltieri fabiobaltieri Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do LOG_MODULE_REGISTER(app, CONFIG_LOG_DEFAULT_LEVEL); and drop the define above

display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
if (!device_is_ready(display_dev)) {
LOG_ERR("Device not ready, aborting test");
return 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes nothing in this case but it's odd to catch an error and return 0... -ENODEV?

Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, brilliant, thank you @faxe1008! This is great work

@carlescufi carlescufi merged commit b946416 into zephyrproject-rtos:main Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LVGL Light and Versatile Graphics Library Support area: Samples Samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lvgl: add sample to build demos
5 participants