AP_Baro: Add CONFIG_MS5611_SERIAL option to choose between SPI and I2C.

- Update ArduCopter and ArduPlane modules to pass the correct serial
  driver to the MS5611 driver.
- Update barometer examples, assuming SPI.
This commit is contained in:
James Bielman 2013-01-03 10:21:17 -08:00 committed by Pat Hickey
parent 5753ae5692
commit 264db3670e
7 changed files with 21 additions and 6 deletions

View File

@ -205,7 +205,13 @@ SITL sitl;
#if CONFIG_BARO == AP_BARO_BMP085
AP_Baro_BMP085 barometer;
#elif CONFIG_BARO == AP_BARO_MS5611
AP_Baro_MS5611 barometer;
#if CONFIG_MS5611_SERIAL == SPI
AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi);
#elif CONFIG_MS5611_SERIAL == I2C
AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c);
#else
#error Unrecognized CONFIG_MS5611_SERIAL setting.
#endif
#endif
AP_Compass_HMC5843 compass;

View File

@ -62,7 +62,8 @@
# ifdef APM2_BETA_HARDWARE
# define CONFIG_BARO AP_BARO_BMP085
# else // APM2 Production Hardware (default)
# define CONFIG_BARO AP_BARO_MS5611
# define CONFIG_BARO AP_BARO_MS5611
# define CONFIG_MS5611_SERIAL SPI
# endif
#elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
# define CONFIG_IMU_TYPE CONFIG_IMU_SITL

View File

@ -153,7 +153,13 @@ SITL sitl;
#if CONFIG_BARO == AP_BARO_BMP085
static AP_Baro_BMP085 barometer;
#elif CONFIG_BARO == AP_BARO_MS5611
static AP_Baro_MS5611 barometer;
#if CONFIG_MS5611_SERIAL == SPI
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::spi);
#elif CONFIG_MS5611_SERIAL == I2C
static AP_Baro_MS5611 barometer(&AP_Baro_MS5611::i2c);
#else
#error Unrecognized CONFIG_MS5611_SERIAL setting.
#endif
#endif
static AP_Compass_HMC5843 compass;

View File

@ -120,7 +120,8 @@
# ifdef APM2_BETA_HARDWARE
# define CONFIG_BARO AP_BARO_BMP085
# else // APM2 Production Hardware (default)
# define CONFIG_BARO AP_BARO_MS5611
# define CONFIG_BARO AP_BARO_MS5611
# define CONFIG_MS5611_SERIAL SPI
# endif
#elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
# define A_LED_PIN 27

View File

@ -54,6 +54,7 @@
# define CONFIG_PITOT_SOURCE PITOT_SOURCE_ANALOG_PIN
# define MAGNETOMETER ENABLED
# define CONFIG_BARO AP_BARO_MS5611
# define CONFIG_MS5611_SERIAL SPI
# define A_LED_PIN 27
# define B_LED_PIN 26

View File

@ -13,7 +13,7 @@ const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
#if CONFIG_HAL_BOARD == HAL_BOARD_APM2
AP_Baro_MS5611 baro;
AP_Baro_MS5611 baro(&AP_Baro_MS5611::spi);
static uint32_t timer;
void setup()

View File

@ -28,7 +28,7 @@ const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
#define A_LED_PIN 27
#define C_LED_PIN 25
AP_InertialSensor_MPU6000 ins;
AP_Baro_MS5611 baro;
AP_Baro_MS5611 baro(&AP_Baro_MS5611::spi);
#else