![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
The mpl3115_drv.h file describes the MPL3115 driver interface and structures. More...
Go to the source code of this file.
Data Structures | |
struct | mpl3115_i2c_sensorhandle_t |
This defines the sensor specific information. More... | |
struct | mpl3115_pressuredata_t |
This structure defines the mpl3115 data buffer in Pressure Mode. More... | |
struct | mpl3115_altitudedata_t |
This structure defines the mpl3115 data buffer in Altitude Mode. More... | |
Macros | |
#define | MPL3115_PRESSURE_CONV_FACTOR (64) /* Will give Pascals */ |
#define | MPL3115_ALTITUDE_CONV_FACTOR (65536) /* Will give meters above MSL */ |
#define | MPL3115_TEMPERATURE_CONV_FACTOR (256) /* Will give °C */ |
Functions | |
int32_t | MPL3115_I2C_Initialize (mpl3115_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi) |
The interface function to initialize the sensor. More... | |
void | MPL3115_I2C_SetIdleTask (mpl3115_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam) |
: The interface function to set the I2C Idle Task. More... | |
int32_t | MPL3115_I2C_Configure (mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList) |
The interface function to configure he sensor. More... | |
int32_t | MPL3115_I2C_ReadData (mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer) |
The interface function to read the sensor data. More... | |
int32_t | MPL3115_I2C_DeInit (mpl3115_i2c_sensorhandle_t *pSensorHandle) |
The interface function to De Initialize sensor.. More... | |
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
Definition in file mpl3115_drv.h.
#define MPL3115_ALTITUDE_CONV_FACTOR (65536) /* Will give meters above MSL */ |
Definition at line 29 of file mpl3115_drv.h.
Referenced by main().
#define MPL3115_PRESSURE_CONV_FACTOR (64) /* Will give Pascals */ |
Definition at line 28 of file mpl3115_drv.h.
Referenced by main().
#define MPL3115_TEMPERATURE_CONV_FACTOR (256) /* Will give °C */ |
Definition at line 30 of file mpl3115_drv.h.
Referenced by main().
int32_t MPL3115_I2C_Configure | ( | mpl3115_i2c_sensorhandle_t * | pSensorHandle, |
const registerwritelist_t * | pRegWriteList | ||
) |
The interface function to configure he sensor.
This function configure the sensor with requested ODR, Range and registers in the regsiter pair array.
[in] | pSensorHandle | handle to the sensor. |
[in] | pRegWriteList | pointer to the register list. |
Validate for the correct handle and register write list.
Check whether sensor handle is initialized before applying configuration.
Put the device into standby mode so that configuration can be applied.
Apply the Sensor Configuration based on the Register Write List
Put the device into active mode and ready for reading data.
Definition at line 61 of file mpl3115_drv.c.
References mpl3115_i2c_sensorhandle_t::deviceInfo, int32_t(), mpl3115_i2c_sensorhandle_t::isInitialized, MPL3115_CTRL_REG1, MPL3115_CTRL_REG1_SBYB_ACTIVE, MPL3115_CTRL_REG1_SBYB_MASK, MPL3115_CTRL_REG1_SBYB_STANDBY, mpl3115_i2c_sensorhandle_t::pCommDrv, Register_I2C_Write(), SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, SENSOR_ERROR_WRITE, Sensor_I2C_Write(), mpl3115_i2c_sensorhandle_t::slaveAddress, and status.
Referenced by main().
int32_t MPL3115_I2C_DeInit | ( | mpl3115_i2c_sensorhandle_t * | pSensorHandle | ) |
The interface function to De Initialize sensor..
This function made sensor in a power safe state and de initialize its handle.
[in] | pSensorHandle | handle to the sensor. |
Check whether sensor handle is initialized before triggering sensor reset.
Trigger sensor device reset.
De-initialize sensor handle.
Definition at line 133 of file mpl3115_drv.c.
References mpl3115_i2c_sensorhandle_t::deviceInfo, int32_t(), mpl3115_i2c_sensorhandle_t::isInitialized, MPL3115_CTRL_REG1, MPL3115_CTRL_REG1_RST_EN, MPL3115_CTRL_REG1_RST_MASK, mpl3115_i2c_sensorhandle_t::pCommDrv, Register_I2C_Write(), SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, SENSOR_ERROR_WRITE, mpl3115_i2c_sensorhandle_t::slaveAddress, and status.
int32_t MPL3115_I2C_Initialize | ( | mpl3115_i2c_sensorhandle_t * | pSensorHandle, |
ARM_DRIVER_I2C * | pBus, | ||
uint8_t | index, | ||
uint16_t | sAddress, | ||
uint8_t | whoAmi | ||
) |
The interface function to initialize the sensor.
This function initialize the sensor and sensor handle.
[in] | pSensorHandle | handle to the sensor. |
[in] | pBus | pointer to the CMSIS API compatible I2C bus object. |
[in] | index | the I2C device number. |
[in] | sAddress | slave address of the device on the bus. |
[in] | whoami | WHO_AM_I value of the device. |
Check the input parameters.
Read and store the device's WHO_AM_I.
Initialize the sensor handle.
Definition at line 22 of file mpl3115_drv.c.
References mpl3115_i2c_sensorhandle_t::deviceInfo, registerDeviceInfo_t::deviceInstance, registerDeviceInfo_t::functionParam, registerDeviceInfo_t::idleFunction, int32_t(), mpl3115_i2c_sensorhandle_t::isInitialized, MPL3115_WHO_AM_I, mpl3115_i2c_sensorhandle_t::pCommDrv, Register_I2C_Read(), SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, mpl3115_i2c_sensorhandle_t::slaveAddress, and status.
Referenced by main().
int32_t MPL3115_I2C_ReadData | ( | mpl3115_i2c_sensorhandle_t * | pSensorHandle, |
const registerreadlist_t * | pReadList, | ||
uint8_t * | pBuffer | ||
) |
The interface function to read the sensor data.
This function read the sensor data out from the device and returns raw data in a byte stream.
[in] | pSensorHandle | handle to the sensor. |
[in] | pReadList | pointer to the list of device registers and values to read. |
[out] | pBuffer | buffer which holds raw sensor data.This buffer may be back to back databuffer based command read in the list. |
Validate for the correct handle and register read list.
Check whether sensor handle is initialized before reading sensor data.
Parse through the read list and read the data one by one.
Definition at line 104 of file mpl3115_drv.c.
References mpl3115_i2c_sensorhandle_t::deviceInfo, int32_t(), mpl3115_i2c_sensorhandle_t::isInitialized, mpl3115_i2c_sensorhandle_t::pCommDrv, SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, SENSOR_ERROR_READ, Sensor_I2C_Read(), mpl3115_i2c_sensorhandle_t::slaveAddress, and status.
Referenced by main().
void MPL3115_I2C_SetIdleTask | ( | mpl3115_i2c_sensorhandle_t * | pSensorHandle, |
registeridlefunction_t | idleTask, | ||
void * | userParam | ||
) |
: The interface function to set the I2C Idle Task.
[in] | mpl3115_i2c_sensorhandle_t *pSensorHandle, handle to the sensor handle. | |
[in] | registeridlefunction_t idleTask, function pointer to the function to execute on I2C Idle Time. | |
[in] | void *userParam, the pointer to the user idle ftask parameters. |
Definition at line 53 of file mpl3115_drv.c.
References mpl3115_i2c_sensorhandle_t::deviceInfo, registerDeviceInfo_t::functionParam, and registerDeviceInfo_t::idleFunction.
Referenced by main().