mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Fixes and improvements
This commit is contained in:
parent
73b85e0f86
commit
3749017575
@ -134,6 +134,7 @@ def write_device_structs(file, device: Device, parent_device: Device, bindings:
|
||||
file.write(f"\t.name = \"{device.node_name}\",\n") # Use original name
|
||||
file.write(f"\t.config = &{config_variable_name},\n")
|
||||
file.write(f"\t.parent = {parent_value},\n")
|
||||
file.write(f"\t.internal = NULL\n")
|
||||
file.write("};\n\n")
|
||||
# Child devices
|
||||
for child_device in device.devices:
|
||||
|
||||
@ -14,7 +14,7 @@ struct HalDevicePrivate {
|
||||
std::shared_ptr<tt::hal::Device> halDevice;
|
||||
};
|
||||
|
||||
#define GET_DATA(device) ((struct HalDevicePrivate*)device->internal.driver_data)
|
||||
#define GET_DATA(device) ((HalDevicePrivate*)device_get_driver_data(device))
|
||||
|
||||
static enum HalDeviceType getHalDeviceType(tt::hal::Device::Type type) {
|
||||
switch (type) {
|
||||
@ -94,7 +94,9 @@ void hal_device_set_device(::Device* kernelDevice, std::shared_ptr<Device> halDe
|
||||
|
||||
static error_t start(Device* device) {
|
||||
LOG_I(TAG, "start %s", device->name);
|
||||
device->internal.driver_data = new HalDevicePrivate();
|
||||
auto hal_device_data = new(std::nothrow) HalDevicePrivate();
|
||||
if (hal_device_data == nullptr) return ERROR_OUT_OF_MEMORY;
|
||||
device_set_driver_data(device, hal_device_data);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ struct InternalData {
|
||||
};
|
||||
|
||||
#define GET_CONFIG(device) ((Esp32I2cConfig*)device->config)
|
||||
#define GET_DATA(device) ((InternalData*)device->internal.driver_data)
|
||||
#define GET_DATA(device) ((InternalData*)device_get_driver_data(device))
|
||||
|
||||
#define lock(data) mutex_lock(&data->mutex);
|
||||
#define unlock(data) mutex_unlock(&data->mutex);
|
||||
|
||||
@ -31,7 +31,7 @@ struct InternalData {
|
||||
};
|
||||
|
||||
#define GET_CONFIG(device) ((Esp32I2sConfig*)device->config)
|
||||
#define GET_DATA(device) ((InternalData*)device->internal.driver_data)
|
||||
#define GET_DATA(device) ((InternalData*)device_get_driver_data(device))
|
||||
|
||||
#define lock(data) mutex_lock(&data->mutex);
|
||||
#define unlock(data) mutex_unlock(&data->mutex);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user