|
1 |
| -# Littlev Graphics Libraray |
| 1 | +<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1> |
2 | 2 |
|
3 |
| - |
| 3 | +<p align="center"> |
| 4 | +<img src="https://lvgl.io/assets/images/img_1.png"> |
| 5 | +</p> |
4 | 6 |
|
5 |
| -LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint. |
| 7 | +<p align="center"> |
| 8 | +LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. |
| 9 | +</p> |
6 | 10 |
|
7 |
| -Homepage: https://littlevgl.com |
| 11 | +<h4 align="center"> |
| 12 | +<a href="https://lvgl.io">Website </a> · |
| 13 | +<a href="https://lvgl.io/demos">Online demo</a> · |
| 14 | +<a href="https://lvgl.github.io/lv_examples/">Nightly demos</a> · |
| 15 | +<a href="https://docs.lvgl.io/">Docs</a> · |
| 16 | +<a href="https://forum.lvgl.io">Forum</a> |
| 17 | +</h4> |
8 | 18 |
|
9 |
| -### Table Of Content |
10 |
| -* [Key features](#key-features) |
11 |
| -* [Porting](#porting) |
12 |
| -* [Project set-up](#project-set-up) |
13 |
| -* [PC simulator](#pc-simulator) |
14 |
| -* [Screenshots](#screenshots) |
15 |
| -* [Contributing](#contributing) |
16 |
| -* [Donate](#donate) |
| 19 | +--- |
17 | 20 |
|
18 |
| -## Key features |
19 |
| -* Powerful building blocks buttons, charts, lists, sliders, images etc |
20 |
| -* Advanced graphics with animations, anti-aliasing, opacity, smooth scrolling |
21 |
| -* Various input devices touch pad, mouse, keyboard, encoder, buttons etc |
22 |
| -* Multi language support with UTF-8 decoding |
23 |
| -* Fully customizable graphical elements |
| 21 | +## Features |
| 22 | +* Powerful [building blocks](https://docs.lvgl.io/latest/en/html/widgets/index.html): buttons, charts, lists, sliders, images, etc. |
| 23 | +* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling |
| 24 | +* Use [various input devices](https://docs.lvgl.io/latest/en/html/overview/indev.html): touchscreen, mouse, keyboard, encoder, buttons, etc. |
| 25 | +* Use [multiple displays](https://docs.lvgl.io/latest/en/html/overview/display.html): e.g. monochrome and color display |
24 | 26 | * Hardware independent to use with any microcontroller or display
|
25 |
| -* Scalable to operate with few memory (50 kB Flash, 10 kB RAM) |
26 |
| -* OS, External memory and GPU supported but not required |
27 |
| -* Single frame buffer operation even with advances graphical effects |
28 |
| -* Written in C for maximal compatibility |
29 |
| -* Simulator to develop on PC without embedded hardware |
30 |
| -* Tutorials, examples, themes for rapid development |
31 |
| -* Documentation and API references online |
32 |
| - |
33 |
| -## Porting |
34 |
| -In the most sime case you need 4 things: |
35 |
| -1. Call `lv_tick_inc(1)` in every millisecods in a Timer or Task |
36 |
| -2. Register a function which can **copy a pixel array** to an area of the screen |
37 |
| -3. Register a function which can **read an input device**. (E.g. touch pad) |
38 |
| -4. Call `lv_task_handler()` periodically in every few milliseconds |
39 |
| -For more information visit https://littlevgl.com/porting |
40 |
| - |
41 |
| -## Project set-up |
42 |
| -1. **Clone** or [Download](https://littlevgl.com/download) the lvgl repository: `git clone https://github.com/littlevgl/lvgl.git` |
43 |
| -2. **Create project** with your preferred IDE and add the *lvgl* folder |
44 |
| -3. Copy **lvgl/lv_conf_templ.h** as **lv_conf.h** next to the *lvgl* folder |
45 |
| -4. In the lv_conf.h delete the first `#if 0` and its `#endif`. Let the default configurations at first. |
46 |
| -5. In your *main.c*: #include "lvgl/lvgl.h" |
47 |
| -6. In your *main function*: |
48 |
| - * lvgl_init(); |
49 |
| - * tick, display and input device initialization (see above) |
50 |
| -7. To **test** create a label: `lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);` |
51 |
| -8. In the main *while(1)* call `lv_task_handler();` and make a few milliseconds delay (e.g. `my_delay_ms(5);`) |
52 |
| -9. Compile the code and load it to your embedded hardware |
53 |
| - |
54 |
| -## PC Simulator |
55 |
| -If you don't have got an embedded hardware you can test the graphics library in a PC simulator. The simulator uses [SDL2](https://www.libsdl.org/) to emulate a display on your monitor and a touch pad with your mouse. |
56 |
| - |
57 |
| -There is a pre-configured PC project for **Eclipse CDT** in this repository: https://github.com/littlevgl/pc_simulator |
58 |
| - |
59 |
| -## Screenshots |
60 |
| - |
61 |
| - |
62 |
| - |
63 |
| - |
| 27 | +* Scalable to operate with little memory (64 kB Flash, 10 kB RAM) |
| 28 | +* Multi-language support with UTF-8 handling, Bidirectional and Arabic script support |
| 29 | +* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/latest/en/html/overview/style.html) |
| 30 | +* OS, External memory and GPU are supported but not required |
| 31 | +* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/latest/en/html/porting/display.html) |
| 32 | +* Written in C for maximal compatibility (C++ compatible) |
| 33 | +* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings) |
| 34 | +* [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) to develop on PC without embedded hardware |
| 35 | +* [Examples](lv_examples) and tutorials for rapid development |
| 36 | +* [Documentation](http://docs.lvgl.io/) and API references |
64 | 37 |
|
65 |
| -## Contributing |
66 |
| -See [CONTRIBUTING.md](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md) |
| 38 | +## Requirements |
| 39 | +Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are: |
| 40 | + |
| 41 | +<table> |
| 42 | + <tr> |
| 43 | + <td> <strong>Name</strong> </td> |
| 44 | + <td><strong>Minimal</strong></td> |
| 45 | + <td><strong>Recommended</strong></td> |
| 46 | + </tr> |
| 47 | + <tr> |
| 48 | + <td><strong>Architecture</strong></td> |
| 49 | + <td colspan="2">16, 32 or 64 bit microcontroller or processor</td> |
| 50 | + </tr> |
| 51 | + <tr> |
| 52 | + <td> <strong>Clock</strong></td> |
| 53 | + <td> > 16 MHz </td> |
| 54 | + <td> > 48 MHz</td> |
| 55 | + </tr> |
| 56 | + |
| 57 | + <tr> |
| 58 | + <td> <strong>Flash/ROM</strong></td> |
| 59 | + <td> > 64 kB </td> |
| 60 | + <td> > 180 kB</td> |
| 61 | + </tr> |
| 62 | + |
| 63 | + <tr> |
| 64 | + <td> <strong>Static RAM</strong></td> |
| 65 | + <td> > 2 kB </td> |
| 66 | + <td> > 4 kB</td> |
| 67 | + </tr> |
| 68 | + |
| 69 | + <tr> |
| 70 | + <td> <strong>Stack</strong></td> |
| 71 | + <td> > 2 kB </td> |
| 72 | + <td> > 8 kB</td> |
| 73 | + </tr> |
| 74 | + |
| 75 | + <tr> |
| 76 | + <td> <strong>Heap</strong></td> |
| 77 | + <td> > 2 kB </td> |
| 78 | + <td> > 8 kB</td> |
| 79 | + </tr> |
| 80 | + |
| 81 | + <tr> |
| 82 | + <td> <strong>Display buffer</strong></td> |
| 83 | + <td> > 1 × <em>hor. res.</em> pixels </td> |
| 84 | + <td> > 10 × <em>hor. res.</em> pixels </td> |
| 85 | + </tr> |
| 86 | + |
| 87 | + <tr> |
| 88 | + <td> <strong>Compiler</strong></td> |
| 89 | + <td colspan="2"> C99 or newer </td> |
| 90 | + </tr> |
| 91 | +</table> |
| 92 | + |
| 93 | +*Note that the memory usage might vary depending on the architecture, compiler and build options.* |
| 94 | + |
| 95 | +Just to mention some platforms: |
| 96 | +- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7 |
| 97 | +- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ |
| 98 | +- NXP: Kinetis, LPC, iMX, iMX RT |
| 99 | +- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb) |
| 100 | +- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl) |
| 101 | +- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32) |
| 102 | +- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix) |
| 103 | +- Nordic NRF52 Bluetooth modules |
| 104 | +- Quectel modems |
67 | 105 |
|
68 |
| -## Donate |
69 |
| -If you are pleased with the graphics library, found it useful or be happy with the support you got, please help its further development: |
| 106 | +## Get started |
| 107 | +This list shows the recommended way of learning the library: |
| 108 | +1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes) |
| 109 | +2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes) |
| 110 | +3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page (15 minutes) |
| 111 | +4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes) |
| 112 | +5. Try out some [Examples](https://github.com/lvgl/lv_examples/) |
| 113 | +6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=) |
| 114 | +7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours) |
| 115 | +8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage |
| 116 | +9. If you have questions go to the [Forum](http://forum.lvgl.io/) |
| 117 | +10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes) |
| 118 | + |
| 119 | +## Examples |
| 120 | + |
| 121 | +For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository. |
| 122 | + |
| 123 | +### Button with label |
| 124 | +```c |
| 125 | +lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button to the current screen*/ |
| 126 | +lv_obj_set_pos(btn, 10, 10); /*Set its position*/ |
| 127 | +lv_obj_set_size(btn, 100, 50); /*Set its size*/ |
| 128 | +lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/ |
| 129 | + |
| 130 | +lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/ |
| 131 | +lv_label_set_text(label, "Button"); /*Set the labels text*/ |
| 132 | + |
| 133 | +... |
| 134 | + |
| 135 | +void btn_event_cb(lv_obj_t * btn, lv_event_t event) |
| 136 | +{ |
| 137 | + if(event == LV_EVENT_CLICKED) { |
| 138 | + printf("Clicked\n"); |
| 139 | + } |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +
|
| 144 | +### LVGL from Micropython |
| 145 | +Learn more about [Micropython](https://docs.lvgl.io/latest/en/html/get-started/micropython.html). |
| 146 | +```python |
| 147 | +# Create a Button and a Label |
| 148 | +scr = lv.obj() |
| 149 | +btn = lv.btn(scr) |
| 150 | +btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0) |
| 151 | +label = lv.label(btn) |
| 152 | +label.set_text("Button") |
| 153 | +
|
| 154 | +# Load the screen |
| 155 | +lv.scr_load(scr) |
| 156 | +``` |
| 157 | + |
| 158 | +## Contributing |
| 159 | +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 to hosing your own project under in LVGL. |
70 | 160 |
|
71 |
| -[](https://littlevgl.com/donate) |
| 161 | +For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation. |
0 commit comments