2017-05-15 14:11:12 +02:00
# LittleV Graphics Libraray
2016-06-15 11:40:04 +02:00
2017-07-30 23:36:42 +02:00
![LittlevGL cover ](http://www.gl.littlev.hu/home/main_cover_small.png )
2016-06-15 11:40:04 +02:00
2017-09-23 23:28:06 +02:00
LittlevGL is a graphics library to create Graphical User Interfaces (GUI) on TFT, LCD or monochrome displays for microcontroller based embedded systems.
2017-07-31 01:21:29 +02:00
2017-09-23 23:25:12 +02:00
Transparency, anti-aliassing and smooth animations can be used with no double buffering so typically no external memories are required. Layouts, scrolling, word-wrapping, layers and other features make your job easier.
2016-06-15 11:40:04 +02:00
2017-05-15 14:11:12 +02:00
The graphics library is written in C and it is completely hardware independent. You can even run it in a PC simulator without any embedded hardware.
2016-06-15 11:40:04 +02:00
2017-07-31 01:21:29 +02:00
Homepage: http://gl.littlev.hu
2016-06-15 11:40:04 +02:00
2017-05-15 14:11:12 +02:00
## Key features
2017-07-30 23:36:42 +02:00
* Hardware independent, support any modern microcontroller
* High resolution TFTs, monochrome or any type of display supported (24/16/8/1 bit color depth)
2017-07-30 23:38:13 +02:00
* External RAM, FPU or GPU not required just optional
2017-05-15 14:11:12 +02:00
* Build GUI from simple graphical objects
* Buttons, Labels, Images
* Charts, Lists, Bars, Sliders, Text areas etc.
2017-09-23 23:27:17 +02:00
* Create or delete graphical object dynamically in run time
2017-07-30 23:36:42 +02:00
* High level graphical features without double buffering
2017-05-15 14:11:12 +02:00
* Antialiassing (font or full screen)
* Animations
* Transparency
* Gradient colors
* Smooth dragging and scrolling
2017-09-23 23:25:12 +02:00
* Built-in features
* Layouts (to auto-arrange items)
* Scrolling
* Auto-size (aligned to the content)
* Word wrapping
2017-07-30 23:36:42 +02:00
* Layers
2017-05-15 14:11:12 +02:00
* Customizable appearance with styles
* Applications for complex tasks
* Can run in a PC simulator
2017-07-30 23:36:42 +02:00
* Modular and well-structured source code
2017-05-15 14:11:12 +02:00
* Actively developed
2016-06-15 11:40:04 +02:00
2017-05-15 14:11:12 +02:00
## Porting
The following functions has to be provided
* hal/disp `disp_fill(x1, y1, x2, y2, color)` to fill area with a color
* hal/disp `disp_map(x1, y1, x2, y2, &color_array)` copy a color map to an area
2017-07-30 23:44:59 +02:00
* hal/disp `disp_color_cpy(dest, src, length, opa)` copy pixel, optional for GPU
2017-05-15 14:11:12 +02:00
* hal/indev `indev_get(id, &x, &y)` get the *x* and *y* coordinates from an input device (e.g. touch pad)
* hal/systick `systick_get()` get a system tick with 1 ms resolution
* hal/systick `systick_elapse(prev_time)` get the elapsed milliseconds sience *prev_time*
2016-06-15 11:40:04 +02:00
2017-05-15 14:11:12 +02:00
See the [example HAL ](https://github.com/littlevgl/hal ) repository!
2016-06-15 11:40:04 +02:00
2017-05-15 14:11:12 +02:00
## Requirements
* [Misc. library ](https://github.com/littlevgl/misc ) is used by the graphics library
## Project set-up
1. Clone or download the following repositories:
* lvgl:`git clone https://github.com/littlevgl/lvgl.git`
* misc: `git clone https://github.com/littlevgl/misc.git`
* hal: `git clone https://github.com/littlevgl/hal.git`
2. Create project with your prefered IDE and add the **lvgl** , **misc** and **hal** folders
3. Add your projects **root directory as include path**
4. Write your display, touch pad and system tick **drivers in hal**
2017-05-15 15:09:22 +02:00
5. Copy *lvgl/lv_conf_templ.h* as **lv_conf.h** and *misc/misc_conf_templ.h* as **misc_conf.h** to the projects root folder
6. In the *_conf.h files delete the first `#if 0` and its `#endif` . Let the default configurations at first.
2017-07-09 14:39:28 +02:00
7. In your *main.c* include:
2017-05-15 14:12:42 +02:00
* #include "misc/misc.h"
* #include "misc/os/ptask.h"
* #include "lvgl/lvgl.h"
2017-05-15 14:11:12 +02:00
8. In your *main.c* intialize:
2017-05-15 14:12:42 +02:00
* **misc_init()**;
* your_systick_init();
* your_disp_init();
* your_indev_init();
2017-08-12 17:08:29 +02:00
* **lv_init()**;
2017-05-15 15:09:22 +02:00
10. To **test** create a label: `lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);`
2017-05-15 14:11:12 +02:00
11. In the main *while(1)* call `ptask_handler();` and make a few milliseconds delay (e.g. `your_delay_ms(5);` )
2017-05-15 15:09:22 +02:00
12. Compile the code and load it to your embedded hardware
2017-05-15 14:11:12 +02:00
2017-05-15 15:09:22 +02:00
## PC Simulator
2017-05-15 15:22:03 +02:00
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.
2017-05-15 14:11:12 +02:00
2017-05-15 15:09:22 +02:00
There is a pre-configured PC project for **Eclipse CDT** in this repository: https://github.com/littlevgl/proj_pc
2017-05-15 14:11:12 +02:00
## Contributing
2017-07-30 15:50:04 +02:00
See [CONTRIBUTING.md ](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md )
2017-05-15 14:11:12 +02:00
## Donate
2017-07-30 23:36:42 +02:00
If you are pleased with the graphics library and found it useful please support its further development:
2017-05-15 14:11:12 +02:00
2017-07-09 14:39:28 +02:00
[![Donate ](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif )](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick& hosted_button_id=GJV3SC5EHDANS)
2016-06-15 11:40:04 +02:00