ISSDK  1.7
IoT Sensing Software Development Kit
Functions
sensor_io_spi.c File Reference

The sensor_io_spi.c file contains definitions for low-level interface functions for reading and writing data from/to sensor using CMSIS APIs. More...

#include "Driver_SPI.h"
#include "sensor_drv.h"
#include "systick_utils.h"
#include "sensor_io_spi.h"
Include dependency graph for sensor_io_spi.c:

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.c file contains definitions for low-level interface functions for reading and writing data from/to sensor using CMSIS APIs.

Definition in file sensor_io_spi.c.

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.

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 50 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.

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 130 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 DIFF_P_SPI_ReadData(), FXAS21002_SPI_ReadData(), FXLC95000_SPI_CommandResponse(), FXLS8471Q_Read(), FXLS8471Q_SPI_ReadData(), FXLS8962_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.

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 97 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 DIFF_P_SPI_Configure(), FXAS21002_SPI_Configure(), FXLS8471Q_Idle(), FXLS8471Q_Init(), FXLS8471Q_SPI_Configure(), FXLS8962_SPI_Configure(), FXOS8700_SPI_Configure(), and main().

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