![]() |
ISSDK
1.7
IoT Sensing Software Development Kit
|
The mma8491q_drv.h file describes the MMA8491Q driver interface and structures. More...
Go to the source code of this file.
Data Structures | |
struct | mma8491q_i2c_sensorhandle_t |
This defines the function pointers and sensor specific information. More... | |
struct | mma8491q_acceldata_t |
This structure defines the mma8491q data buffer. More... | |
struct | mma8491q_context_t |
This structure stores the Sensor's context parameters. More... | |
Macros | |
#define | MMA8491Q_DATA_SIZE (6) /* 2 byte X,Y,Z Axis Data each. */ |
Enumerations | |
enum | { SENSOR_MODE_SHUTDOWN, SENSOR_MODE_ACTIVE, SENSOR_MODE_STANDBY } |
This enum lists the MMA8491Q operating Modes. More... | |
Functions | |
int32_t | MMA8491Q_I2C_Initialize (mma8491q_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress) |
The interface function to initialize the sensor. More... | |
void | MMA8491Q_I2C_SetIdleTask (mma8491q_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam) |
: The interface function to set the I2C Idle Task. More... | |
int32_t | MMA8491Q_I2C_ReadData (mma8491q_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer) |
The interface function to read the sensor data. More... | |
The mma8491q_drv.h file describes the MMA8491Q driver interface and structures.
Definition in file mma8491q_drv.h.
#define MMA8491Q_DATA_SIZE (6) /* 2 byte X,Y,Z Axis Data each. */ |
Definition at line 89 of file mma8491q_drv.h.
Referenced by main().
anonymous enum |
This enum lists the MMA8491Q operating Modes.
Enumerator | |
---|---|
SENSOR_MODE_SHUTDOWN | |
SENSOR_MODE_ACTIVE | |
SENSOR_MODE_STANDBY |
Definition at line 82 of file mma8491q_drv.h.
int32_t MMA8491Q_I2C_Initialize | ( | mma8491q_i2c_sensorhandle_t * | pSensorHandle, |
ARM_DRIVER_I2C * | pBus, | ||
uint8_t | index, | ||
uint16_t | sAddress | ||
) |
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.
Initialize the sensor handle.
Definition at line 48 of file mma8491q_drv.c.
References mma8491q_i2c_sensorhandle_t::deviceInfo, registerDeviceInfo_t::deviceInstance, registerDeviceInfo_t::functionParam, registerDeviceInfo_t::idleFunction, int32_t(), mma8491q_i2c_sensorhandle_t::isInitialized, MMA8491Q_STATUS, MMA8491Q_STATUS_RESERVED_MASK, MMA8491Q_STATUS_RESERVED_ZERO, mma8491q_i2c_sensorhandle_t::pCommDrv, Register_I2C_Read(), SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, mma8491q_i2c_sensorhandle_t::slaveAddress, status, and MMA8491Q_STATUS_t::w.
Referenced by main().
int32_t MMA8491Q_I2C_ReadData | ( | mma8491q_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 90 of file mma8491q_drv.c.
References mma8491q_i2c_sensorhandle_t::deviceInfo, int32_t(), mma8491q_i2c_sensorhandle_t::isInitialized, mma8491q_i2c_sensorhandle_t::pCommDrv, SENSOR_ERROR_INIT, SENSOR_ERROR_INVALID_PARAM, SENSOR_ERROR_NONE, SENSOR_ERROR_READ, Sensor_I2C_Read(), mma8491q_i2c_sensorhandle_t::slaveAddress, and status.
Referenced by main().
void MMA8491Q_I2C_SetIdleTask | ( | mma8491q_i2c_sensorhandle_t * | pSensorHandle, |
registeridlefunction_t | idleTask, | ||
void * | userParam | ||
) |
: The interface function to set the I2C Idle Task.
[in] | mma8491q_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 82 of file mma8491q_drv.c.
References mma8491q_i2c_sensorhandle_t::deviceInfo, registerDeviceInfo_t::functionParam, and registerDeviceInfo_t::idleFunction.
Referenced by main().