ISSDK  1.7
IoT Sensing Software Development Kit
fxlc95000_drv.c
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 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 fxlc95000_drv.c
37  * @brief The fxlc95000_drv.c file implements the FXLC95000 sensor driver interface.
38  */
39 
40 //-----------------------------------------------------------------------
41 // ISSDK Includes
42 //-----------------------------------------------------------------------
43 #include "gpio_driver.h"
44 #include "fxlc95000_drv.h"
45 #include "systick_utils.h"
46 
47 //-----------------------------------------------------------------------
48 // Global Variables
49 //-----------------------------------------------------------------------
53 
54 //-----------------------------------------------------------------------
55 // Functions
56 //-----------------------------------------------------------------------
57 void FXLC95000_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
58 {
59  spiCmdParams_t *pSlaveCmd = pCmdOut;
60 
61  uint8_t *pWBuff = fxlc95000_spiRead_CmdBuffer;
62  uint8_t *pRBuff = fxlc95000_spiRead_DataBuffer;
63 
64  /* Formatting for Read command of FXLC95000 SENSOR. */
65  *(pWBuff) =
66  (offset & 0x7F) << 1; /* offset is the internal register address of the sensor at which write is performed. */
67 
68  /* Create the slave read command. */
69  pSlaveCmd->size = size + FXLC95000_SPI_CMD_LEN;
70  pSlaveCmd->pWriteBuffer = pWBuff;
71  pSlaveCmd->pReadBuffer = pRBuff;
72 }
73 
74 void FXLC95000_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
75 {
76  spiCmdParams_t *pSlaveCmd = pCmdOut;
77 
78  uint8_t *pWBuff = fxlc95000_spiWrite_CmdDataBuffer;
80 
81  /* Formatting for Write command of FXLC95000 SENSOR. */
82  *(pWBuff) =
83  (offset | 0x40) << 1; /* offset is the internal register address of the sensor at which write is performed. */
84 
85  /* Copy the slave write command */
86  memcpy(pWBuff + FXLC95000_SPI_CMD_LEN, pWritebuffer, size);
87 
88  /* Create the slave command. */
89  pSlaveCmd->size = size + FXLC95000_SPI_CMD_LEN;
90  pSlaveCmd->pWriteBuffer = pWBuff;
91  pSlaveCmd->pReadBuffer = pRBuff;
92 }
93 
95  ARM_DRIVER_SPI *pBus,
96  uint8_t index,
97  void *pSpiSelect,
98  void *pSlaveSelect,
99  void *pReset,
100  uint16_t buildId)
101 {
102  int32_t status;
103  uint16_t readNumber[2];
105 
106  /*! Check the input parameters. */
107  if (pSensorHandle == NULL || pBus == NULL || pSpiSelect == NULL || pSlaveSelect == NULL || pReset == NULL)
108  {
110  }
111 
112  /*! Initialize the sensor handle. */
113  pSensorHandle->pCommDrv = pBus;
116  pSensorHandle->slaveParams.pTargetSlavePinID = pSlaveSelect;
119 
120  pSensorHandle->deviceInfo.deviceInstance = index;
121  pSensorHandle->deviceInfo.functionParam = NULL;
122  pSensorHandle->deviceInfo.idleFunction = NULL;
123 
124  /* Initialize the Slave Select and reset Pins. */
125  pGPIODriver->pin_init(pSlaveSelect, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
126  pGPIODriver->pin_init(pSpiSelect, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
127  pGPIODriver->pin_init(pReset, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
128 
129  /* Pull down SPI Select, Pull up SS and Reset */
130  pGPIODriver->set_pin(pSlaveSelect);
131  pGPIODriver->clr_pin(pSpiSelect);
132  pGPIODriver->set_pin(pReset);
133  BOARD_DELAY_ms(30); /* Wait for Part to Complete Reset */
134 
135  pGPIODriver->clr_pin(pReset);
136  BOARD_DELAY_ms(50); /* Wait for Part to Initialize in SPI Mode */
137 
138  pGPIODriver->set_pin(pSpiSelect);
139  BOARD_DELAY_ms(10); /* Wait for ROM Initialization before communication */
140 
141  /* Verify if the SPI connection by writing command to Boot to flash and fetch Device Info.
142  * A matching Build Number confirms Sensor Identity and Firmware. */
143  Register_SPI_BlockWrite(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams, 0,
144  BootToFlash, sizeof(BootToFlash));
145  BOARD_DELAY_ms(10); /* Allow time for the device to boot to Flash. */
146  Register_SPI_BlockWrite(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams, 0,
147  GetDeviceInfoCmd, sizeof(GetDeviceInfoCmd));
148  BOARD_DELAY_ms(1);
149 
150  status = Register_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
152  (uint8_t *)&readNumber);
153  readNumber[0] = (readNumber[0] >> 8) | (readNumber[0] << 8);
154  readNumber[1] = (readNumber[1] >> 8) | (readNumber[1] << 8);
155  if (ARM_DRIVER_OK != status || readNumber[0] != buildId || readNumber[1] != FXLC95000_PART_NUMBER)
156  {
157  pSensorHandle->isInitialized = false;
158  return SENSOR_ERROR_INIT;
159  }
160 
161  pSensorHandle->isInitialized = true;
162  return SENSOR_ERROR_NONE;
163 }
164 
166  registeridlefunction_t idleTask,
167  void *userParam)
168 {
169  pSensorHandle->deviceInfo.functionParam = userParam;
170  pSensorHandle->deviceInfo.idleFunction = idleTask;
171 }
172 
174  const registercommandlist_t *pCommandList,
175  const registerreadlist_t *pResponseList,
176  uint8_t *pBuffer)
177 {
178  int32_t status;
179 
180  /*! Validate for the correct handle and command list.*/
181  if (pSensorHandle == NULL || (pCommandList == NULL && pResponseList == NULL))
182  {
184  }
185 
186  /*! Check whether sensor handle is initialized before reading sensor data.*/
187  if (pSensorHandle->isInitialized != true)
188  {
189  return SENSOR_ERROR_INIT;
190  }
191 
192  if (pCommandList != NULL)
193  { /* Write command to fetch configuration. */
194  status = Sensor_SPI_BlockWrite(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
195  pCommandList, FXLC95000_COCO_ERROR_MASK);
196  if (ARM_DRIVER_OK != status)
197  {
198  return SENSOR_ERROR_WRITE;
199  }
200  }
201 
202  /*! Parse through the read list and read the data one by one. */
203  if (pResponseList != NULL)
204  {
205  status = Sensor_SPI_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, &pSensorHandle->slaveParams,
206  pResponseList, pBuffer);
207  if (ARM_DRIVER_OK != status)
208  {
209  return SENSOR_ERROR_READ;
210  }
211  }
212 
213  return SENSOR_ERROR_NONE;
214 }
215 
216 int32_t FXLC95000_I2C_CheckRomMode(ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress)
217 {
218  int32_t status;
219  uint16_t readNumber[2];
220  registerDeviceInfo_t deviceInfo = {.deviceInstance = index, .idleFunction = NULL};
221 
222  Register_I2C_BlockWrite(pBus, &deviceInfo, sAddress, 0, GetDeviceInfoCmd, sizeof(GetDeviceInfoCmd));
223  BOARD_DELAY_ms(1);
224 
225  status = Register_I2C_Read(pBus, &deviceInfo, sAddress, FXLC95000_BUILD_ID_OFFSET,
226  FXLC95000_BUILD_ID_SIZE + FXLC95000_PART_NUMBER_SIZE, (uint8_t *)&readNumber);
227  readNumber[0] = (readNumber[0] >> 8) | (readNumber[0] << 8);
228  readNumber[1] = (readNumber[1] >> 8) | (readNumber[1] << 8);
229  if (ARM_DRIVER_OK != status || readNumber[0] != FXLC95000_RESERVED_ID || readNumber[1] != FXLC95000_PART_NUMBER)
230  {
231  return -1;
232  }
233 
234  return 0;
235 }
236 
238  uint8_t index,
239  uint16_t sAddress,
240  const registercommandlist_t *pCommandList)
241 {
242  int32_t status;
243  registerDeviceInfo_t deviceInfo = {.deviceInstance = index, .idleFunction = NULL};
244 
245  /*! Validate for the correct handle and register write list.*/
246  if (pBus == NULL || pCommandList == NULL)
247  {
249  }
250 
251  /* Write command to fetch configuration. */
252  status = Sensor_I2C_BlockWrite(pBus, &deviceInfo, sAddress, pCommandList, FXLC95000_COCO_ERROR_MASK);
253  if (ARM_DRIVER_OK != status)
254  {
255  return SENSOR_ERROR_WRITE;
256  }
257 
258  return SENSOR_ERROR_NONE;
259 }
260 
262  ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t *pFlashBytes, uint8_t numBytes)
263 {
264  int32_t status;
265 
266  /* First 4 bytes is address (which fits into 2 byte separate address field and Bank code)
267  * and then remaining bytes is WData. */
268  /* Make sure that the Flash payload received has the minimum information bytes
269  * required to construct a CI_READ_WRITE ROM Command. */
271  {
272  uint8_t bytesToPageBoundary = 256 - *(pFlashBytes + 3);
273  uint8_t bytesAfterPageBoundary = numBytes - bytesToPageBoundary - FXLC95000_FLASH_PAYLOAD_ADDR_LEN;
274  /* Prepare CI_READ_WRITE ROM Command. */
275  /* Check if the write command being attempted spans across a page boundary (256 bytes). */
276  if (bytesToPageBoundary > 0 && bytesToPageBoundary < numBytes - FXLC95000_FLASH_PAYLOAD_ADDR_LEN)
277  { /* Break it into 2 write commands if write spans across 2 pages. Ref. Section 16.5 of FXLC95000CLHWRM. */
278  uint8_t writeFlashCommand[FXLC95000_ROM_CI_READ_WRITE_MAX_LEN] = {0x0A, 0x00, 0x12, 0x34, 0x56, 0x78};
279  uint8_t writeFlashCommand_2[FXLC95000_ROM_CI_READ_WRITE_MAX_LEN] = {0x0A, 0x00, 0x12, 0x34, 0x56, 0x78};
280 
281  writeFlashCommand[1] =
282  (*(pFlashBytes + 1) == 0) ? 0x1F & (bytesToPageBoundary) : 0xC0 | (bytesToPageBoundary);
283  for (int i = 0; i < bytesToPageBoundary + FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN;
284  i++) // 2 LSB Bytes of Address + Data.
285  {
286  writeFlashCommand[FXLC95000_ROM_CI_READ_WRITE_HDR_LEN + i] =
287  pFlashBytes[FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN + i];
288  }
289 
290  writeFlashCommand_2[1] =
291  (*(pFlashBytes + 1) == 0) ? 0x1F & (bytesAfterPageBoundary) : 0xC0 | (bytesAfterPageBoundary);
292  uint8_t address[] = {*(pFlashBytes + FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN + 1),
293  *(pFlashBytes + FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN)};
294  *((uint16_t *)address) += bytesToPageBoundary;
295  writeFlashCommand_2[FXLC95000_ROM_CI_READ_WRITE_HDR_LEN] = address[1];
296  writeFlashCommand_2[FXLC95000_ROM_CI_READ_WRITE_HDR_LEN + 1] = address[0];
297  for (int i = 0; i < bytesAfterPageBoundary; i++)
298  {
299  writeFlashCommand_2[FXLC95000_ROM_CI_READ_WRITE_HDR_LEN + FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN + i] =
300  pFlashBytes[FXLC95000_FLASH_PAYLOAD_ADDR_LEN + bytesToPageBoundary + i];
301  }
302 
303  if (bytesToPageBoundary > FXLC95000_ROM_CI_WRITE_MAX_LEN ||
304  bytesAfterPageBoundary > FXLC95000_ROM_CI_WRITE_MAX_LEN)
305  {
307  }
308  else
309  { /* Create Command List to Write. */
310  const registercommandlist_t cWriteFlashSequence[] = {
311  {writeFlashCommand, 0,
312  FXLC95000_ROM_CI_READ_WRITE_HDR_LEN + FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN + bytesToPageBoundary},
313  {writeFlashCommand_2, 0, FXLC95000_ROM_CI_READ_WRITE_HDR_LEN +
314  FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN + bytesAfterPageBoundary},
316  /* Write Flash Bytes as Commands to Sensor. */
317  status = FXLC95000_I2C_FlashCommands(pBus, index, sAddress, cWriteFlashSequence);
318  if (ARM_DRIVER_OK != status)
319  {
320  return SENSOR_ERROR_WRITE;
321  }
322  }
323  }
324  else /* If write is enclosed within 1-page, a single CI_READ_WRITE will do the job. */
325  {
326  uint8_t writeFlashCommand[FXLC95000_ROM_CI_READ_WRITE_MAX_LEN] = {0x0A, 0x00, 0x12, 0x34, 0x56, 0x78};
327  writeFlashCommand[1] = /* Ref. Section 16.5 of FXLC95000CLHWRM. */
328  (*(pFlashBytes + 1) == 0) ? 0x1F & (numBytes - FXLC95000_FLASH_PAYLOAD_ADDR_LEN) :
329  0xC0 | (numBytes - FXLC95000_FLASH_PAYLOAD_ADDR_LEN);
330 
331  for (int i = FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN; i < numBytes; i++) // Skip 2 MSBs of Address.
332  {
334  pFlashBytes[i];
335  }
336  if (FXLC95000_ROM_CI_READ_WRITE_HDR_LEN + numBytes >
338  {
340  }
341  else
342  { /* Create Command List to Write. */
343  const registercommandlist_t cWriteFlashSequence[] = {
344  {writeFlashCommand, 0,
347  /* Write Flash Bytes as Commands to Sensor. */
348  status = FXLC95000_I2C_FlashCommands(pBus, index, sAddress, cWriteFlashSequence);
349  if (ARM_DRIVER_OK != status)
350  {
351  return SENSOR_ERROR_WRITE;
352  }
353  }
354  }
355  }
356  else
357  {
359  }
360 
361  return SENSOR_ERROR_NONE;
362 }
363 
365  ARM_DRIVER_I2C *pBus,
366  uint8_t index,
367  uint16_t sAddress,
368  uint16_t buildId)
369 {
370  int32_t status;
371  uint16_t readNumber[2];
372 
373  /*! Check the input parameters. */
374  if ((pSensorHandle == NULL) || (pBus == NULL))
375  {
377  }
378 
379  pSensorHandle->deviceInfo.deviceInstance = index;
380  pSensorHandle->deviceInfo.functionParam = NULL;
381  pSensorHandle->deviceInfo.idleFunction = NULL;
382 
383  /* Verify if the I2C connection by writing command to Boot to flash and fetch Device Info.
384  * A matching Build Number confirms Sensor Identity and Firmware. */
385  Register_I2C_BlockWrite(pBus, &pSensorHandle->deviceInfo, sAddress, 0, BootToFlash, sizeof(BootToFlash));
386  BOARD_DELAY_ms(10); /* Allow time for the device to boot to Flash. */
387  Register_I2C_BlockWrite(pBus, &pSensorHandle->deviceInfo, sAddress, 0, GetDeviceInfoCmd, sizeof(GetDeviceInfoCmd));
388  BOARD_DELAY_ms(1);
389 
390  status = Register_I2C_Read(pBus, &pSensorHandle->deviceInfo, sAddress, FXLC95000_BUILD_ID_OFFSET,
391  FXLC95000_BUILD_ID_SIZE + FXLC95000_PART_NUMBER_SIZE, (uint8_t *)&readNumber);
392  readNumber[0] = (readNumber[0] >> 8) | (readNumber[0] << 8);
393  readNumber[1] = (readNumber[1] >> 8) | (readNumber[1] << 8);
394  if (ARM_DRIVER_OK != status || readNumber[0] != buildId || readNumber[1] != FXLC95000_PART_NUMBER)
395  {
396  pSensorHandle->isInitialized = false;
397  return SENSOR_ERROR_INIT;
398  }
399 
400  pSensorHandle->pCommDrv = pBus;
401  pSensorHandle->slaveAddress = sAddress;
402  pSensorHandle->isInitialized = true;
403 
404  return SENSOR_ERROR_NONE;
405 }
406 
408  registeridlefunction_t idleTask,
409  void *userParam)
410 {
411  pSensorHandle->deviceInfo.functionParam = userParam;
412  pSensorHandle->deviceInfo.idleFunction = idleTask;
413 }
414 
416  const registercommandlist_t *pCommandList,
417  const registerreadlist_t *pResponseList,
418  uint8_t *pBuffer)
419 {
420  int32_t status;
421 
422  /*! Validate for the correct handle and register read list.*/
423  if (pSensorHandle == NULL || (pCommandList == NULL && pResponseList == NULL))
424  {
426  }
427 
428  /*! Check whether sensor handle is initialized before reading sensor data.*/
429  if (pSensorHandle->isInitialized != true)
430  {
431  return SENSOR_ERROR_INIT;
432  }
433 
434  if (pCommandList != NULL)
435  { /* Write command to fetch configuration. */
436  status = Sensor_I2C_BlockWrite(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
437  pCommandList, FXLC95000_COCO_ERROR_MASK);
438  if (ARM_DRIVER_OK != status)
439  {
440  return SENSOR_ERROR_WRITE;
441  }
442  }
443 
444  if (pResponseList != NULL)
445  { /* Parse through the read list and read the data one by one */
446  status = Sensor_I2C_Read(pSensorHandle->pCommDrv, &pSensorHandle->deviceInfo, pSensorHandle->slaveAddress,
447  pResponseList, pBuffer);
448  if (ARM_DRIVER_OK != status)
449  {
450  return SENSOR_ERROR_READ;
451  }
452  }
453 
454  return SENSOR_ERROR_NONE;
455 }
void FXLC95000_SPI_SetIdleTask(fxlc95000_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
#define FXLC95000_ROM_CI_WRITE_MIN_LEN
The MIN Length of ROM CI_WRITE Data.
#define FXLC95000_SPI_CMD_LEN
The size of the Sensor specific SPI Header.
Definition: fxlc95000_drv.h:95
fpSpiWritePreprocessFn_t pWritePreprocessFN
#define FXLC95000_PART_NUMBER_SIZE
The FXLC95000 Size of Part Number.
Definition: fxlc95000.h:34
registeridlefunction_t idleFunction
Definition: sensor_drv.h:130
#define FXLC95000_BUILD_ID_SIZE
The FXLC95000 Size of ISF1.1_95k_Build_ID.
Definition: fxlc95000.h:22
int32_t FXLC95000_I2C_CheckRomMode(ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress)
The interface function to check if the sensor is in ROM CI Mode.
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
Definition: Driver_GPIO.h:67
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.
Definition: sensor_io_i2c.c:50
#define FXLC95000_SS_ACTIVE_VALUE
Is the Slave Select Pin Active Low or High.
Definition: fxlc95000_drv.h:99
#define FXLC95000_SPI_MAX_MSG_SIZE
The MAX size of SPI message.
Definition: fxlc95000_drv.h:91
registerDeviceInfo_t deviceInfo
Definition: fxlc95000_drv.h:61
#define FXLC95000_ROM_CI_WRITE_MAX_LEN
The MAX Length of ROM CI_WRITE Data.
#define FXLC95000_ROM_CI_READ_WRITE_ADDR_LEN
The Length of Address field in ROM CI_READ_WRITE Command Header.
int32_t Register_SPI_BlockWrite(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, const uint8_t *pBuffer, uint8_t bytesToWrite)
The interface function to block write to a sensor register.
int32_t status
registerDeviceInfo_t deviceInfo
Definition: fxlc95000_drv.h:72
uint8_t fxlc95000_spiRead_CmdBuffer[FXLC95000_SPI_MAX_MSG_SIZE]
Definition: fxlc95000_drv.c:50
void BOARD_DELAY_ms(uint32_t delay_ms)
Function to insert delays.
int32_t FXLC95000_SPI_Initialize(fxlc95000_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSpiSelect, void *pSlaveSelect, void *pReset, uint16_t buildId)
The interface function to initialize the sensor.
Definition: fxlc95000_drv.c:94
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.
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
Definition: sensor_drv.h:123
uint8_t fxlc95000_spiRead_DataBuffer[FXLC95000_SPI_MAX_MSG_SIZE]
Definition: fxlc95000_drv.c:51
The fxlc95000_drv.h file describes the FXLC95000L driver interface and structures.
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:50
#define FXLC95000_PART_NUMBER
The FXLC95000 2-byte packed BCD encoded Part Number (BCD for Last 4 characters).
Definition: fxlc95000.h:37
int32_t FXLC95000_SPI_CommandResponse(fxlc95000_spi_sensorhandle_t *pSensorHandle, const registercommandlist_t *pCommandList, const registerreadlist_t *pResponseList, uint8_t *pBuffer)
The interface function to read the sensor data.
int32_t FXLC95000_I2C_FlashPayload(ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t *pFlashBytes, uint8_t numBytes)
The interface function to write ROM CI Data Payload.
int32_t FXLC95000_I2C_FlashCommands(ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, const registercommandlist_t *pCommandList)
The interface function to write ROM CI Commands.
#define FXLC95000_ROM_CI_READ_WRITE_HDR_LEN
The Length of ROM CI_READ_WRITE Command Header.
uint8_t fxlc95000_spiWrite_CmdDataBuffer[FXLC95000_SPI_MAX_MSG_SIZE]
Definition: fxlc95000_drv.c:52
#define __END_WRITE_CMD__
Definition: sensor_drv.h:83
int32_t Register_I2C_BlockWrite(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, const uint8_t *pBuffer, uint8_t bytesToWrite)
The interface function to write a sensor register.
void(* set_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:72
void(* clr_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:73
void FXLC95000_I2C_SetIdleTask(fxlc95000_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
The SPI Slave Transfer Command Params SDK2.0 Driver.
void FXLC95000_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
The SPI Read Pre-Process function to generate Sensor specific SPI Message Header. ...
Definition: fxlc95000_drv.c:57
int32_t FXLC95000_I2C_CommandResponse(fxlc95000_i2c_sensorhandle_t *pSensorHandle, const registercommandlist_t *pCommandList, const registerreadlist_t *pResponseList, uint8_t *pBuffer)
The interface function to read the sensor data.
#define FXLC95000_ROM_CI_READ_WRITE_MAX_LEN
The MAX Length of ROM CI_READ_WRITE Command.
GENERIC_DRIVER_GPIO * pGPIODriver
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:203
void FXLC95000_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: fxlc95000_drv.c:74
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
uint32_t size
spiSlaveSpecificParams_t slaveParams
Definition: fxlc95000_drv.h:64
#define FXLC95000_FLASH_PAYLOAD_ADDR_LEN
The Length of Address field in FLASH Payload form Host.
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:64
int32_t FXLC95000_I2C_Initialize(fxlc95000_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint16_t buildId)
The interface function to initialize the sensor.
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.
#define FXLC95000_RESERVED_ID
The FXLC95000 Reserved filed bytes.
Definition: fxlc95000.h:28
ARM Systick Utilities.
This defines the sensor specific information for SPI.
Definition: fxlc95000_drv.h:59
This structure defines the Read command List.
Definition: sensor_drv.h:104
#define FXLC95000_BUILD_ID_OFFSET
Offset of 2-Byte ISF1.1_95k_Build_ID in Device Info Response.
Definition: fxlc95000.h:19
This defines the sensor specific information for I2C.
Definition: fxlc95000_drv.h:70
This structure defines the device specific info required by register I/O.
Definition: sensor_drv.h:128
This structure defines the Block command List.
Definition: sensor_drv.h:113
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.
fpSpiReadPreprocessFn_t pReadPreprocessFN
#define FXLC95000_COCO_ERROR_MASK
The Error Bit Mask in COCO Byte.
Definition: fxlc95000_drv.h:87