Transplant moves the generated anyui-LIVE output onto a target device or integrates it into an existing project. This guide covers migration, transplantation, and integration with other systems.
Overview
anyui-LIVE focuses on UI design, and the generated UI code is designed to stay independent of specific hardware and development tools (such as Keil). The generated code can be moved to any target that satisfies the LVGL requirements.
The output being transplanted is described in the codegen guide, and the code it depends on is described in the image guide and the font library guide.
Transplant process
UI code
All UI code is generated within the {root}/generated directory, including screen implementations and converted assets (images, fonts, lotties). To transplant:
- Copy the
generatedcode into your project. - Invoke
setup_ui()to initialize the UI. - Compile the project for the target toolchain.
This code is automatically generated and should not be manually modified.
lv_conf.h
Maintain a device-specific copy of lv_conf.h with at least the following configurations:
The following three items are mandatory and important:
LV_HOR_RES_MAXandLV_VER_RES_MAX- Display resolutionLV_COLOR_DEPTH- Color depthLV_MEM_SIZE- Memory size in bytes
Configure resolution
- Configure resolution for LVGL v8.x in lv_conf.h
#define LV_HOR_RES_MAX (?) // Horizontal resolution
#define LV_VER_RES_MAX (?) // Vertical resolution
- Configure resolution for LVGL v9.x in
hal_init(w, h)
hal_init(720, 480); // configure display size to 720 x 480
Configure color depth and memory size in lv_conf.h
/** Required configurations */
#define LV_COLOR_DEPTH 32
/* Size of the memory available for lv_mem_alloc() in bytes */
#define LV_MEM_SIZE (32 * 1024) // Memory size 32KB, adjust as needed
Optional configurations as needed in lv_conf.h
#define LV_USE_BTN 1 // Enable button
#define LV_USE_IMG 1 // Enable image
#define LV_USE_LABEL 1 // Enable label
// Additional components as required
/** Optional configurations as needed */
#define LV_FONT_MONTSERRAT_8 1 // Enable Montserrat 8px font; 0: disable
// Other MONTSERRAT font sizes ...
#define LV_FONT_MONTSERRAT_48 1 // Enable Montserrat 48px font; 0: disable
Integration with external systems
The generated code can be integrated with an existing embedded project:
- Application entry - call
setup_ui()after LVGL is initialized (lv_init()andhal_init()).
Related guides
- Font library - font assets included in the transplant.
- Workspace - the generated folder.
- Overview - the screens that are transplanted.
- Codegen - the generated output and entry points.