36 return (calib->
b5 + 8) >> 4;
51 x1 = calib->
ac3 *
b6 >> 13;
52 x2 = (calib->
b1 * (
b6 *
b6 >> 12)) >> 16;
53 x3 = ((x1 + x2) + 2) >> 2;
57 x1 = (
p >> 8) * (
p >> 8);
58 x1 = (x1 * 3038) >> 16;
59 x2 = (-7357 *
p) >> 16;
60 return p + ((x1 + x2 + 3791) >> 4);
76 bmp->initialized =
false;
89 bmp->i2c_trans.slave_addr = addr;
93 bmp->data_available =
false;
94 bmp->initialized =
false;
110 switch (
bmp->status) {
145 switch (
bmp->status) {
147 bmp->calib.ac1 = (
bmp->i2c_trans.buf[0] << 8) |
bmp->i2c_trans.buf[1];
148 bmp->calib.ac2 = (
bmp->i2c_trans.buf[2] << 8) |
bmp->i2c_trans.buf[3];
149 bmp->calib.ac3 = (
bmp->i2c_trans.buf[4] << 8) |
bmp->i2c_trans.buf[5];
150 bmp->calib.ac4 = (
bmp->i2c_trans.buf[6] << 8) |
bmp->i2c_trans.buf[7];
151 bmp->calib.ac5 = (
bmp->i2c_trans.buf[8] << 8) |
bmp->i2c_trans.buf[9];
152 bmp->calib.ac6 = (
bmp->i2c_trans.buf[10] << 8) |
bmp->i2c_trans.buf[11];
153 bmp->calib.b1 = (
bmp->i2c_trans.buf[12] << 8) |
bmp->i2c_trans.buf[13];
154 bmp->calib.b2 = (
bmp->i2c_trans.buf[14] << 8) |
bmp->i2c_trans.buf[15];
155 bmp->calib.mb = (
bmp->i2c_trans.buf[16] << 8) |
bmp->i2c_trans.buf[17];
156 bmp->calib.mc = (
bmp->i2c_trans.buf[18] << 8) |
bmp->i2c_trans.buf[19];
157 bmp->calib.md = (
bmp->i2c_trans.buf[20] << 8) |
bmp->i2c_trans.buf[21];
159 bmp->initialized =
true;
164 bmp->ut = (
bmp->i2c_trans.buf[0] << 8) |
bmp->i2c_trans.buf[1];
175 bmp->up = (
bmp->i2c_trans.buf[0] << 16) |
176 (
bmp->i2c_trans.buf[1] << 8) |
177 bmp->i2c_trans.buf[2];
180 bmp->data_available =
true;
189 if (
bmp->initialized) {
void bmp085_init(struct Bmp085 *bmp, struct i2c_periph *i2c_p, uint8_t addr)
static int32_t bmp085_compensated_pressure(struct Bmp085Calib *calib, int32_t raw)
Apply temp calibration and sensor calibration to raw measurement to get Pa (from BMP085 datasheet)
void bmp085_event(struct Bmp085 *bmp)
static int32_t bmp085_compensated_temperature(struct Bmp085Calib *calib, int32_t raw)
void bmp085_read_eeprom_calib(struct Bmp085 *bmp)
static bool bmp085_eoc_true(void)
Dummy function to always return TRUE on EndOfConversion check.
void bmp085_periodic(struct Bmp085 *bmp)
Start new measurement if idle or read temp/pressure.
Bosch BMP085 driver interface.
@ BMP085_STATUS_START_TEMP
@ BMP085_STATUS_READ_TEMP
@ BMP085_STATUS_READ_PRESS
@ BMP085_STATUS_START_PRESS
Bosch BMP085 register definitions.
#define BMP085_EEPROM_AC1
#define BMP085_START_TEMP
#define BMP085_OSS
Over sample setting (0-3)
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
@ I2CTransSuccess
transaction successfully finished by I2C driver
@ I2CTransFailed
transaction failed
@ I2CTransDone
transaction set to done by user level
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.