ISSDK  1.8
IoT Sensing Software Development Kit
Functions
sensor_io_i2c.h File Reference

The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor registers. More...

#include <stdint.h>
#include <stdbool.h>
#include "Driver_I2C.h"
#include "register_io_i2c.h"
Include dependency graph for sensor_io_i2c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int32_t Sensor_I2C_BlockWrite (ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registercommandlist_t *pCommandList, uint8_t error_mask)
 Write commands to a sensor. More...
 
int32_t Sensor_I2C_Write (ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)
 Write register data to a sensor. More...
 
int32_t Sensor_I2C_Read (ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)
 Read register data from a sensor. More...
 

Detailed Description

The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor registers.

Definition in file sensor_io_i2c.h.

Function Documentation

◆ Sensor_I2C_BlockWrite()

int32_t Sensor_I2C_BlockWrite ( ARM_DRIVER_I2C *  pCommDrv,
registerDeviceInfo_t devInfo,
uint16_t  slaveAddress,
const registercommandlist_t pCommandList,
uint8_t  error_mask 
)

Write commands to a sensor.

Parameters
[in]pCommDrvpointer to the I2C ARM driver to use
[in]devInfoThe I2C device number and idle function.
[in]slaveAddressthe I2C slave address to write to
[in]pCommandLista list of one or more commands to write
[in]error_maskThe mask for Error Code Bits in CoCo Byte
Returns
returns the execution status of the operation using ESensorErrors

The interface function to block write commands to a sensor.

Validate for the correct handle.

Update register values based on register write list unless the next Cmd is the list terminator

Write the command based on the values in the command and value pair.

Wait for Command Completion.

Definition at line 24 of file sensor_io_i2c.c.

References BOARD_DELAY_ms(), int32_t(), registercommandlist_t::numBytes, registercommandlist_t::pWriteBuffer, Register_I2C_BlockWrite(), Register_I2C_Read(), SENSOR_ERROR_BAD_ADDRESS, SENSOR_ERROR_NONE, SENSOR_ERROR_READ, SENSOR_ERROR_WRITE, status, and registercommandlist_t::writeTo.

Referenced by FXLC95000_I2C_CommandResponse(), FXLC95000_I2C_FlashCommands(), MMA9553_I2C_CommandResponse(), MMA9553_I2C_Configure(), MMA9553_I2C_DeInit(), and MMA9553_I2C_Initialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sensor_I2C_Read()

int32_t Sensor_I2C_Read ( ARM_DRIVER_I2C *  pCommDrv,
registerDeviceInfo_t devInfo,
uint16_t  slaveAddress,
const registerreadlist_t pReadList,
uint8_t *  pOutBuffer 
)

Read register data from a sensor.

Parameters
[in]pCommDrvpointer to the I2C ARM driver to use
[in]devInfoThe I2C device number and idle function.
[in]slaveAddressthe I2C slave address to read from
[in]pReadLista list of one or more register addresses and lengths to read
[in]pOutBuffera pointer of sufficient size to contain the requested read data
Returns
returns the execution status of the operation using ESensorErrors

The interface function to read register data from a sensor.

Validate for the correct handle.

Traverse the read list and read the registers one by one unless the register read list numBytes is zero

Definition at line 105 of file sensor_io_i2c.c.

References int32_t(), registerreadlist_t::numBytes, registerreadlist_t::readFrom, Register_I2C_Read(), SENSOR_ERROR_BAD_ADDRESS, SENSOR_ERROR_NONE, SENSOR_ERROR_READ, and status.

Referenced by DBAP_I2C_ReadData(), FXAS21002_I2C_ReadData(), FXLC95000_I2C_CommandResponse(), FXLS8471Q_Read(), FXLS8962_I2C_ReadData(), FXLS896x_I2C_ReadData(), FXLS8974_I2C_ReadData(), FXOS8700_I2C_ReadData(), FXOS8700_Init(), FXOS8700_ReadMagData(), FXPQ3115_I2C_ReadData(), ISL29023_I2C_ReadData(), MAG3110_I2C_ReadData(), MAG3110_Read(), MMA845x_I2C_ReadData(), MMA8491Q_I2C_ReadData(), MMA865x_I2C_ReadData(), MMA9553_I2C_CommandResponse(), and MPL3115_I2C_ReadData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sensor_I2C_Write()

int32_t Sensor_I2C_Write ( ARM_DRIVER_I2C *  pCommDrv,
registerDeviceInfo_t devInfo,
uint16_t  slaveAddress,
const registerwritelist_t pRegWriteList 
)

Write register data to a sensor.

Parameters
[in]pCommDrvpointer to the I2C ARM driver to use
[in]devInfoThe I2C device number and idle function.
[in]slaveAddressthe I2C slave address to write to
[in]pRegWriteLista list of one or more register/value pairs to write
Returns
returns the execution status of the operation using ESensorErrors

The interface function to write register data to a sensor.

Validate for the correct handle.

Update register values based on register write list unless the next Cmd is the list terminator

Set the register based on the values in the register value pair.

Definition at line 71 of file sensor_io_i2c.c.

References int32_t(), registerwritelist_t::mask, Register_I2C_Write(), SENSOR_ERROR_BAD_ADDRESS, SENSOR_ERROR_NONE, SENSOR_ERROR_WRITE, status, registerwritelist_t::value, and registerwritelist_t::writeTo.

Referenced by DBAP_I2C_Configure(), FXAS21002_I2C_Configure(), FXLS8471Q_Idle(), FXLS8471Q_Init(), FXLS8962_I2C_Configure(), FXLS896x_I2C_Configure(), FXLS8974_I2C_Configure(), FXOS8700_I2C_Configure(), FXOS8700_Idle(), FXOS8700_Init(), FXPQ3115_I2C_Configure(), ISL29023_I2C_Configure(), MAG3110_I2C_Configure(), MAG3110_Idle(), MAG3110_Init(), main(), MMA845x_I2C_Configure(), MMA865x_I2C_Configure(), and MPL3115_I2C_Configure().

Here is the call graph for this function:
Here is the caller graph for this function: