Initial attempt to access the device from userspace.
[freerunner-navigation-board:bmp085.git] / userspace / bmp085.h
1 #include <sys/types.h>
2
3 #ifndef BMP085_H
4 #define BMP085_H
5
6 #define BMP085_I2C_ADDRESS              0x77
7
8 #define BMP085_CALIBRATION_DATA_START   0xAA
9 #define BMP085_CALIBRATION_DATA_LENGTH  22
10
11 #define BMP085_CHIP_ID_REG              0xD0
12 #define BMP085_VERSION_REG              0xD1
13
14 #define BMP085_CHIP_ID                  0x55 /* 85 */
15
16
17 typedef int16_t s16;
18 typedef u_int16_t u16;
19 typedef int32_t s32;
20 typedef u_int8_t u8;
21
22 #ifdef __KERNEL__
23 #define DEVICE struct i2c_client
24 #else
25 #define DEVICE int
26 #endif
27
28
29
30 struct bmp085_calibration_data {
31         s16 AC1, AC2, AC3;
32         u16 AC4, AC5, AC6;
33         s16 B1, B2;
34         s16 MB, MC, MD;
35 };
36
37
38 /* Each client has this additional data */
39 struct bmp085_data {
40 #ifdef __KERNEL__
41         struct i2c_client *client;
42 #else
43         int client;
44 #endif
45         unsigned char version;
46         struct bmp085_calibration_data calibration;
47         unsigned long raw_temperature;
48         unsigned long raw_pressure;
49         unsigned char oversampling_setting;
50         unsigned long next_temp_measurement;
51         long b6; // calculated temperature correction coefficient
52 };
53
54 #endif