Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
mpl3115.h File Reference

Driver for the baro MPL3115A2 from Freescale (i2c) More...

#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/i2c.h"
+ Include dependency graph for mpl3115.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Mpl3115


#define MPL3115_I2C_ADDR   0xC0
#define MPL3115_REG_STATUS   0x00
#define MPL3115_REG_OUT_P_MSB   0x01
#define MPL3115_REG_OUT_P_CSB   0x02
#define MPL3115_REG_OUT_P_LSB   0x03
#define MPL3115_REG_OUT_T_MSB   0x04
#define MPL3115_REG_OUT_T_LSB   0x05
#define MPL3115_REG_WHO_AM_I   0x0C
#define MPL3115_REG_PT_DATA_CFG   0x13
#define MPL3115_REG_CTRL_REG1   0x26
#define MPL3115_REG_CTRL_REG2   0x27
#define MPL3115_REG_CTRL_REG3   0x28
#define MPL3115_REG_CTRL_REG4   0x29
#define MPL3115_REG_CTRL_REG5   0x2A
#define MPL3115_OST_BIT   (1<<1)
#define MPL3115_PT_DATA_CFG   0x2
#define MPL3115_OVERSAMPLING   0x5




void mpl3115_init (struct Mpl3115 *mpl, struct i2c_periph *i2c_p, uint8_t addr)
void mpl3115_configure (struct Mpl3115 *mpl)
void mpl3115_read (struct Mpl3115 *mpl)
void mpl3115_event (struct Mpl3115 *mpl)
void mpl3115_periodic (struct Mpl3115 *mpl)

Detailed Description

Driver for the baro MPL3115A2 from Freescale (i2c)

Definition in file mpl3115.h.

Data Structure Documentation

◆ Mpl3115

struct Mpl3115

Definition at line 70 of file mpl3115.h.

+ Collaboration diagram for Mpl3115:
Data Fields
bool alt_mode set to TRUE to enable altitude output (otherwise pressure)
float altitude altitude in meters
volatile bool data_available data ready flag
struct i2c_periph * i2c_p
enum Mpl3115Status init_status
bool initialized config done flag
uint32_t pressure pressure in 1/4 Pascal
bool raw_mode set to TRUE to enable raw output
struct i2c_transaction req_trans I2C transaction for conversion request.
int16_t temperature temperature in 1/16 degrees Celcius
struct i2c_transaction trans I2C transaction for reading and configuring.

Macro Definition Documentation

◆ MPL3115_I2C_ADDR

#define MPL3115_I2C_ADDR   0xC0

Definition at line 35 of file mpl3115.h.


#define MPL3115_OST_BIT   (1<<1)

Definition at line 52 of file mpl3115.h.


#define MPL3115_OVERSAMPLING   0x5

Definition at line 59 of file mpl3115.h.


#define MPL3115_PT_DATA_CFG   0x2

Definition at line 56 of file mpl3115.h.


#define MPL3115_REG_CTRL_REG1   0x26

Definition at line 46 of file mpl3115.h.


#define MPL3115_REG_CTRL_REG2   0x27

Definition at line 47 of file mpl3115.h.


#define MPL3115_REG_CTRL_REG3   0x28

Definition at line 48 of file mpl3115.h.


#define MPL3115_REG_CTRL_REG4   0x29

Definition at line 49 of file mpl3115.h.


#define MPL3115_REG_CTRL_REG5   0x2A

Definition at line 50 of file mpl3115.h.


#define MPL3115_REG_OUT_P_CSB   0x02

Definition at line 40 of file mpl3115.h.


#define MPL3115_REG_OUT_P_LSB   0x03

Definition at line 41 of file mpl3115.h.


#define MPL3115_REG_OUT_P_MSB   0x01

Definition at line 39 of file mpl3115.h.


#define MPL3115_REG_OUT_T_LSB   0x05

Definition at line 43 of file mpl3115.h.


#define MPL3115_REG_OUT_T_MSB   0x04

Definition at line 42 of file mpl3115.h.


#define MPL3115_REG_PT_DATA_CFG   0x13

Definition at line 45 of file mpl3115.h.


#define MPL3115_REG_STATUS   0x00

Definition at line 38 of file mpl3115.h.


#define MPL3115_REG_WHO_AM_I   0x0C

Definition at line 44 of file mpl3115.h.

Enumeration Type Documentation

◆ Mpl3115Status


Definition at line 63 of file mpl3115.h.

Function Documentation

◆ mpl3115_configure()

void mpl3115_configure ( struct Mpl3115 mpl)

Definition at line 81 of file mpl3115.c.

References I2CTransDone, I2CTransSuccess, Mpl3115::init_status, mpl3115_send_config(), MPL_CONF_UNINIT, i2c_transaction::status, and Mpl3115::trans.

Referenced by mpl3115_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mpl3115_event()

◆ mpl3115_init()

◆ mpl3115_periodic()

void mpl3115_periodic ( struct Mpl3115 mpl)

Definition at line 153 of file mpl3115.c.

References Mpl3115::initialized, mpl3115_configure(), and mpl3115_read().

Referenced by baro_mpl3115_read_periodic(), and baro_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mpl3115_read()

void mpl3115_read ( struct Mpl3115 mpl)