aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/ms5611/ms5611_i2c.cpp
diff options
context:
space:
mode:
authorAndrew Tridgell <andrew@tridgell.net>2015-02-01 12:07:16 +1100
committerLorenz Meier <lm@inf.ethz.ch>2015-02-01 13:09:44 +0100
commit04a905041009e4763cdc9e08a853c16a7e0b7dca (patch)
treeb2380472c550423daf862ac5b44b33c57a275e88 /src/drivers/ms5611/ms5611_i2c.cpp
parenta2a244584e36a0e9ffdb93a0dda8473baf8344d3 (diff)
downloadpx4-firmware-04a905041009e4763cdc9e08a853c16a7e0b7dca.tar.gz
px4-firmware-04a905041009e4763cdc9e08a853c16a7e0b7dca.tar.bz2
px4-firmware-04a905041009e4763cdc9e08a853c16a7e0b7dca.zip
ms5611: allow for all 4 bus combinations in ms5611 driver
this uses the same table driven approach as the hmc5883 driver, and allows for a ms5611 baro on any of the 4 bus combinations. A simple "ms5611 start" will start all baros that are found.
Diffstat (limited to 'src/drivers/ms5611/ms5611_i2c.cpp')
-rw-r--r--src/drivers/ms5611/ms5611_i2c.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/drivers/ms5611/ms5611_i2c.cpp b/src/drivers/ms5611/ms5611_i2c.cpp
index 87d9b94a6..ca651409f 100644
--- a/src/drivers/ms5611/ms5611_i2c.cpp
+++ b/src/drivers/ms5611/ms5611_i2c.cpp
@@ -56,14 +56,6 @@
#include "board_config.h"
-#ifdef PX4_I2C_OBDEV_MS5611
-
-#ifndef PX4_I2C_BUS_ONBOARD
- #define MS5611_BUS 1
-#else
- #define MS5611_BUS PX4_I2C_BUS_ONBOARD
-#endif
-
#define MS5611_ADDRESS_1 0x76 /* address select pins pulled high (PX4FMU series v1.6+) */
#define MS5611_ADDRESS_2 0x77 /* address select pins pulled low (PX4FMU prototypes) */
@@ -74,7 +66,7 @@ device::Device *MS5611_i2c_interface(ms5611::prom_u &prom_buf);
class MS5611_I2C : public device::I2C
{
public:
- MS5611_I2C(int bus, ms5611::prom_u &prom_buf);
+ MS5611_I2C(uint8_t bus, ms5611::prom_u &prom_buf);
virtual ~MS5611_I2C();
virtual int init();
@@ -113,12 +105,12 @@ private:
};
device::Device *
-MS5611_i2c_interface(ms5611::prom_u &prom_buf)
+MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum)
{
- return new MS5611_I2C(MS5611_BUS, prom_buf);
+ return new MS5611_I2C(busnum, prom_buf);
}
-MS5611_I2C::MS5611_I2C(int bus, ms5611::prom_u &prom) :
+MS5611_I2C::MS5611_I2C(uint8_t bus, ms5611::prom_u &prom) :
I2C("MS5611_I2C", nullptr, bus, 0, 400000),
_prom(prom)
{
@@ -274,5 +266,3 @@ MS5611_I2C::_read_prom()
/* calculate CRC and return success/failure accordingly */
return ms5611::crc4(&_prom.c[0]) ? OK : -EIO;
}
-
-#endif /* PX4_I2C_OBDEV_MS5611 */