Summary
To移植 your anyui
project to a target device:
- Copy the
generated
code to your project and invokesetupUI()
to initialize the UI - Copy the SDK code to your project as needed
- Replace dummy implementations with device-specific code as required
Overview
While anyui
primarily focuses on UI design, the generated UI code should maintain independence from underlying hardware and development tools such as Keil.
Additionally, anyui
provides an SDK that can be utilized and extended for screen management and hardware communication.
Transplant Process
UI Code
All UI code is generated within the {root}/generated
directory, including screen implementations and converted assets (images, fonts, lotties).
This code is automatically generated and should not be manually modified.
SDK
The SDK implementation resides in the {root}/sdk
directory, providing utilities for screen management and hardware communication.
The SDK can be extended to address specific requirements.
Warning
The SDK code may be updated in future releases to provide additional features. Any custom modifications will require conflict resolution during updates.
Dummy Code
Dummy implementations are located in {root}/simulator/dummy.c
, providing placeholder functionality that must be replaced with device-specific implementations.
The dummy code includes:
- Handlers for communication commands originating from the UI
- File system driver implementations for external storage (when external image files are used as sources)
- Timer implementations for time and battery status updates (for demonstration purposes only; replace with actual implementations or remove as needed)
lv_conf.h
Maintain a device-specific copy of the lv_conf.h
file with at least the following configurations:
/*
* Required configurations
*/
#define LV_HOR_RES_MAX (?) // Horizontal resolution
#define LV_VER_RES_MAX (?) // Vertical resolution
#define LV_COLOR_DEPTH 16
/*Size of the memory available for 'lv_mem_alloc()' in bytes (>= 2kB)*/
#define LV_MEM_SIZE (?) // Memory size in bytes
/*
* Optional configurations as needed
*/
#define LV_USE_LOG 1 // Enable log
#define LV_USE_FS_STDIO 1 // Enable file system
#define LV_USE_PNG 1 // Enable PNG decoder
#define LV_USE_JPEG 1 // Enable JPEG decoder
#define LV_USE_BMP 1 // Enable BMP decoder
#define LV_USE_GIF 1 // Enable GIF decoder
#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
/*
* Device-specific exclusions
*/;
//#define USE_SIMULATOR