AP_Baro: save some flash and memory on APM2

we don't need the I2C MS5611 driver
This commit is contained in:
Andrew Tridgell 2014-07-08 13:27:06 +10:00
parent da178ee3b6
commit e118984c26
2 changed files with 15 additions and 1 deletions

View File

@ -69,7 +69,9 @@ bool volatile AP_Baro_MS5611::_updated;
AP_Baro_MS5611_Serial* AP_Baro_MS5611::_serial = NULL;
AP_Baro_MS5611_SPI AP_Baro_MS5611::spi;
#if MS5611_WITH_I2C
AP_Baro_MS5611_I2C AP_Baro_MS5611::i2c;
#endif
// SPI Device //////////////////////////////////////////////////////////////////
@ -154,7 +156,7 @@ void AP_Baro_MS5611_SPI::sem_give()
}
// I2C Device //////////////////////////////////////////////////////////////////
#if MS5611_WITH_I2C
/** I2C address of the MS5611 on the PX4 board. */
#define MS5611_ADDR 0x76
@ -225,6 +227,7 @@ void AP_Baro_MS5611_I2C::sem_give()
{
_i2c_sem->give();
}
#endif // MS5611_WITH_I2C
// Public Methods //////////////////////////////////////////////////////////////

View File

@ -6,6 +6,13 @@
#include <AP_HAL.h>
#include "AP_Baro.h"
#if CONFIG_HAL_BOARD != HAL_BOARD_APM2
#define MS5611_WITH_I2C 1
#else
#define MS5611_WITH_I2C 0
#endif
/** Abstract serial device driver for MS5611. */
class AP_Baro_MS5611_Serial
{
@ -49,6 +56,7 @@ private:
AP_HAL::Semaphore *_spi_sem;
};
#if MS5611_WITH_I2C
/** I2C serial device. */
class AP_Baro_MS5611_I2C : public AP_Baro_MS5611_Serial
{
@ -64,6 +72,7 @@ public:
private:
AP_HAL::Semaphore *_i2c_sem;
};
#endif // MS5611_WITH_I2C
class AP_Baro_MS5611 : public AP_Baro
{
@ -82,7 +91,9 @@ public:
/* Serial port drivers to pass to "init". */
static AP_Baro_MS5611_SPI spi;
#if MS5611_WITH_I2C
static AP_Baro_MS5611_I2C i2c;
#endif
private:
void _calculate();