ISSDK  1.8
IoT Sensing Software Development Kit
sensor_io_spi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 /**
10  * @file sensor_io_spi.h
11  * @brief The sensor_io_spi.h file declares low-level interface functions for reading
12  * and writing sensor registers using CMSIS APIs.
13  */
14 
15 #ifndef __SENSOR_IO_SPI_H
16 #define __SENSOR_IO_SPI_H
17 
18 #include <stdint.h>
19 #include <stdbool.h>
20 #include "Driver_SPI.h"
21 #include "register_io_spi.h"
22 
23 /*******************************************************************************
24  * API
25  ******************************************************************************/
26 /*! @brief Write commands to a sensor
27 
28  * @param[in] pCommDrv pointer to the I2C ARM driver to use.
29  * @param[in] devInfo The SPI device number and idle function.
30  * @param[in] pWriteParams The SPI slave slect handle of the sensor to write to.
31  * @param[in] pCommandList A list of one or more commands to write.
32  * @param[in] error_mask The mask for Error Code Bits in CoCo Byte.
33  *
34  * @return returns the execution status of the operation using ::ESensorErrors
35  */
36 int32_t Sensor_SPI_BlockWrite(ARM_DRIVER_SPI *pCommDrv,
37  registerDeviceInfo_t *devInfo,
38  void *pWriteParams,
39  const registercommandlist_t *pCommandList,
40  uint8_t error_mask);
41 
42 /*! @brief Write register data to a sensor
43 
44  * @param[in] pCommDrv Pointer to the SPI ARM driver to use
45  * @param[in] devInfo The SPI device number and idle function.
46  * @param[in] pWriteParams SPI slave Params to write to.
47  * @param[in] pRegWriteList A list of one or more register/value pairs to write.
48  *
49  * @return returns the execution status of the operation using ::ESensorErrors
50  */
51 int32_t Sensor_SPI_Write(ARM_DRIVER_SPI *pCommDrv,
52  registerDeviceInfo_t *devInfo,
53  void *pWriteParams,
54  const registerwritelist_t *pRegWriteList);
55 
56 /*! @brief Read register data from a sensor
57 
58  * @param[in] pCommDrv Pointer to the SPI ARM driver to use.
59  * @param[in] devInfo The SPI device number and idle function.
60  * @param[in] pReadParams SPI slave Params read from.
61  * @param[in] pReadList A list of one or more register addresses and lengths to read.
62  * @param[in] pOutBuffer A pointer of sufficient size to contain the requested read data.
63  *
64  * @return returns the execution status of the operation using ::ESensorErrors
65  */
66 int32_t Sensor_SPI_Read(ARM_DRIVER_SPI *pCommDrv,
67  registerDeviceInfo_t *devInfo,
68  void *pReadParams,
69  const registerreadlist_t *pReadList,
70  uint8_t *pOutBuffer);
71 
72 #endif /* __SENSOR_IO_SPI_H */
This structure defines the device specific info required by register I/O.
Definition: sensor_drv.h:102
This structure defines the Write command List.
Definition: sensor_drv.h:68
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...
This structure defines the Block command List.
Definition: sensor_drv.h:87
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
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.
This structure defines the Read command List.
Definition: sensor_drv.h:78
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.
Definition: sensor_io_spi.c:24
int32_t Sensor_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
Definition: sensor_io_spi.c:71