aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/device/device.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2014-07-08 21:09:12 +1000
committerLorenz Meier <lm@inf.ethz.ch>2014-07-12 16:25:43 +0200
commit93d444d1aade59b5e88f41b71c842a00ab950c64 (patch)
treebac1fefd6a71196c7584804d38bf765612d11434 /src/drivers/device/device.h
parenta2f528c5ba20ade8c3be200ed07fb6e925030c0d (diff)
downloadpx4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.tar.gz
px4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.tar.bz2
px4-firmware-93d444d1aade59b5e88f41b71c842a00ab950c64.zip
device: added a _device_id to all drivers
this device ID identifies a specific device via the tuple of (bus, bus type, address, devtype). This allows device specific configuration data to be stored along with a device ID, so the code can know when the user has changed device configuration (such as removing an external compass), and either invalidate the device configuration or force the user to re-calibrate
Diffstat (limited to 'src/drivers/device/device.h')
-rw-r--r--src/drivers/device/device.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drivers/device/device.h b/src/drivers/device/device.h
index d99f22922..c98386eb0 100644
--- a/src/drivers/device/device.h
+++ b/src/drivers/device/device.h
@@ -124,9 +124,34 @@ public:
*/
virtual int ioctl(unsigned operation, unsigned &arg);
+ /*
+ device bus types for DEVID
+ */
+ enum DeviceBusType {
+ DeviceBusType_UNKNOWN = 0,
+ DeviceBusType_I2C = 1,
+ DeviceBusType_SPI = 2
+ };
+
+ /*
+ broken out
+ */
+ struct DeviceStructure {
+ enum DeviceBusType bus_type;
+ uint8_t bus; // which instance of the bus type
+ uint8_t address; // address on the bus (eg. I2C address)
+ uint8_t devtype; // device class specific device type
+ };
+
+ union DeviceId {
+ struct DeviceStructure devid_s;
+ uint32_t devid;
+ };
+
protected:
const char *_name; /**< driver name */
bool _debug_enabled; /**< if true, debug messages are printed */
+ union DeviceId _device_id; /**< device identifier information */
/**
* Constructor