Kernel and TactilitySDK improvements (#479)
* **New Features** * Expanded public device and driver APIs (accessors, sync, lifecycle, binding) and a module construct+start helper. * Added kernel symbol registry and new exported symbols (lvgl, C++ nothrow, I2S APIs, additional math funcs). * **Refactor** * Renamed device traversal APIs for consistency (device_for_each*). * Moved inline helpers to explicit public declarations. * **Chores** * Replaced several shell release scripts with Python-based SDK release tooling. * **Style** * Header naming consistency fixes.
This commit is contained in:
committed by
GitHub
parent
9cc96fd32b
commit
9a672a30ff
@@ -240,7 +240,51 @@ void device_set_parent(Device* device, Device* parent) {
|
||||
device->parent = parent;
|
||||
}
|
||||
|
||||
void for_each_device(void* callback_context, bool(*on_device)(Device* device, void* context)) {
|
||||
Device* device_get_parent(struct Device* device) {
|
||||
return device->parent;
|
||||
}
|
||||
|
||||
void device_set_driver(struct Device* device, struct Driver* driver) {
|
||||
device->internal.driver = driver;
|
||||
}
|
||||
|
||||
struct Driver* device_get_driver(struct Device* device) {
|
||||
return device->internal.driver;
|
||||
}
|
||||
|
||||
bool device_is_ready(const struct Device* device) {
|
||||
return device->internal.state.started;
|
||||
}
|
||||
|
||||
void device_set_driver_data(struct Device* device, void* driver_data) {
|
||||
device->internal.driver_data = driver_data;
|
||||
}
|
||||
|
||||
void* device_get_driver_data(struct Device* device) {
|
||||
return device->internal.driver_data;
|
||||
}
|
||||
|
||||
bool device_is_added(const struct Device* device) {
|
||||
return device->internal.state.added;
|
||||
}
|
||||
|
||||
void device_lock(struct Device* device) {
|
||||
mutex_lock(&device->internal.mutex);
|
||||
}
|
||||
|
||||
bool device_try_lock(struct Device* device) {
|
||||
return mutex_try_lock(&device->internal.mutex);
|
||||
}
|
||||
|
||||
void device_unlock(struct Device* device) {
|
||||
mutex_unlock(&device->internal.mutex);
|
||||
}
|
||||
|
||||
const struct DeviceType* device_get_type(struct Device* device) {
|
||||
return device->internal.driver ? device->internal.driver->device_type : NULL;
|
||||
}
|
||||
|
||||
void device_for_each(void* callback_context, bool(*on_device)(Device* device, void* context)) {
|
||||
ledger_lock();
|
||||
for (auto* device : ledger.devices) {
|
||||
if (!on_device(device, callback_context)) {
|
||||
@@ -250,7 +294,7 @@ void for_each_device(void* callback_context, bool(*on_device)(Device* device, vo
|
||||
ledger_unlock();
|
||||
}
|
||||
|
||||
void for_each_device_child(Device* device, void* callbackContext, bool(*on_device)(struct Device* device, void* context)) {
|
||||
void device_for_each_child(Device* device, void* callbackContext, bool(*on_device)(struct Device* device, void* context)) {
|
||||
auto* data = get_device_private(device);
|
||||
for (auto* child_device : data->children) {
|
||||
if (!on_device(child_device, callbackContext)) {
|
||||
@@ -259,7 +303,7 @@ void for_each_device_child(Device* device, void* callbackContext, bool(*on_devic
|
||||
}
|
||||
}
|
||||
|
||||
void for_each_device_of_type(const DeviceType* type, void* callbackContext, bool(*on_device)(Device* device, void* context)) {
|
||||
void device_for_each_of_type(const DeviceType* type, void* callbackContext, bool(*on_device)(Device* device, void* context)) {
|
||||
ledger_lock();
|
||||
for (auto* device : ledger.devices) {
|
||||
auto* driver = device->internal.driver;
|
||||
|
||||
Reference in New Issue
Block a user