35 #define MPL3115_I2C_ADDR 0xC0
38 #define MPL3115_REG_STATUS 0x00
39 #define MPL3115_REG_OUT_P_MSB 0x01
40 #define MPL3115_REG_OUT_P_CSB 0x02
41 #define MPL3115_REG_OUT_P_LSB 0x03
42 #define MPL3115_REG_OUT_T_MSB 0x04
43 #define MPL3115_REG_OUT_T_LSB 0x05
44 #define MPL3115_REG_WHO_AM_I 0x0C
45 #define MPL3115_REG_PT_DATA_CFG 0x13
46 #define MPL3115_REG_CTRL_REG1 0x26
47 #define MPL3115_REG_CTRL_REG2 0x27
48 #define MPL3115_REG_CTRL_REG3 0x28
49 #define MPL3115_REG_CTRL_REG4 0x29
50 #define MPL3115_REG_CTRL_REG5 0x2A
52 #define MPL3115_OST_BIT (1<<1) // One Shot control bit
55 #ifndef MPL3115_PT_DATA_CFG
56 #define MPL3115_PT_DATA_CFG 0x2 // Enable data event flag for pressure
58 #ifndef MPL3115_OVERSAMPLING
59 #define MPL3115_OVERSAMPLING 0x5 // Oversample ratio (0x5: 130ms between data sample)
bool_t raw_mode
set to TRUE to enable raw output
bool_t alt_mode
set to TRUE to enable altitude output (otherwise pressure)
void mpl3115_read(struct Mpl3115 *mpl)
uint32_t pressure
pressure in 1/4 Pascal
struct i2c_transaction req_trans
I2C transaction for conversion request.
void mpl3115_init(struct Mpl3115 *mpl, struct i2c_periph *i2c_p, uint8_t addr)
void mpl3115_periodic(struct Mpl3115 *mpl)
I2C transaction structure.
int16_t temperature
temperature in 1/16 degrees Celcius
struct i2c_transaction trans
I2C transaction for reading and configuring.
I2C peripheral structure.
enum Mpl3115Status init_status
float altitude
altitude in meters
bool_t initialized
config done flag
volatile bool_t data_available
data ready flag
void mpl3115_configure(struct Mpl3115 *mpl)
Paparazzi fixed point algebra.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
void mpl3115_event(struct Mpl3115 *mpl)
struct i2c_periph * i2c_p