aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/device/i2c.h
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-08-04 19:48:20 -0700
committerpx4dev <px4@purgatory.org>2013-08-04 19:48:20 -0700
commit4b4f33e6a4fb18047a6ca73d3a4872a900519b5c (patch)
treec8580715886028dcea9e7e3d8ea11e6a677f25fe /src/drivers/device/i2c.h
parent567f621754f1f68ed0aae560e9590805045fa3e0 (diff)
downloadpx4-firmware-4b4f33e6a4fb18047a6ca73d3a4872a900519b5c.tar.gz
px4-firmware-4b4f33e6a4fb18047a6ca73d3a4872a900519b5c.tar.bz2
px4-firmware-4b4f33e6a4fb18047a6ca73d3a4872a900519b5c.zip
Add direct-access methods to the base Device class, so that there's a common way of talking to drivers regardless of which of the specialised classes they derive from.
Make the Device destructor public and virtual, so that arbitrary devices can be deleted. Likewise for classes that derive from it. Make Device::init public so that arbitrary devices can be initialised after being returned by factories.
Diffstat (limited to 'src/drivers/device/i2c.h')
-rw-r--r--src/drivers/device/i2c.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/drivers/device/i2c.h b/src/drivers/device/i2c.h
index b4a9cdd53..549879352 100644
--- a/src/drivers/device/i2c.h
+++ b/src/drivers/device/i2c.h
@@ -55,13 +55,11 @@ class __EXPORT I2C : public CDev
public:
- /**
- * Get the address
- */
- uint16_t get_address() {
- return _address;
- }
-
+ /**
+ * Get the address
+ */
+ int16_t get_address() { return _address; }
+
protected:
/**
* The number of times a read or write operation will be retried on
@@ -90,7 +88,7 @@ protected:
uint16_t address,
uint32_t frequency,
int irq = 0);
- ~I2C();
+ virtual ~I2C();
virtual int init();