1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-540 Adds support for ms5607 and ms5637 to the ms5611 driver and renames it ms56xx.

This commit is contained in:
Brian Webb 2017-06-27 18:28:37 -07:00
parent d031352cdd
commit 4ee7249b4a
32 changed files with 261 additions and 213 deletions

View File

@ -84,7 +84,7 @@ SRC += $(PIOSCOMMON)/pios_mpu6000.c
SRC += $(PIOSCOMMON)/pios_mpu9250.c SRC += $(PIOSCOMMON)/pios_mpu9250.c
SRC += $(PIOSCOMMON)/pios_mpxv.c SRC += $(PIOSCOMMON)/pios_mpxv.c
SRC += $(PIOSCOMMON)/pios_ms4525do.c SRC += $(PIOSCOMMON)/pios_ms4525do.c
SRC += $(PIOSCOMMON)/pios_ms5611.c SRC += $(PIOSCOMMON)/pios_ms56xx.c
SRC += $(PIOSCOMMON)/pios_bmp280.c SRC += $(PIOSCOMMON)/pios_bmp280.c
SRC += $(PIOSCOMMON)/pios_oplinkrcvr.c SRC += $(PIOSCOMMON)/pios_oplinkrcvr.c
SRC += $(PIOSCOMMON)/pios_video.c SRC += $(PIOSCOMMON)/pios_video.c

View File

@ -38,9 +38,7 @@
# include <pios_mpu6000_config.h> # include <pios_mpu6000_config.h>
#endif #endif
#ifdef PIOS_INCLUDE_MS5611 # include <pios_ms56xx.h>
# include <pios_ms5611.h>
#endif
#ifdef PIOS_INCLUDE_BMP280 #ifdef PIOS_INCLUDE_BMP280
# include <pios_bmp280.h> # include <pios_bmp280.h>
@ -190,13 +188,13 @@ void PIOS_BOARD_Sensors_Configure()
# endif /* PIOS_INCLUDE_HMC5X83 */ # endif /* PIOS_INCLUDE_HMC5X83 */
// internal ms5611 baro // internal ms5611 baro
#if defined(PIOS_INCLUDE_MS5611) #ifdef PIOS_INCLUDE_MS56XX
const struct pios_ms5611_cfg *ms5611_cfg = PIOS_BOARD_HW_DEFS_GetMS5611Cfg(pios_board_info_blob.board_rev); const struct pios_ms56xx_cfg *ms56xx_cfg = PIOS_BOARD_HW_DEFS_GetMS56xxCfg(pios_board_info_blob.board_rev);
if (ms5611_cfg) { if (ms56xx_cfg) {
PIOS_MS5611_Init(ms5611_cfg, PIOS_I2C_MS5611_INTERNAL_ADAPTER); PIOS_MS56xx_Init(ms56xx_cfg, PIOS_I2C_MS56XX_INTERNAL_ADAPTER);
PIOS_MS5611_Register(); PIOS_MS56xx_Register();
} }
#endif #endif /* PIOS_INCLUDE_MS56XX */
#ifdef PIOS_INCLUDE_BMP280 #ifdef PIOS_INCLUDE_BMP280
const struct pios_bmp280_cfg *bmp280_cfg = PIOS_BOARD_HW_DEFS_GetBMP280Cfg(pios_board_info_blob.board_rev); const struct pios_bmp280_cfg *bmp280_cfg = PIOS_BOARD_HW_DEFS_GetBMP280Cfg(pios_board_info_blob.board_rev);

View File

@ -2,13 +2,13 @@
****************************************************************************** ******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer * @addtogroup PIOS PIOS Core hardware abstraction layer
* @{ * @{
* @addtogroup PIOS_MS5611 MS5611 Functions * @addtogroup PIOS_MS56XX MS56XX Functions
* @brief Hardware functions to deal with the altitude pressure sensor * @brief Hardware functions to deal with the altitude pressure sensor
* @{ * @{
* *
* @file pios_ms5611.c * @file pios_ms56xx.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief MS5611 Pressure Sensor Routines * @brief MS56XX Pressure Sensor Routines
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3
* *
******************************************************************************/ ******************************************************************************/
@ -29,44 +29,52 @@
*/ */
#include "pios.h" #include "pios.h"
#ifdef PIOS_INCLUDE_MS5611 #ifdef PIOS_INCLUDE_MS56XX
#include <pios_ms5611.h> #include <pios_ms56xx.h>
#define POW2(x) (1 << x) #define POW2(x) (1 << x)
// Command addresses
#define MS56XX_RESET 0x1E
#define MS56XX_CALIB_ADDR 0xA2 /* First sample is factory stuff */
#define MS56XX_CALIB_LEN 16
#define MS56XX_ADC_READ 0x00
#define MS56XX_PRES_ADDR 0x40
#define MS56XX_TEMP_ADDR 0x50
// Option to change the interleave between Temp and Pressure conversions // Option to change the interleave between Temp and Pressure conversions
// Undef for normal operation // Undef for normal operation
#define PIOS_MS5611_SLOW_TEMP_RATE 20 #define PIOS_MS56XX_SLOW_TEMP_RATE 20
#ifndef PIOS_MS5611_SLOW_TEMP_RATE #ifndef PIOS_MS56XX_SLOW_TEMP_RATE
#define PIOS_MS5611_SLOW_TEMP_RATE 1 #define PIOS_MS56XX_SLOW_TEMP_RATE 1
#endif #endif
// Running moving average smoothing factor // Running moving average smoothing factor
#define PIOS_MS5611_TEMP_SMOOTHING 10 #define PIOS_MS56XX_TEMP_SMOOTHING 10
#define PIOS_MS5611_INIT_DELAY_US 1000000 #define PIOS_MS56XX_INIT_DELAY_US 1000000
#define PIOS_MS5611_RESET_DELAY_US 20000 #define PIOS_MS56XX_RESET_DELAY_US 20000
/* Local Types */ /* Local Types */
typedef struct { typedef struct {
uint16_t C[6]; uint16_t C[6];
} MS5611CalibDataTypeDef; } MS56XXCalibDataTypeDef;
typedef enum { typedef enum {
MS5611_CONVERSION_TYPE_None = 0, MS56XX_CONVERSION_TYPE_None = 0,
MS5611_CONVERSION_TYPE_PressureConv, MS56XX_CONVERSION_TYPE_PressureConv,
MS5611_CONVERSION_TYPE_TemperatureConv MS56XX_CONVERSION_TYPE_TemperatureConv
} ConversionTypeTypeDef; } ConversionTypeTypeDef;
typedef enum { typedef enum {
MS5611_FSM_INIT = 0, MS56XX_FSM_INIT = 0,
MS5611_FSM_CALIBRATION, MS56XX_FSM_CALIBRATION,
MS5611_FSM_TEMPERATURE, MS56XX_FSM_TEMPERATURE,
MS5611_FSM_PRESSURE, MS56XX_FSM_PRESSURE,
MS5611_FSM_CALCULATE, MS56XX_FSM_CALCULATE,
} MS5611_FSM_State; } MS56XX_FSM_State;
static ConversionTypeTypeDef CurrentRead = MS5611_CONVERSION_TYPE_None; static ConversionTypeTypeDef CurrentRead = MS56XX_CONVERSION_TYPE_None;
static MS5611CalibDataTypeDef CalibData; static MS56XXCalibDataTypeDef CalibData;
static uint8_t temp_press_interleave_count = 1; static uint8_t temp_press_interleave_count = 1;
@ -86,61 +94,62 @@ static uint32_t conversionDelayUs;
static int64_t compensation_t2; static int64_t compensation_t2;
// Move into proper driver structure with cfg stored // Move into proper driver structure with cfg stored
static enum pios_ms56xx_version version;
static uint8_t ms56xx_address;
static uint32_t oversampling; static uint32_t oversampling;
static const struct pios_ms5611_cfg *dev_cfg;
static int32_t i2c_id; static int32_t i2c_id;
static PIOS_SENSORS_1Axis_SensorsWithTemp results; static PIOS_SENSORS_1Axis_SensorsWithTemp results;
static bool hw_error = false; static bool hw_error = false;
// private functions // private functions
static int32_t PIOS_MS5611_Read(uint8_t address, uint8_t *buffer, uint8_t len); static int32_t PIOS_MS56xx_Read_I2C(uint8_t address, uint8_t *buffer, uint8_t len);
static int32_t PIOS_MS5611_WriteCommand(uint8_t command, uint32_t delayuS); static int32_t PIOS_MS56xx_WriteCommand(uint8_t command, uint32_t delayuS);
static uint32_t PIOS_MS5611_GetDelayUs(void); static uint32_t PIOS_MS56xx_GetDelayUs(void);
static void PIOS_MS5611_ReadCalibrationData(void); static void PIOS_MS56xx_ReadCalibrationData(void);
// sensor driver interface // sensor driver interface
bool PIOS_MS5611_driver_Test(uintptr_t context); bool PIOS_MS56xx_driver_Test(uintptr_t context);
void PIOS_MS5611_driver_Reset(uintptr_t context); void PIOS_MS56xx_driver_Reset(uintptr_t context);
void PIOS_MS5611_driver_get_scale(float *scales, uint8_t size, uintptr_t context); void PIOS_MS56xx_driver_get_scale(float *scales, uint8_t size, uintptr_t context);
void PIOS_MS5611_driver_fetch(void *, uint8_t size, uintptr_t context); void PIOS_MS56xx_driver_fetch(void *, uint8_t size, uintptr_t context);
bool PIOS_MS5611_driver_poll(uintptr_t context); bool PIOS_MS56xx_driver_poll(uintptr_t context);
const PIOS_SENSORS_Driver PIOS_MS5611_Driver = { const PIOS_SENSORS_Driver PIOS_MS56xx_Driver = {
.test = PIOS_MS5611_driver_Test, .test = PIOS_MS56xx_driver_Test,
.poll = PIOS_MS5611_driver_poll, .poll = PIOS_MS56xx_driver_poll,
.fetch = PIOS_MS5611_driver_fetch, .fetch = PIOS_MS56xx_driver_fetch,
.reset = PIOS_MS5611_driver_Reset, .reset = PIOS_MS56xx_driver_Reset,
.get_queue = NULL, .get_queue = NULL,
.get_scale = PIOS_MS5611_driver_get_scale, .get_scale = PIOS_MS56xx_driver_get_scale,
.is_polled = true, .is_polled = true,
}; };
/** /**
* Initialise the MS5611 sensor * Initialise the MS56XX sensor
*/ */
void PIOS_MS5611_Init(const struct pios_ms5611_cfg *cfg, int32_t i2c_device) void PIOS_MS56xx_Init(const struct pios_ms56xx_cfg *cfg, int32_t i2c_device)
{ {
i2c_id = i2c_device; i2c_id = i2c_device;
ms56xx_address = cfg->address;
version = cfg->version;
oversampling = cfg->oversampling; oversampling = cfg->oversampling;
conversionDelayUs = PIOS_MS5611_GetDelayUs(); conversionDelayUs = PIOS_MS56xx_GetDelayUs();
dev_cfg = cfg; // Store cfg before enabling interrupt
} }
/** /**
* Start the ADC conversion * Start the ADC conversion
* \param[in] PresOrTemp BMP085_PRES_ADDR or BMP085_TEMP_ADDR * \param[in] PresOrTemp BMP085_PRES_ADDR or BMP085_TEMP_ADDR
* \return 0 for success, -1 for failure (conversion completed and not read), -2 if failure occurred * \return 0 for success, -1 for failure (conversion completed and not read), -2 if failure occurred
*/ */
int32_t PIOS_MS5611_StartADC(ConversionTypeTypeDef Type) int32_t PIOS_MS56xx_StartADC(ConversionTypeTypeDef Type)
{ {
/* Start the conversion */ /* Start the conversion */
if (Type == MS5611_CONVERSION_TYPE_TemperatureConv) { if (Type == MS56XX_CONVERSION_TYPE_TemperatureConv) {
if (PIOS_MS5611_WriteCommand(MS5611_TEMP_ADDR + oversampling, conversionDelayUs) != 0) { if (PIOS_MS56xx_WriteCommand(MS56XX_TEMP_ADDR + oversampling, conversionDelayUs) != 0) {
return -2; return -2;
} }
} else if (Type == MS5611_CONVERSION_TYPE_PressureConv) { } else if (Type == MS56XX_CONVERSION_TYPE_PressureConv) {
if (PIOS_MS5611_WriteCommand(MS5611_PRES_ADDR + oversampling, conversionDelayUs) != 0) { if (PIOS_MS56xx_WriteCommand(MS56XX_PRES_ADDR + oversampling, conversionDelayUs) != 0) {
return -2; return -2;
} }
} }
@ -153,24 +162,27 @@ int32_t PIOS_MS5611_StartADC(ConversionTypeTypeDef Type)
/** /**
* @brief Return the delay for the current osr in uS * @brief Return the delay for the current osr in uS
*/ */
static uint32_t PIOS_MS5611_GetDelayUs() static uint32_t PIOS_MS56xx_GetDelayUs()
{ {
switch (oversampling) { switch (oversampling) {
case MS5611_OSR_256: case MS56XX_OSR_256:
return 600; return 600;
case MS5611_OSR_512: case MS56XX_OSR_512:
return 1170; return 1170;
case MS5611_OSR_1024: case MS56XX_OSR_1024:
return 2280; return 2280;
case MS5611_OSR_2048: case MS56XX_OSR_2048:
return 4540; return 4540;
case MS5611_OSR_4096: case MS56XX_OSR_4096:
return 9040; return 9040;
case MS56XX_OSR_8192:
return 18080;
default: default:
break; break;
} }
@ -181,7 +193,7 @@ static uint32_t PIOS_MS5611_GetDelayUs()
* Read the ADC conversion value (once ADC conversion has completed) * Read the ADC conversion value (once ADC conversion has completed)
* \return 0 if successfully read the ADC, -1 if conversion time has not elapsed, -2 if failure occurred * \return 0 if successfully read the ADC, -1 if conversion time has not elapsed, -2 if failure occurred
*/ */
int32_t PIOS_MS5611_ReadADC(void) int32_t PIOS_MS56xx_ReadADC(void)
{ {
uint8_t Data[3]; uint8_t Data[3];
@ -189,18 +201,18 @@ int32_t PIOS_MS5611_ReadADC(void)
Data[1] = 0; Data[1] = 0;
Data[2] = 0; Data[2] = 0;
if (CurrentRead == MS5611_CONVERSION_TYPE_None) { if (CurrentRead == MS56XX_CONVERSION_TYPE_None) {
return -2; return -2;
} }
static int64_t deltaTemp; static int64_t deltaTemp;
if (PIOS_MS5611_Read(MS5611_ADC_READ, Data, 3) != 0) { if (PIOS_MS56xx_Read_I2C(MS56XX_ADC_READ, Data, 3) != 0) {
return -2; return -2;
} }
/* Read and store the 16bit result */ /* Read and store the 16bit result */
if (CurrentRead == MS5611_CONVERSION_TYPE_TemperatureConv) { if (CurrentRead == MS56XX_CONVERSION_TYPE_TemperatureConv) {
RawTemperature = (Data[0] << 16) | (Data[1] << 8) | Data[2]; RawTemperature = (Data[0] << 16) | (Data[1] << 8) | Data[2];
// Difference between actual and reference temperature // Difference between actual and reference temperature
// dT = D2 - TREF = D2 - C5 * 2^8 // dT = D2 - TREF = D2 - C5 * 2^8
@ -209,8 +221,8 @@ int32_t PIOS_MS5611_ReadADC(void)
// TEMP = 20°C + dT * TEMPSENS = 2000 + dT * C6 / 2^23 // TEMP = 20°C + dT * TEMPSENS = 2000 + dT * C6 / 2^23
Temperature = 2000l + ((deltaTemp * CalibData.C[5]) / POW2(23)); Temperature = 2000l + ((deltaTemp * CalibData.C[5]) / POW2(23));
if (FilteredTemperature != INT32_MIN) { if (FilteredTemperature != INT32_MIN) {
FilteredTemperature = (FilteredTemperature * (PIOS_MS5611_TEMP_SMOOTHING - 1) FilteredTemperature = (FilteredTemperature * (PIOS_MS56XX_TEMP_SMOOTHING - 1)
+ Temperature) / PIOS_MS5611_TEMP_SMOOTHING; + Temperature) / PIOS_MS56XX_TEMP_SMOOTHING;
} else { } else {
FilteredTemperature = Temperature; FilteredTemperature = Temperature;
} }
@ -247,17 +259,28 @@ int32_t PIOS_MS5611_ReadADC(void)
} }
RawPressure = ((Data[0] << 16) | (Data[1] << 8) | Data[2]); RawPressure = ((Data[0] << 16) | (Data[1] << 8) | Data[2]);
// Offset at actual temperature // Offset at actual temperature
// OFF = OFFT1 + TCO * dT = C2 * 2^16 + (C4 * dT) / 2^7 if (version == MS56XX_VERSION_5611) {
Offset = ((int64_t)CalibData.C[1]) * POW2(16) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(7) - Offset2; // OFF = OFFT1 + TCO * dT = C2 * 2^16 + (C4 * dT) / 2^7
Offset = ((int64_t)CalibData.C[1]) * POW2(16) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(7) - Offset2;
} else {
// OFF = OFFT1 + TCO * dT = C2 * 2^17 + (C4 * dT) / 2^6
Offset = ((int64_t)CalibData.C[1]) * POW2(17) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(6) - Offset2;
}
// Sensitivity at actual temperature // Sensitivity at actual temperature
// SENS = SENST1 + TCS * dT = C1 * 2^15 + (C3 * dT) / 2^8 if (version == MS56XX_VERSION_5611) {
Sens = ((int64_t)CalibData.C[0]) * POW2(15) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(8) - Sens2; // SENS = SENST1 + TCS * dT = C1 * 2^15 + (C3 * dT) / 2^8
Sens = ((int64_t)CalibData.C[0]) * POW2(15) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(8) - Sens2;
} else {
// SENS = SENST1 + TCS * dT = C1 * 2^16 + (C3 * dT) / 2^7
Sens = ((int64_t)CalibData.C[0]) * POW2(16) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(7) - Sens2;
}
// Temperature compensated pressure (10…1200mbar with 0.01mbar resolution) // Temperature compensated pressure (10…1200mbar with 0.01mbar resolution)
// P = D1 * SENS - OFF = (D1 * SENS / 2^21 - OFF) / 2^15 // P = D1 * SENS - OFF = (D1 * SENS / 2^21 - OFF) / 2^15
Pressure = (((((int64_t)RawPressure) * Sens) / POW2(21)) - Offset) / POW2(15); Pressure = (((((int64_t)RawPressure) * Sens) / POW2(21)) - Offset) / POW2(15);
} }
CurrentRead = MS5611_CONVERSION_TYPE_None; CurrentRead = MS56XX_CONVERSION_TYPE_None;
return 0; return 0;
} }
@ -265,7 +288,7 @@ int32_t PIOS_MS5611_ReadADC(void)
/** /**
* Return the most recently computed temperature in kPa * Return the most recently computed temperature in kPa
*/ */
static float PIOS_MS5611_GetTemperature(void) static float PIOS_MS56xx_GetTemperature(void)
{ {
// Apply the second order low and very low temperature compensation offset // Apply the second order low and very low temperature compensation offset
return ((float)(FilteredTemperature - compensation_t2)) / 100.0f; return ((float)(FilteredTemperature - compensation_t2)) / 100.0f;
@ -274,7 +297,7 @@ static float PIOS_MS5611_GetTemperature(void)
/** /**
* Return the most recently computed pressure in Pa * Return the most recently computed pressure in Pa
*/ */
static float PIOS_MS5611_GetPressure(void) static float PIOS_MS56xx_GetPressure(void)
{ {
return (float)Pressure; return (float)Pressure;
} }
@ -287,12 +310,12 @@ static float PIOS_MS5611_GetPressure(void)
* \return 0 if operation was successful * \return 0 if operation was successful
* \return -1 if error during I2C transfer * \return -1 if error during I2C transfer
*/ */
static int32_t PIOS_MS5611_Read(uint8_t address, uint8_t *buffer, uint8_t len) static int32_t PIOS_MS56xx_Read_I2C(uint8_t address, uint8_t *buffer, uint8_t len)
{ {
const struct pios_i2c_txn txn_list[] = { const struct pios_i2c_txn txn_list[] = {
{ {
.info = __func__, .info = __func__,
.addr = MS5611_I2C_ADDR, .addr = ms56xx_address,
.rw = PIOS_I2C_TXN_WRITE, .rw = PIOS_I2C_TXN_WRITE,
.len = 1, .len = 1,
.buf = &address, .buf = &address,
@ -300,7 +323,7 @@ static int32_t PIOS_MS5611_Read(uint8_t address, uint8_t *buffer, uint8_t len)
, ,
{ {
.info = __func__, .info = __func__,
.addr = MS5611_I2C_ADDR, .addr = ms56xx_address,
.rw = PIOS_I2C_TXN_READ, .rw = PIOS_I2C_TXN_READ,
.len = len, .len = len,
.buf = buffer, .buf = buffer,
@ -321,18 +344,18 @@ static int32_t PIOS_MS5611_Read(uint8_t address, uint8_t *buffer, uint8_t len)
} }
/** /**
* Writes one or more bytes to the MS5611 * Writes one or more bytes to the MS56XX
* \param[in] address Register address * \param[in] address Register address
* \param[in] buffer source buffer * \param[in] buffer source buffer
* \return 0 if operation was successful * \return 0 if operation was successful
* \return -1 if error during I2C transfer * \return -1 if error during I2C transfer
*/ */
static int32_t PIOS_MS5611_WriteCommand(uint8_t command, uint32_t delayuS) static int32_t PIOS_MS56xx_WriteCommand(uint8_t command, uint32_t delayuS)
{ {
const struct pios_i2c_txn txn_list[] = { const struct pios_i2c_txn txn_list[] = {
{ {
.info = __func__, .info = __func__,
.addr = MS5611_I2C_ADDR, .addr = ms56xx_address,
.rw = PIOS_I2C_TXN_WRITE, .rw = PIOS_I2C_TXN_WRITE,
.len = 1, .len = 1,
.buf = &command, .buf = &command,
@ -356,7 +379,7 @@ static int32_t PIOS_MS5611_WriteCommand(uint8_t command, uint32_t delayuS)
return -1; return -1;
} }
static void PIOS_MS5611_ReadCalibrationData() static void PIOS_MS56xx_ReadCalibrationData()
{ {
uint8_t data[2]; uint8_t data[2];
@ -364,19 +387,19 @@ static void PIOS_MS5611_ReadCalibrationData()
compensation_t2 = 0; compensation_t2 = 0;
/* Calibration parameters */ /* Calibration parameters */
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (PIOS_MS5611_Read(MS5611_CALIB_ADDR + i * 2, data, 2) != 0) { if (PIOS_MS56xx_Read_I2C(MS56XX_CALIB_ADDR + i * 2, data, 2) != 0) {
break; break;
} }
CalibData.C[i] = (data[0] << 8) | data[1]; CalibData.C[i] = (data[0] << 8) | data[1];
} }
} }
static void PIOS_MS5611_Reset() static void PIOS_MS56xx_Reset()
{ {
temp_press_interleave_count = 1; temp_press_interleave_count = 1;
hw_error = false; hw_error = false;
PIOS_MS5611_WriteCommand(MS5611_RESET, PIOS_MS5611_RESET_DELAY_US); PIOS_MS56xx_WriteCommand(MS56XX_RESET, PIOS_MS56XX_RESET_DELAY_US);
} }
@ -384,23 +407,23 @@ static void PIOS_MS5611_Reset()
* @brief Run self-test operation. * @brief Run self-test operation.
* \return 0 if self-test succeed, -1 if failed * \return 0 if self-test succeed, -1 if failed
*/ */
int32_t PIOS_MS5611_Test() int32_t PIOS_MS56xx_Test()
{ {
// TODO: Is there a better way to test this than just checking that pressure/temperature has changed? // TODO: Is there a better way to test this than just checking that pressure/temperature has changed?
int32_t cur_value = 0; int32_t cur_value = 0;
cur_value = Temperature; cur_value = Temperature;
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_TemperatureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_TemperatureConv);
PIOS_DELAY_WaitmS(10); PIOS_DELAY_WaitmS(10);
PIOS_MS5611_ReadADC(); PIOS_MS56xx_ReadADC();
if (cur_value == Temperature) { if (cur_value == Temperature) {
return -1; return -1;
} }
cur_value = Pressure; cur_value = Pressure;
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_PressureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_PressureConv);
PIOS_DELAY_WaitmS(10); PIOS_DELAY_WaitmS(10);
PIOS_MS5611_ReadADC(); PIOS_MS56xx_ReadADC();
if (cur_value == Pressure) { if (cur_value == Pressure) {
return -1; return -1;
} }
@ -410,33 +433,33 @@ int32_t PIOS_MS5611_Test()
/* PIOS sensor driver implementation */ /* PIOS sensor driver implementation */
void PIOS_MS5611_Register() void PIOS_MS56xx_Register()
{ {
PIOS_SENSORS_Register(&PIOS_MS5611_Driver, PIOS_SENSORS_TYPE_1AXIS_BARO, 0); PIOS_SENSORS_Register(&PIOS_MS56xx_Driver, PIOS_SENSORS_TYPE_1AXIS_BARO, 0);
} }
bool PIOS_MS5611_driver_Test(__attribute__((unused)) uintptr_t context) bool PIOS_MS56xx_driver_Test(__attribute__((unused)) uintptr_t context)
{ {
return true; // !PIOS_MS5611_Test(); return true; // !PIOS_MS56xx_Test();
} }
void PIOS_MS5611_driver_Reset(__attribute__((unused)) uintptr_t context) {} void PIOS_MS56xx_driver_Reset(__attribute__((unused)) uintptr_t context) {}
void PIOS_MS5611_driver_get_scale(float *scales, uint8_t size, __attribute__((unused)) uintptr_t context) void PIOS_MS56xx_driver_get_scale(float *scales, uint8_t size, __attribute__((unused)) uintptr_t context)
{ {
PIOS_Assert(size > 0); PIOS_Assert(size > 0);
scales[0] = 1; scales[0] = 1;
} }
void PIOS_MS5611_driver_fetch(void *data, __attribute__((unused)) uint8_t size, __attribute__((unused)) uintptr_t context) void PIOS_MS56xx_driver_fetch(void *data, __attribute__((unused)) uint8_t size, __attribute__((unused)) uintptr_t context)
{ {
PIOS_Assert(data); PIOS_Assert(data);
memcpy(data, (void *)&results, sizeof(PIOS_SENSORS_1Axis_SensorsWithTemp)); memcpy(data, (void *)&results, sizeof(PIOS_SENSORS_1Axis_SensorsWithTemp));
} }
bool PIOS_MS5611_driver_poll(__attribute__((unused)) uintptr_t context) bool PIOS_MS56xx_driver_poll(__attribute__((unused)) uintptr_t context)
{ {
static MS5611_FSM_State next_state = MS5611_FSM_INIT; static MS56XX_FSM_State next_state = MS56XX_FSM_INIT;
if (PIOS_DELAY_DiffuS(lastCommandTimeRaw) < commandDelayUs) { if (PIOS_DELAY_DiffuS(lastCommandTimeRaw) < commandDelayUs) {
return false; return false;
@ -444,40 +467,40 @@ bool PIOS_MS5611_driver_poll(__attribute__((unused)) uintptr_t context)
commandDelayUs = 0; commandDelayUs = 0;
PIOS_MS5611_ReadADC(); PIOS_MS56xx_ReadADC();
switch (next_state) { switch (next_state) {
case MS5611_FSM_INIT: case MS56XX_FSM_INIT:
PIOS_MS5611_Reset(); PIOS_MS56xx_Reset();
next_state = MS5611_FSM_CALIBRATION; next_state = MS56XX_FSM_CALIBRATION;
break; break;
case MS5611_FSM_CALIBRATION: case MS56XX_FSM_CALIBRATION:
PIOS_MS5611_ReadCalibrationData(); PIOS_MS56xx_ReadCalibrationData();
/* fall through to MS5611_FSM_TEMPERATURE */ /* fall through to MS56XX_FSM_TEMPERATURE */
case MS5611_FSM_TEMPERATURE: case MS56XX_FSM_TEMPERATURE:
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_TemperatureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_TemperatureConv);
next_state = MS5611_FSM_PRESSURE; next_state = MS56XX_FSM_PRESSURE;
break; break;
case MS5611_FSM_PRESSURE: case MS56XX_FSM_PRESSURE:
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_PressureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_PressureConv);
next_state = MS5611_FSM_CALCULATE; next_state = MS56XX_FSM_CALCULATE;
break; break;
case MS5611_FSM_CALCULATE: case MS56XX_FSM_CALCULATE:
temp_press_interleave_count--; temp_press_interleave_count--;
if (!temp_press_interleave_count) { if (!temp_press_interleave_count) {
temp_press_interleave_count = PIOS_MS5611_SLOW_TEMP_RATE; temp_press_interleave_count = PIOS_MS56XX_SLOW_TEMP_RATE;
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_TemperatureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_TemperatureConv);
next_state = MS5611_FSM_PRESSURE; next_state = MS56XX_FSM_PRESSURE;
} else { } else {
PIOS_MS5611_StartADC(MS5611_CONVERSION_TYPE_PressureConv); PIOS_MS56xx_StartADC(MS56XX_CONVERSION_TYPE_PressureConv);
next_state = MS5611_FSM_CALCULATE; next_state = MS56XX_FSM_CALCULATE;
} }
results.temperature = PIOS_MS5611_GetTemperature(); results.temperature = PIOS_MS56xx_GetTemperature();
results.sample = PIOS_MS5611_GetPressure(); results.sample = PIOS_MS56xx_GetPressure();
return true; return true;
default: default:
@ -487,16 +510,25 @@ bool PIOS_MS5611_driver_poll(__attribute__((unused)) uintptr_t context)
if (hw_error) { if (hw_error) {
lastCommandTimeRaw = PIOS_DELAY_GetRaw(); lastCommandTimeRaw = PIOS_DELAY_GetRaw();
commandDelayUs = (next_state == MS5611_FSM_CALIBRATION) ? PIOS_MS5611_INIT_DELAY_US : 0; commandDelayUs = (next_state == MS56XX_FSM_CALIBRATION) ? PIOS_MS56XX_INIT_DELAY_US : 0;
CurrentRead = MS5611_CONVERSION_TYPE_None; CurrentRead = MS56XX_CONVERSION_TYPE_None;
next_state = MS5611_FSM_INIT; next_state = MS56XX_FSM_INIT;
} }
return false; return false;
} }
/* Poll the pressure sensor and return the temperature and pressure. */
bool PIOS_MS56xx_Read(float *temperature, float *pressure) {
if (PIOS_MS56xx_driver_poll(0)) {
*temperature = results.temperature;
*pressure = results.sample;
return true;
}
return false;
}
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**
* @} * @}

View File

@ -44,8 +44,8 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetInternalHMC5x83Cfg(uint32_t
#ifdef PIOS_INCLUDE_HMC5X83 #ifdef PIOS_INCLUDE_HMC5X83
const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(uint32_t board_revision); const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(uint32_t board_revision);
#endif #endif
#ifdef PIOS_INCLUDE_MS5611 #ifdef PIOS_INCLUDE_MS56XX
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(uint32_t board_revision); const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(uint32_t board_revision);
#endif #endif
#ifdef PIOS_INCLUDE_BMP280 #ifdef PIOS_INCLUDE_BMP280
const struct pios_bmp280_cfg *PIOS_BOARD_HW_DEFS_GetBMP280Cfg(uint32_t board_revision); const struct pios_bmp280_cfg *PIOS_BOARD_HW_DEFS_GetBMP280Cfg(uint32_t board_revision);

View File

@ -30,35 +30,41 @@
#ifndef PIOS_MS5611_H #ifndef PIOS_MS5611_H
#define PIOS_MS5611_H #define PIOS_MS5611_H
#include <pios_sensors.h>
/* BMP085 Addresses */
#define MS5611_I2C_ADDR 0x77
#define MS5611_RESET 0x1E
#define MS5611_CALIB_ADDR 0xA2 /* First sample is factory stuff */
#define MS5611_CALIB_LEN 16
#define MS5611_ADC_READ 0x00
#define MS5611_PRES_ADDR 0x40
#define MS5611_TEMP_ADDR 0x50
#define MS5611_ADC_MSB 0xF6
struct pios_ms5611_cfg { #ifdef PIOS_INCLUDE_MS56XX
uint32_t oversampling;
#include <pios_sensors.h>
enum pios_ms56xx_version {
MS56XX_VERSION_5607 = 0,
MS56XX_VERSION_5611 = 1,
MS56XX_VERSION_5637 = 2,
}; };
enum pios_ms5611_osr { enum pios_ms5611_osr {
MS5611_OSR_256 = 0, MS56XX_OSR_256 = 0,
MS5611_OSR_512 = 2, MS56XX_OSR_512 = 2,
MS5611_OSR_1024 = 4, MS56XX_OSR_1024 = 4,
MS5611_OSR_2048 = 6, MS56XX_OSR_2048 = 6,
MS5611_OSR_4096 = 8, MS56XX_OSR_4096 = 8,
// Only supported by the ms5637
MS56XX_OSR_8192 = 10
};
struct pios_ms56xx_cfg {
uint8_t address;
enum pios_ms56xx_version version;
enum pios_ms5611_osr oversampling;
}; };
/* Public Functions */ /* Public Functions */
extern void PIOS_MS5611_Init(const struct pios_ms5611_cfg *cfg, int32_t i2c_device); extern void PIOS_MS56xx_Init(const struct pios_ms56xx_cfg *cfg, int32_t i2c_device);
extern const PIOS_SENSORS_Driver PIOS_MS5611_Driver; extern void PIOS_MS56xx_Register();
void PIOS_MS5611_Register(); extern bool PIOS_MS56xx_Read(float *temperature, float *pressure);
#endif /* PIOS_MS5611_H */ #endif /* PIOS_INCLUDE_MS56XX */
#endif /* PIOS_MS56XX_H */
/** /**
* @} * @}

View File

@ -88,7 +88,7 @@
/* #define PIOS_INCLUDE_HMC5X83 */ /* #define PIOS_INCLUDE_HMC5X83 */
/* #define PIOS_HMC5883_HAS_GPIOS */ /* #define PIOS_HMC5883_HAS_GPIOS */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -88,7 +88,7 @@
/* #define PIOS_INCLUDE_HMC5X83 */ /* #define PIOS_INCLUDE_HMC5X83 */
/* #define PIOS_HMC5883_HAS_GPIOS */ /* #define PIOS_HMC5883_HAS_GPIOS */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -1425,16 +1425,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_512, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_512,
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**

View File

@ -89,7 +89,7 @@
#define PIOS_INCLUDE_HMC5X83_INTERNAL #define PIOS_INCLUDE_HMC5X83_INTERNAL
// #define PIOS_HMC5X83_HAS_GPIOS // #define PIOS_HMC5X83_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
// #define PIOS_INCLUDE_MS5611 /* #define PIOS_INCLUDE_MS56XX */
// #define PIOS_INCLUDE_MPXV // #define PIOS_INCLUDE_MPXV
// #define PIOS_INCLUDE_ETASV3 // #define PIOS_INCLUDE_ETASV3
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -86,7 +86,7 @@
#define PIOS_INCLUDE_HMC5X83_INTERNAL #define PIOS_INCLUDE_HMC5X83_INTERNAL
// #define PIOS_HMC5X83_HAS_GPIOS // #define PIOS_HMC5X83_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -92,7 +92,7 @@
/* #define PIOS_MPU9250_MAG */ /* #define PIOS_MPU9250_MAG */
/* #define PIOS_INCLUDE_BMP280 */ /* #define PIOS_INCLUDE_BMP280 */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -84,7 +84,7 @@
/* #define PIOS_INCLUDE_HMC5X83 */ /* #define PIOS_INCLUDE_HMC5X83 */
/* #define PIOS_HMC5883_HAS_GPIOS */ /* #define PIOS_HMC5883_HAS_GPIOS */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -84,7 +84,7 @@
/* #define PIOS_INCLUDE_HMC5X83 */ /* #define PIOS_INCLUDE_HMC5X83 */
/* #define PIOS_HMC5X83_HAS_GPIOS */ /* #define PIOS_HMC5X83_HAS_GPIOS */
#define PIOS_INCLUDE_BMP085 #define PIOS_INCLUDE_BMP085
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -92,7 +92,7 @@
/* #define PIOS_MPU9250_MAG */ /* #define PIOS_MPU9250_MAG */
/* #define PIOS_INCLUDE_BMP280 */ /* #define PIOS_INCLUDE_BMP280 */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -1702,16 +1702,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_4096, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_4096
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**

View File

@ -89,7 +89,7 @@
#define PIOS_INCLUDE_HMC5X83_INTERNAL #define PIOS_INCLUDE_HMC5X83_INTERNAL
#define PIOS_HMC5X83_HAS_GPIOS #define PIOS_HMC5X83_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
#define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MS56XX
#define PIOS_INCLUDE_MPXV #define PIOS_INCLUDE_MPXV
#define PIOS_INCLUDE_ETASV3 #define PIOS_INCLUDE_ETASV3
#define PIOS_INCLUDE_MS4525DO #define PIOS_INCLUDE_MS4525DO

View File

@ -127,7 +127,7 @@ extern uint32_t pios_spi_telem_flash_adapter_id;
#define PIOS_I2C_MAX_DEVS 3 #define PIOS_I2C_MAX_DEVS 3
extern uint32_t pios_i2c_mag_pressure_adapter_id; extern uint32_t pios_i2c_mag_pressure_adapter_id;
#define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_pressure_adapter_id) #define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_pressure_adapter_id)
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_mag_pressure_adapter_id) #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_mag_pressure_adapter_id)
extern uint32_t pios_i2c_flexiport_adapter_id; extern uint32_t pios_i2c_flexiport_adapter_id;
#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
#define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)

View File

@ -996,16 +996,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_4096, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_4096,
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**
* Configuration for the MPU9250 chip * Configuration for the MPU9250 chip

View File

@ -88,7 +88,7 @@
#define PIOS_INCLUDE_HMC5X83 #define PIOS_INCLUDE_HMC5X83
// #define PIOS_HMC5X83_HAS_GPIOS // #define PIOS_HMC5X83_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
#define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MS56XX
#define PIOS_INCLUDE_MPXV #define PIOS_INCLUDE_MPXV
#define PIOS_INCLUDE_ETASV3 #define PIOS_INCLUDE_ETASV3
#define PIOS_INCLUDE_MS4525DO #define PIOS_INCLUDE_MS4525DO

View File

@ -123,7 +123,7 @@ extern uint32_t pios_spi_gyro_adapter_id;
// ------------------------ // ------------------------
#define PIOS_I2C_MAX_DEVS 3 #define PIOS_I2C_MAX_DEVS 3
extern uint32_t pios_i2c_eeprom_pressure_adapter_id; extern uint32_t pios_i2c_eeprom_pressure_adapter_id;
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_eeprom_pressure_adapter_id) #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_eeprom_pressure_adapter_id)
extern uint32_t pios_i2c_flexiport_adapter_id; extern uint32_t pios_i2c_flexiport_adapter_id;
#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
#define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER) #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)

View File

@ -1754,16 +1754,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_4096, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_4096,
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**
* Configuration for the BMA180 chip * Configuration for the BMA180 chip

View File

@ -86,7 +86,7 @@
#define PIOS_INCLUDE_HMC5X83_INTERNAL #define PIOS_INCLUDE_HMC5X83_INTERNAL
#define PIOS_HMC5X83_HAS_GPIOS #define PIOS_HMC5X83_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
#define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MS56XX
#define PIOS_INCLUDE_MPXV #define PIOS_INCLUDE_MPXV
#define PIOS_INCLUDE_ETASV3 #define PIOS_INCLUDE_ETASV3
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -108,7 +108,7 @@ extern uint32_t pios_spi_accel_id;
extern uint32_t pios_i2c_mag_adapter_id; extern uint32_t pios_i2c_mag_adapter_id;
extern uint32_t pios_i2c_pressure_adapter_id; extern uint32_t pios_i2c_pressure_adapter_id;
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id) #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id)
#define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_adapter_id) #define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_adapter_id)
extern uint32_t pios_i2c_flexiport_adapter_id; extern uint32_t pios_i2c_flexiport_adapter_id;

View File

@ -67,7 +67,7 @@
// #define PIOS_INCLUDE_MPU6000 // #define PIOS_INCLUDE_MPU6000
// #define PIOS_MPU6000_ACCEL // #define PIOS_MPU6000_ACCEL
// #define PIOS_INCLUDE_L3GD20 // #define PIOS_INCLUDE_L3GD20
// #define PIOS_INCLUDE_MS5611 // #define PIOS_INCLUDE_MS56XX
// #define PIOS_INCLUDE_HCSR04 // #define PIOS_INCLUDE_HCSR04
#define PIOS_FLASH_ON_ACCEL /* true for second revo */ #define PIOS_FLASH_ON_ACCEL /* true for second revo */

View File

@ -1283,16 +1283,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetExternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_4096, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_4096,
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56xx */
/** /**
* Configuration for the MPU9250 chip * Configuration for the MPU9250 chip

View File

@ -88,7 +88,7 @@
#define PIOS_INCLUDE_HMC5X83 #define PIOS_INCLUDE_HMC5X83
/* Sparky2 5X83s are all external and thus don't have GPIOs #define PIOS_HMC5X83_HAS_GPIOS */ /* Sparky2 5X83s are all external and thus don't have GPIOs #define PIOS_HMC5X83_HAS_GPIOS */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
#define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MS56XX
#define PIOS_INCLUDE_MPXV #define PIOS_INCLUDE_MPXV
#define PIOS_INCLUDE_ETASV3 #define PIOS_INCLUDE_ETASV3
#define PIOS_INCLUDE_MS4525DO #define PIOS_INCLUDE_MS4525DO

View File

@ -128,7 +128,7 @@ extern uint32_t pios_spi_gyro_adapter_id;
// ------------------------ // ------------------------
#define PIOS_I2C_MAX_DEVS 3 #define PIOS_I2C_MAX_DEVS 3
extern uint32_t pios_i2c_pressure_adapter_id; extern uint32_t pios_i2c_pressure_adapter_id;
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id) #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id)
#define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_pressure_adapter_id) #define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_pressure_adapter_id)
extern uint32_t pios_i2c_flexiport_adapter_id; extern uint32_t pios_i2c_flexiport_adapter_id;
#define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id) #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)

View File

@ -152,16 +152,18 @@ const struct pios_hmc5x83_cfg *PIOS_BOARD_HW_DEFS_GetInternalHMC5x83Cfg(__attrib
/** /**
* Configuration for the MS5611 chip * Configuration for the MS5611 chip
*/ */
#if defined(PIOS_INCLUDE_MS5611) #if defined(PIOS_INCLUDE_MS56XX)
#include "pios_ms5611.h" #include "pios_ms56xx.h"
static const struct pios_ms5611_cfg pios_ms5611_cfg = { static const struct pios_ms56xx_cfg pios_ms56xx_cfg = {
.oversampling = MS5611_OSR_4096, .address = 0x77,
.version = MS56XX_VERSION_5611,
.oversampling = MS56XX_OSR_4096,
}; };
const struct pios_ms5611_cfg *PIOS_BOARD_HW_DEFS_GetMS5611Cfg(__attribute__((unused)) uint32_t board_revision) const struct pios_ms56xx_cfg *PIOS_BOARD_HW_DEFS_GetMS56xxCfg(__attribute__((unused)) uint32_t board_revision)
{ {
return &pios_ms5611_cfg; return &pios_ms56xx_cfg;
} }
#endif /* PIOS_INCLUDE_MS5611 */ #endif /* PIOS_INCLUDE_MS56XX */
/** /**

View File

@ -89,7 +89,7 @@
#define PIOS_INCLUDE_HMC5X83_INTERNAL #define PIOS_INCLUDE_HMC5X83_INTERNAL
#define PIOS_HMC5883_HAS_GPIOS #define PIOS_HMC5883_HAS_GPIOS
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
#define PIOS_INCLUDE_MS5611 #define PIOS_INCLUDE_MS56XX
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -106,7 +106,7 @@
extern uint32_t pios_i2c_id; extern uint32_t pios_i2c_id;
#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_id) #define PIOS_I2C_MAIN_ADAPTER (pios_i2c_id)
#define PIOS_I2C_ESC_ADAPTER (pios_i2c_id) #define PIOS_I2C_ESC_ADAPTER (pios_i2c_id)
#define PIOS_I2C_MS5611_INTERNAL_ADAPTER (pios_i2c_id) #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_id)
#define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_id) #define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_id)
#define PIOS_I2C_MPU6000_ADAPTER (pios_i2c_id) #define PIOS_I2C_MPU6000_ADAPTER (pios_i2c_id)
#define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_id) #define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_id)

View File

@ -92,7 +92,7 @@
#define PIOS_MPU9250_MAG #define PIOS_MPU9250_MAG
#define PIOS_INCLUDE_BMP280 #define PIOS_INCLUDE_BMP280
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */

View File

@ -92,7 +92,7 @@
/* #define PIOS_MPU9250_MAG */ /* #define PIOS_MPU9250_MAG */
/* #define PIOS_INCLUDE_BMP280 */ /* #define PIOS_INCLUDE_BMP280 */
/* #define PIOS_INCLUDE_BMP085 */ /* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */ /* #define PIOS_INCLUDE_MS56XX */
/* #define PIOS_INCLUDE_MPXV */ /* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */ /* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */ /* #define PIOS_INCLUDE_HCSR04 */