mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
proper use of i2c transfer, return 0 is all ok, original code locked the transfer when all ok.
This commit is contained in:
parent
60c4d7f922
commit
ad0473e646
@ -141,8 +141,8 @@ void PIOS_BMP085_Init(void)
|
||||
|
||||
/* Read all 22 bytes of calibration data in one transfer, this is a very optimized way of doing things */
|
||||
uint8_t Data[BMP085_CALIB_LEN];
|
||||
PIOS_BMP085_Read(BMP085_CALIB_ADDR, Data, BMP085_CALIB_LEN);
|
||||
// continue;
|
||||
while (PIOS_BMP085_Read(BMP085_CALIB_ADDR, Data, BMP085_CALIB_LEN) != 0)
|
||||
continue;
|
||||
|
||||
/* Parameters AC1-AC6 */
|
||||
CalibData.AC1 = (Data[0] << 8) | Data[1];
|
||||
@ -196,8 +196,8 @@ void PIOS_BMP085_ReadADC(void)
|
||||
/* Read and store the 16bit result */
|
||||
if (CurrentRead == TemperatureConv) {
|
||||
/* Read the temperature conversion */
|
||||
PIOS_BMP085_Read(BMP085_ADC_MSB, Data, 2);
|
||||
// continue;
|
||||
while (PIOS_BMP085_Read(BMP085_ADC_MSB, Data, 2) != 0)
|
||||
continue;
|
||||
RawTemperature = ((Data[0] << 8) | Data[1]);
|
||||
|
||||
X1 = (RawTemperature - CalibData.AC6) * CalibData.AC5 >> 15;
|
||||
@ -206,8 +206,8 @@ void PIOS_BMP085_ReadADC(void)
|
||||
Temperature = (B5 + 8) >> 4;
|
||||
} else {
|
||||
/* Read the pressure conversion */
|
||||
PIOS_BMP085_Read(BMP085_ADC_MSB, Data, 3);
|
||||
// continue;
|
||||
while (PIOS_BMP085_Read(BMP085_ADC_MSB, Data, 3) != 0)
|
||||
continue;
|
||||
RawPressure = ((Data[0] << 16) | (Data[1] << 8) | Data[2]) >> (8 - BMP085_OVERSAMPLING);
|
||||
|
||||
B6 = B5 - 4000;
|
||||
|
Loading…
x
Reference in New Issue
Block a user