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

The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor registers using CMSIS APIs. More...

#include <stdint.h>
#include <stdbool.h>
#include "Driver_SPI.h"
#include "register_io_spi.h"
Include dependency graph for sensor_io_spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int32_t Sensor_SPI_BlockWrite (ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registercommandlist_t *pCommandList, uint8_t error_mask)
 Write commands to a sensor. More...
 
int32_t Sensor_SPI_Write (ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registerwritelist_t *pRegWriteList)
 Write register data to a sensor. More...
 
int32_t Sensor_SPI_Read (ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)
 Read register data from a sensor. More...
 

Detailed Description

The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor registers using CMSIS APIs.

Definition in file sensor_io_spi.h.

Function Documentation

◆ Sensor_SPI_BlockWrite()

int32_t Sensor_SPI_BlockWrite ( ARM_DRIVER_SPI *  pCommDrv,
registerDeviceInfo_t devInfo,
void *  pWriteParams,
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 SPI device number and idle function.
[in]pWriteParamsThe SPI slave slect handle of the sensor 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 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

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_spi.c.

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

Referenced by FXLC95000_SPI_CommandResponse(), MMA9553_SPI_CommandResponse(), MMA9553_SPI_Configure(), MMA9553_SPI_DeInit(), and MMA9553_SPI_Initialize().

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

◆ Sensor_SPI_Read()

int32_t Sensor_SPI_Read ( ARM_DRIVER_SPI *  pCommDrv,
registerDeviceInfo_t devInfo,
void *  pReadParams,
const registerreadlist_t pReadList,
uint8_t *  pOutBuffer 
)

Read register data from a sensor.

Parameters
[in]pCommDrvPointer to the SPI ARM driver to use.
[in]devInfoThe SPI device number and idle function.
[in]pReadParamsSPI slave Params 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 104 of file sensor_io_spi.c.

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

Referenced by FXAS21002_SPI_ReadData(), FXLC95000_SPI_CommandResponse(), FXLS8471Q_Read(), FXLS8471Q_SPI_ReadData(), FXLS8962_SPI_ReadData(), FXLS896x_SPI_ReadData(), FXLS8974_SPI_ReadData(), FXOS8700_SPI_ReadData(), and MMA9553_SPI_CommandResponse().

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

◆ Sensor_SPI_Write()

int32_t Sensor_SPI_Write ( ARM_DRIVER_SPI *  pCommDrv,
registerDeviceInfo_t devInfo,
void *  pWriteParams,
const registerwritelist_t pRegWriteList 
)

Write register data to a sensor.

Parameters
[in]pCommDrvPointer to the SPI ARM driver to use
[in]devInfoThe SPI device number and idle function.
[in]pWriteParamsSPI slave Params 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_spi.c.

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

Referenced by FXAS21002_SPI_Configure(), FXLS8471Q_Idle(), FXLS8471Q_Init(), FXLS8471Q_SPI_Configure(), FXLS8962_SPI_Configure(), FXLS896x_SPI_Configure(), FXLS8974_SPI_Configure(), and FXOS8700_SPI_Configure().

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