Refactor LVGL code into kernel module (#472)
* **New Features** * Added a standalone LVGL module and enabled LVGL support in the simulator for richer local UI testing. * **Refactor** * HAL and LVGL split into distinct modules; startup and device attach/detach flows reorganized for clearer lifecycle management. * Public APIs tightened with clearer nullability/documentation. * **Bug Fixes** * More consistent LVGL start/stop and device attach/detach behavior for improved stability.
This commit is contained in:
committed by
GitHub
parent
3fe1dc0312
commit
9f721e6655
@@ -19,9 +19,6 @@ else()
|
||||
|
||||
add_library(TactilityC OBJECT)
|
||||
|
||||
add_definitions(-D_Nullable=)
|
||||
add_definitions(-D_Nonnull=)
|
||||
|
||||
target_sources(TactilityC PRIVATE ${SOURCES})
|
||||
include_directories(TactilityC PRIVATE Private/)
|
||||
target_include_directories(TactilityC PUBLIC Include/)
|
||||
|
||||
+17
-16
@@ -22,46 +22,47 @@ typedef enum {
|
||||
|
||||
typedef unsigned int AppLaunchId;
|
||||
|
||||
/** Important: These function types must map to t::app types exactly */
|
||||
/** Important: These function types must map to t::app types exactly. All void* data is nullable. */
|
||||
typedef void* (*AppCreateData)();
|
||||
typedef void (*AppDestroyData)(void* data);
|
||||
typedef void (*AppOnCreate)(AppHandle app, void* _Nullable data);
|
||||
typedef void (*AppOnDestroy)(AppHandle app, void* _Nullable data);
|
||||
typedef void (*AppOnShow)(AppHandle app, void* _Nullable data, lv_obj_t* parent);
|
||||
typedef void (*AppOnHide)(AppHandle app, void* _Nullable data);
|
||||
typedef void (*AppOnResult)(AppHandle app, void* _Nullable data, AppLaunchId launchId, AppResult result, BundleHandle resultData);
|
||||
typedef void (*AppOnCreate)(AppHandle app, void* data);
|
||||
typedef void (*AppOnDestroy)(AppHandle app, void* data);
|
||||
typedef void (*AppOnShow)(AppHandle app, void* data, lv_obj_t* parent);
|
||||
typedef void (*AppOnHide)(AppHandle app, void* data);
|
||||
typedef void (*AppOnResult)(AppHandle app, void* data, AppLaunchId launchId, AppResult result, BundleHandle resultData);
|
||||
|
||||
/** All callback types are nullable */
|
||||
typedef struct {
|
||||
/** The application can allocate data to re-use later (e.g. struct with state) */
|
||||
AppCreateData _Nullable createData;
|
||||
AppCreateData createData;
|
||||
/** If createData is specified, this one must be specified too */
|
||||
AppDestroyData _Nullable destroyData;
|
||||
AppDestroyData destroyData;
|
||||
/** Called when the app is launched (started) */
|
||||
AppOnCreate _Nullable onCreate;
|
||||
AppOnCreate onCreate;
|
||||
/** Called when the app is exited (stopped) */
|
||||
AppOnDestroy _Nullable onDestroy;
|
||||
AppOnDestroy onDestroy;
|
||||
/** Called when the app is about to be shown to the user (app becomes visible) */
|
||||
AppOnShow _Nullable onShow;
|
||||
AppOnShow onShow;
|
||||
/** Called when the app is about to be invisible to the user (e.g. other app was launched by this app, and this app goes to the background) */
|
||||
AppOnHide _Nullable onHide;
|
||||
AppOnHide onHide;
|
||||
/** Called when the app receives a result after launching another app */
|
||||
AppOnResult _Nullable onResult;
|
||||
AppOnResult onResult;
|
||||
} AppRegistration;
|
||||
|
||||
/** This is used to register the manifest of an external app. */
|
||||
void tt_app_register(const AppRegistration app);
|
||||
|
||||
/** @return the bundle that belongs to this application, or null if it wasn't started with parameters. */
|
||||
BundleHandle _Nullable tt_app_get_parameters(AppHandle handle);
|
||||
BundleHandle tt_app_get_parameters(AppHandle handle);
|
||||
|
||||
/**
|
||||
* Set the result before closing an app.
|
||||
* The result and bundle are passed along to the app that launched this app, when this app is closed.
|
||||
* @param[in] handle the app handle to set the result for
|
||||
* @param[in] result the result state to set
|
||||
* @param[in] bundle the result bundle to set
|
||||
* @param[in] bundle the result bundle to set (can be null)
|
||||
*/
|
||||
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle _Nullable bundle);
|
||||
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle bundle);
|
||||
|
||||
/** @return true if a result was set for this app context */
|
||||
bool tt_app_has_result(AppHandle handle);
|
||||
|
||||
@@ -32,11 +32,11 @@ void tt_app_register(
|
||||
#endif
|
||||
}
|
||||
|
||||
BundleHandle _Nullable tt_app_get_parameters(AppHandle handle) {
|
||||
BundleHandle tt_app_get_parameters(AppHandle handle) {
|
||||
return (BundleHandle)HANDLE_AS_APP_CONTEXT(handle)->getParameters().get();
|
||||
}
|
||||
|
||||
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle _Nullable bundle) {
|
||||
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle bundle) {
|
||||
auto shared_bundle = std::unique_ptr<tt::Bundle>(static_cast<tt::Bundle*>(bundle));
|
||||
HANDLE_AS_APP_CONTEXT(handle)->getApp()->setResult(static_cast<tt::app::Result>(result), std::move(shared_bundle));
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void tt_hal_touch_driver_free(TouchDriverHandle handle) {
|
||||
delete wrapper;
|
||||
}
|
||||
|
||||
bool tt_hal_touch_driver_get_touched_points(TouchDriverHandle handle, uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) {
|
||||
bool tt_hal_touch_driver_get_touched_points(TouchDriverHandle handle, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) {
|
||||
DriverWrapper* wrapper = static_cast<DriverWrapper*>(handle);
|
||||
return wrapper->driver->getTouchedPoints(x, y, strength, pointCount, maxPointCount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user