[v6.0] General events, better fonts, multi-display support, image rotation and more
Improvements
General events
In v5.3 you could add actions to only a few object types (like a button). In v6.0 you can do it for an object type using Events.
Use lv_obj_set_event_cb(obj, event_handler)
to set an event callback for an object.
In event_handler
you will get the caller object and the event like LV_EVENT_CLICKED/PRESSED/VALUE_CHANGED
etc.
Learn more here.
Better fonts
A new font converter is created which supports kerning and some other features. It is written in Node.JS so it should be easy to use offline.
You can choose more fonts and ranges to include them in the final font file.
The new Online font converter: https://littlevgl.com/ttf-font-to-c-array
The source code of the Font converter: https://github.com/littlevgl/lv_font_conv
Multi-display support
In v6.0
you can have multiple displays each with its own drivers and objects.
To learn more about multi-display support visit https://docs.littlevgl.com/en/html/overview/display.html
MicroPython
A lot of improvements happened to smoothly support MicroPython.
Click here to learn more about it MicroPython with LittlevGL
New forum
Not really a LittlevGL feature but it happens along with v6.0. We have launched a new, more modern forum: https://forum.littlevgl.com/
You can easily log in with your GitHub or Google account.
The old forum will be moved to http://forumold.littlevgl.com
Migrating from v5.3 to v6.0
v6.0 is not fully compatible with v5.3 because some API and even conceptual changes have happened:
The most important things
- Update your
lv_conf.h
fromlv_conf_template.h
- Generate your fonts again with the new converter: https://littlevgl.com/ttf-font-to-c-array
- Read the new documentation: https://docs.littlevgl.com
Actions vs Events
lv_obj_set_event_cb(obj, callback)
is used instead oflv_btn_set_action(btn, LV_BTN_ACTION_..., callback)
. Event callbacks are used to handle all the former actions (i.e. long pressed, released are handled by a single function).- Objects now automatically detect if they've been deleted, no need for returning
LV_RES_OK/LV_RES_INV
in yourlv_event_cb_t
. For this reason,lv_event_cb_t
functions returnvoid
.
Driver level
- Driver function signatures now take an initial first parameter, the driver objects itself. This allows your driver functions to work with more than one physical device without requiring two separate drivers to be written.
- (i.e.
indev
callbacks now take an initial first parameter oflv_indev_t *
) disp_flush
is nowflush_cb
. Instead of directly taking x/y coordinates, it takes in anlv_area_t
which has x1, y1, x2, y2 fields- The
mem_fill
(calledgpu_fill_cb
in v6.0) fills an area instead of a line - Dynamically changeable display config. Instead of hardcoded in
lv_conf.h
. - Need to explicitly initialize your display buffer and add it to your display driver. It replaces the VDB in v5.3. so there is no
LV_VDB_SIZE
in v6.0 but you should use this display buffers. LV_HOR_RES
andLV_VER_RES
are replaced withLV_HOR_RES_MAX
andLV_VER_RES_MAX
, which define the maximum horizontal and vertical resolution of your display, respectively.LV_HOR_RES
andLV_VER_RES
still work but always reflects the resolution of the lastly created display. (No difference with only one display).
Renames
- All the macros like
USE_LV_BTN
now are likeLV_USE_BTN
. - Rename symbols:
SYMBOL_HOME
-->LV_SYMBOL_HOME
- Rename
LV_GROUP_KEY_...
toLV_KEY_...
- Several minor function API changes. Nearly all features are still present so you should find every v5.3 function but maybe with a slightly different name or usage
Animations
- Renames in
lv_anim_t
. Theready_cb
get'slv_anim_t *
as argument. lv_anim_set_...(&a)
function are added to replace manual initialization of ```lv_anim_t`lv_style_anim_t
is removed. Uselv_anim_t a;
andlv_style_anim_set_...(&a, ...)
instead.
Objects and Styles
lv_obj_get_free_ptr
andlv_obj_get_free_num
are replacedlv_obj_get_user_data
. The type of the user data can be changed inlv_conf.h
- All padding and fits are left, right, top, bottom instead of ver and hor.
- lv_canvas: use
lv_draw_...
functions
Fonts
- Font system is updated and now supports kerning. You can generate your fonts again with the new converter.
- Use the new Online font converter to generate new fonts
- Built-in fonts have changed
Others
- User data is now available for some other structures as well, like driver objects.
- Callbacks of
lv_task
now receive a pointer to the task itself instead of the user data. The user data can be accessed astask->user_data
- The
img_decoder
is improved to cache the opened images. So e.g. PNG images are not decoded all the time but left open. Learn more here
Credits
@embeddedt for tirelessly supporting users and professional help in the development
@amirgon for creating and maintaining the MicroPython binding
@puzrin for creating the new font converter
And for every contributor who helped with pull requests, ideas and suggestion, testing and feedback,
Thank you very much for all of you!