36 return (calib->
b5 + 8) >> 4;
47 int32_t x1 = (calib->
b2 * (b6 * b6 >> 12)) >> 11;
51 x1 = calib->
ac3 * b6 >> 13;
52 x2 = (calib->
b1 * (b6 * b6 >> 12)) >> 16;
53 x3 = ((x1 + x2) + 2) >> 2;
56 int32_t p = b7 < 0x80000000 ? (b7 * 2) / b4 : (b7 / b4) * 2;
57 x1 = (
p >> 8) * (
p >> 8);
58 x1 = (x1 * 3038) >> 16;
59 x2 = (-7357 *
p) >> 16;
60 return p + ((x1 + x2 + 3791) >> 4);
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.
int32_t up
uncompensated pressure
int32_t pressure
pressure in Pascal
enum Bmp085Status status
state machine status
Bmp085EOC eoc
function to check End Of Conversion
int32_t temperature
temperature in 0.1 deg Celcius
bool initialized
config done flag
int32_t ut
uncompensated temperature
struct i2c_transaction i2c_trans
struct i2c_periph * i2c_p
volatile bool data_available
data ready flag
@ 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)
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
uint8_t slave_addr
Slave address.
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.