diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
| commit | dd27c3530432ea0b09f01e604bf577f31d8ef841 (patch) | |
| tree | bbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/docs/libs | |
| parent | 6fd588e970470b15936187980829916d0dbe77bb (diff) | |
| download | tangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz | |
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/docs/libs')
| m--------- | lib/lvgl | 0 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/bmp.md | 38 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/ffmpeg.md | 37 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/freetype.md | 51 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/fsdrv.md | 21 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/gif.md | 39 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/index.md | 19 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/png.md | 27 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/qrcode.md | 38 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/rlottie.md | 106 | ||||
| -rw-r--r-- | lib/lvgl/docs/libs/sjpg.md | 73 |
11 files changed, 449 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl deleted file mode 160000 -Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a diff --git a/lib/lvgl/docs/libs/bmp.md b/lib/lvgl/docs/libs/bmp.md new file mode 100644 index 00000000..3aace9e1 --- /dev/null +++ b/lib/lvgl/docs/libs/bmp.md @@ -0,0 +1,38 @@ + +# BMP decoder + +This extension allows the use of BMP images in LVGL. +This implementation uses [bmp-decoder](https://github.com/caj-johnson/bmp-decoder) library. +The pixels are read on demand (not the whole image is loaded) so using BMP images requires very little RAM. + +If enabled in `lv_conf.h` by `LV_USE_BMP` LVGL will register a new image decoder automatically so BMP files can be directly used as image sources. For example: +``` +lv_img_set_src(my_img, "S:path/to/picture.bmp"); +``` + +Note that, a file system driver needs to registered to open images from files. Read more about it [here](https://docs.lvgl.io/master/overview/file-system.html) or just enable one in `lv_conf.h` with `LV_USE_FS_...` + +## Limitations +- Only BMP files are supported and BMP images as C array (`lv_img_dsc_t`) are not. It's because there is no practical differences between how the BMP files and LVGL's image format stores the image data. +- BMP files can be loaded only from file. If you want to store them in flash it's better to convert them to C array with [LVGL's image converter](https://lvgl.io/tools/imageconverter). +- The BMP files color format needs to match with `LV_COLOR_DEPTH`. Use GIMP to save the image in the required format. + Both RGB888 and ARGB888 works with `LV_COLOR_DEPTH 32` +- Palette is not supported. +- Because not the whole image is read in can not be zoomed or rotated. + + +## Example +```eval_rst + +.. include:: ../../examples/libs/bmp/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_bmp.h + :project: lvgl + +``` diff --git a/lib/lvgl/docs/libs/ffmpeg.md b/lib/lvgl/docs/libs/ffmpeg.md new file mode 100644 index 00000000..b68712de --- /dev/null +++ b/lib/lvgl/docs/libs/ffmpeg.md @@ -0,0 +1,37 @@ + +# FFmpeg support +[FFmpeg](https://www.ffmpeg.org/) A complete, cross-platform solution to record, convert and stream audio and video. + +## Install FFmpeg +- Download FFmpeg from [here](https://www.ffmpeg.org/download.html) +- `./configure --disable-all --disable-autodetect --disable-podpages --disable-asm --enable-avcodec --enable-avformat --enable-decoders --enable-encoders --enable-demuxers --enable-parsers --enable-protocol='file' --enable-swscale --enable-zlib` +- `make` +- `sudo make install` + +## Add FFmpeg to your project +- Add library: `FFmpeg` (for GCC: `-lavformat -lavcodec -lavutil -lswscale -lm -lz -lpthread`) + +## Usage + +Enable `LV_USE_FFMPEG` in `lv_conf.h`. + +See the examples below. + +Note that, the FFmpeg extension doesn't use LVGL's file system. +You can simply pass the path to the image or video as usual on your operating system or platform. + +## Example +```eval_rst + +.. include:: ../../examples/libs/ffmpeg/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_ffmpeg.h + :project: lvgl + +```
\ No newline at end of file diff --git a/lib/lvgl/docs/libs/freetype.md b/lib/lvgl/docs/libs/freetype.md new file mode 100644 index 00000000..a734bba2 --- /dev/null +++ b/lib/lvgl/docs/libs/freetype.md @@ -0,0 +1,51 @@ + +# FreeType support +Interface to [FreeType](https://www.freetype.org/) to generate font bitmaps run time. + +## Install FreeType +- Download Freetype from [here](https://sourceforge.net/projects/freetype/files/) +- `make` +- `sudo make install` + +## Add FreeType to your project +- Add include path: `/usr/include/freetype2` (for GCC: `-I/usr/include/freetype2 -L/usr/local/lib`) +- Add library: `freetype` (for GCC: `-L/usr/local/lib -lfreetype`) + +## Usage +Enable `LV_USE_FREETYPE` in `lv_conf.h`. + +To cache the glyphs from the opened fonts, set `LV_FREETYPE_CACHE_SIZE >= 0` and then use the following macros for detailed configuration: +1. `LV_FREETYPE_CACHE_SIZE`:maximum memory(bytes) used to cache font bitmap, outline, character maps, etc. 0 means use the system default value, less than 0 means disable cache. Note: that this value does not account for managed FT_Face and FT_Size objects. +1. `LV_FREETYPE_CACHE_FT_FACES`:maximum number of opened FT_Face objects managed by this cache instance.0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. +1. `LV_FREETYPE_CACHE_FT_SIZES`:maximum number of opened FT_Size objects managed by this cache instance. 0 means use the system default value. Only useful when LV_FREETYPE_CACHE_SIZE >= 0. + +When you are sure that all the used font sizes will not be greater than 256, you can enable `LV_FREETYPE_SBIT_CACHE`, which is much more memory efficient for small bitmaps. + +You can use `lv_ft_font_init()` to create FreeType fonts. It returns `true` to indicate success, at the same time, the `font` member of `lv_ft_info_t` will be filled with a pointer to an LVGL font, and you can use it like any LVGL font. + +Font style supports bold and italic, you can use the following macros to set: +1. `FT_FONT_STYLE_NORMAL`:default style. +1. `FT_FONT_STYLE_ITALIC`:Italic style +1. `FT_FONT_STYLE_BOLD`:bold style + +They can be combined.eg:`FT_FONT_STYLE_BOLD | FT_FONT_STYLE_ITALIC`. + +Note that, the FreeType extension doesn't use LVGL's file system. +You can simply pass the path to the font as usual on your operating system or platform. + +## Example +```eval_rst +.. include:: ../../examples/libs/freetype/index.rst +``` + + +## Learn more +- FreeType [tutorial](https://www.freetype.org/freetype2/docs/tutorial/step1.html) +- LVGL's [font interface](https://docs.lvgl.io/v7/en/html/overview/font.html#add-a-new-font-engine) + + +## API +```eval_rst +.. doxygenfile:: lv_freetype.h + :project: lvgl +```
\ No newline at end of file diff --git a/lib/lvgl/docs/libs/fsdrv.md b/lib/lvgl/docs/libs/fsdrv.md new file mode 100644 index 00000000..7b9015aa --- /dev/null +++ b/lib/lvgl/docs/libs/fsdrv.md @@ -0,0 +1,21 @@ + +# File System Interfaces + +LVGL has a [File system](https://docs.lvgl.io/master/overview/file-system.html) module to provide an abstraction layer for various file system drivers. + +LVG has built in support for: +- [FATFS](http://elm-chan.org/fsw/ff/00index_e.html) +- STDIO (Linux and Windows using C standard function .e.g fopen, fread) +- POSIX (Linux and Windows using POSIX function .e.g open, read) +- WIN32 (Windows using Win32 API function .e.g CreateFileA, ReadFile) + +You still need to provide the drivers and libraries, this extension provides only the bridge between FATFS, STDIO, POSIX, WIN32 and LVGL. + +## Usage + +In `lv_conf.h` enable `LV_USE_FS_...` and assign an upper cased letter to `LV_FS_..._LETTER` (e.g. `'S'`). +After that you can access files using that driver letter. E.g. `"S:path/to/file.txt"`. + +The work directory can be set with `LV_FS_..._PATH`. E.g. `"/home/joe/projects/"` The actual file/directory paths will be appended to it. + +Cached reading is also supported if `LV_FS_..._CACHE_SIZE` is set to not `0` value. `lv_fs_read` caches this size of data to lower the number of actual reads from the storage. diff --git a/lib/lvgl/docs/libs/gif.md b/lib/lvgl/docs/libs/gif.md new file mode 100644 index 00000000..f3ae7584 --- /dev/null +++ b/lib/lvgl/docs/libs/gif.md @@ -0,0 +1,39 @@ + +# GIF decoder +Allow using GIF images in LVGL. Based on https://github.com/lecram/gifdec + +When enabled in `lv_conf.h` with `LV_USE_GIF` `lv_gif_create(parent)` can be used to create a gif widget. + +`lv_gif_set_src(obj, src)` works very similarly to `lv_img_set_src`. As source, it also accepts images as variables (`lv_img_dsc_t`) or files. + + +## Convert GIF files to C array +To convert a GIF file to byte values array use [LVGL's online converter](https://lvgl.io/tools/imageconverter). Select "Raw" color format and "C array" Output format. + + +## Use GIF images from file +For example: +```c +lv_gif_set_src(obj, "S:path/to/example.gif"); +``` + +Note that, a file system driver needs to be registered to open images from files. Read more about it [here](https://docs.lvgl.io/master/overview/file-system.html) or just enable one in `lv_conf.h` with `LV_USE_FS_...` + + +## Memory requirements +To decode and display a GIF animation the following amount of RAM is required: +- `LV_COLOR_DEPTH 8`: 3 x image width x image height +- `LV_COLOR_DEPTH 16`: 4 x image width x image height +- `LV_COLOR_DEPTH 32`: 5 x image width x image height + +## Example +```eval_rst +.. include:: ../../examples/libs/gif/index.rst +``` + +## API + +```eval_rst +.. doxygenfile:: lv_gif.h + :project: lvgl +```
\ No newline at end of file diff --git a/lib/lvgl/docs/libs/index.md b/lib/lvgl/docs/libs/index.md new file mode 100644 index 00000000..8217e912 --- /dev/null +++ b/lib/lvgl/docs/libs/index.md @@ -0,0 +1,19 @@ +# 3rd party libraries + + +```eval_rst + +.. toctree:: + :maxdepth: 1 + + fsdrv + bmp + sjpg + png + gif + freetype + qrcode + rlottie + ffmpeg +``` + diff --git a/lib/lvgl/docs/libs/png.md b/lib/lvgl/docs/libs/png.md new file mode 100644 index 00000000..96a80248 --- /dev/null +++ b/lib/lvgl/docs/libs/png.md @@ -0,0 +1,27 @@ + +# PNG decoder + +Allow the use of PNG images in LVGL. This implementation uses [lodepng](https://github.com/lvandeve/lodepng) library. + +If enabled in `lv_conf.h` by `LV_USE_PNG` LVGL will register a new image decoder automatically so PNG files can be directly used as any other image sources. + +Note that, a file system driver needs to registered to open images from files. Read more about it [here](https://docs.lvgl.io/master/overview/file-system.html) or just enable one in `lv_conf.h` with `LV_USE_FS_...` + +The whole PNG image is decoded so during decoding RAM equals to `image width x image height x 4` bytes are required. + +As it might take significant time to decode PNG images LVGL's [images caching](https://docs.lvgl.io/master/overview/image.html#image-caching) feature can be useful. + +## Example +```eval_rst + +.. include:: ../../examples/libs/png/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_png.h + :project: lvgl + diff --git a/lib/lvgl/docs/libs/qrcode.md b/lib/lvgl/docs/libs/qrcode.md new file mode 100644 index 00000000..46e0a47d --- /dev/null +++ b/lib/lvgl/docs/libs/qrcode.md @@ -0,0 +1,38 @@ + +# QR code + +QR code generation with LVGL. Uses [QR-Code-generator](https://github.com/nayuki/QR-Code-generator) by [nayuki](https://github.com/nayuki). + +## Get started +- Download or clone this repository + - [Download](https://github.com/lvgl/lv_lib_qrcode.git) from GitHub + - Clone: git clone https://github.com/lvgl/lv_lib_qrcode.git +- Include the library: `#include "lv_lib_qrcode/lv_qrcode.h"` +- Test with the following code: +```c +const char * data = "Hello world"; + +/*Create a 100x100 QR code*/ +lv_obj_t * qr = lv_qrcode_create(lv_scr_act(), 100, lv_color_hex3(0x33f), lv_color_hex3(0xeef)); + +/*Set data*/ +lv_qrcode_update(qr, data, strlen(data)); +``` + +## Notes +- QR codes with less data are smaller, but they scaled by an integer number to best fit to the given size. + + +## Example +```eval_rst + +.. include:: ../../examples/libs/qrcode/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_qrcode.h + :project: lvgl diff --git a/lib/lvgl/docs/libs/rlottie.md b/lib/lvgl/docs/libs/rlottie.md new file mode 100644 index 00000000..85b56540 --- /dev/null +++ b/lib/lvgl/docs/libs/rlottie.md @@ -0,0 +1,106 @@ + + +# Lottie player +Allows to use Lottie animations in LVGL. Taken from this [base repository](https://github.com/ValentiWorkLearning/lv_rlottie) + +LVGL provides the interface to [Samsung/rlottie](https://github.com/Samsung/rlottie) library's C API. That is the actual Lottie player is not part of LVGL, it needs to be built separately. + +## Build Rlottie +To build Samsung's Rlottie C++14-compatible compiler and optionally CMake 3.14 or higher is required. + +To build on desktop you can follow the instructions from Rlottie's [README](https://github.com/Samsung/rlottie/blob/master/README.md). In the most basic case it looks like this: +``` +mkdir rlottie_workdir +cd rlottie_workdir +git clone https://github.com/Samsung/rlottie.git +mkdir build +cd build +cmake ../rlottie +make -j +sudo make install +``` + +And finally add the `-lrlottie` flag to your linker. + +On embedded systems you need to take care of integrating Rlottie to the given build system. + + +## Usage + +You can use animation from files or raw data (text). In either case first you need to enable `LV_USE_RLOTTIE` in `lv_conf.h`. + + +The `width` and `height` of the object be set in the *create* function and the animation will be scaled accordingly. + +### Use Rlottie from file + +To create a Lottie animation from file use: +```c + lv_obj_t * lottie = lv_rlottie_create_from_file(parent, width, height, "path/to/lottie.json"); +``` + +Note that, Rlottie uses the standard STDIO C file API, so you can use the path "normally" and no LVGL specific driver letter is required. + + +### Use Rlottie from raw string data + +`lv_example_rlottie_approve.c` contains an example animation in raw format. Instead storing the JSON string a hex array is stored for the following reasons: +- avoid escaping `"` in the JSON file +- some compilers don't support very long strings + +`lvgl/scripts/filetohex.py` can be used to convert a Lottie file a hex array. E.g.: +``` +./filetohex.py path/to/lottie.json > out.txt +``` + +To create an animation from raw data: + +```c +extern const uint8_t lottie_data[]; +lv_obj_t* lottie = lv_rlottie_create_from_raw(parent, width, height, (const char *)lottie_data); +``` + +## Getting animations + +Lottie is standard and popular format so you can find many animation files on the web. +For example: https://lottiefiles.com/ + +You can also create your own animations with Adobe After Effects or similar software. + +## Controlling animations + +LVGL provides two functions to control the animation mode: `lv_rlottie_set_play_mode` and `lv_rlottie_set_current_frame`. +You'll combine your intentions when calling the first method, like in these examples: +```c +lv_obj_t * lottie = lv_rlottie_create_from_file(scr, 128, 128, "test.json"); +lv_obj_center(lottie); +// Pause to a specific frame +lv_rlottie_set_current_frame(lottie, 50); +lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PAUSE); // The specified frame will be displayed and then the animation will pause + +// Play backward and loop +lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_BACKWARD | LV_RLOTTIE_CTRL_LOOP); + +// Play forward once (no looping) +lv_rlottie_set_play_mode(lottie, LV_RLOTTIE_CTRL_PLAY | LV_RLOTTIE_CTRL_FORWARD); +``` + +The default animation mode is **play forward with loop**. + +If you don't enable looping, a `LV_EVENT_READY` is sent when the animation can not make more progress without looping. + +To get the number of frames in an animation or the current frame index, you can cast the `lv_obj_t` instance to a `lv_rlottie_t` instance and inspect the `current_frame` and `total_frames` members. + +## Example +```eval_rst + +.. include:: ../../examples/libs/rlottie/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_rlottie.h + :project: lvgl diff --git a/lib/lvgl/docs/libs/sjpg.md b/lib/lvgl/docs/libs/sjpg.md new file mode 100644 index 00000000..3ee7858e --- /dev/null +++ b/lib/lvgl/docs/libs/sjpg.md @@ -0,0 +1,73 @@ + +# JPG decoder + +Allow the use of JPG images in LVGL. Besides that it also allows the use of a custom format, called Split JPG (SJPG), which can be decoded in more optimal way on embedded systems. + +## Overview + - Supports both normal JPG and the custom SJPG formats. + - Decoding normal JPG consumes RAM with the size fo the whole uncompressed image (recommended only for devices with more RAM) + - SJPG is a custom format based on "normal" JPG and specially made for LVGL. + - SJPG is 'split-jpeg' which is a bundle of small jpeg fragments with an sjpg header. + - SJPG size will be almost comparable to the jpg file or might be a slightly larger. + - File read from file and c-array are implemented. + - SJPEG frame fragment cache enables fast fetching of lines if available in cache. + - By default the sjpg image cache will be image width * 2 * 16 bytes (can be modified) + - Currently only 16 bit image format is supported (TODO) + - Only the required partion of the JPG and SJPG images are decoded, therefore they can't be zoomed or rotated. + +## Usage + +If enabled in `lv_conf.h` by `LV_USE_SJPG` LVGL will register a new image decoder automatically so JPG and SJPG files can be directly used as image sources. For example: +``` +lv_img_set_src(my_img, "S:path/to/picture.jpg"); +``` + +Note that, a file system driver needs to registered to open images from files. Read more about it [here](https://docs.lvgl.io/master/overview/file-system.html) or just enable one in `lv_conf.h` with `LV_USE_FS_...` + + + +## Converter + +### Converting JPG to C array + - Use lvgl online tool https://lvgl.io/tools/imageconverter + - Color format = RAW, output format = C Array + +### Converting JPG to SJPG +python3 and the PIL library required. (PIL can be installed with `pip3 install pillow`) + +To create SJPG from JPG: +- Copy the image to convert into `lvgl/scripts` +- `cd lvgl/scripts` +- `python3 jpg_to_sjpg.py image_to_convert.jpg`. It creates both a C files and an SJPG image. + +The expected result is: +```sh +Conversion started... + +Input: + image_to_convert.jpg + RES = 640 x 480 + +Output: + Time taken = 1.66 sec + bin size = 77.1 KB + walpaper.sjpg (bin file) + walpaper.c (c array) + +All good! +``` + + +## Example +```eval_rst + +.. include:: ../../examples/libs/sjpg/index.rst + +``` + +## API + +```eval_rst + +.. doxygenfile:: lv_sjpg.h + :project: lvgl |
