upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Go to the source code of this file.
Data Structures | |
struct | _bmpx8x_context |
Functions | |
bmpx8x_context | bmpx8x_init (int bus, int addr) |
void | bmpx8x_close (bmpx8x_context dev) |
uint8_t | bmpx8x_get_chip_id (const bmpx8x_context dev) |
upm_result_t | bmpx8x_devinit (const bmpx8x_context dev, BMPX8X_OSS_T oss) |
upm_result_t | bmpx8x_reset (const bmpx8x_context dev) |
upm_result_t | bmpx8x_update (const bmpx8x_context dev) |
void | bmpx8x_set_oversampling (const bmpx8x_context dev, BMPX8X_OSS_T oss) |
int | bmpx8x_get_pressure (const bmpx8x_context dev) |
float | bmpx8x_get_temperature (const bmpx8x_context dev) |
int | bmpx8x_get_sealevel_pressure (const bmpx8x_context dev, float altitude) |
float | bmpx8x_get_altitude (const bmpx8x_context dev, int sealevel) |
uint8_t | bmpx8x_read_reg (const bmpx8x_context dev, uint8_t reg) |
int | bmpx8x_read_regs (const bmpx8x_context dev, uint8_t reg, uint8_t *buffer, int len) |
upm_result_t | bmpx8x_write_reg (const bmpx8x_context dev, uint8_t reg, uint8_t val) |
Typedefs | |
typedef struct _bmpx8x_context * | bmpx8x_context |
bmpx8x_context bmpx8x_init | ( | int | bus, |
int | addr | ||
) |
BMPX8X initialization.
By default, the device is initialized to it's highest accuracy (BMP085_OSS_ULTRAHIGHRES).
bus | I2C bus number. |
addr | I2C address of the device. |
void bmpx8x_close | ( | bmpx8x_context | dev | ) |
BMPX8X close function.
dev | Device context. |
uint8_t bmpx8x_get_chip_id | ( | const bmpx8x_context | dev | ) |
Return the chip ID.
dev | The device context. |
upm_result_t bmpx8x_devinit | ( | const bmpx8x_context | dev, |
BMPX8X_OSS_T | oss | ||
) |
Initialize the device, read calibration data, and start operation. This function is called from bmpx8x_init() so it will not typically need to be called by a user unless the device is reset. This method will call bmpx8x_set_oversampling() with the passed parameter.
dev | The device context. |
oss | One of the BMPX8X_OSS_T values. The default set at bmpx8x_init() time is BMP085_OSS_ULTRAHIGHRES. |
upm_result_t bmpx8x_reset | ( | const bmpx8x_context | dev | ) |
Perform a device reset. The device will be reset as if it was just powered on. All compensation values will be lost. You should call bmpx8x_devinit() afterward, or perform the same steps that bmpx8x_devinit() performs before attempting to use the device.
dev | The device context. |
upm_result_t bmpx8x_update | ( | const bmpx8x_context | dev | ) |
Update the internal stored values from sensor data.
dev | The device context. |
void bmpx8x_set_oversampling | ( | const bmpx8x_context | dev, |
BMPX8X_OSS_T | oss | ||
) |
Set the oversampling (precision mode) of the device. Higher precision requires more time to complete.
dev | The device context. |
oss | The desired oversampling mode, one of the BMPX8X_OSS_T values. |
int bmpx8x_get_pressure | ( | const bmpx8x_context | dev | ) |
Returns the pressure in Pascals. bmpx8x_update() must have been called prior to calling this function.
dev | Device context. |
float bmpx8x_get_temperature | ( | const bmpx8x_context | dev | ) |
Returns the temperature in degrees Celsius. bmpx8x_update() must have been called prior to calling this function.
dev | Device context. |
int bmpx8x_get_sealevel_pressure | ( | const bmpx8x_context | dev, |
float | altitude | ||
) |
With a given current altitude, calculate pressure at sea level. bmpx8x_update() must have been called prior to calling this function.
dev | Device context. |
altitude | Current altitude in Meters. |
float bmpx8x_get_altitude | ( | const bmpx8x_context | dev, |
int | sealevel | ||
) |
With a given sea level, calculate altitude in meters. bmpx8x_update() must have been called prior to calling this function.
dev | Device context. |
sealevel | Sea level pressure in Pascals. If a negative number, or zero is supplied, a default sealevel of 101325 Pa will be used instead. |
uint8_t bmpx8x_read_reg | ( | const bmpx8x_context | dev, |
uint8_t | reg | ||
) |
Read a register.
dev | The device context. |
reg | The register to read. |
int bmpx8x_read_regs | ( | const bmpx8x_context | dev, |
uint8_t | reg, | ||
uint8_t * | buffer, | ||
int | len | ||
) |
Read contiguous registers into a buffer.
dev | The device context. |
buffer | The buffer to store the results. |
len | The number of registers to read. |
upm_result_t bmpx8x_write_reg | ( | const bmpx8x_context | dev, |
uint8_t | reg, | ||
uint8_t | val | ||
) |
Write to a register.
dev | The device context. |
reg | The register to write to. |
val | The value to write. |
typedef struct _bmpx8x_context * bmpx8x_context |
Device context