Giter VIP home page Giter VIP logo

lv_drivers'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_drivers's People

Contributors

aiwintermuteai avatar boraozgen avatar dolphinchips avatar ederguidsa avatar embeddedt avatar embetrix avatar fastshift avatar higaski avatar hr1025 avatar iggysha avatar johennes avatar jojos62 avatar kaythe avatar kevinpt avatar kisvegabor avatar leiflm avatar mariotaku avatar mheranco avatar mourinaruto avatar niklasf avatar poelstra avatar rdsantos18 avatar rzr avatar summershrimp avatar superna9999 avatar thelunatic avatar viatorus avatar wallaceit avatar winneymj avatar woodsts avatar

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

lv_drivers's Issues

fbdev.c: Re-use of previously confined area can result in out-of-range memcpy

The function fbdev_flush nicely confines the set area if it exceeds the screen size.

But in the line https://github.com/littlevgl/lv_drivers/blob/master/display/fbdev.c#L175 the original unconfined area value is used for width calculation which can result in memory corruption.

I don't have a monochrome display but line https://github.com/littlevgl/lv_drivers/blob/master/display/fbdev.c#L225 may also be affected by this problem.

X axis not inverting

Hi, I'm trying to use this library to interface with an Adafruit TFT display hooked to a raspberry pi 3.
I enabled the marker to work with the calibration and I swapped the X and Y axis through EVDEV_SWAP_AXES in lv_drv_conf.h. I enabled EVDEV_SCALE and EVDEV_CALIBRATE as well. By reading the comment just to the right of EVDEV_HOR_MIN I swapped it with its counterpart EVDEV_HOR_MAX but the axis is not inverting. Could this be a bug? (Ps. the Y axis is not inverting as well).

Scale input received from evdev, if touchscreen resolution does not match display resolution

Hi,

the resolution of my touch input reveived from evdev does not match the resolution of my display.
With the following patch it would be possible to define a custom input resolution. Every position read from evdev would be scaled to the display resolution.

index 94027d8..e7346f7 100644
--- a/b/indev/evdev.c
+++ b/a/indev/evdev.c
@@ -90,21 +90,25 @@ bool evdev_read(lv_indev_data_t * data)
         }
     }

-
-    if(evdev_root_x < 0)
-        evdev_root_x = 0;
-    if(evdev_root_y < 0)
-        evdev_root_y = 0;
-    if(evdev_root_x >= LV_HOR_RES)
-        evdev_root_x = LV_HOR_RES - 1;
-    if(evdev_root_y >= LV_VER_RES)
-        evdev_root_y = LV_VER_RES - 1;
-
     /*Store the collected data*/
+#if SCALE_EVDEV
+    data->point.x = (evdev_root_x * LV_HOR_RES) / SCALE_EVDEV_HOR_RES;
+    data->point.y = (evdev_root_y * LV_VER_RES) / SCALE_EVDEV_VER_RES;
+#else
     data->point.x = evdev_root_x;
     data->point.y = evdev_root_y;
+#endif
     data->state = evdev_button;

+    if(data->point.x < 0)
+      data->point.x = 0;
+    if(data->point.y < 0)
+      data->point.y = 0;
+    if(data->point.x >= LV_HOR_RES)
+      data->point.x = LV_HOR_RES - 1;
+    if(data->point.y >= LV_VER_RES)
+      data->point.y = LV_VER_RES - 1;
+
     return false;
 }
index 449796c..2090830 100644
--- a/b/lv_drv_conf_templ.h
+++ b/a/lv_drv_conf_templ.h
@@ -207,6 +207,11 @@
 #define USE_EVDEV    0
 #if USE_EVDEV
 #define EVDEV_NAME   "/dev/input/event0"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
+#define SCALE_EVDEV  0                          /* Scale input, e.g. if touchscreen resolution does not match display resolution */
+#if SCALE_EVDEV
+#define SCALE_EVDEV_HOR_RES     (4096)          /* Horizontal resolution of touchscreen */
+#define SCALE_EVDEV_VER_RES     (4096)          /* Vertical resolution of touchscreen */
+#endif
 #endif

Build failure due to incorrect header path

Hi,
I'm currently working on a project where I'm using lvgl and lv_drivers as git submodules.
The issue is that the following include:
https://github.com/littlevgl/lv_drivers/blob/117812eec9a5b82fe879f53ee0d1bf39cb9027c8/display/fbdev.h#L29

Breaks the build as the header lvgl.h is in "../../lvgl/lvgl.h" and not "lvgl/lvgl.h" as lv_drivers and lvgl are two separate directories.

Is this intentional or can this be updated to match "../../lv_drv_conf.h" include above it?

Best regards,
Vijay

libinput driver not linking

Hello!

I'm setting up my project to use libinput for the touchscreen. When I enable this through the config file and make, I get several linking errors when calling libinput functions. I haven't modified the files within lv_drivers folder.

It seems the libinput library isn't being compiled into the lv_indev.o file correctly. Any ideas?

I'm using Ubuntu 14.04.

These are the errors below:

arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.14-sumo/sysroots/cortexa9hf-neon-poky-linux-gnueabi -o demo ./main.o lv_group.o lv_indev.o lv_disp.o lv_obj.o lv_refr.o lv_style.o lv_debug.o lv_hal_disp.o lv_hal_indev.o lv_hal_tick.o lv_arc.o lv_bar.o lv_cb.o lv_cpicker.o lv_ddlist.o lv_kb.o lv_line.o lv_mbox.o lv_preload.o lv_roller.o lv_table.o lv_tabview.o lv_tileview.o lv_btn.o lv_calendar.o lv_chart.o lv_canvas.o lv_gauge.o lv_label.o lv_list.o lv_slider.o lv_ta.o lv_spinbox.o lv_btnm.o lv_cont.o lv_img.o lv_imgbtn.o lv_led.o lv_lmeter.o lv_page.o lv_sw.o lv_win.o lv_font.o lv_font_fmt_txt.o lv_font_roboto_12.o lv_font_roboto_16.o lv_font_roboto_22.o lv_font_roboto_28.o lv_font_unscii_8.o lv_circ.o lv_area.o lv_task.o lv_fs.o lv_anim.o lv_mem.o lv_ll.o lv_color.o lv_txt.o lv_math.o lv_log.o lv_gc.o lv_utils.o lv_async.o lv_printf.o lv_bidi.o lv_theme_alien.o lv_theme.o lv_theme_default.o lv_theme_night.o lv_theme_templ.o lv_theme_zen.o lv_theme_material.o lv_theme_nemo.o lv_theme_mono.o lv_draw_basic.o lv_draw.o lv_draw_rect.o lv_draw_label.o lv_draw_line.o lv_draw_img.o lv_draw_arc.o lv_draw_triangle.o lv_img_decoder.o lv_img_cache.o fbdev.o monitor.o R61581.o SSD1963.o ST7565.o UC1610.o SHARP_MIP.o FT5406EE8.o keyboard.o mouse.o mousewheel.o evdev.o libinput.o XPT2046.o win_drv.o -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
libinput.o: In function libinput_set_file': lv_drivers/indev/libinput.c:72: undefined reference to libinput_device_unref'
lv_drivers/indev/libinput.c:73: undefined reference to libinput_path_remove_device' lv_drivers/indev/libinput.c:76: undefined reference to libinput_path_add_device'
lv_drivers/indev/libinput.c:81: undefined reference to libinput_device_ref' libinput.o: In function libinput_init':
lv_drivers/indev/libinput.c:98: undefined reference to libinput_path_create_context' lv_drivers/indev/libinput.c:103: undefined reference to libinput_get_fd'
libinput.o: In function libinput_read': lv_drivers/indev/libinput.c:132: undefined reference to libinput_dispatch'
lv_drivers/indev/libinput.c:134: undefined reference to libinput_event_get_type' lv_drivers/indev/libinput.c:149: undefined reference to libinput_event_destroy'
lv_drivers/indev/libinput.c:133: undefined reference to libinput_get_event' lv_drivers/indev/libinput.c:138: undefined reference to libinput_event_get_touch_event'
lv_drivers/indev/libinput.c:139: undefined reference to libinput_event_touch_get_x_transformed' lv_drivers/indev/libinput.c:140: undefined reference to libinput_event_touch_get_y_transformed'
collect2: error: ld returned 1 exit status
Makefile:37: recipe for target 'default' failed
make: *** [default] Error 1

IRQ and input

I think i found a way to use IRQ to read input device without need change lvgl. This way to work seems good to you ? I use 5-2 dev because input_dev got user_data.
in the input library i will get input function and irq function like this:

Library (WIP):

static bool ar10xx_input_get(lv_indev_data_t * data)
{
    ar10xx_t* dev = data->user_data;  //get input device
    if (!dev->flag) //no irq, return false
        return false;
   //
    int16_t xpos;
    int16_t ypos;
    bool pen = AR10XX_GetPos(&xpos, &ypos);
    /*Store the collected data*/
    data->point.x = xpos;
    data->point.y = ypos;
    data->state = pen ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
    if(dev->flag) dev->flag-- ;
    return (dev->flag) ? true : false;
}

inline void ar10xx_irq(const* ar10xx_t dev)
{
        dev->flag++ ; //event on irq
}

Main:

void indev_init(void)
{
    lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv);          /*Basic initialization*/
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read = ar10xx_input_get;         /*This function will be called periodically*/
    indev_drv.user_data = &ar10xx_dev,
    lv_indev_drv_register(&indev_drv);
}

inline void interupt_fn(void)
{
    ar10xx_irq(&dev);
}

lvgl functions are called constantly. I wonder if we can activate a task only when an event incoming.
A bit like using "Queue" in FreeRTOS. The task is waiting for a new information (here the flag) to activate the task.
The advantage of the interupt system above is do not do transmission when it is not needed.

libinput: automatic device discovery

I'm working on an application that is meant to be run on many different types of devices which means I can't hard-code the /dev/input/event... paths because I don't know them at build time. It would be great if the libinput driver could provide an interface for automatically detecting touchscreens, pointer devices and keyboards.

I have some very rudimentary code here that basically just walks the /dev/input/event... files, makes a libinput call to determine the device capabilities and then filters the files based on that.

I'd be interested to know if you would consider adding something like this to lv_drivers? I think this could be beneficial to other users as well.

master branch does not compile with lvgl master branch

Hi !

I'm running into trouble by using both repositories with the current master branch.

  • lvgl: 2a78353ca485e9d07e2aa5f5543db13e6370580a
  • lv_driver: bc24e9f

Maybe the lvgl update to V7 is not considered fully in lv_drivers - I found the following issues:

wrong header file location

The lv_drv_conf_templ.h has 3 devices enabled per default

  • #define USE_SSD1306 1
  • #define USE_SSD1306 1
  • #define USE_AR10XX (1)

Additionally for these devices the normally used code template is missing:

#ifndef USE_<device>
#  define USE_<device>         0
#endif

This leads for all 3 devices to a header include error

fatal error: lvgl/lv_misc/lv_color.h: No such file or directory 
#include "lvgl/lv_misc/lv_color.h"

The lv_color.h file is found at lvgl/src/lv_misc/lv_color.h
(quickly fixed by disabling the drivers which are not used in my project anyway)

the cpp keyword "template" is used as function argument

I'm using the lvgl framework in a c/cpp project and this error pops up after updating to master branch

In file included from /home/pi/work/lora/Rfm96Raspberry/Application/lv_drivers/display/fbdev.h:20,                                                
                 from /home/pi/work/lora/Rfm96Raspberry/Application/gui.h:12,                                                                     
                 from /home/pi/work/lora/Rfm96Raspberry/Application/main.cpp:9:                                                                   
/home/pi/work/lora/Rfm96Raspberry/Application/lv_drivers/display/../../lv_drv_conf.h: At global scope:                                            
/home/pi/work/lora/Rfm96Raspberry/Application/lv_drivers/display/../../lv_drv_conf.h:235:70: error: expected ‘,’ or ‘...’ before ‘template’       
 static inline int lv_spi_repeat(lv_spi_handle_t spi_dev, const void* template, uint32_t repeats, uint8_t template_size)

Renaming the function argument template in lv_drv_conf_templ.h fixes this issue.

warnings

Compiling the master branch shows a lot of new warnings, mainly

  • warning: unused parameter
  • warning: no return statement in function

Currently I'm ignoring this warning and after fixing the other issues temporarily my little demo application is running nearly the same as for V6 (except of the look and feel due to the changed theme handling ;-) )

XPT2046 driver gives jumping results

The driver is not up to date, the result code for the read should always return false. When implemented as in this sample, the touch does not respond precisely. The returned x/y coordinates have a variation of about 30 pixels on the same position.
https://github.com/littlevgl/lv_drivers/blob/9fb21b087b52b46eca015d80d27eefcd71739786/indev/XPT2046.c#L109
The porting template in lvgl is correct:
https://github.com/littlevgl/lvgl/blob/master/porting/lv_port_indev_template.c

[new_api] vdb SSD1306 visual artifacts

I just updated to the latest commit of the new_api branch and am having visual artifacts. I looked through the new SSD1306 code, but I don't seem anything obviously wrong with it; however, I am not super familiar with the VDB system. Previously, everything worked fine with the old fill/flush method. The odd thing is it only happens sometimes; full screen refreshes seem fine, as well as some scrolling text.

Microcontroller: ESP32
Display: I2C SSD1306

Changing the VDB size seems to have no impact.

Attached gif demonstrating the issue:
https://gfycat.com/AgileDemandingHound

@Zaltora , can you offer any insight on this?

error while compiling lv_port_linux_frame_buffer with EVDEV_CALIBRATE enabled

Hi,

when compiling the mentioned project for a rPi project with a touchscreen that needs to be scaled I get following error 2x

 error: ‘drv->disp->driver’ is a pointer

to solve this i have changed lines (from 215) in evdev.c from

    data->point.x = map(evdev_root_x, EVDEV_HOR_MIN, EVDEV_HOR_MAX, 0, drv->disp->driver.hor_res);
    data->point.y = map(evdev_root_y, EVDEV_VER_MIN, EVDEV_VER_MAX, 0, drv->disp->driver.ver_res);

to

    data->point.x = map(evdev_root_x, EVDEV_HOR_MIN, EVDEV_HOR_MAX, 0, drv->disp->driver->hor_res);
    data->point.y = map(evdev_root_y, EVDEV_VER_MIN, EVDEV_VER_MAX, 0, drv->disp->driver->ver_res);

tried to create a pull request but was unable to do this from the lv_port_linux_frame_buffer project as lv_drivers is a submodule and i do not yet know how to do this.

thanks for your nice library
Jef

lvgl with bit sized vdb

With the new lvgl 5.2, i see some special function/configuration for monochrome display. with discussion here, i see more function : lvgl/lvgl#300

#define LV_VDB_PX_BPP
...
 void (*vdb_wr)(uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa);

The vdb_rd function doesn't exist yet ?
What is the rounder function described in the commit ?
If i set 1bpp color for vdb, the buffer size will be lower than use 1 byte by pixel ?

It is a WIP feature ?

sdl.c "SDL_StartTextInput" opens native device keyboard

This function is called inside sdl_init() and just opens the device keyboard when running lvgl, which is not desired for me.

I commented the function and now the app works fine. I am not sure what this function is exactly used for but i'm typing this because it might be looked at. My device is the Nintendo Switch.

evdev / libinput: "full" keyboard support

When using the LV_INDEV_TYPE_KEYPAD type, the evdev driver supports a limited number of keys (backspace, enter, up right, left, down). Any other keys are ignored. It would be great if the driver would handle input from a regular keyboard so that, for instance, typed characters are forwarded into a textarea.

I'm not sure if there is a better way to achieve this other than adding further cases for the relevant key codes and handling things like SHIFT manually.

Maybe ASCII characters or characters found on common US English keyboard layouts would be enough for a start as that would limit the amount of switching.

I'm curious if you'd be open to adding this to lv_drivers and would be happy to help implement it.

SSD1306 (probably SH1106)

Hi!

I'm trying the driver (new_api) for the screen I have (it was sold as a SSD1306, but works better when I select SH1106 in the typedef). This one have the pins for I2C.
I'm using this with an STM32F091RC nucleo board, to make the code I like IDEs and as much debugging possibilities as I can have, then I'm using Eclipse with the GNU MCU Eclipse plugins + OCD, and CubeMX to generate the base.
I don't know if this is the 'correct' way, but the only way I was able to make this work was adding a call for the function ssd1306_load_frame_buffer(&dev) in the main loop of my main, don't know if this is documented somewhere, I didn't find it, just figured out.

here is the relevant part of the main:

lv_init();
ssd1306_t scr;
scr.height = 64;
scr.width =128;
scr.protocol = SSD1306_PROTO_I2C;
scr.screen = SH1106_SCREEN; //SSD1306_SCREEN ; //
scr.i2c_dev = &hi2c1;
scr.rst_pin = 0;
ssd1306_init(&scr);

lv_disp_drv_t disp_drv; /Descriptor of a display driver/
lv_disp_drv_init(&disp_drv);

disp_drv.disp_flush = ssd1306_flush; /Used in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)/
// disp_drv.disp_fill = ssd1306_fill; /Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)/
// disp_drv.disp_map = ssd1306_map; /Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)/

lv_disp_drv_register(&disp_drv);

///////////////////////////*******\\\\\\\\\\\\\\\\\\\\

lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);

/Modify the Label's text/
lv_label_set_text(label1, "Hello world!");

/* Align the Label to the center

  • NULL means align on parent (which is the screen now)
  • 0, 0 at the end means an x, y offset after alignment*/
    lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);

/* USER CODE END 2 */

/* Infinite loop /
/
USER CODE BEGIN WHILE */
while (1)
{
HAL_Delay(5);
lv_tick_inc(5);
lv_task_handler();
if (ssd1306_need_redraw()) ssd1306_load_frame_buffer(&scr);

/* USER CODE END WHILE */

}

the next problem I had was with the function to talk with i2c in lv_drv_conf.h, here is the code I wrote:
static inline int lv_i2c_write(lv_i2c_handle_t i2c_dev, uint8_t reg, void* data_out, uint8_t datalen)
{
//Do the dependant port here
uint8_t buffer[datalen +1];
uint8_t *ptr = data_out;
buffer[0] = reg;

for (int i = 1; i <= datalen +1; i++) buffer[i] = *(ptr++);
HAL_I2C_Master_Transmit(i2c_dev, 0x78, buffer ,datalen + 1, HAL_MAX_DELAY);

}

this function is called from lv_drv_common.h with
static inline int i2c_send(const lv_i2c_handle_t i2c_dev, uint8_t reg, uint8_t* data, uint8_t len)
{
return lv_i2c_write(i2c_dev, &reg, data, len);
}
which is called form SSD1306.c in the command and data sections, the command is more easy to read:
err_control(i2c_send(dev->i2c_dev, 0, &cmd, 1));

when the function was called all the time with the third argument as '0' I never get a 0 at the interface (was reading that with the scope all the time), I tried several ways to write 'reg' but I always get 63 or 60 or 6B when should be 0 and 47 when should be 40 (both hex)
I ended writing the function inside ssd1306_command and _load_frame_buffer, like:
{
#if (SSD1306_I2C_SUPPORT)
case SSD1306_PROTO_I2C:
// err_control(i2c_send(dev->i2c_dev, 0, &cmd, 1));
;
uint8_t buffer[2];
buffer[0] = 0x00;
buffer[1] = cmd;

    HAL_I2C_Master_Transmit(&hi2c1, 0x78, buffer, 2, HAL_MAX_DELAY);
    break;

the other is a bit more long but same idea.

Any idea about what I'm doing wrong here?

and lastly, in the init procedure, this option should be false:
&& !ssd1306_set_whole_display_lighting(dev, false) // was true!!
if is set to true the whole screen remains white.

ST7565 driver results in black background

Hi, I'm currently porting lvgl to work with mbed-os using platformio. The screen I'm using is an ST7565 LCD 128x64 monochrome (specs). I was able to get "Hello World!" to draw on the screen, however the entire screen background is solid black (the text can be seen if the screen is tilted, see attached images). I'm struggling to figure out what is wrong. I do have a feeling that my lv_conf.h is mis-configured, so I will keep digging on my end. If anyone have any ideas or suggestions, please do let me know.

main.cpp
lv_conf.h

20190120_132817
20190120_132754

SDL mouse driver ignores touchscreen events

We're using the SDL display and mouse drivers. We had naively assumed that if the UI worked with a mouse then it'd work with a touchscreen, however touchscreen events are completely ignored.

In our use case I fixed this by adding the following to mouse_handler(), but not sure if this is the correct general solution. Maybe you'd prefer it if this went into a separate touchscreen driver.

        case SDL_FINGERUP:
            left_button_down = false;
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;
        case SDL_FINGERDOWN:
            left_button_down = true;
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;
        case SDL_FINGERMOTION:
            last_x = LV_HOR_RES_MAX * event->tfinger.x / MONITOR_ZOOM;
            last_y = LV_VER_RES_MAX * event->tfinger.y / MONITOR_ZOOM;
            break;

mouse_hid driver shoud rename to evdev and support EV_ABS

Hi,

I use littlevgl in embed linux, and i have a touch screen use input evdev interface. I notice that mouse_hid use evdev interface, and only support EV_REL event (my touch screen need support EV_ABS and BTN_TOUCH event). So maybe mouse_hid shoud rename to evdev more precisely and add EV_ABS and BTN_TOUCH support.

Below is the patch to support EV_ABS and BTN_TOUCH:


diff --git a/indev/mouse_hid.c b/indev/mouse_hid.c
index b2e91de..6907c32 100644
--- a/indev/mouse_hid.c
+++ b/indev/mouse_hid.c
@@ -76,15 +76,22 @@ bool mouse_hid_read(lv_indev_data_t * data)
             if (in.code == 1)
                 mouse_hid_root_y += in.value;
         } else if (in.type == 1) {
-            if (in.code == 272) {
+            if (in.code == 272 || in.code == BTN_TOUCH) {
                 if (in.value == 0)
                     mouse_hid_button = LV_INDEV_STATE_REL;
                 if (in.value == 1)
                     mouse_hid_button = LV_INDEV_STATE_PR;
             }
+        } else if (in.type == EV_ABS)
+        {
+            if (in.code == 0)
+                mouse_hid_root_x = in.value;
+            if (in.code == 1)
+                mouse_hid_root_y = in.value;
         }
     }
 
+
     if (mouse_hid_root_x < 0)
         mouse_hid_root_x = 0;
     if (mouse_hid_root_y < 0) 

Drivers questions

When working with PIO drivers, i could not understand concept of this repo. It looks like "assorted collection of different useful things", and may be tries to emulate features of missed package manager.

Of cause, i understand, we need to do something to make lvgl work, but there are no clean limits "where to stop" and everything is tight-coupled via template header.

I had to copy-paste files and edit hardcoded paths. That's strange and not good for maintenance.

Goals

I'd like to understand concept and make some (or all parts) useable from PIO with ease.

Problems

  1. It's not clear, which drivers are about SDL.
  2. Grouping by display / indev looks strange. And it's not clear why win_drv placed separate, in root.
  3. Global header required, which defines everything, even if i need only SDL drivers with couple of defines.

Suggestions

  1. Global header should NOT be mandatory.

It worth to cleanup such patterns:

#ifndef USE_SSD1963
#  define USE_SSD1963         0
#endif

User should be able to pass #define-s only for used "drivers"

  1. Improve isolation

https://github.com/littlevgl/lv_drivers/blob/master/display/monitor.c#L20-L22 - it's very suspicious, when one driver goes for another one, out of it's scope (folder)

Probably, may worth to more flat layout with prefixes, OR may be move SDL drivers to separate repo.

If drivers are independent, probably those could be in separate folder each (something like mono repository, but not sure).

Added touch screen device file setting function of evdev.

Hi,
I want to add the function as follows:

evdev.c

bool evdev_set_file(char* dev_name)
{ 
     if(evdev_fd != -1) {
        close(evdev_fd);
     }
     evdev_fd = open(dev_name, O_RDWR | O_NOCTTY | O_NDELAY);

     if(evdev_fd == -1) {
        perror("unable open evdev interface:");
        return false;
     }

     fcntl(evdev_fd, F_SETFL, O_ASYNC | O_NONBLOCK);

     evdev_root_x = 0;
     evdev_root_y = 0;
     evdev_button = LV_INDEV_STATE_REL;

     return true;
}

Can I commit & push? Or do you have additional code rules to follow?

Driver PAR, init_9341 and options

Hi, my test wiht ILI9341 parallel port.
Lvgl library compiling ok (Eclipse NXP).

how to init driver sequence
ex 1:
static ili9341_t _xParDev;
ili9341_t* _pxdev = &_xParDev;
_pxdev->par_dev = (lv_par_handle_t)&_xParDev;
_pxdev->protocol = ILI9341_PROTO_8080_8BIT;
....
...
lv_label_set_text(label1, "Hello world!");

ex 2:
how to modifier bus ILI9341_PROTO_8080_8BIT to ILI9341_PROTO_8080_16BIT
in driver : lv_par_write();

thanks
Carlos.

Apply calibration to evdev touchscreen and swap/invert axes

Hi,

I have a touchscreen that - similar to issue #35 - has a scaling that doesn't equal the display resolution. Additionally the x and y axes are swapped and the reported coordinates have quite a big offset from 0 and 4096, resp. I do have an xorg.conf that came with the screen and contains the calibration values.

I added options to swap x and y axes, invert one or both axes (on my touchscreen the x axis is inverted) and apply min/max values for the x and y axes to calibrate the screen. I'd be happy to create a pull request if you're interested.

Touchscreen Problem after upgrading lv_drivers folder

After updating the lv_drivers folder for our application, the X/Y coordinates being reported to our application are not correct. Looks like the problem is in evdev.c and is related to the check in commited on Nov 24, 2019.

In our case, the data->point.x/y calculated in the #if EVDEV_SCALE section is being overwritten by the #else portion of the #if EV_CALIBRATE section (lines 189-199).

I am not sure what case the Nov 2019 checkin was addressing but looks like the code will now always override the x/y values calculated using the scaling code. So I'm not sure if that check in should just be reverted or if it needs modified in some manner.

libinput touch driver assumes fullscreen display

I've been swamping you folks with PRs lately so I thought I'd write this one up as an issue first before sending yet another PR. 🙂

I ran into this when following up on #164. As described in that pull request, I'm working on a framebuffer application that covers only part of the screen and leaves the rest of it untouched for other programs to use. When trying this out on a touch screen, I noticed that the libinput touch driver uses LV_HOR_RES and LV_VER_RES to transform the touch to screen coordinates.

case LIBINPUT_EVENT_TOUCH_MOTION:
case LIBINPUT_EVENT_TOUCH_DOWN:
  touch_event = libinput_event_get_touch_event(event);
  most_recent_touch_point.x = libinput_event_touch_get_x_transformed(touch_event, LV_HOR_RES);
  most_recent_touch_point.y = libinput_event_touch_get_y_transformed(touch_event, LV_VER_RES);
  libinput_button = LV_INDEV_STATE_PR;
  break;

When the display size is reduced with the API introduced in #164, however, that means touches outside of the actual display area are proportionally mapped into the display area. Or in other words, the touch is registered in a different place than the one you touched.

I found a way to fix this by injecting the full screen size and display offset into the driver:

case LIBINPUT_EVENT_TOUCH_MOTION:
case LIBINPUT_EVENT_TOUCH_DOWN: {
  touch_event = libinput_event_get_touch_event(event);
  lv_coord_t y = libinput_event_touch_get_y_transformed(touch_event, full_display_height) - display_y_offset;
  if (y < 0) {
    break; /* ignore touches that are out of bounds */
  }
  most_recent_touch_point.x = libinput_event_touch_get_x_transformed(touch_event, LV_HOR_RES);
  most_recent_touch_point.y = y;
  state->button = LV_INDEV_STATE_PR;
  break;

I'm curious if you'd accept a corresponding contribution. We could default full_display_height to LV_VER_RES and display_y_offset to 0 so that no client change is required if you're using a fullscreen display.

evdev_read defined to return bool

In version 8 it seems that evdev_read should return void not bool. I get a compiler error on it.
bool evdev_read(lv_indev_drv_t * drv, lv_indev_data_t * data);

evdev / libinput: support KEY_POWER

Some devices have dedicated power buttons that emit the KEY_POWER scan code. Here's an example from the power button on my laptop:

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x1 version 0x0
Input device name: "Power Button"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 116 (KEY_POWER)
Properties:
Testing ... (interrupt to exit)
Event: time 1631010379.405744, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1631010379.405744, -------------- SYN_REPORT ------------
Event: time 1631010379.405837, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1631010379.405837, -------------- SYN_REPORT ------------

As an addendum to #153 and #155, it would be nice if:

  1. the libinput driver could automatically recognize power-button devices
  2. the evdev / libinput drivers could handle KEY_POWER

For 1, we'd just have to add another case to the libinput_capability enum and a corresponding capability check (just like we do for the other device types in #157).

For 2, performing the shutdown is as easy as

#include <sys/reboot.h>
sync();
reboot(RB_POWER_OFF);

However, I am not sure how to best integrate this into the existing drivers. 🤔

We could add a new case to LV_INDEV_TYPE_POWER to the lv_indev_type_t enum in lvgl but that might mean quite invasive changes.

Alternatively, we could just use LV_INDEV_TYPE_KEYPAD for power button devices and handle the key in indev_keypad_proc. It'll feel a little odd to refer to the device as "keypad" but after all the kernel treats it as a keyboard, too, because it can send keys so maybe that's the best approach.

VDB update

Since i update the library SSD1306, i got a lot of visual problem in my final application. the "hello world" example work but my app got more objects.

I need to clean some thing.

  • I need a custom (perfect) monochrome style setting
  • I didn't found the way to set a custom style by default like "font"

For my current Test, i use VDB screen sized (128*64). My first thought about the problem is the wrong style setting.
I got a second thought about the rounder function that will erase object already updated (not confirmed).
I will test more.

lv_drivers branch 8.0 doesn't compile

I checked out the v8.0 branch in lv_drivers in the hope to have a more-or-less stable branch instead of being on the latest greatest but untested master.
https://github.com/lvgl/lv_drivers/tree/release/v8.0
tag v8.0.1

This branch fails to compile because indev/evdev.c references
drv->disp->driver.hor_res
instead of using a '->' in the last part

This (and more) has been fixed on master
Can we update the v8.0 branch to a working version again?

SHARP_MIP.h typos

Line 46 should be:

void sharp_mip_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);

Line 50 should be:

void sharp_mip_com_inversion(void);

VGA driver

Someone please implement a VGA display and PS/2(keyboard and mouse) LVGL driver for embedded devices which is implemented on software side and depends only on GPIO access. I came across two such similar libraries- FabGL and vgax but both of them are hardware (ESP32/ARDUINO) specific, would be happy if there is no hardware-specific code in the new driver.

[fbdev] Shouldn't the framebuffer driver use color channels fb_bitfield from fb_var_screeninfo

Hi,

I have the following issue with my setup. The data lines for red and blue channels of the LCD are inverted. This leads to having red and blue colors swapped between the UI on desktop (dev env) and UI on target (production env).

I noticed the returned value for red, green and blue channels are not really as expected and as assumed by LVGL (and plenty other tools like https://github.com/phoenix826/fb-test-app). Each pixel is not RGBA (32bits) but rather BGRA (32bits).

One can read this info from struct fb_var_screeninfo. I have not tested, but it looks like this guy is leveraging that data to properly fill pixels into the memory mapped framebuffer https://github.com/sigma-embedded/fbtest/blob/master/fbtest.c.

Here is an extract from the linux kernel fb API (include/uapi/linux/fb.h):

/* Interpretation of offset for color fields: All offsets are from the right,
 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
 * can use the offset as right argument to <<). A pixel afterwards is a bit
 * stream and is written to video memory as that unmodified.
 *
 * For pseudocolor: offset and length should be the same for all color
 * components. Offset specifies the position of the least significant bit
 * of the pallette index in a pixel value. Length indicates the number
 * of available palette entries (i.e. # of entries = 1 << length).
 */
struct fb_bitfield {
	__u32 offset;			/* beginning of bitfield	*/
	__u32 length;			/* length of bitfield		*/
	__u32 msb_right;		/* != 0 : Most significant bit is */ 
					/* right */ 
};

struct fb_var_screeninfo {
	__u32 xres;			/* visible resolution		*/
	__u32 yres;
	__u32 xres_virtual;		/* virtual resolution		*/
	__u32 yres_virtual;
	__u32 xoffset;			/* offset from virtual to visible */
	__u32 yoffset;			/* resolution			*/

	__u32 bits_per_pixel;		/* guess what			*/
	__u32 grayscale;		/* 0 = color, 1 = grayscale,	*/
					/* >1 = FOURCC			*/
	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
	struct fb_bitfield green;	/* else only length is significant */
	struct fb_bitfield blue;
	struct fb_bitfield transp;	/* transparency			*/	
	[...]
}

I guess my issue is very specific and I managed to get around it by switching channels in lv_color_t right before it is copied into the framebuffer device.

But how much work would that represent to get support for color channels into fbdev?

Thanks!

How to use this repo ?

I am trying to use LittlevGL with SSD1306 (OLED, Monochrome). I have found this repo containing SSD1306 drivers.

But I couldn't understand how to use these driver with lvgl library and port this driver to my MCU.

Can somebody please help me ?

GC9A01 driver uses undeclared functions for SPI settings

The driver for display GC9A01 contains macro call to LV_DRV_DISP_SPI_FREQ and LV_DRV_DISP_SPI_MODE. These are not included in the driver config template.

lv_drivers/display/GC9A01.c

Lines 532 to 533 in d23241e

LV_DRV_DISP_SPI_FREQ(GC9A01_SPI_BAUD);
LV_DRV_DISP_SPI_MODE(GC9A01_SPI_BITS, GC9A01_SPI_MODE);

I suggest to remove the SPI settings and let the application set these parameters.

The driver model with the macros also does not support multiple instances of displays, which is possible with lvgl.

Anyway, thanks for the driver templates.

evdev / libinput: use multiple devices

The current evdev and libinput drivers store state in static variables. That means they can only be used with one device at a time but I cannot use, say, two trackpads or a trackpad and a keyboard at the same time (or at least my weak C-fu doesn't let me see how).

It would be great if the driver state could instead be stored in an external structure, to be managed by the caller. This way I could connect an arbitrary number of input devices via either of these drivers.

In order to not break the interface of the existing evdev / libinput drivers maybe a new driver with support for multiple devices could be created and the existing drivers could be changed to use the new one under the hood.

Suggestions for setting input devices.

In raspberry pie, the device name of the touch screen and the mouse changes each time depending on whether the mouse is used or not. When the mouse is connected / dev / input / event0 (mouse) and / dev / input / event1 (touch screen), If the mouse is not connected / dev / input / event1 (touch screen).
Therefore, I want to modify a function that can set the touch screen device in such a way that the driver parameter is passed to the function instead of the method defined in the existing lv_drv_conf.h.

~before
evdev_init()

~after
evdev_init(char* device_name)

How to rotate LVGL output to linux framebuffer driver?

Hi,

In the current release of LVGL drivers, the linux framebuffer driver is present in display/fbdev.{h,c}. But does it use the fbdev(4) as described here https://manpages.debian.org/stretch/xserver-xorg-video-fbdev/fbdev.4.en.html?

We are developing an GUI using LVGL and a custom linux distribution built with yocto on targeting an i.MX6ULL platform. The display attached is by default in landscape mode, but we want the LVGL GUI to be in portrait mode. We currently set USE_FBDEV=1 and USE_EVDEV=1 in the config file.

Hence, with such a setup, would it be possible to rotate the screen CCW by 90° to achieve expected portrait mode?

In the yocto recipe, we are using the framebuffer distribution, no X11, no Wayland. I'd like to keep it like that because our need is simple: a fullscreen GUI without any desktop environment. I could eventually add X11 to the image and use Xorg.conf file as stipulated int the link above, but wouldn't LVGL bypass X11 since the display/fbdev.c directly use mapped memory to flush graphics?

Thanks for the help,
Hugo

Cannot build with evdev enabled

I am trying to port to a Raspberry Pi 4 using gcc compiler.

Attempting to build with evdev enabled yields the following error:
/home/pi/lvgl-test/lv_drivers/indev/evdev.c:228:42: error: ‘drv->disp->driver’ is a pointer; did you mean to use ‘->’?

Changing lines 228-231 in evdev.c to use to arrow operator instead of dot operator fixes the issue on my end.
if(data->point.x >= drv->disp->driver->hor_res) data->point.x = drv->disp->driver->hor_res - 1; if(data->point.y >= drv->disp->driver->ver_res) data->point.y = drv->disp->driver->ver_res - 1;

FBDEV driver always tries to use the FBSD code

HI!

If i try to use the linux framebuffer code it alwas ends with a compile fail. The failure occurs inside codeblocks that belongs to fbsd. This occurs irrespecitively of how i configre littlvgl in lv_drv_conf.h

in lv_drv_conf.h the use of the freebsd framebuffer code is defined like this

#ifndev USE_BSD_FBDEV
#   deine USE_BSD_FBDEV   0
#endif

Its the same pattern used in all config files, and that means that USE_BSD_FBDEV is always defined and is either 0 or 1.

But in fbdev.c the code checks if USE_BSD_FBDEV is defined or not, and it will always be defined, so the bsd code will always be used.

#ifdef USE_BSD_FBDEV
#include <sys/fcntl.h>
#include <sys/time.h>
#include <sys/consio.h>
#include <sys/fbio.h>
#else  /* USE_BSD_FBDEV */
#include <linux/fb.h>
#endif /* USE_BSD_FBDEV */

The code works fine if its altered to check if USE_BSD_FBDEV is 0 or 1 instead of if it is defined att all. Eg just replace #ifdef with #if in the few locations where the code checks for USE_BSD_FBDEV

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.