upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
BMPX8X Class Reference

API for the GY65/BMP085 and BMP180 Atmospheric Pressure Sensors. More...

Detailed Description

Bosch GY65/BMP085 and BMP180 are high-precision, ultra-low power consumption pressure sensors. They operate in the range of 30,000-110,000 Pa.

This module has been tested on the GY65/BMP085 and BMP180 sensors.

bmp085.jpeg
uint32_t presure = 0;
float temperature = 0;
float altitude = 0;
uint32_t sealevel = 0;
// Instantiate a BMPX8X sensor on I2C
sensor = new upm::BMPX8X(0, ADDR);
// Print the pressure, altitude, sea level, and
// temperature values every 0.1 seconds
while (!doWork) {
presure = sensor->getPressure ();
temperature = sensor->getTemperature ();
altitude = sensor->getAltitude ();
sealevel = sensor->getSealevelPressure ();
std::cout << "pressure value = " <<
presure <<
", altitude value = " <<
altitude <<
", sealevel value = " <<
sealevel <<
", temperature = " <<
temperature << std::endl;
usleep (100000);
}

Public Member Functions

 BMPX8X (int bus, int devAddr=0x77, uint8_t mode=BMP085_ULTRAHIGHRES)
 
int32_t getPressure ()
 
int32_t getPressureRaw ()
 
int16_t getTemperatureRaw ()
 
float getTemperature ()
 
int32_t getSealevelPressure (float altitudeMeters=0)
 
float getAltitude (float sealevelPressure=101325)
 
int32_t computeB5 (int32_t UT)
 
uint16_t i2cReadReg_16 (int reg)
 
mraa::Result i2cWriteReg (uint8_t reg, uint8_t value)
 
uint8_t i2cReadReg_8 (int reg)
 

Constructor & Destructor Documentation

BMPX8X ( int  bus,
int  devAddr = 0x77,
uint8_t  mode = BMP085_ULTRAHIGHRES 
)

Instantiates a BMPX8X object

Parameters
busNumber of the used bus
devAddrAddress of the used I2C device
modeBMP085 mode

Here is the call graph for this function:

Member Function Documentation

int32_t getPressure ( )

BMPX8X object destructor; basically, it closes the I2C connection. ~BMPX8X (); LE: there is no need for the destructor, as the I2C connection will be closed when the m_i2ControlCtx variable will go out of scope (when all the BMPX8X objects will be destroyed) Returns the calculated pressure

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t getPressureRaw ( )

Gets raw pressure data

Here is the call graph for this function:

Here is the caller graph for this function:

int16_t getTemperatureRaw ( )

Gets raw temperature data from the sensor

Here is the call graph for this function:

Here is the caller graph for this function:

float getTemperature ( void  )

Returns the calculated temperature

Here is the call graph for this function:

int32_t getSealevelPressure ( float  altitudeMeters = 0)

With a given absolute altitude, sea level can be calculated

Parameters
altitudeMetersAltitude

Here is the call graph for this function:

float getAltitude ( float  sealevelPressure = 101325)

With a given sea level, altitude in meters can be calculated

Parameters
sealevelPressureSea level

Here is the call graph for this function:

int32_t computeB5 ( int32_t  UT)

Calculates B5 (check the spec for more information)

Parameters
UT

Here is the caller graph for this function:

uint16_t i2cReadReg_16 ( int  reg)

Reads a two-byte register

Parameters
regAddress of the register

Here is the caller graph for this function:

mraa::Result i2cWriteReg ( uint8_t  reg,
uint8_t  value 
)

Writes to a one-byte register

Parameters
regAddress of the register
valueByte to be written

Here is the caller graph for this function:

uint8_t i2cReadReg_8 ( int  reg)

Reads a one-byte register

Parameters
regAddress of the register

Here is the caller graph for this function:


The documentation for this class was generated from the following files: