Giter Site home page Giter Site logo

lvgl / lv_demos Goto Github PK

View Code? Open in Web Editor NEW
477.0 477.0 366.0 41.13 MB

Examples, tutorials and applications for the LVGL embedded GUI library

Home Page: https://lvgl.io

C 99.96% Makefile 0.01% Python 0.04% Shell 0.01% CMake 0.01%
embedded-gui example graphics-library littlevgl lvgl tutorial

lv_demos's Introduction

English | 中文 | Português do Brasil | 日本語


 

 

Light and Versatile Graphics Library

 

   

Website | Docs | Forum | Demos | Services


📒 Overview

Mature and Well-known
LVGL is the most popular free and open source embedded graphics library to create beautiful UIs for any MCU, MPU and display type. It's supported by industry leading vendors and projects like  Arm, STM32, NXP, Espressif, Nuvoton, Arduino, RT-Thread, Zephyr, NuttX, Adafruit and many more.

Feature Rich
It has all the features to create modern and beautiful GUIs: 30+ built-in widgets, a powerful style system, web inspired layout managers, and a typography system supporting many languages. To integrate LVGL into your platform, all you need is at least 32kB RAM and 128 kB Flash, a C compiler, a frame buffer, and at least an 1/10 screen sized buffer for rendering.

Services
Our team is ready to help you with graphics design, UI implementation and consulting services. Contact us if you need some support during the development of your next GUI project.

🚀 Features

Free and Portable

  • A fully portable C (C++ compatible) library with no external dependencies.
  • Can be compiled to any MCU or MPU, with any (RT)OS.
  • Supports monochrome, ePaper, OLED or TFT displays, or even monitors. Porting Guide
  • Distributed under the MIT license, so you can easily use it in commercial projects too.
  • Needs only 32kB RAM and 128 kB Flash, a frame buffer, and at least an 1/10 screen sized buffer for rendering.
  • OS, External memory and GPU are supported but not required.

Widgets, Styles, Layouts and more

  • 30+ built-in Widgets:  Button, Label, Slider, Chart, Keyboard, Meter, Arc, Table and many more.
  • Flexible Style system with  ~100 style properties to customize any part of the widgets in any state.
  • Flexbox and Grid-like layouts engines to automatically size and position the widgets in a responsive way.
  • Texts are rendered with UTF-8 encoding supporting CJK, Thai, Hindi, Arabic, Persian writing systems.
  • Word wrapping, kerning, text scrolling, sub-pixel rendering, Pinyin-IME Chinese input, Emojis in texts.
  • Rendering engine supporting animations, anti-aliasing, opacity, smooth scrolling, shadows, image transformation, etc  
  • Supports Mouse, Touchpad, Keypad, Keyboard, External buttons, Encoder Input devices.
  • Multiple display support.

Binding and Build Support

  • MicroPython Binding exposes LVGL API
  • PikaScript Binding python on MCU lighter and easier.
  • No custom build system is used. You can build LVGL as you build the other files of your project.
  • Support for Make and CMake is included out of the box.
  • Develop on PC and use the same UI code on embedded hardware.
  • Convert the C UI code to HTML file with our Emscripten port.

Docs, Tools, and Services

❤️ Sponsor

If LVGL saved you a lot of time and money or you just had fun using it, consider Supporting its Development.

How do we spend the donations?
Our goal is to provide financial compensation for people who do the most for LVGL. It means not only the maintainers but anyone who implements a great feature should get a payment from the accumulated money. We use the donations to cover our operational costs like servers and related services.

How to donate?
We use GitHub Sponsors where you can easily send one time or recurring donations. You can also see all of our expenses in a transparent way.

How to get paid for your contribution?
If someone implements or fixes an issue labeled as Sponsored he or she will get a payment for that work. We estimate the required time, complexity and importance of the issue and set a price accordingly. To jump in just comment on a Sponsored issue saying "Hi, I'd like to deal with it. This is how I'm planning to fix/implement it...". A work is considered ready when it's approved and merged by a maintainer. After that you can submit and expense at opencollective.com and you will receive the payment in a few days.

Organizations supporting LVGL
Sponsors of LVGL

Individuals supporting LVGL
Backers of LVGL

📦 Packages

LVGL is available as:

🤖 Examples

See some examples of creating widgets, using layouts and applying styles. You will find C and MicroPython code, and links to try out or edit the examples in an online MicroPython editor.

For more examples check out the Examples folder.

Hello world label

Simple Hello world label example in LVGL

C code
/*Change the active screen's background color*/
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);

/*Create a white label, set its text and align it to the center*/
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(label, lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
MicroPython code | Online Simulator
# Change the active screen's background color
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x003a57), lv.PART.MAIN)

# Create a white label, set its text and align it to the center
label = lv.label(lv.screen_active())
label.set_text("Hello world")
label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
label.align(lv.ALIGN.CENTER, 0, 0)

Button with Click Event

LVGL button with label example

C code
lv_obj_t * button = lv_button_create(lv_screen_active());                   /*Add a button to the current screen*/
lv_obj_center(button);                                             /*Set its position*/
lv_obj_set_size(button, 100, 50);                                  /*Set its size*/
lv_obj_add_event_cb(button, button_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/

lv_obj_t * label = lv_label_create(button);                        /*Add a label to the button*/
lv_label_set_text(label, "Button");                             /*Set the labels text*/
lv_obj_center(label);                                           /*Align the label to the center*/
...

void button_event_cb(lv_event_t * e)
{
  printf("Clicked\n");
}
MicroPython code | Online Simulator
def button_event_cb(e):
  print("Clicked")

# Create a Button and a Label
button = lv.button(lv.screen_active())
button.center()
button.set_size(100, 50)
button.add_event_cb(button_event_cb, lv.EVENT.CLICKED, None)

label = lv.label(button)
label.set_text("Button")
label.center()

Checkboxes with Layout

Checkboxes with layout in LVGL

C code
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);

lv_obj_t * cb;
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Apple");
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);

cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Banana");
lv_obj_add_state(cb, LV_STATE_CHECKED);
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);

cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Lemon");
lv_obj_add_state(cb, LV_STATE_DISABLED);
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);

cb = lv_checkbox_create(lv_screen_active());
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_checkbox_set_text(cb, "Melon\nand a new line");
lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL);
MicroPython code | Online Simulator
def event_handler(e):
    code = e.get_code()
    obj = e.get_target_obj()
    if code == lv.EVENT.VALUE_CHANGED:
        txt = obj.get_text()
        if obj.get_state() & lv.STATE.CHECKED:
            state = "Checked"
        else:
            state = "Unchecked"
        print(txt + ":" + state)


lv.screen_active().set_flex_flow(lv.FLEX_FLOW.COLUMN)
lv.screen_active().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv.FLEX_ALIGN.CENTER)

cb = lv.checkbox(lv.screen_active())
cb.set_text("Apple")
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)

cb = lv.checkbox(lv.screen_active())
cb.set_text("Banana")
cb.add_state(lv.STATE.CHECKED)
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)

cb = lv.checkbox(lv.screen_active())
cb.set_text("Lemon")
cb.add_state(lv.STATE.DISABLED)
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)

cb = lv.checkbox(lv.screen_active())
cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
cb.set_text("Melon")
cb.add_event_cb(event_handler, lv.EVENT.ALL, None)

Styling a Slider

Styling a slider with LVGL

C code
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_slider_set_value(slider, 70, LV_ANIM_OFF);
lv_obj_set_size(slider, 300, 20);
lv_obj_center(slider);

/*Add local styles to MAIN part (background rectangle)*/
lv_obj_set_style_bg_color(slider, lv_color_hex(0x0F1215), LV_PART_MAIN);
lv_obj_set_style_bg_opa(slider, 255, LV_PART_MAIN);
lv_obj_set_style_border_color(slider, lv_color_hex(0x333943), LV_PART_MAIN);
lv_obj_set_style_border_width(slider, 5, LV_PART_MAIN);
lv_obj_set_style_pad_all(slider, 5, LV_PART_MAIN);

/*Create a reusable style sheet for the INDICATOR part*/
static lv_style_t style_indicator;
lv_style_init(&style_indicator);
lv_style_set_bg_color(&style_indicator, lv_color_hex(0x37B9F5));
lv_style_set_bg_grad_color(&style_indicator, lv_color_hex(0x1464F0));
lv_style_set_bg_grad_dir(&style_indicator, LV_GRAD_DIR_HOR);
lv_style_set_shadow_color(&style_indicator, lv_color_hex(0x37B9F5));
lv_style_set_shadow_width(&style_indicator, 15);
lv_style_set_shadow_spread(&style_indicator, 5);
4
/*Add the style sheet to the slider's INDICATOR part*/
lv_obj_add_style(slider, &style_indicator, LV_PART_INDICATOR);

/*Add the same style to the KNOB part too and locally overwrite some properties*/
lv_obj_add_style(slider, &style_indicator, LV_PART_KNOB);

lv_obj_set_style_outline_color(slider, lv_color_hex(0x0096FF), LV_PART_KNOB);
lv_obj_set_style_outline_width(slider, 3, LV_PART_KNOB);
lv_obj_set_style_outline_pad(slider, -5, LV_PART_KNOB);
lv_obj_set_style_shadow_spread(slider, 2, LV_PART_KNOB);
MicroPython code | Online Simulator
# Create a slider and add the style
slider = lv.slider(lv.screen_active())
slider.set_value(70, lv.ANIM.OFF)
slider.set_size(300, 20)
slider.center()

# Add local styles to MAIN part (background rectangle)
slider.set_style_bg_color(lv.color_hex(0x0F1215), lv.PART.MAIN)
slider.set_style_bg_opa(255, lv.PART.MAIN)
slider.set_style_border_color(lv.color_hex(0x333943), lv.PART.MAIN)
slider.set_style_border_width(5, lv.PART.MAIN)
slider.set_style_pad_all(5, lv.PART.MAIN)

# Create a reusable style sheet for the INDICATOR part
style_indicator = lv.style_t()
style_indicator.init()
style_indicator.set_bg_color(lv.color_hex(0x37B9F5))
style_indicator.set_bg_grad_color(lv.color_hex(0x1464F0))
style_indicator.set_bg_grad_dir(lv.GRAD_DIR.HOR)
style_indicator.set_shadow_color(lv.color_hex(0x37B9F5))
style_indicator.set_shadow_width(15)
style_indicator.set_shadow_spread(5)

# Add the style sheet to the slider's INDICATOR part
slider.add_style(style_indicator, lv.PART.INDICATOR)
slider.add_style(style_indicator, lv.PART.KNOB)

# Add the same style to the KNOB part too and locally overwrite some properties
slider.set_style_outline_color(lv.color_hex(0x0096FF), lv.PART.KNOB)
slider.set_style_outline_width(3, lv.PART.KNOB)
slider.set_style_outline_pad(-5, lv.PART.KNOB)
slider.set_style_shadow_spread(2, lv.PART.KNOB)

English, Hebrew (mixed LTR-RTL) and Chinese texts

English, Hebrew and Chinese texts with LVGL

C code
lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
lv_obj_set_width(ltr_label, 310);
lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);

lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_width(rtl_label, 310);
lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);

lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
                  "嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
lv_obj_set_width(cz_label, 310);
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
MicroPython code | Online Simulator
ltr_label = lv.label(lv.screen_active())
ltr_label.set_text("In modern terminology, a microcontroller is similar to a system on a chip (SoC).")
ltr_label.set_style_text_font(lv.font_montserrat_16, 0);

ltr_label.set_width(310)
ltr_label.align(lv.ALIGN.TOP_LEFT, 5, 5)

rtl_label = lv.label(lv.screen_active())
rtl_label.set_text("מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).")
rtl_label.set_style_base_dir(lv.BASE_DIR.RTL, 0)
rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
rtl_label.set_width(310)
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)

font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")

cz_label = lv.label(lv.screen_active())
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
cz_label.set_width(310)
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)

▶️ Get started

This list will guide you to get started with LVGL step-by-step.

Get Familiar with LVGL

  1. Check the Online demos to see LVGL in action (3 minutes)
  2. Read the Introduction page of the documentation (5 minutes)
  3. Get familiar with the basics on the Quick overview page (15 minutes)

Start to Use LVGL

  1. Set up a Simulator (10 minutes)
  2. Try out some Examples
  3. Port LVGL to a board. See the Porting guide or check the ready to use Projects

Become a Pro

  1. Read the Overview page to get a better understanding of the library (2-3 hours)
  2. Check the documentation of the Widgets to see their features and usage

Get Help and Help Others

  1. If you have questions go to the Forum
  2. Read the Contributing guide to see how you can help to improve LVGL (15 minutes)

🤝 Services

LVGL LLC was established to provide a solid background for LVGL library and to offer several type of services to help you in UI development. With 15+ years of experience in the user interface and graphics industry we can help you the bring your UI to the next level.

  • Graphics design Our in-house graphics designers are experts in creating beautiful modern designs which fit to your product and the resources of your hardware.
  • UI implementation We can also implement your UI based on the design you or we have created. You can be sure that we will make the most out of your hardware and LVGL. If a feature or widget is missing from LVGL, don't worry, we will implement it for you.
  • Consulting and Support We can support you with consulting as well to avoid pricey and time consuming mistakes during the UI development.
  • Board certification For companies who are offering development boards, or production ready kits we do board certification which shows how board can run LVGL.

Check out our Demos as reference. For more information take look at the Services page.

Contact us and tell how we can help.

🌟 Contributing

LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs or even hosting your own project under the LVGL organization.

For a detailed description of contribution opportunities visit the Contributing section of the documentation.

More than 300 people already left their fingerprint in LVGL. Be one them! See you here! 🙂

... and many other.

lv_demos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lv_demos's Issues

lv_draw_vbasic.c Line 448 causes compiler error

lv_draw_vbasic.c:448 lv_color_t px_color = (lv_color_t) * ((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]);

causes a fault

Error[Pe119]: cast to type "lv_color_t" is not allowed lvgl\lv_draw\lv_draw_vbasic.c 448

with IAR ICC compiler.

Removing the outer cast (which seems to be unnessecary) solves the issue:

lv_color_t px_color = * ((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]);

How to run hello world?

I've a basic script, based on lv_examples/lv_tutorial/1_hello_world:

/* gui.c */
#include "lvgl/lvgl.h"

int main()
{	 	 
    return 0;
}

void gui(void)
{
    lv_obj_t * scr = lv_disp_get_scr_act(NULL); /* just one line from the example */
}

I compile it with gcc gui.c and get the following error:

/tmp/cca5tFm7.o: In function `gui':
gui.c:(.text+0x2c): undefined reference to `lv_disp_get_scr_act'
collect2: error: ld returned 1 exit status

Where does lv_disp_get_scr_act() come from and what am I missing?

Thanks in advance!

Compiling lv_ex_img_3 will not work without LV_USE_DEMO_MUSIC being defined

The definition of the img_lv_demo_music_cover_1 variable is found inside a #if LV_USE_DEMO_MUSIC block. That variable is used inside the lv_ex_img_3 example function, referenced using an extern declaration. If LV_USE_DEMO_MUSIC is not defined then the compilation fails with the following message in visual studio (for example).

Error	LNK2001	unresolved external symbol img_lv_demo_music_cover_1	lv_sim_visual_studio_sdl	C:\Users\mikef\source\repos\lv_sim_visual_studio_sdl\visual_studio_2017_sdl\lv_ex_img_3.obj	1

This could be fixed in a number of ways but I'm not sure what the vision for lv_ex_img_3 was. It seems odd that it pulls in a variable from the assets in the lv_demo_music directory tree. You could define LV_USE_DEMO_MUSIC inside the lv_ec_img_3.c file but that would seem like a misuse of that macro. Move that asset out of the lv_demo_muse and into the more general src/assets directory? Do not wrapt the definition of img_lv_demo_music_cover_1 in the #if/#endif block?

Hardfault (IntegerDivideByZero) on demo stress when using UNSCII 8 font.

Hi,

This issue was found while working on the lv_esp32_port repo. The hardfault seems to be triggered when using symbols with the unscii 8 font set as default (the project had all the 4 font types set to unscii 8). See here for more details.

Can symbols be used on unscii 8 font? the hardfault gets triggered with the wifi symbol.

I report this here because I think it can be sorted out on the demo code, transfer to lvgl main repo if you think it's more appropiate.

How make it work?

How make it work?

I have download lvgl and download lv_examples inside lvgl. But how i can run it into my raspberry pi 3?

In connecting to my raspberry pi 3 using SSH. I want run the examples, but there is nothing like a Makefile to build and run.

There is not documentation. The only decent tutorial that i found is a video that use eclipse and pc simulator.

Thanks.

How to make a Makefile

Awesome project! Thank you for your work.
I am on Ubuntu 16.04 platform. I want to build the examples without using IDEs.
Is it possible?
I need an example Makefile
Regards.

Compilation error

When compiling the examples with the Makefile I get an error:

lv_examples/src/lv_demo_stress/lv_demo_stress.c:246:37: error: cast between incompatible function types from ‘void (*)(lv_obj_t *, uint16_t)’ {aka ‘void (*)(struct _lv_obj_t *, short unsigned int)’} to ‘void (*)(void *, lv_anim_value_t)’ {aka ‘void (*)(void *, short int)’} [-Werror=cast-function-type]
  246 |             lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_arc_set_end_angle);
      |                                     ^
lv_examples/src/lv_demo_stress/lv_demo_stress.c:256:37: error: cast between incompatible function types from ‘void (*)(lv_obj_t *, uint16_t)’ {aka ‘void (*)(struct _lv_obj_t *, short unsigned int)’} to ‘void (*)(void *, lv_anim_value_t)’ {aka ‘void (*)(void *, short int)’} [-Werror=cast-function-type]
  256 |             lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_linemeter_set_angle_offset);

I got rid of it adding -Wno-cast-function-type
I am using gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

Error with live examples

@embeddedt
I've released v7.6.1 but now the live examples are not working. It shows 404 error instead of the examples and I can't find the html files anywhere.

BTW, if the html files are added into the gh-pages branch how can we manage more branches (other than the master)?

Unable to allocate memory when performing benchmark

Here is my trace:

[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:177:lv_init] -- lv_init started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:236:lv_init] -- lv_init ready
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:278:lv_obj_create] -- Screen create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:278:lv_obj_create] -- Screen create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:278:lv_obj_create] -- Screen create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_widgets/lv_label.c:78:lv_label_create] -- label create started
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[INFO]  [../thirdparty/lvgl/src/lv_widgets/lv_label.c:166:lv_label_create] -- label created
[TRACE] [../thirdparty/lvgl/src/lv_widgets/lv_label.c:78:lv_label_create] -- label create started
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[INFO]  [../thirdparty/lvgl/src/lv_widgets/lv_label.c:166:lv_label_create] -- label created
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:94:lv_anim_start] -- animation create started
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:121:lv_anim_start] -- animation created
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:94:lv_anim_start] -- animation create started
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:121:lv_anim_start] -- animation created
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:94:lv_anim_start] -- animation create started
[TRACE] [../thirdparty/lvgl/src/lv_misc/lv_anim.c:121:lv_anim_start] -- animation created
[TRACE] [../thirdparty/lvgl/src/lv_core/lv_obj.c:310:lv_obj_create] -- Object create started
[INFO]  [../thirdparty/lvgl/src/lv_core/lv_obj.c:469:lv_obj_create] -- Object create ready
[WARN]  [../thirdparty/lvgl/src/lv_misc/lv_mem.c:208:lv_mem_alloc] -- Couldn't allocate memory
[WARN]  [../thirdparty/lvgl/src/lv_misc/lv_mem.c:323:lv_mem_realloc] -- Couldn't allocate memory

I'm well under the memory limit of my MCU. I'm using a same54n19a which has 512KB of flash and 192KB of ram. Here is my memory usage:

   text	   data	    bss	    dec	    hex	filename
 242140	   2232	  64760	 309132	  4b78c	rev_0.elf

Any ideas why the benchmark won't run?

LV_THEME_MATERIAL_FLAG_LIGHT and LV_THEME_MATERIAL_FLAG_DARK symbols undeclared for MONO theme

Hi,

I'm using the latest lvgl dev-7.0 branch and rework-7 branch of this repo on the lv_port_esp32 repo dev-7.0 branch.

I get the following errors while trying to compile an example application for a monochrome display.

../components/lv_examples/lv_examples/src/lv_demo_widgets/lv_demo_widgets.c: In function 'color_chg_event_cb':
../components/lv_examples/lv_examples/src/lv_demo_widgets/lv_demo_widgets.c:701:25: error: 'LV_THEME_MATERIAL_FLAG_LIGHT' undeclared (first use in this function); did you mean 'LV_THEME_MATERIAL_H'?
         uint32_t flag = LV_THEME_MATERIAL_FLAG_LIGHT;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         LV_THEME_MATERIAL_H
../components/lv_examples/lv_examples/src/lv_demo_widgets/lv_demo_widgets.c:701:25: note: each undeclared identifier is reported only once for each function it appears in
../components/lv_examples/lv_examples/src/lv_demo_widgets/lv_demo_widgets.c:702:44: error: 'LV_THEME_MATERIAL_FLAG_DARK' undeclared (first use in this function); did you mean 'LV_THEME_MATERIAL_H'?
         if(lv_switch_get_state(sw)) flag = LV_THEME_MATERIAL_FLAG_DARK;
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                            LV_THEME_MATERIAL_H

Relevant part of my lv_config.h:

#define LV_USE_THEME_MONO 1

#define LV_THEME_DEFAULT_INIT lv_theme_mono_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_BLACK
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_WHITE
#define LV_THEME_DEFAULT_FLAG 0

Should the example check if the application is not using the MONO theme or the value of LV_THEME_DEFAULT_FLAG before trying to use the LV_THEME_MATERIAL_FLAG_DARK and LV_THEME_MATERIAL_FLAG_LIGHT symbols?

Deploy error with music player

I've just merged the music player demo to master and got this error from the depoly script:

main.c:76:5: error: implicit declaration of function 'lv_demo_music_list_btn_check' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    CHOSEN_DEMO();
    ^
<command line>:10:21: note: expanded from here
#define CHOSEN_DEMO lv_demo_music_list_btn_check

Seemingly it interprets the image files as demo.

@embeddedt could you take a look?

Configuration STM32 with SSD1963

Hi there! I am new to the use of this library, and I am very excited to start it, I loved how it is made.
I want to connect a STM32 Nucleo F746ZG board, it is a Cortex M7 processor, with a display with 800x600px SSD1963 driver, using parallel connection. I am a little dizzy in the method of configuring the MCU pins for each data. In the configuration definition, is the data port a complete port? Thank you

/*------------------
 *  Parallel port
 *-----------------*/
#define LV_DRV_DISP_PAR_CS(val)          /*par_cs_set(val)*/   /*Set the Parallel port's Chip select to 'val'*/
#define LV_DRV_DISP_PAR_SLOW             /*par_slow()*/        /*Set low speed on the parallel port*/
#define LV_DRV_DISP_PAR_FAST             /*par_fast()*/        /*Set high speed on the parallel port*/
#define LV_DRV_DISP_PAR_WR_WORD(data)    /*par_wr(data)*/      /*Write a word to the parallel port*/
#define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/

lvgl.h path

There are some includes like this #include "lvgl/lvgl.h", should we update them to:

#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

example 3 of text area

I don't like example 3 (auto text formatting)very much: It is supposed to show a text in form of 12:34.
However:

  • If you press the accept button, all further input is rejected.
  • If you press the reject button, the keyboard disappears altogether
  • If you use the left button followed by a backspace you can easily create something like 1:234

When writing the micropython version of the example I created a different keyboard without the accept, reject, +- and . buttons. In the event handler I make sure that no more than 2 digits can appear before and after the : If you try, these digits are immediately deleted again.

[Request] Update README and add README to each example

The main README still refers to the examples using LVGL v6, how can it be updated?

The purpose of a README on each example would be to list the requirements it needs (fonts, LVGL special configuration, etc.), and features it shows.

lv_demo_music_main.c looks wrong

It looks like lv_demo_music_main.c has been commented out in its entirety and any occurrence of the word signal has been replaced with the string "Call the ancestor's event handler".

Was this intentional?

keyboard tutorial crashes when Yes or No is pressed

This seems to be related to deleting the mbox in mbox_action.

I'm running this under mbed but not multi-threading.
I'm using the NUCLEO-F446RE dev board with this display connected in 16-bit parallel.
lv_tic_inc and lv_task_handler are called from the main loop context, not from a timer.
I can get it to not crash if I hide the mbox instead of deleting it in mbox_action.

In mbox_action, if I call

lv_obj_set_hidden(lv_obj_get_parent(mbox), true); 

instead of

lv_obj_del(lv_obj_get_parent(mbox));

The app does not crash.
If I create a variable to save the mbox on creation

static lv_obj_t * mbox = NULL;

Then I can change enable_action to delete the 'old' mbox and create a new one. This works fine.

static lv_res_t enable_action(lv_obj_t * btn)
{
   /*If the butto nsi released the show message box to be sure about the Enable*/
   if(lv_btn_get_state(btn) == LV_BTN_STATE_REL) {
      if (mbox != NULL) {
         printf("mbox existed previously, deleting prior to creating new.\r\n");
         lv_obj_del(lv_obj_get_parent(mbox));    /*Delete the black background. (it will delete the mbox too)*/
      }
...
      /*Create a message box*/
      //lv_obj_t * mbox = lv_mbox_create(bg, NULL);
      mbox = lv_mbox_create(bg, NULL);

Based on the crash report and the memory map, it seems to be crashing in memcpy after the object is deleted.

Is it possible that somehow a touch is trying to be delivered to the deleted mbox and deleting it later is ok?

Micropython examples for v7

Hi,

A year ago @stepansnigirev did an excellent job adding Micropython examples to lv_examples.
Since then focused moved to v7. The Micropython examples were written for v6 and are not compatible with v7.

Looking at LVGL documentation, v6 documentation still contains all the examples from @stepansnigirev work, but v7 does not.
Unfortunately it looks like only the C examples were migrated to v7 while Micropython examples were removed.

I think it would be a good idea to migrate Micropython examples to v7.
The work required for migrating most examples is probably straightforward.
Currently I don't have the time to do it myself, so I'm opening this issue just to point this up.
In case other contributors don't have the bandwidth for this, I think this task could be tagged as "help wanted" and suggested to new contributors who are looking for a simple contribution task.

What do you think?

lv_demo_rinter_icon_eco.o: No such file or directory

Platform: Windows 7
LVGL version 7.2.0
Running Eclipse CDT 2018

Trying to compile lv_sim_eclipse_SDL demo with LV_USE_DEMO_PRINTER set 1. In main.c, lv_demo_printer() called. Added all SDL files following guideline in Simulator on PC.

Compile with build all gives the following error message:

'Building target: lv_sim_eclipse_sdl'
<skip for simplicity>
./lv_drivers/display/UC1610.o ./lv_drivers/display/fbdev.o ./lv_drivers/display/monitor.o  ./lv_drivers/win_drv.o  ./main.o ./mouse_cursor_icon.o   -lmingw32 -lSDL2main -lSDL2
gcc: error: ./lv_examples/src/lv_demo_printer/images/lv_demo_rinter_icon_eco.o: No such file or directory
make: *** [lv_sim_eclipse_sdl] Error 1

Is it somewhere in the source file mistyped lv_demo_rinter_icon_eco? I searched almost everywhere but could not locate it.

gauge example offset

the origin of the three hands is not in the same when x/y is other than 0.
the scale is not centered wrt to background circle.
gauge_1

MAX resolution display on 9486

Hi,
I just started to use LVGL. The first program I run on 9341, TFT and Touchscreen works ok. The resulution of tft and touch is 320x240.
I tried to run a program on 9486 which is 480x320. I connected 9486 : touch recognise full 480x320 matrix, unfortunately screen works in 320x240 mode. Of coures I changed in menu config/component/lvgl configutation resulution to 480x320 but no result.
Kconfig keeps 480x 320 resolution. Is there any other place I have to enter the resolution?

Declaring 4 times bigger Canvas Buffer

Am I missing something I'm not sure.
When I look up the canvas examples Canvas's buffer is always 4 times bigger than the actual pixel buffer.
For example
https://github.com/lvgl/lv_examples/blob/master/src/lv_ex_widgets/lv_ex_canvas/lv_ex_canvas_2.c

line 16:
static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)];

For a RGBA8888 format:
LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)
means this;
LV_IMG_BUF_SIZE_TRUE_COLOR(w, h) ((LV_COLOR_SIZE / 8) * w * h)
then w=200 h=150;
((32 / 8) * w * h) = 120 000 array elements
lv_color_t 4 bytes;
4 * 120 000 = 480 000 bytes!

Raw data should be
RGBA8888 x 150 x 200 = 120 000 bytes?

Is it a issue or not?

Rework the examples repo

This repo should be reworked to make people easier to get started.

My vision is the following

Simple examples

Add very simple examples. It would be nice to use these examples in the documentation too (add lv_examples as a submodule to docs). I was collecting the recurring questions which could be answered with examples:

  • mbox: modal (@embeddedt, lv_ex_mbox_2)
  • slider: move the slider and set a label's text (@embeddedt, lv_ex_slider_2)
  • button: styling
  • image: recolor (@embeddedt, lv_ex_img_2)
  • label: styling
  • label: text shadow (@embeddedt, lv_ex_label_2)
  • text area: password and one line mode (@embeddedt, lv_ex_ta_2)
  • text area: finish on Enter
  • text area: format text (e.g automatically add dots for IP address)
  • image: slide show animation
  • image: mosaic wallpaper
  • display driver test (aded in FAQ)

Ready to use / easy to modify applications

  • Android like menu LINK
  • Car dashboard
  • File browser
  • Home automatization
  • Audio players
  • WiFi connect
  • All in one example to show LittlevGL's features Example

External libraries

Create a separate repo for examples when external libraries are used:

  • PNG decoder
  • JPG decoder
  • Video player
  • QR code
  • FatFS and Windows/Unix fs integration. Here I've already started something
  • FreeType

Blog post

Create blog posts about longer, more complex topics

  • responsive: fit, auto realign, layout, LV_DPI
  • optimizations for monocrome: round, pixel_wr
  • OSD menu
  • FAQ: added to the documentation's welcome page instead

Tutorials

  • lv_tutorial should be removed as it makes the examples and documentation fragile

Tests

  • lv_tests are not designed for the users, so they can go to a separate repo: lv_tets

Feedback is very welcome

Examples and assets include paths

Hello,

I'm working on rework-7 branch, tried to bring-up 7.0 tests. I came across issue with lvgl.h include paths - all demos, examples and assets are using:

#include "lvgl/lvgl.h"

This doesn't follow style used in rest of the framework and breaks build. Shouldn't be there a construction like:

#if defined(LV_CONF_INCLUDE_SIMPLE)
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif 

or is it a problem in my integration only? I use LV_CONF_INCLUDE_SIMPLE=1 and LV_EX_CONF_INCLUDE_SIMPLE=1 for work.

Jozef

Kconfig for lv_port_esp32 repo

We're adding a Kconfig file to the lv_port_esp32 components and this repo is one of them, I'm wondering what should we add on the Kconfig configuration menu, here's what we were planning to add:

  • Let the user choose what demo or example to run.
  • Let the user enable or disable the task to 'emulate' user input, when available.

This changes will be first tested on the lv_port_esp32 repo and then added here when they are proven to work fine.

What do you think?

ERROR IN lv_img_set_src from bin file

hi,I use the following code,An error occurred,maybe 《lv_fs_file_t * file_p》 Parameter transfer error
void test(void)
{
lv_obj_t *img;
img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img, "c:/1.bin");
}
bin1
bin2
bin3
but i used gif testcode,no error occurred;
void gif_demo(void)
{
lv_obj_t * img = lv_gif_create_from_file(lv_scr_act(), "c:/1.gif");

}
GIF
GIF1

I USE LVGL "LV_EXAMPLES"&"LVGL_NEW_FS_API"&"lv_fs_if"&"lv_lib_gif"

Root component.mk

In the root component.mk, shouldn't the lines:
lv_test/lv_test_theme
lv_test/lv_test_group
lv_test/lv_test_group
be:
lv_tests/lv_test_theme
lv_tests/lv_test_group
lv_tests/lv_test_group \

I haven't really delved into makefiles before, not really ever had to, so apologies if I am missing something.

The screen size

How to achieve screen size adaptation, Can Iset the size of the screen to a variable value obtained dynamically instead of a macro definition?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.