DroneOS/Drivers/Source/drvBMPxxx.c
/*
 * This function starts the pressure measurement and returns the value
 * in millibar. Since the pressure depends on the ambient temperature,
 * a temperature measurement is executed if the last known value is older
 * than one second.
 */
This function starts the pressure measurement and returns the value
in millibar. Since the pressure depends on the ambient temperature,
a temperature measurement is executed if the last known value is older
than one second.
This function starts the pressure measurement and returns the value in millibar . Since the pressure depends on the ambient temperature a temperature measurement is executed if the last known value is older than one second .
static inline s32 bmp180_get_pressure(struct bmp180_data *data, int *pressure)
{
	struct bmp180_calibration_data *cali = &data->calibration;
	s32 x1, x2, x3, b3;
	u32 b4, b7;
	s32 p;
	int status;
	if (data->last_temp_measurement + 1*HZ < jiffies) {
		status = bmp180_get_temperature(data, NULL);
		if (status != 0)
			goto exit;
	}
	status = bmp180_update_raw_pressure(data);
	if (status != 0)
		goto exit;
	x1 = (data->b6 * data->b6) >> 12;
	x1 *= cali->B2;
	x1 >>= 11;
	x2 = cali->AC2 * data->b6;
	x2 >>= 11;
	x3 = x1 + x2;
	b3 = (((((s32)cali->AC1) * 4 + x3) << data->oversampling_setting) + 2);
	b3 >>= 2;
	x1 = (cali->AC3 * data->b6) >> 13;
	x2 = (cali->B1 * ((data->b6 * data->b6) >> 12)) >> 16;
	x3 = (x1 + x2 + 2) >> 2;
	b4 = (cali->AC4 * (u32)(x3 + 32768)) >> 15;
	b7 = ((u32)data->raw_pressure - b3) *
		(50000 >> data->oversampling_setting);
	p = ((b7 < 0x80000000) ? ((b7 << 1) / b4) : ((b7 / b4) * 2));
	x1 = p >> 8;
	x1 *= x1;
	x1 = (x1 * 3038) >> 16;
	x2 = (-7357 * p) >> 16;
	p += (x1 + x2 + 3791) >> 4;
	*pressure = p;
exit:
	return status;
}
static inline s32 bmp180_get_pressure ( struct bmp180_data * data , int * pressure ) { struct bmp180_calibration_data * cali = & data -> calibration ; s32 x1 , x2 , x3 , b3 ; u32 b4 , b7 ; s32 p ; int status ; if ( data -> last_temp_measurement + 1 * HZ < jiffies ) { status = bmp180_get_temperature ( data , NULL ) ; if ( status != 0 ) goto exit ; } status = bmp180_update_raw_pressure ( data ) ; if ( status != 0 ) goto exit ; x1 = ( data -> b6 * data -> b6 ) >> 12 ; x1 *= cali -> B2 ; x1 >>= 11 ; x2 = cali -> AC2 * data -> b6 ; x2 >>= 11 ; x3 = x1 + x2 ; b3 = ( ( ( ( ( s32 ) cali -> AC1 ) * 4 + x3 ) << data -> oversampling_setting ) + 2 ) ; b3 >>= 2 ; x1 = ( cali -> AC3 * data -> b6 ) >> 13 ; x2 = ( cali -> B1 * ( ( data -> b6 * data -> b6 ) >> 12 ) ) >> 16 ; x3 = ( x1 + x2 + 2 ) >> 2 ; b4 = ( cali -> AC4 * ( u32 ) ( x3 + 32768 ) ) >> 15 ; b7 = ( ( u32 ) data -> raw_pressure - b3 ) * ( 50000 >> data -> oversampling_setting ) ; p = ( ( b7 < 0x80000000 ) ? ( ( b7 << 1 ) / b4 ) : ( ( b7 / b4 ) * 2 ) ) ; x1 = p >> 8 ; x1 *= x1 ; x1 = ( x1 * 3038 ) >> 16 ; x2 = ( -7357 * p ) >> 16 ; p += ( x1 + x2 + 3791 ) >> 4 ; * pressure = p ; exit : return status ; }
This function starts the pressure measurement and returns the value
 in millibar.
This function starts the pressure measurement and returns the value in millibar .
/* alt least every second force an update of the ambient temperature */