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.
◆ 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
Enumerator |
---|
MPL3115A2_OS_RATIO_1 | Oversample Ratio 1, conversion 6ms.
|
MPL3115A2_OS_RATIO_2 | Oversample Ratio 2, conversion 10ms.
|
MPL3115A2_OS_RATIO_4 | Oversample Ratio 4, conversion 18ms.
|
MPL3115A2_OS_RATIO_8 | Oversample Ratio 8, conversion 34ms.
|
MPL3115A2_OS_RATIO_16 | Oversample Ratio 16, conversion 66ms.
|
MPL3115A2_OS_RATIO_32 | Oversample Ratio 32, conversion 130ms.
|
MPL3115A2_OS_RATIO_64 | Oversample Ratio 64, conversion 258ms.
|
MPL3115A2_OS_RATIO_128 | Oversample Ratio 128, conversion 514ms.
|
Definition at line 62 of file mpl3115a2.h.
◆ mpl3115a2_init()
Initialize the MPL3115A2 sensor driver.
- Parameters
-
[out] | dev | device descriptor of sensor to initialize |
[in] | params | configuration parameters |
- Returns
- MPL3115A2_OK on success
-
-MPL3115A2_ERROR_I2C on I2C bus error
-
-MPL3115A2_ERROR_DEV on device error
-
-MPL3115A2_ERROR_CNF on config error
◆ mpl3115a2_is_ready()
Check for new set of measurement data.
- Parameters
-
[in] | dev | device descriptor of sensor |
- Returns
- >0 if new data sample is ready
-
MPL3115A2_OK measurement in progress
-
-MPL3115A2_ERROR_I2C on error
◆ mpl3115a2_read_pressure()
int mpl3115a2_read_pressure |
( |
const mpl3115a2_t * |
dev, |
|
|
uint32_t * |
pres, |
|
|
uint8_t * |
status |
|
) |
| |
Read sensor's data in pressure mode.
- Parameters
-
[in] | dev | device descriptor of sensor |
[out] | pres | pressure in Pascals |
[out] | status | sensor status register |
- Returns
- MPL3115A2_OK on success,
-
-MPL3115A2_ERROR_I2C on error
◆ mpl3115a2_read_temp()
int mpl3115a2_read_temp |
( |
const mpl3115a2_t * |
dev, |
|
|
int16_t * |
temp |
|
) |
| |
Read sensor's temperature.
- Parameters
-
[in] | dev | device descriptor of sensor |
[out] | temp | temperature in |
- Returns
- MPL3115A2_OK on success
-
-MPL3115A2_ERROR_I2C on error
◆ mpl3115a2_reset()
Reset the MPL3115A2 sensor.
After that, the sensor should be reinitialized.
- Parameters
-
[in] | dev | device descriptor of sensor |
- Returns
- MPL3115A2_OK on success
-
-MPL3115A2_ERROR_I2C on error
◆ mpl3115a2_set_active()
Set active mode, this enables periodic measurements.
- Parameters
-
[in] | dev | device descriptor of sensor |
- Returns
- MPL3115A2_OK on success
-
-MPL3115A2_ERROR_I2C on error
◆ mpl3115a2_set_standby()
Set standby mode.
- Parameters
-
[in] | dev | device descriptor of sensor |
- Returns
- MPL3115A2_OK on success
-
-MPL3115A2_ERROR_I2C on error