diff --git a/TactilityKernel/Include/tactility/device.h b/TactilityKernel/Include/tactility/device.h index d3622e3e..4f76d866 100644 --- a/TactilityKernel/Include/tactility/device.h +++ b/TactilityKernel/Include/tactility/device.h @@ -20,8 +20,7 @@ struct DeviceInternal; /** Enables discovering devices of the same type */ struct DeviceType { - /* Placeholder because empty structs have a different size with C vs C++ compilers */ - uint8_t _; + const char* name; }; /** Represents a piece of hardware */ diff --git a/TactilityKernel/Source/drivers/gpio_controller.cpp b/TactilityKernel/Source/drivers/gpio_controller.cpp index 4fe89ac5..f7e3a583 100644 --- a/TactilityKernel/Source/drivers/gpio_controller.cpp +++ b/TactilityKernel/Source/drivers/gpio_controller.cpp @@ -32,6 +32,8 @@ error_t gpio_controller_get_pin_count(struct Device* device, uint32_t* count) { return GPIO_DRIVER_API(driver)->get_pin_count(device, count); } -extern const struct DeviceType GPIO_CONTROLLER_TYPE { 0 }; +extern const struct DeviceType GPIO_CONTROLLER_TYPE { + .name = "gpio-controller" +}; } diff --git a/TactilityKernel/Source/drivers/i2c_controller.cpp b/TactilityKernel/Source/drivers/i2c_controller.cpp index 661cf1df..31a92519 100644 --- a/TactilityKernel/Source/drivers/i2c_controller.cpp +++ b/TactilityKernel/Source/drivers/i2c_controller.cpp @@ -49,6 +49,8 @@ error_t i2c_controller_has_device_at_address(Device* device, uint8_t address, Ti return I2C_DRIVER_API(driver)->write(device, address, message, 2, timeout); } -extern const struct DeviceType I2C_CONTROLLER_TYPE { 0 }; +extern const struct DeviceType I2C_CONTROLLER_TYPE { + .name = "i2c-controller" +}; } diff --git a/TactilityKernel/Source/drivers/i2s_controller.cpp b/TactilityKernel/Source/drivers/i2s_controller.cpp index ba0c8b27..e4c04c72 100644 --- a/TactilityKernel/Source/drivers/i2s_controller.cpp +++ b/TactilityKernel/Source/drivers/i2s_controller.cpp @@ -32,6 +32,8 @@ error_t i2s_controller_reset(struct Device* device) { return I2S_DRIVER_API(driver)->reset(device); } -extern const struct DeviceType I2S_CONTROLLER_TYPE { 0 }; +extern const struct DeviceType I2S_CONTROLLER_TYPE { + .name = "i2s-controller" +}; }