Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
BMP085 Class Reference

a BMP085 driver that implements the devices main capabilities. More...

#include <bmp085.hpp>

Inheritance diagram for BMP085:
Inheritance graph
[legend]

List of all members.

Public Types

enum  sampling_mode { ULTRA_LOW_POWER = 0, STANDARD = 1, HIGH = 2, ULTRA_HIGH_RESOLUTION = 3 }
 configurable sampling mode. Higher resolution settings will result in a longer conversion time on the sensor before the value can be read. More...

Public Member Functions

 BMP085 (bosch_hardware_interface *hw)
double calcAltitude (double input_pressure)
 calculate the altitude given an input pressure and using the class's reference pressure, pressure_at_sea_level_.
double getAltitude (void)
 Compute the altitude using the latest pressure data and the reference pressure, which is pressure_at_sea_level_.
uint8_t getDeviceAddress ()
double getPressure ()
bool getPressureData (void)
 acquires the sensor's raw pressure data depending on the sampling mode and computes the calculated pressure using the most recent temperature measurement.
double getTemperature ()
bool getTemperatureData (void)
 acquires the sensors raw temperature data and calculates the calculated temperature data.
bool initialize ()
 sends a prompt to initialize the connected hardware device so that communication can begin with the sensor.
void setPressureAtSeaLevel (double pressure)
 set the reference pressure to another value different from the default value: 101.325 [kPa]
bool takeMeasurement ()
 First acquires the raw temperature; then acquires the raw pressure.
 ~BMP085 ()

Static Public Attributes

static const uint8_t INPUT_REG_ADDRESS = 0xF4
static const uint8_t MEAS_OUTPUT_LSB = 0xF7
static const uint8_t MEAS_OUTPUT_MSB = 0xF6
static const uint8_t MEAS_OUTPUT_XLSB = 0xF8
static const uint8_t PRESSURE_OSRS_0 = 0x34
 Pressure Address register values.
static const uint8_t PRESSURE_OSRS_1 = 0x74
static const uint8_t PRESSURE_OSRS_2 = 0xB4
static const uint8_t PRESSURE_OSRS_3 = 0xF4

Private Member Functions

bool writeToReg (uint8_t reg, uint8_t value)

Private Attributes

short AC1
 The following values are calibration constants specific to each individual sensor.
short AC2
short AC3
unsigned short AC4
unsigned short AC5
unsigned short AC6
double altitude_
 the calculated altitude in [m]
short B1
short B2
long B5
short MB
short MC
short MD
short oss
long p
double pressure_
 the latest calculated pressure measurement determined from both the raw temperature and raw pressure measurements.
double pressure_at_sea_level_
 the class's reference pressure used to perform the altitude calculation.
long T
double temperature_
 the latest calculated temperature measurement determined from the raw temperature measurement from the sensor.
long UP
long UT

Static Private Attributes

static const uint8_t ADDRESS_AC1_LSB = 0xAB
static const uint8_t ADDRESS_AC1_MSB = 0xAA
static const uint8_t ADDRESS_AC2_LSB = 0xAD
static const uint8_t ADDRESS_AC2_MSB = 0xAC
static const uint8_t ADDRESS_AC3_LSB = 0xAF
static const uint8_t ADDRESS_AC3_MSB = 0xAE
static const uint8_t ADDRESS_AC4_LSB = 0xB1
static const uint8_t ADDRESS_AC4_MSB = 0xB0
static const uint8_t ADDRESS_AC5_LSB = 0xB3
static const uint8_t ADDRESS_AC5_MSB = 0xB2
static const uint8_t ADDRESS_AC6_LSB = 0xB5
static const uint8_t ADDRESS_AC6_MSB = 0xB4
static const uint8_t ADDRESS_B1_LSB = 0xB7
static const uint8_t ADDRESS_B1_MSB = 0xB6
static const uint8_t ADDRESS_B2_LSB = 0xB9
static const uint8_t ADDRESS_B2_MSB = 0xB8
static const uint8_t ADDRESS_MB_LSB = 0xBB
static const uint8_t ADDRESS_MB_MSB = 0xBA
static const uint8_t ADDRESS_MC_LSB = 0xBD
static const uint8_t ADDRESS_MC_MSB = 0xBC
static const uint8_t ADDRESS_MD_MSB = 0xBE
static const uint8_t ADDRESS_MF_LSB = 0xBF
static const uint8_t ADDRESS_READ = 0xEF
static const uint8_t ADDRESS_TEMP_REQUEST = 0x2E
 Write this value into INPUT_REG_ADDRESS to prompt the sensor for temperature.
static const uint8_t ADDRESS_WRITE = 0xEE
static const uint8_t DEVICE_ADDRESS = 0x77

Detailed Description

a BMP085 driver that implements the devices main capabilities.

This class provides access to both the temperature and pressure data.

Warning:
This class implements it's methods through a generic hardware interface.

Definition at line 73 of file bmp085.hpp.


Member Enumeration Documentation

configurable sampling mode. Higher resolution settings will result in a longer conversion time on the sensor before the value can be read.

Enumerator:
ULTRA_LOW_POWER 
STANDARD 
HIGH 
ULTRA_HIGH_RESOLUTION 

Reimplemented from BMP085Parameters.

Definition at line 99 of file bmp085.hpp.


Constructor & Destructor Documentation

Definition at line 60 of file bmp085.cpp.

Definition at line 72 of file bmp085.cpp.


Member Function Documentation

double BMP085::calcAltitude ( double  input_pressure)

calculate the altitude given an input pressure and using the class's reference pressure, pressure_at_sea_level_.

Parameters:
input_pressurethe current pressure.
Returns:
the pressure in [kPa].

Definition at line 296 of file bmp085.cpp.

double BMP085::getAltitude ( void  )

Compute the altitude using the latest pressure data and the reference pressure, which is pressure_at_sea_level_.

Warning:
reference pressure must be changed beforehand if it differs from the default value: 101.325 [kPa].
Returns:
the calculated altitude in [m].

Definition at line 307 of file bmp085.cpp.

uint8_t BMP085::getDeviceAddress ( ) [virtual]

Implements bosch_drivers_common::sensor_driver.

Definition at line 152 of file bmp085.cpp.

double BMP085::getPressure ( )
Returns:
the most recent calculated pressure data.

Definition at line 323 of file bmp085.cpp.

bool BMP085::getPressureData ( void  )

acquires the sensor's raw pressure data depending on the sampling mode and computes the calculated pressure using the most recent temperature measurement.

Warning:
it is critical that the temperature is measured immediately beforehand for an accurate pressure value.
Returns:
a boolean indicating success.

Definition at line 215 of file bmp085.cpp.

Returns:
the most recent calculated temperature data.

Definition at line 315 of file bmp085.cpp.

bool BMP085::getTemperatureData ( void  )

acquires the sensors raw temperature data and calculates the calculated temperature data.

Returns:
a boolean indicating success.

Definition at line 170 of file bmp085.cpp.

sends a prompt to initialize the connected hardware device so that communication can begin with the sensor.

This method also sets class constants based on the user-defined (or default) parameters set beforehand.

Returns:
a boolean indicating successful hardware initialization.

Definition at line 80 of file bmp085.cpp.

void BMP085::setPressureAtSeaLevel ( double  pressure)

set the reference pressure to another value different from the default value: 101.325 [kPa]

Parameters:
input_pressurethe new reference pressure in [kPa]

Definition at line 331 of file bmp085.cpp.

First acquires the raw temperature; then acquires the raw pressure.

Computes the calculated temperature and pressure based on the two raw sensor readings. The pressure calculation is dependent on the temperature.

Returns:
A boolean indicating success

Definition at line 136 of file bmp085.cpp.

bool BMP085::writeToReg ( uint8_t  reg,
uint8_t  value 
) [private]

Definition at line 340 of file bmp085.cpp.


Member Data Documentation

short BMP085::AC1 [private]

The following values are calibration constants specific to each individual sensor.

They are stored in the sensors EEPROM and are read out and stored to these class members upon calling the initialize() method.

Note:
these values are necessary to calculate the pressure.
B5 is determined by the latest temperature measurement, so its value changes each time the temperature calculation changes.

Definition at line 245 of file bmp085.hpp.

short BMP085::AC2 [private]

Definition at line 245 of file bmp085.hpp.

short BMP085::AC3 [private]

Definition at line 245 of file bmp085.hpp.

unsigned short BMP085::AC4 [private]

Definition at line 246 of file bmp085.hpp.

unsigned short BMP085::AC5 [private]

Definition at line 246 of file bmp085.hpp.

unsigned short BMP085::AC6 [private]

Definition at line 246 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC1_LSB = 0xAB [static, private]

Definition at line 198 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC1_MSB = 0xAA [static, private]

Definition at line 197 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC2_LSB = 0xAD [static, private]

Definition at line 200 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC2_MSB = 0xAC [static, private]

Definition at line 199 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC3_LSB = 0xAF [static, private]

Definition at line 202 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC3_MSB = 0xAE [static, private]

Definition at line 201 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC4_LSB = 0xB1 [static, private]

Definition at line 204 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC4_MSB = 0xB0 [static, private]

Definition at line 203 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC5_LSB = 0xB3 [static, private]

Definition at line 206 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC5_MSB = 0xB2 [static, private]

Definition at line 205 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC6_LSB = 0xB5 [static, private]

Definition at line 208 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_AC6_MSB = 0xB4 [static, private]

Definition at line 207 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_B1_LSB = 0xB7 [static, private]

Definition at line 210 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_B1_MSB = 0xB6 [static, private]

Definition at line 209 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_B2_LSB = 0xB9 [static, private]

Definition at line 212 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_B2_MSB = 0xB8 [static, private]

Definition at line 211 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MB_LSB = 0xBB [static, private]

Definition at line 214 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MB_MSB = 0xBA [static, private]

Definition at line 213 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MC_LSB = 0xBD [static, private]

Definition at line 216 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MC_MSB = 0xBC [static, private]

Definition at line 215 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MD_MSB = 0xBE [static, private]

Definition at line 217 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_MF_LSB = 0xBF [static, private]

Definition at line 218 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_READ = 0xEF [static, private]

Definition at line 195 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_TEMP_REQUEST = 0x2E [static, private]

Write this value into INPUT_REG_ADDRESS to prompt the sensor for temperature.

Definition at line 224 of file bmp085.hpp.

const uint8_t BMP085::ADDRESS_WRITE = 0xEE [static, private]

Definition at line 194 of file bmp085.hpp.

double BMP085::altitude_ [private]

the calculated altitude in [m]

Definition at line 271 of file bmp085.hpp.

short BMP085::B1 [private]

Definition at line 247 of file bmp085.hpp.

short BMP085::B2 [private]

Definition at line 247 of file bmp085.hpp.

long BMP085::B5 [private]

Definition at line 248 of file bmp085.hpp.

const uint8_t BMP085::DEVICE_ADDRESS = 0x77 [static, private]

Definition at line 192 of file bmp085.hpp.

const uint8_t BMP085::INPUT_REG_ADDRESS = 0xF4 [static]

Definition at line 88 of file bmp085.hpp.

short BMP085::MB [private]

Definition at line 249 of file bmp085.hpp.

short BMP085::MC [private]

Definition at line 249 of file bmp085.hpp.

short BMP085::MD [private]

Definition at line 249 of file bmp085.hpp.

const uint8_t BMP085::MEAS_OUTPUT_LSB = 0xF7 [static]

Definition at line 96 of file bmp085.hpp.

const uint8_t BMP085::MEAS_OUTPUT_MSB = 0xF6 [static]

Definition at line 95 of file bmp085.hpp.

const uint8_t BMP085::MEAS_OUTPUT_XLSB = 0xF8 [static]

Definition at line 97 of file bmp085.hpp.

short BMP085::oss [private]
Note:
this value is set to the value requested in the parameters upon calling the initialize() method.
if no value is called in the parameters, the oss mode is set to the default value: STANDARD.

Definition at line 232 of file bmp085.hpp.

long BMP085::p [private]

The raw pressure in [kPa]

Definition at line 260 of file bmp085.hpp.

double BMP085::pressure_ [private]

the latest calculated pressure measurement determined from both the raw temperature and raw pressure measurements.

Note:
units: [kPa]

Definition at line 285 of file bmp085.hpp.

the class's reference pressure used to perform the altitude calculation.

Definition at line 266 of file bmp085.hpp.

const uint8_t BMP085::PRESSURE_OSRS_0 = 0x34 [static]

Pressure Address register values.

Only PRESSURE_OSRS_0 is used in the class, since the rest can be deduced by adding(oss << 6) as offset from PRESSURE_OSRS_0.

Definition at line 83 of file bmp085.hpp.

const uint8_t BMP085::PRESSURE_OSRS_1 = 0x74 [static]

Definition at line 84 of file bmp085.hpp.

const uint8_t BMP085::PRESSURE_OSRS_2 = 0xB4 [static]

Definition at line 85 of file bmp085.hpp.

const uint8_t BMP085::PRESSURE_OSRS_3 = 0xF4 [static]

Definition at line 86 of file bmp085.hpp.

long BMP085::T [private]

The raw temperature in [C].

Definition at line 255 of file bmp085.hpp.

double BMP085::temperature_ [private]

the latest calculated temperature measurement determined from the raw temperature measurement from the sensor.

Note:
units: [C]

Definition at line 278 of file bmp085.hpp.

long BMP085::UP [private]

Definition at line 250 of file bmp085.hpp.

long BMP085::UT [private]

Definition at line 250 of file bmp085.hpp.


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


bmp085_driver
Author(s): Joshua Vasquez, Philip Roan. Maintained by Philip Roan
autogenerated on Sat Dec 28 2013 16:49:18