2018-09-06 15:57:10 +08:00
# Littlev Graphics Library
2016-06-15 17:40:04 +08:00
2018-08-21 14:40:12 +08:00
![LittlevGL cover ](https://littlevgl.com/docs/themes/lv_theme_intro.png )
2016-06-15 17:40:04 +08:00
2018-09-24 17:42:32 +08:00
**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.**
2018-09-24 17:42:13 +08:00
https://littlevgl.com
2017-11-29 18:41:34 +08:00
2018-12-27 06:35:18 +08:00
Check out the [References ](https://blog.littlevgl.com/2018-12-26/references ) where LittlevGL was used. You can add your project too!
2017-05-15 20:11:12 +08:00
## Key features
2018-09-24 17:42:13 +08:00
* **Powerful building blocks** buttons, charts, lists, sliders, images, etc.
* **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling
* **Various input devices** touch pad, mouse, keyboard, encoder, buttons, etc.
* **Multi-language support** with UTF-8 encoding
* **Fully customizable** graphical elements
* **Hardware independent** to use with any microcontroller or display
* **Scalable** to operate with little memory (50 kB Flash, 10 kB RAM)
* **OS, External memory and GPU** supported but not required
* **Single frame buffer** operation even with advances graphical effects
* **Written in C** for maximal compatibility
* **Simulator** to develop on PC without embedded hardware
* **Tutorials, examples, themes** for rapid development
* **Documentation** and API references online
2016-06-15 17:40:04 +08:00
2017-05-15 20:11:12 +08:00
## Porting
2018-08-27 13:19:33 +08:00
In the simplest case you need 5 things:
2018-09-17 19:05:41 +08:00
1. Call `lv_tick_inc(x)` every `x` milliseconds in a Timer or Task (`x` should be between 1 and 10)
2018-03-10 14:47:28 +08:00
2. Register a function which can **copy a pixel array** to an area of the screen.
2017-12-21 08:06:11 +08:00
3. Register a function which can **read an input device** . (E.g. touch pad)
2018-08-27 01:24:41 +08:00
4. Copy `lv_conf_templ.h` as `lv_conf.h` and set at least `LV_HOR_RES` , `LV_VER_RES` and `LV_COLOR_DEPTH` .
5. Call `lv_task_handler()` periodically every few milliseconds.
2018-11-17 21:02:11 +08:00
For a detailed description visit https://github.com/littlevgl/lvgl/wiki/Porting
2018-03-10 14:47:28 +08:00
Or check the [Porting tutorial ](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c )
2017-11-29 18:32:38 +08:00
2017-05-15 20:11:12 +08:00
## Project set-up
2018-03-07 20:51:59 +08:00
1. **Clone** or [Download ](https://littlevgl.com/download ) the lvgl repository: `git clone https://github.com/littlevgl/lvgl.git`
2018-09-17 19:05:41 +08:00
2. **Create project** with your preferred IDE and add the *lvgl* folder
2017-12-21 08:06:11 +08:00
3. Copy **lvgl/lv_conf_templ.h** as **lv_conf.h** next to the *lvgl* folder
2018-08-19 03:53:44 +08:00
4. In the lv_conf.h delete the first `#if 0` and its `#endif` . Leave the default configuration for the first try.
2017-11-29 18:10:12 +08:00
5. In your *main.c* : #include "lvgl/lvgl.h"
6. In your *main function* :
* lvgl_init();
2017-11-29 18:32:38 +08:00
* tick, display and input device initialization (see above)
2017-11-29 18:37:26 +08:00
7. To **test** create a label: `lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);`
8. In the main *while(1)* call `lv_task_handler();` and make a few milliseconds delay (e.g. `my_delay_ms(5);` )
9. Compile the code and load it to your embedded hardware
2017-05-15 20:11:12 +08:00
2017-05-15 21:09:22 +08:00
## PC Simulator
2018-09-17 19:05:41 +08:00
You can test the graphics library in a PC simulator, if you don't have an embedded hardware. The simulator uses [SDL2 ](https://www.libsdl.org/ ) library to emulate a display on your monitor and a touch pad with your mouse.
2017-05-15 20:11:12 +08:00
2017-12-20 05:09:06 +08:00
There is a pre-configured PC project for **Eclipse CDT** in this repository: https://github.com/littlevgl/pc_simulator
2017-05-15 20:11:12 +08:00
2018-08-21 14:40:12 +08:00
## Related repositories
2018-09-17 19:05:41 +08:00
* PC simulator: https://github.com/littlevgl/pc_simulator
2018-08-21 14:40:12 +08:00
* Projects: https://github.com/littlevgl/lv_projects
* Examples: https://github.com/littlevgl/lv_examples
* Drivers: https://github.com/littlevgl/lv_drivers
2017-12-24 18:00:46 +08:00
## Screenshots
![TFT material ](http://www.gl.littlev.hu/github_res/tft_material.png )
![TFT zen ](http://www.gl.littlev.hu/github_res/tft_zen.png )
![TFT alien ](http://www.gl.littlev.hu/github_res/tft_alien.png )
![TFT night ](http://www.gl.littlev.hu/github_res/tft_night.png )
2017-05-15 20:11:12 +08:00
## Contributing
2017-07-30 21:50:04 +08:00
See [CONTRIBUTING.md ](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md )
2017-05-15 20:11:12 +08:00
## Donate
2018-08-19 03:53:44 +08:00
If you are pleased with this graphics library, found it useful, or are happy with the support you got, please help its further development:
2017-05-15 20:11:12 +08:00
2018-01-29 19:32:14 +08:00
[![Donate ](https://littlevgl.com/donate_dir/donate_btn.png )](https://littlevgl.com/donate)