Driver for the Freescale MPL3115A2 pressure sensor. More...
Driver for the Freescale MPL3115A2 pressure sensor.
The driver will initialize the sensor for pressure measurement. The conversion duration depends on oversample ratio. After initialization the sensor can be set active to run periodic measurements. The oversample ratio can be configured during sensor initialization.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
Modules | |
MPL3115A2 Pressure Sensor driver compile configuration | |
Files | |
file | mpl3115a2.h |
Interface definition for the MPL3115A2 sensor driver. | |
file | mpl3115a2_params.h |
Default configuration for MPL3115A2 devices. | |
file | mpl3115a2_reg.h |
Register definition for the MPL3115A2 sensor driver. | |
Data Structures | |
struct | mpl3115a2_params_t |
Configuration parameters. More... | |
struct | mpl3115a2_t |
Device descriptor for MPL3115A2 sensors. More... | |
Macros | |
#define | MPL3115A2_I2C_ADDRESS (0x60) |
MPL3115A2 Default Address. | |
Enumerations | |
enum | { MPL3115A2_OK , MPL3115A2_ERROR_I2C , MPL3115A2_ERROR_DEV , MPL3115A2_ERROR_CNF } |
Named return values. More... | |
Functions | |
int | mpl3115a2_init (mpl3115a2_t *dev, const mpl3115a2_params_t *params) |
Initialize the MPL3115A2 sensor driver. | |
int | mpl3115a2_reset (const mpl3115a2_t *dev) |
Reset the MPL3115A2 sensor. | |
int | mpl3115a2_set_active (const mpl3115a2_t *dev) |
Set active mode, this enables periodic measurements. | |
int | mpl3115a2_set_standby (const mpl3115a2_t *dev) |
Set standby mode. | |
int | mpl3115a2_is_ready (const mpl3115a2_t *dev) |
Check for new set of measurement data. | |
int | mpl3115a2_read_pressure (const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status) |
Read sensor's data in pressure mode. | |
int | mpl3115a2_read_temp (const mpl3115a2_t *dev, int16_t *temp) |
Read sensor's temperature. | |
Oversample Ratio configuration | |
enum | { MPL3115A2_OS_RATIO_1 = 0 , MPL3115A2_OS_RATIO_2 , MPL3115A2_OS_RATIO_4 , MPL3115A2_OS_RATIO_8 , MPL3115A2_OS_RATIO_16 , MPL3115A2_OS_RATIO_32 , MPL3115A2_OS_RATIO_64 , MPL3115A2_OS_RATIO_128 } |
#define | MPL3115A2_OS_RATIO_DEFAULT MPL3115A2_OS_RATIO_16 |
Default Ratio. | |
#define MPL3115A2_I2C_ADDRESS (0x60) |
MPL3115A2 Default Address.
Definition at line 56 of file mpl3115a2.h.
#define MPL3115A2_OS_RATIO_DEFAULT MPL3115A2_OS_RATIO_16 |
Default Ratio.
Definition at line 72 of file mpl3115a2.h.
anonymous enum |
Named return values.
Enumerator | |
---|---|
MPL3115A2_OK | all good |
MPL3115A2_ERROR_I2C | I2C communication failed. |
MPL3115A2_ERROR_DEV | Device MPL3115A2 not found. |
MPL3115A2_ERROR_CNF | Device configuration failed. |
Definition at line 46 of file mpl3115a2.h.
anonymous enum |
Definition at line 62 of file mpl3115a2.h.
int mpl3115a2_init | ( | mpl3115a2_t * | dev, |
const mpl3115a2_params_t * | params | ||
) |
Initialize the MPL3115A2 sensor driver.
[out] | dev | device descriptor of sensor to initialize |
[in] | params | configuration parameters |
int mpl3115a2_is_ready | ( | const mpl3115a2_t * | dev | ) |
Check for new set of measurement data.
[in] | dev | device descriptor of sensor |
int mpl3115a2_read_pressure | ( | const mpl3115a2_t * | dev, |
uint32_t * | pres, | ||
uint8_t * | status | ||
) |
Read sensor's data in pressure mode.
[in] | dev | device descriptor of sensor |
[out] | pres | pressure in Pascals |
[out] | status | sensor status register |
int mpl3115a2_read_temp | ( | const mpl3115a2_t * | dev, |
int16_t * | temp | ||
) |
Read sensor's temperature.
[in] | dev | device descriptor of sensor |
[out] | temp | temperature in |
int mpl3115a2_reset | ( | const mpl3115a2_t * | dev | ) |
Reset the MPL3115A2 sensor.
After that, the sensor should be reinitialized.
[in] | dev | device descriptor of sensor |
int mpl3115a2_set_active | ( | const mpl3115a2_t * | dev | ) |
Set active mode, this enables periodic measurements.
[in] | dev | device descriptor of sensor |
int mpl3115a2_set_standby | ( | const mpl3115a2_t * | dev | ) |
Set standby mode.
[in] | dev | device descriptor of sensor |