API for the GY65/BMP085 and BMP180 Atmospheric Pressure Sensors.
More...
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.
while (shouldRun) {
upm_delay_us(500000);
}
cout << "Exiting..." << endl;
|
uint8_t | readReg (uint8_t reg) |
|
int | readRegs (uint8_t reg, uint8_t *buffer, int len) |
|
void | writeReg (uint8_t reg, uint8_t val) |
|
BMPX8X |
( |
int |
bus = BMPX8X_DEFAULT_I2C_BUS , |
|
|
int |
addr = BMPX8X_DEFAULT_I2C_ADDR |
|
) |
| |
Instantiates a BMPX8X object
- Parameters
-
bus | I2C bus to use. |
addr | The I2C address of the device. |
- Exceptions
-
std::runtime_error | on failure. |
Reset the device to power-on defaults. All calibration data is lost when the device is reset, so you should call init() before attempting to use the device.
- Exceptions
-
std::runtime_error | on failure. |
void init |
( |
BMPX8X_OSS_T |
oss = BMPX8X_OSS_ULTRAHIGHRES | ) |
|
Initialize the device, read calibration data, and start operation. This function is called from the constructor, so it will not typically need to be called by a user unless the device is reset.
- Parameters
-
oss | One of the BMPX8X_OSS_T values. The default is BMPX8X_OSS_ULTRAHIGHRES. |
- Exceptions
-
std::runtime_error | on failure. |
void setOversampling |
( |
BMPX8X_OSS_T |
oss = BMPX8X_OSS_ULTRAHIGHRES | ) |
|
Set the oversampling (precision mode) of the device. Higher precision requires more time to complete. This call takes effect the next time update() is called.
- Parameters
-
oss | One of the BMPX8X_OSS_T values. The default is BMPX8X_OSS_ULTRAHIGHRES. |
Returns the calculated pressure in Pascals. update() must have been called prior to calling this function.
- Returns
- The pressure in Pascals.
float getTemperature |
( |
void |
| ) |
|
Returns the calculated temperature in Celsius. update() must have been called prior to calling this function.
- Returns
- The temperature in Celsius.
int getSealevelPressure |
( |
float |
meters | ) |
|
Using the supplied altitude in meters, compute the pressure at sea level in Pascals. update() must have been called prior to calling this function.
- Parameters
-
meters | The altitude in meters. |
- Returns
- The computed sea level pressure in Pascals.
int getSealevelPressure |
( |
| ) |
|
|
inline |
Using the current calculated altitude, compute the pressure at sea level in Pascals. update() must have been called prior to calling this function.
- Returns
- The computed sea level pressure in Pascals.
float getAltitude |
( |
int |
sealevelPressure = 101325 | ) |
|
Calculate the current altitude in meters, given a sea level pressure in Pascals. The default sea level pressure is 101325 Pascals. update() must have been called prior to calling this function.
- Parameters
-
sealevelPressure | The pressure at sea level in Pascals. The default is 101325 Pascals. |
- Returns
- the computed altitude in meters.
int getTemperatureCelsius |
( |
| ) |
|
|
inlinevirtual |
const char* getModuleName |
( |
| ) |
|
|
inlinevirtual |
Returns the name of module.
- Returns
- The name of the module.
Implements IModuleStatus.
uint8_t readReg |
( |
uint8_t |
reg | ) |
|
|
protected |
Read a register.
- Parameters
-
- Returns
- The value of the register.
int readRegs |
( |
uint8_t |
reg, |
|
|
uint8_t * |
buffer, |
|
|
int |
len |
|
) |
| |
|
protected |
Read contiguous registers into a buffer.
- Parameters
-
buffer | The buffer to store the results. |
len | The number of registers to read. |
- Returns
- The number of bytes read.
- Exceptions
-
std::runtime_error | on failure. |
void writeReg |
( |
uint8_t |
reg, |
|
|
uint8_t |
val |
|
) |
| |
|
protected |
Write to a register.
- Parameters
-
reg | The register to write to. |
val | The value to write. |
- Exceptions
-
std::runtime_error | on failure. |
The documentation for this class was generated from the following files: