Arduino-TWI
Two-Wire Interface (TWI) library for Arduino
BMP085 Class Reference

#include <BMP085.h>

Inheritance diagram for BMP085:
Inheritance graph
Collaboration diagram for BMP085:
Collaboration graph

Classes

struct  param_t
 

Public Types

enum  Mode { ULTRA_LOW_POWER = 0, STANDARD = 1, HIGH_RESOLUTION = 2, ULTRA_HIGH_RESOLUTION = 3 }
 

Public Member Functions

 BMP085 (TWI &twi)
 
bool begin (Mode mode=ULTRA_LOW_POWER)
 
bool sample_temperature_request ()
 
bool read_temperature ()
 
bool sample_temperature ()
 
bool sample_pressure_request ()
 
bool read_pressure ()
 
bool sample_pressure ()
 
bool sample ()
 
int16_t temperature () const
 
int32_t pressure () const
 

Protected Types

enum  reg_t { COEFF_REG = 0xAA, CMD_REG = 0xF4, RES_REG = 0xF6 }
 
enum  cmd_t { TEMP_CONV_CMD = 0x2E, PRESSURE_CONV_CMD = 0x34 }
 

Protected Member Functions

bool acquire ()
 
bool release ()
 
int read (void *buf, size_t count)
 
int write (const void *buf, size_t count)
 
int write (iovec_t *vp)
 

Protected Attributes

param_t m_param
 
Mode m_mode
 
uint8_t m_cmd
 
uint16_t m_start
 
int32_t B5
 
int32_t m_pressure
 
TWIm_twi
 
uint8_t m_addr
 

Static Protected Attributes

static const uint16_t TEMP_CONV_MS = 5
 

Detailed Description

TWI Device Driver for the Bosch BMP085 Digital Pressure Sensor.

Circuit

The GY-80 10DOF module with pull-up resistors (4K7) for TWI signals and internal 3V3 voltage converter.

GY-80
+------------+
(VCC)---------------1-|VCC |
2-|3V3 |
(GND)---------------3-|GND |
(A5/SCL)------------4-|SCL |
(A4/SDA)------------5-|SDA |
6-|M-DRDY |
7-|A-INT1 |
8-|T-INT1 |
9-|P-XCLR |
(Dn/EXTn)----------10-|P-EOC |
+------------+

References

  1. http://media.digikey.com/pdf/Data%20Sheets/Bosch/BMP085.pdf BST-BMP085-DS000-03, Rev. 1.0, 01 July 2008.

Definition at line 50 of file BMP085.h.

Member Enumeration Documentation

enum BMP085::cmd_t
protected

Measurement/Control register value (chap. 4.4, pp. 16).

Enumerator
TEMP_CONV_CMD 

Temperature conversion command.

PRESSURE_CONV_CMD 

Pressure conversion command.

Definition at line 325 of file BMP085.h.

Oversampling modes (table, pp. 10).

Enumerator
ULTRA_LOW_POWER 
STANDARD 
HIGH_RESOLUTION 
ULTRA_HIGH_RESOLUTION 

Definition at line 55 of file BMP085.h.

enum BMP085::reg_t
protected

EEPROM parameters, command and result registers (chap. 4.5, pp. 17). Parameter and result registers are 16-bit, in big-endian order.

Enumerator
COEFF_REG 

Calibration coefficients register address.

CMD_REG 

Command register address (8-bit).

RES_REG 

Result register address (16-bit).

Definition at line 316 of file BMP085.h.

Constructor & Destructor Documentation

BMP085::BMP085 ( TWI twi)
inline

Construct BMP085 driver with I2C address(0x77) and default ULTRA_LOW_POWER mode.

Definition at line 66 of file BMP085.h.

Member Function Documentation

bool TWI::Device::acquire ( )
inlineinherited

Start transaction. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 52 of file TWI.h.

bool BMP085::begin ( Mode  mode = ULTRA_LOW_POWER)
inline

Initiate device driver. Load calibration coefficients from device. Return true(1) if successful otherwise false(0).

Parameters
[in]modeoversampling (Default ULTRA_LOW_POWER).
Returns
bool.

Definition at line 81 of file BMP085.h.

int32_t BMP085::pressure ( ) const
inline

Return latest calculated pressure from temperature and pressure raw sensor data.

Returns
calculated pressure in steps of 1 Pa (0,01 hPa).

Definition at line 285 of file BMP085.h.

int TWI::Device::read ( void *  buf,
size_t  count 
)
inlineinherited

Read data from device to given buffer.

Parameters
[in]bufbuffer pointer.
[in]countbuffer size in bytes.
Returns
number of bytes read or negative error code.

Definition at line 73 of file TWI.h.

bool BMP085::read_pressure ( )
inline

Read the raw pressure sensor. Will wait for the conversion to complete. Return true(1) if successful otherwise false(0).

Returns
bool.

Pressure conversion time max table (ms), index with mode.

Definition at line 194 of file BMP085.h.

bool BMP085::read_temperature ( )
inline

Read the raw temperature sensor. Will wait for the conversion to complete. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 129 of file BMP085.h.

bool TWI::Device::release ( )
inlineinherited

Stop transaction. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 62 of file TWI.h.

bool BMP085::sample ( )
inline

Sample and read the raw temperature and pressure sensor. Return true(1) if successful otherwise false(0). Retrieve calculated values with temperature() and pressure().

Returns
bool.

Definition at line 264 of file BMP085.h.

bool BMP085::sample_pressure ( )
inline

Sample and read the raw pressure sensor. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 252 of file BMP085.h.

bool BMP085::sample_pressure_request ( )
inline

Issue a sample request of the raw pressure sensor. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 172 of file BMP085.h.

bool BMP085::sample_temperature ( )
inline

Sample the raw temperature sensor and read. Return true(1) if successful otherwise false(0).

Returns
bool.

Definition at line 162 of file BMP085.h.

bool BMP085::sample_temperature_request ( )
inline

Issue a sample raw temperature sensor request. Return true(1) if successful otherwise false.

Returns
bool.

Definition at line 107 of file BMP085.h.

int16_t BMP085::temperature ( ) const
inline

Calculate temperature from the latest raw sensor reading.

Returns
calculated temperature in steps of 0.1 C

Definition at line 274 of file BMP085.h.

int TWI::Device::write ( const void *  buf,
size_t  count 
)
inlineinherited

Write data from the given buffer to device.

Parameters
[in]bufbuffer pointer.
[in]countbuffer size in bytes.
Returns
number of bytes written or negative error code.

Definition at line 84 of file TWI.h.

int TWI::Device::write ( iovec_t *  vp)
inlineinherited

Write data to device with from given io vector.

Parameters
[in]vpio vector pointer.
Returns
number of bytes written or negative error code.

Definition at line 94 of file TWI.h.

Member Data Documentation

int32_t BMP085::B5
protected

Common intermediate temperature factor.

Definition at line 343 of file BMP085.h.

uint8_t TWI::Device::m_addr
protectedinherited

Device address.

Definition at line 104 of file TWI.h.

uint8_t BMP085::m_cmd
protected

Currrent command.

Definition at line 337 of file BMP085.h.

Mode BMP085::m_mode
protected

Pressure conversion mode.

Definition at line 334 of file BMP085.h.

param_t BMP085::m_param
protected

Device calibration data (from EEPROM data registers).

Definition at line 331 of file BMP085.h.

int32_t BMP085::m_pressure
protected

Latest calculated pressure.

Definition at line 346 of file BMP085.h.

uint16_t BMP085::m_start
protected

Sample request start time (ms).

Definition at line 340 of file BMP085.h.

TWI& TWI::Device::m_twi
protectedinherited

Two-Wire Interface Manager.

Definition at line 101 of file TWI.h.

const uint16_t BMP085::TEMP_CONV_MS = 5
staticprotected

Temperature conversion time max (ms).

Definition at line 292 of file BMP085.h.


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