AP_Baro: save some flash and memory on APM2
we don't need the I2C MS5611 driver
This commit is contained in:
parent
da178ee3b6
commit
e118984c26
@ -69,7 +69,9 @@ bool volatile AP_Baro_MS5611::_updated;
|
|||||||
|
|
||||||
AP_Baro_MS5611_Serial* AP_Baro_MS5611::_serial = NULL;
|
AP_Baro_MS5611_Serial* AP_Baro_MS5611::_serial = NULL;
|
||||||
AP_Baro_MS5611_SPI AP_Baro_MS5611::spi;
|
AP_Baro_MS5611_SPI AP_Baro_MS5611::spi;
|
||||||
|
#if MS5611_WITH_I2C
|
||||||
AP_Baro_MS5611_I2C AP_Baro_MS5611::i2c;
|
AP_Baro_MS5611_I2C AP_Baro_MS5611::i2c;
|
||||||
|
#endif
|
||||||
|
|
||||||
// SPI Device //////////////////////////////////////////////////////////////////
|
// SPI Device //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ void AP_Baro_MS5611_SPI::sem_give()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// I2C Device //////////////////////////////////////////////////////////////////
|
// I2C Device //////////////////////////////////////////////////////////////////
|
||||||
|
#if MS5611_WITH_I2C
|
||||||
/** I2C address of the MS5611 on the PX4 board. */
|
/** I2C address of the MS5611 on the PX4 board. */
|
||||||
#define MS5611_ADDR 0x76
|
#define MS5611_ADDR 0x76
|
||||||
|
|
||||||
@ -225,6 +227,7 @@ void AP_Baro_MS5611_I2C::sem_give()
|
|||||||
{
|
{
|
||||||
_i2c_sem->give();
|
_i2c_sem->give();
|
||||||
}
|
}
|
||||||
|
#endif // MS5611_WITH_I2C
|
||||||
|
|
||||||
// Public Methods //////////////////////////////////////////////////////////////
|
// Public Methods //////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
#include <AP_HAL.h>
|
#include <AP_HAL.h>
|
||||||
#include "AP_Baro.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. */
|
/** Abstract serial device driver for MS5611. */
|
||||||
class AP_Baro_MS5611_Serial
|
class AP_Baro_MS5611_Serial
|
||||||
{
|
{
|
||||||
@ -49,6 +56,7 @@ private:
|
|||||||
AP_HAL::Semaphore *_spi_sem;
|
AP_HAL::Semaphore *_spi_sem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if MS5611_WITH_I2C
|
||||||
/** I2C serial device. */
|
/** I2C serial device. */
|
||||||
class AP_Baro_MS5611_I2C : public AP_Baro_MS5611_Serial
|
class AP_Baro_MS5611_I2C : public AP_Baro_MS5611_Serial
|
||||||
{
|
{
|
||||||
@ -64,6 +72,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
AP_HAL::Semaphore *_i2c_sem;
|
AP_HAL::Semaphore *_i2c_sem;
|
||||||
};
|
};
|
||||||
|
#endif // MS5611_WITH_I2C
|
||||||
|
|
||||||
class AP_Baro_MS5611 : public AP_Baro
|
class AP_Baro_MS5611 : public AP_Baro
|
||||||
{
|
{
|
||||||
@ -82,7 +91,9 @@ public:
|
|||||||
|
|
||||||
/* Serial port drivers to pass to "init". */
|
/* Serial port drivers to pass to "init". */
|
||||||
static AP_Baro_MS5611_SPI spi;
|
static AP_Baro_MS5611_SPI spi;
|
||||||
|
#if MS5611_WITH_I2C
|
||||||
static AP_Baro_MS5611_I2C i2c;
|
static AP_Baro_MS5611_I2C i2c;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _calculate();
|
void _calculate();
|
||||||
|
Loading…
Reference in New Issue
Block a user