lkml.org 
[lkml]   [2010]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] [PATCH] Adding support for BMP085 pressure sensor.
Date
Am Montag, 14. Juni 2010 12:13:44 schrieb Datta, Shubhrajyoti:
> +static s32 bmp085_get_calibration_data(struct i2c_client *client)
> +{
> + u8 tmp[BMP085_CALIBRATION_DATA_LENGTH];
> + struct bmp085_data *data = i2c_get_clientdata(client);
> + struct bmp085_calibration_data *cali = &(data->calibration);
> + s32 status = i2c_smbus_read_i2c_block_data(client,
> + BMP085_CALIBRATION_DATA_START,
> + BMP085_CALIBRATION_DATA_LENGTH, tmp);
> +
> + cali->AC1 = (tmp[0] << 8) | tmp[1];
> + cali->AC2 = (tmp[2] << 8) | tmp[3];
> + cali->AC3 = (tmp[4] << 8) | tmp[5];
> + cali->AC4 = (tmp[6] << 8) | tmp[7];
> + cali->AC5 = (tmp[8] << 8) | tmp[9];
> + cali->AC6 = (tmp[10] << 8) | tmp[11];

Please use the macros for reading be16 data.

Regards
Oliver


\
 
 \ /
  Last update: 2010-06-14 12:19    [W:0.475 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site