PX4 Firmware
PX4 Autopilot Software http://px4.io
mpl3115a2.cpp File Reference

Driver for the MPL3115A2 barometric pressure sensor connected via I2C. More...

#include "mpl3115a2.h"
Include dependency graph for mpl3115a2.cpp:

Go to the source code of this file.

Classes

class  MPL3115A2
 
struct  mpl3115a2::mpl3115a2_bus_option
 

Namespaces

 mpl3115a2
 Local functions in support of the shell command.
 

Macros

#define INCREMENT(_x, _lim)   do { __typeof__(_x) _tmp = _x+1; if (_tmp >= _lim) _tmp = 0; _x = _tmp; } while(0)
 
#define POW2(_x)   ((_x) * (_x))
 
#define MPL3115A2_CONVERSION_INTERVAL   10000 /* microseconds */
 
#define MPL3115A2_OSR   2 /* Over Sample rate of 4 18MS Minimum time between data samples */
 
#define MPL3115A2_CTRL_TRIGGER   (CTRL_REG1_OST | CTRL_REG1_OS(MPL3115A2_OSR))
 
#define MPL3115A2_BARO_DEVICE_PATH_EXT   "/dev/mpl3115a2_ext"
 
#define MPL3115A2_BARO_DEVICE_PATH_INT   "/dev/mpl3115a2_int"
 
#define NUM_BUS_OPTIONS   (sizeof(bus_options)/sizeof(bus_options[0]))
 

Enumerations

enum  MPL3115A2_BUS { MPL3115A2_BUS_ALL = 0, MPL3115A2_BUS_I2C_INTERNAL, MPL3115A2_BUS_I2C_EXTERNAL }
 

Functions

__EXPORT int mpl3115a2_main (int argc, char *argv[])
 
bool mpl3115a2::start_bus (struct mpl3115a2_bus_option &bus)
 Start the driver. More...
 
struct mpl3115a2_bus_option & mpl3115a2::find_bus (enum MPL3115A2_BUS busid)
 find a bus structure for a busid More...
 
void mpl3115a2::start (enum MPL3115A2_BUS busid)
 Start the driver. More...
 
void mpl3115a2::test (enum MPL3115A2_BUS busid)
 Perform some basic functional tests on the driver; make sure we can collect data from the sensor in polled and automatic modes. More...
 
void mpl3115a2::reset (enum MPL3115A2_BUS busid)
 Reset the driver. More...
 
void mpl3115a2::info ()
 Print a little info about the driver. More...
 
void mpl3115a2::usage ()
 Prints info about the driver argument usage. More...
 

Variables

struct mpl3115a2::mpl3115a2_bus_option mpl3115a2::bus_options []
 

Detailed Description

Driver for the MPL3115A2 barometric pressure sensor connected via I2C.

Definition in file mpl3115a2.cpp.

Macro Definition Documentation

◆ INCREMENT

#define INCREMENT (   _x,
  _lim 
)    do { __typeof__(_x) _tmp = _x+1; if (_tmp >= _lim) _tmp = 0; _x = _tmp; } while(0)

Definition at line 49 of file mpl3115a2.cpp.

Referenced by MS5611::collect().

◆ MPL3115A2_BARO_DEVICE_PATH_EXT

#define MPL3115A2_BARO_DEVICE_PATH_EXT   "/dev/mpl3115a2_ext"

Definition at line 61 of file mpl3115a2.cpp.

◆ MPL3115A2_BARO_DEVICE_PATH_INT

#define MPL3115A2_BARO_DEVICE_PATH_INT   "/dev/mpl3115a2_int"

Definition at line 62 of file mpl3115a2.cpp.

◆ MPL3115A2_CONVERSION_INTERVAL

#define MPL3115A2_CONVERSION_INTERVAL   10000 /* microseconds */

Definition at line 58 of file mpl3115a2.cpp.

Referenced by MPL3115A2::ioctl(), and MPL3115A2::Run().

◆ MPL3115A2_CTRL_TRIGGER

#define MPL3115A2_CTRL_TRIGGER   (CTRL_REG1_OST | CTRL_REG1_OS(MPL3115A2_OSR))

Definition at line 60 of file mpl3115a2.cpp.

Referenced by MPL3115A2::measure().

◆ MPL3115A2_OSR

#define MPL3115A2_OSR   2 /* Over Sample rate of 4 18MS Minimum time between data samples */

Definition at line 59 of file mpl3115a2.cpp.

◆ NUM_BUS_OPTIONS

#define NUM_BUS_OPTIONS   (sizeof(bus_options)/sizeof(bus_options[0]))

Definition at line 611 of file mpl3115a2.cpp.

Referenced by mpl3115a2::find_bus(), mpl3115a2::info(), and mpl3115a2::start().

◆ POW2

#define POW2 (   _x)    ((_x) * (_x))

Definition at line 52 of file mpl3115a2.cpp.

Referenced by MS5611::collect().

Enumeration Type Documentation

◆ MPL3115A2_BUS

Enumerator
MPL3115A2_BUS_ALL 
MPL3115A2_BUS_I2C_INTERNAL 
MPL3115A2_BUS_I2C_EXTERNAL 

Definition at line 42 of file mpl3115a2.cpp.

Function Documentation

◆ mpl3115a2_main()

int mpl3115a2_main ( int  argc,
char *  argv[] 
)

Definition at line 828 of file mpl3115a2.cpp.

References mpl3115a2::info(), MPL3115A2_BUS_ALL, MPL3115A2_BUS_I2C_EXTERNAL, MPL3115A2_BUS_I2C_INTERNAL, mpl3115a2::reset(), mpl3115a2::start(), mpl3115a2::test(), and mpl3115a2::usage().

Here is the call graph for this function: