ISSDK  1.7
IoT Sensing Software Development Kit
diff_p_drv.c
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /**
36  * @file diff_p_drv.c
37  * @brief The diff_p_drv.c file implements the diff_p functional interface.
38  */
39 
40 //-----------------------------------------------------------------------
41 // ISSDK Includes
42 //-----------------------------------------------------------------------
43 #include "gpio_driver.h"
44 #include "diff_p_drv.h"
45 #include "systick_utils.h"
46 
47 //-----------------------------------------------------------------------
48 // Global Variables
49 //-----------------------------------------------------------------------
53 
54 //-----------------------------------------------------------------------
55 // Functions
56 //-----------------------------------------------------------------------
57 void DIFF_P_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
58 {
59  spiCmdParams_t *pSlaveCmd = pCmdOut;
60 
61  uint8_t *pWBuff = diff_p_spiRead_CmdBuffer;
62  uint8_t *pRBuff = diff_p_spiRead_DataBuffer;
63 
64  /* Formatting for Read command of DIFF-P SENSOR. */
65  *pWBuff = offset & 0x7F; /* offset is the internal register address of the sensor at which write is performed. */
66 
67  // Create the slave read command.
68  pSlaveCmd->size = size + DIFF_P_SPI_CMD_LEN;
69  pSlaveCmd->pWriteBuffer = pWBuff;
70  pSlaveCmd->pReadBuffer = pRBuff;
71 }
72 
73 void DIFF_P_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
74 {
75  spiCmdParams_t *pSlaveCmd = pCmdOut;
76 
77  uint8_t *pWBuff = diff_p_spiWrite_CmdDataBuffer;
78  uint8_t *pRBuff = diff_p_spiWrite_CmdDataBuffer + size + DIFF_P_SPI_CMD_LEN;
79 
80  /* Formatting for Write command of DIFF-P SENSOR. */
81  *pWBuff = offset | 0x80; /* offset is the internal register address of the sensor at which write is performed. */
82 
83  /* Copy the slave write command */
84  memcpy(pWBuff + DIFF_P_SPI_CMD_LEN, pWritebuffer, size);
85 
86  /* Create the slave command. */
87  pSlaveCmd->size = size + DIFF_P_SPI_CMD_LEN;
88  pSlaveCmd->pWriteBuffer = pWBuff;
89  pSlaveCmd->pReadBuffer = pRBuff;
90 }
91 
93  diff_p_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSlaveSelect, uint8_t whoAmi)
94 {
96  uint8_t reg, retries = 1;
98 
99  /*! Check the input parameters. */
100  if ((pSensorHandle == NULL) || (pBus == NULL) || (pSlaveSelect == NULL))
101  {
103  }
104 
105  /*! Initialize the sensor handle. */
106  pSensorHandle->pCommDrv = pBus;
109  pSensorHandle->slaveParams.pTargetSlavePinID = pSlaveSelect;
110  pSensorHandle->slaveParams.spiCmdLen = DIFF_P_SPI_CMD_LEN;
112 
113  pSensorHandle->deviceInfo.deviceInstance = index;
114  pSensorHandle->deviceInfo.functionParam = NULL;
115  pSensorHandle->deviceInfo.idleFunction = NULL;
116 
117  /* Initialize the Slave Select Pin. */
118  pGPIODriver->pin_init(pSlaveSelect, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
119  if (pSensorHandle->slaveParams.ssActiveValue == SPI_SS_ACTIVE_LOW)
120  {
121  pGPIODriver->set_pin(pSlaveSelect);
122  }
123  else
124  {
125  pGPIODriver->clr_pin(pSlaveSelect);
126  }
127 
128  /*! Read and store the device's WHO_AM_I.*/
129  status = Register_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
130  DIFF_P_WHO_AM_I, 1, &reg);
131  if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
132  {
133  pSensorHandle->isInitialized = false;
134  return SENSOR_ERROR_INIT;
135  }
136 
137  pSensorHandle->isInitialized = true;
138 
139  do
140  { /*! Put the device into standby mode so that we can run calibration can be done. */
141  status = Register_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
143  if (ARM_DRIVER_OK != status)
144  {
145  return SENSOR_ERROR_INIT;
146  }
147 
148  /*! Run Calibration algorithm. */
149  status = Register_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
151  if (ARM_DRIVER_OK != status)
152  {
153  return SENSOR_ERROR_INIT;
154  }
155  BOARD_DELAY_ms(1); /* Wait for calibration to finish... */
156  do
157  { /*! Wait for calibration to finish.*/
158  status = Register_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
159  DIFF_P_CTRL_REG2, 1, &reg);
160  if (ARM_DRIVER_OK != status)
161  {
162  return SENSOR_ERROR_INIT;
163  }
164  } while (reg & DIFF_P_CTRL_REG2_CTRL_AC_MASK);
165 
166  /* Check Calibration Result. */
167  status = Register_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
168  DIFF_P_STATUS, 1, &reg);
169  if (ARM_DRIVER_OK != status)
170  {
171  return SENSOR_ERROR_INIT;
172  }
173  if ((reg & DIFF_P_STATUS_STAT_EP_MASK) == 0)
174  {
175  break;
176  }
177  BOARD_DELAY_ms(10); /* Wait and then retry calibration. */
178  } while (retries--);
179 
180  return SENSOR_ERROR_NONE;
181 }
182 
183 void DIFF_P_SPI_SetIdleTask(diff_p_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
184 {
185  pSensorHandle->deviceInfo.functionParam = userParam;
186  pSensorHandle->deviceInfo.idleFunction = idleTask;
187 }
188 
190 {
191  int32_t status;
192 
193  /*! Validate for the correct handle and register write list.*/
194  if ((pSensorHandle == NULL) || (pRegWriteList == NULL))
195  {
197  }
198 
199  /*! Check whether sensor handle is initialized before applying configuration.*/
200  if (pSensorHandle->isInitialized != true)
201  {
202  return SENSOR_ERROR_INIT;
203  }
204 
205  /*! Put the device into standby mode so that configuration can be applied.*/
206  status = Register_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
208  if (ARM_DRIVER_OK != status)
209  {
210  return SENSOR_ERROR_WRITE;
211  }
212 
213  /*! Apply the Sensor Configuration based on the Register Write List */
214  status = Sensor_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
215  pRegWriteList);
216  if (ARM_DRIVER_OK != status)
217  {
218  return SENSOR_ERROR_WRITE;
219  }
220 
221  /*! Put the device into active mode and ready for reading data.*/
222  status = Register_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
224  if (ARM_DRIVER_OK != status)
225  {
226  return SENSOR_ERROR_WRITE;
227  }
228 
229  return SENSOR_ERROR_NONE;
230 }
231 
233  const registerreadlist_t *pReadList,
234  uint8_t *pBuffer)
235 {
236  int32_t status;
237 
238  /*! Validate for the correct handle and register read list.*/
239  if ((pSensorHandle == NULL) || (pReadList == NULL) || (pBuffer == NULL))
240  {
242  }
243 
244  /*! Check whether sensor handle is initialized before reading sensor data.*/
245  if (pSensorHandle->isInitialized != true)
246  {
247  return SENSOR_ERROR_INIT;
248  }
249 
250  /*! Parse through the read list and read the data one by one. */
251  status = Sensor_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
252  pReadList, pBuffer);
253  if (ARM_DRIVER_OK != status)
254  {
255  return SENSOR_ERROR_READ;
256  }
257 
258  return SENSOR_ERROR_NONE;
259 }
260 
262 {
263  int32_t status;
264 
265  if (pSensorHandle == NULL)
266  {
268  }
269 
270  /*! Check whether sensor handle is initialized before triggering sensor reset.*/
271  if (pSensorHandle->isInitialized != true)
272  {
273  return SENSOR_ERROR_INIT;
274  }
275 
276  /*! Trigger sensor device reset.*/
277  status = Register_SPI_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
279  if (ARM_DRIVER_OK != status)
280  {
281  return SENSOR_ERROR_WRITE;
282  }
283  else
284  {
285  /*! De-initialize sensor handle. */
286  pSensorHandle->isInitialized = false;
287  }
288 
289  return SENSOR_ERROR_NONE;
290 }
291 
293  diff_p_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
294 {
295  int32_t status;
296  uint8_t reg, retries = 1;
297 
298  /*! Check the input parameters. */
299  if ((pSensorHandle == NULL) || (pBus == NULL))
300  {
302  }
303 
304  pSensorHandle->deviceInfo.deviceInstance = index;
305  pSensorHandle->deviceInfo.functionParam = NULL;
306  pSensorHandle->deviceInfo.idleFunction = NULL;
307 
308  /*! Read and store the device's WHO_AM_I.*/
309  status = Register_I2C_Read(pBus, &pSensorHandle->deviceInfo, sAddress, DIFF_P_WHO_AM_I, 1, &reg);
310  if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
311  {
312  pSensorHandle->isInitialized = false;
313  return SENSOR_ERROR_INIT;
314  }
315 
316  /*! Initialize the sensor handle. */
317  pSensorHandle->pCommDrv = pBus;
318  pSensorHandle->slaveAddress = sAddress;
319  pSensorHandle->isInitialized = true;
320 
321  do
322  { /*! Put the device into standby mode so that we can run calibration can be done. */
323  status = Register_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
325  if (ARM_DRIVER_OK != status)
326  {
327  return SENSOR_ERROR_INIT;
328  }
329 
330  /*! Run Calibration algorithm. */
331  status =
332  Register_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
334  if (ARM_DRIVER_OK != status)
335  {
336  return SENSOR_ERROR_INIT;
337  }
338  BOARD_DELAY_ms(1); /* Wait for calibration to finish... */
339  do
340  { /*! Wait for calibration to finish.*/
341  status = Register_I2C_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
342  DIFF_P_CTRL_REG2, 1, &reg);
343  if (ARM_DRIVER_OK != status)
344  {
345  return SENSOR_ERROR_INIT;
346  }
347  } while (reg & DIFF_P_CTRL_REG2_CTRL_AC_MASK);
348 
349  /* Check Calibration Result. */
350  status = Register_I2C_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
351  DIFF_P_STATUS, 1, &reg);
352  if (ARM_DRIVER_OK != status)
353  {
354  return SENSOR_ERROR_INIT;
355  }
356  if ((reg & DIFF_P_STATUS_STAT_EP_MASK) == 0)
357  {
358  break;
359  }
360  BOARD_DELAY_ms(10); /* Wait and then retry calibration. */
361  } while (retries--);
362 
363  return SENSOR_ERROR_NONE;
364 }
365 
366 void DIFF_P_I2C_SetIdleTask(diff_p_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
367 {
368  pSensorHandle->deviceInfo.functionParam = userParam;
369  pSensorHandle->deviceInfo.idleFunction = idleTask;
370 }
371 
373 {
374  int32_t status;
375 
376  /*! Validate for the correct handle and register write list.*/
377  if ((pSensorHandle == NULL) || (pRegWriteList == NULL))
378  {
380  }
381 
382  /*! Check whether sensor handle is initialized before applying configuration.*/
383  if (pSensorHandle->isInitialized != true)
384  {
385  return SENSOR_ERROR_INIT;
386  }
387 
388  /*! Put the device into standby mode so that configuration can be applied.*/
389  status = Register_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
391  if (ARM_DRIVER_OK != status)
392  {
393  return SENSOR_ERROR_WRITE;
394  }
395 
396  /*! Apply the Sensor Configuration based on the Register Write List */
397  status = Sensor_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
398  pRegWriteList);
399  if (ARM_DRIVER_OK != status)
400  {
401  return SENSOR_ERROR_WRITE;
402  }
403 
404  /*! Put the device into active mode and ready for reading data.*/
405  status = Register_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
407  if (ARM_DRIVER_OK != status)
408  {
409  return SENSOR_ERROR_WRITE;
410  }
411 
412  return SENSOR_ERROR_NONE;
413 }
414 
416  const registerreadlist_t *pReadList,
417  uint8_t *pBuffer)
418 {
419  int32_t status;
420 
421  /*! Validate for the correct handle and register read list.*/
422  if ((pSensorHandle == NULL) || (pReadList == NULL) || (pBuffer == NULL))
423  {
425  }
426 
427  /*! Check whether sensor handle is initialized before reading sensor data.*/
428  if (pSensorHandle->isInitialized != true)
429  {
430  return SENSOR_ERROR_INIT;
431  }
432 
433  /*! Parse through the read list and read the data one by one. */
434  status = Sensor_I2C_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
435  pReadList, pBuffer);
436  if (ARM_DRIVER_OK != status)
437  {
438  return SENSOR_ERROR_READ;
439  }
440 
441  return SENSOR_ERROR_NONE;
442 }
443 
445 {
446  int32_t status;
447 
448  if (pSensorHandle == NULL)
449  {
451  }
452 
453  /*! Check whether sensor handle is initialized before triggering sensor reset.*/
454  if (pSensorHandle->isInitialized != true)
455  {
456  return SENSOR_ERROR_INIT;
457  }
458 
459  /*! Trigger sensor device reset.*/
460  status = Register_I2C_Write(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
462  if (ARM_DRIVER_OK != status)
463  {
464  return SENSOR_ERROR_WRITE;
465  }
466  else
467  {
468  /*! De-initialize sensor handle. */
469  pSensorHandle->isInitialized = false;
470  }
471 
472  return SENSOR_ERROR_NONE;
473 }
This defines the sensor specific information for I2C.
Definition: diff_p_drv.h:70
void DIFF_P_I2C_SetIdleTask(diff_p_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
Definition: diff_p_drv.c:366
fpSpiWritePreprocessFn_t pWritePreprocessFN
registeridlefunction_t idleFunction
Definition: sensor_drv.h:130
int32_t DIFF_P_I2C_Configure(diff_p_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
Definition: diff_p_drv.c:372
#define DIFF_P_CTRL_REG1_SBYB_ACTIVE
Definition: diff_p.h:716
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
Definition: Driver_GPIO.h:67
#define DIFF_P_STATUS_STAT_EP_MASK
Definition: diff_p.h:515
void DIFF_P_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
The SPI Read Pre-Process function to generate Sensor specific SPI Message Header. ...
Definition: diff_p_drv.c:57
spiSlaveSpecificParams_t slaveParams
Definition: diff_p_drv.h:64
int32_t status
int32_t DIFF_P_I2C_ReadData(diff_p_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: diff_p_drv.c:415
void BOARD_DELAY_ms(uint32_t delay_ms)
Function to insert delays.
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.
#define DIFF_P_CTRL_REG1_SBYB_MASK
Definition: diff_p.h:700
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
Definition: sensor_drv.h:123
#define DIFF_P_SPI_CMD_LEN
The size of the Sensor specific SPI Header.
Definition: diff_p_drv.h:92
#define DIFF_P_CTRL_REG1_RST_MASK
Definition: diff_p.h:706
registerDeviceInfo_t deviceInfo
Definition: diff_p_drv.h:72
int32_t DIFF_P_I2C_Initialize(diff_p_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
Definition: diff_p_drv.c:292
The diff_p_drv.h file describes the DIFF_P driver interface and structures.
int32_t DIFF_P_SPI_Configure(diff_p_spi_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
Definition: diff_p_drv.c:189
void DIFF_P_SPI_SetIdleTask(diff_p_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
Definition: diff_p_drv.c:183
registerDeviceInfo_t deviceInfo
Definition: diff_p_drv.h:61
uint8_t diff_p_spiRead_CmdBuffer[DIFF_P_SPI_MAX_MSG_SIZE]
Definition: diff_p_drv.c:50
void(* set_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:72
void(* clr_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:73
The SPI Slave Transfer Command Params SDK2.0 Driver.
#define SPI_SS_ACTIVE_LOW
int32_t DIFF_P_SPI_ReadData(diff_p_spi_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: diff_p_drv.c:232
#define DIFF_P_CTRL_REG1_SBYB_STANDBY
Definition: diff_p.h:717
This defines the sensor specific information for SPI.
Definition: diff_p_drv.h:59
int32_t DIFF_P_SPI_DeInit(diff_p_spi_sensorhandle_t *pSensorHandle)
The interface function to De Initialize sensor..
Definition: diff_p_drv.c:261
#define DIFF_P_CTRL_REG1_RST_RESET
Definition: diff_p.h:720
GENERIC_DRIVER_GPIO * pGPIODriver
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:97
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:203
void DIFF_P_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
The SPI Write Pre-Process function to generate Sensor specific SPI Message Header.
Definition: diff_p_drv.c:73
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
uint8_t diff_p_spiWrite_CmdDataBuffer[DIFF_P_SPI_MAX_MSG_SIZE]
Definition: diff_p_drv.c:52
uint32_t size
#define DIFF_P_CTRL_REG2_CTRL_AC_CALRUN
Definition: diff_p.h:807
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:64
int32_t Register_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register.
int32_t Register_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register.
ARM_DRIVER_I2C * pCommDrv
Definition: diff_p_drv.h:73
ARM Systick Utilities.
#define DIFF_P_CTRL_REG2_CTRL_AC_MASK
Definition: diff_p.h:783
int32_t Register_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t value, uint8_t mask, bool repeatedStart)
The interface function to write a sensor register.
This structure defines the Write command List.
Definition: sensor_drv.h:94
This structure defines the Read command List.
Definition: sensor_drv.h:104
uint8_t diff_p_spiRead_DataBuffer[DIFF_P_SPI_MAX_MSG_SIZE]
Definition: diff_p_drv.c:51
int32_t DIFF_P_I2C_DeInit(diff_p_i2c_sensorhandle_t *pSensorHandle)
The interface function to De Initialize sensor..
Definition: diff_p_drv.c:444
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.
#define DIFF_P_SPI_MAX_MSG_SIZE
The MAX size of SPI message.
Definition: diff_p_drv.h:88
int32_t DIFF_P_SPI_Initialize(diff_p_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSlaveSelect, uint8_t whoAmi)
The interface function to initialize the sensor.
Definition: diff_p_drv.c:92
ARM_DRIVER_SPI * pCommDrv
Definition: diff_p_drv.h:62
#define DIFF_P_SS_ACTIVE_VALUE
Is the Slave Select Pin Active Low or High.
Definition: diff_p_drv.h:96
fpSpiReadPreprocessFn_t pReadPreprocessFN
int32_t Register_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, uint8_t value, uint8_t mask)
The interface function to write a sensor register.
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.
Definition: sensor_io_i2c.c:97