From 33f6316d3c813683c3eab8eda0f573e3d7c51c3d Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 28 Jan 2017 19:57:37 +0100 Subject: [PATCH] Device: Also allow to read bus type --- src/drivers/device/device_nuttx.h | 39 +++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/drivers/device/device_nuttx.h b/src/drivers/device/device_nuttx.h index 9786b590b3..bf6ecefda6 100644 --- a/src/drivers/device/device_nuttx.h +++ b/src/drivers/device/device_nuttx.h @@ -130,23 +130,7 @@ public: */ virtual int ioctl(unsigned operation, unsigned &arg); - /** - * Return the bus ID the device is connected to. - * - * @return The bus ID - */ - virtual uint8_t get_device_bus() {return _device_id.devid_s.bus;}; - - /** - * Return the bus address of the device. - * - * @return The bus address - */ - virtual uint8_t get_device_address() {return _device_id.devid_s.address;}; - - /* - device bus types for DEVID - */ + /** Device bus types for DEVID */ enum DeviceBusType { DeviceBusType_UNKNOWN = 0, DeviceBusType_I2C = 1, @@ -154,6 +138,27 @@ public: DeviceBusType_UAVCAN = 3, }; + /** + * Return the bus ID the device is connected to. + * + * @return The bus ID + */ + virtual uint8_t get_device_bus() { return _device_id.devid_s.bus; } + + /** + * Return the bus type the device is connected to. + * + * @return The bus type + */ + virtual DeviceBusType get_device_bus_type() { return _device_id.devid_s.bus_type; } + + /** + * Return the bus address of the device. + * + * @return The bus address + */ + virtual uint8_t get_device_address() { return _device_id.devid_s.address; } + /* broken out device elements. The bitfields are used to keep the overall value small enough to fit in a float accurately,