ISSDK  1.7
IoT Sensing Software Development Kit
auto_detection_service.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 auto_detection_service.c
37  * @brief The auto detection service file implements auto detection sequence
38  * for discovery of QN Board and Sensor Shield Board.
39  */
40 
41 #include <stdio.h>
42 #include <stdint.h>
43 
44 #include "diff_p.h"
45 #include "mma9553.h"
46 #include "mpl3115.h"
47 #include "mag3110.h"
48 #include "mma865x.h"
49 #include "fxls8962.h"
50 #include "fxpq3115.h"
51 #include "fxos8700.h"
52 #include "mma8491q.h"
53 #include "fxas21002.h"
54 #include "fxlc95000.h"
55 #include "fxls8471q.h"
56 
57 #include "issdk_hal.h"
58 #include "gpio_driver.h"
59 #include "systick_utils.h"
60 #include "register_io_spi.h"
61 #include "register_io_i2c.h"
62 #include "auto_detection_shield.h"
63 #include "auto_detection_service.h"
64 
65 #include "fsl_flash.h"
66 
67 /*******************************************************************************
68  * Definitions
69  ******************************************************************************/
70 /*!
71 * @brief These variables are specific to SPI access to the FXLS8471 for ADS.
72 */
73 #define FXLS8471Q_SPI_CMD_LEN (2)
74 #define FXLS8471Q_SS_ACTIVE_VALUE SPI_SS_ACTIVE_LOW
75 
76 /*!
77 * @brief These variables are specific to SPI access to the FXLS8962 for ADS.
78 */
79 #define FXLS8962_SPI_CMD_LEN (2)
80 #define FXLS8962_SS_ACTIVE_VALUE SPI_SS_ACTIVE_LOW
81 
82 /*!
83 * @brief These variables are specific to SPI access to the DIFF_P for ADS.
84 */
85 #define DIFF_P_SPI_CMD_LEN (1)
86 #define DIFF_P_SS_ACTIVE_VALUE SPI_SS_ACTIVE_LOW
87 
88 /*!
89 * @brief These variables are specific to MMA8491Q which does not have a Who Am I register.
90 */
91 #define MMA8491Q_WHO_AM_I (MMA8491Q_STATUS)
92 #define MMA8491Q_WHO_AM_I_VALUE \
93  (MMA8491Q_STATUS_RESERVED_ZERO | MMA8491Q_STATUS_XDR_DRDY | MMA8491Q_STATUS_YDR_DRDY | MMA8491Q_STATUS_ZDR_DRDY | \
94  MMA8491Q_STATUS_ZYXDR_DRDY)
95 #define ADS_QUERY_NUM (sizeof(ADS_SensorQueryList) / sizeof(sensorAccess_t))
96 #define ADS_NUM_BOARDS (sizeof(gADS_QueryMap) / ADS_QUERY_NUM)
97 #define SPI_MAX_MSG_SIZE (64)
98 
99 /*******************************************************************************
100 * Constants
101 ******************************************************************************/
102 /*! @brief The Read Version Info Command for FXLC95000. */
103 const uint8_t ReadVersionInfo_MMA9553[4] = {0x00, 0x00, 0x00, 0x0C};
104 
105 /*!
106 * @brief This constant data structure contains the expected valid MCU Chip ID combinations.
107 * Refer : QN908x user manual - UM11023, Section: 2.5.10
108 */
110  {0x00, 0x3F, ADS_QN_9020}, // QN9020
111  {0x10, 0x38, ADS_QN_9080}, // QN908x
112 };
113 
114 /*!
115 * @brief This constant data structure contains the expected valid comm/sensor/who_am_i combinations.
116 */
132 };
133 
134 /*!
135 * @brief These are the expected query signatures for the shield boards.
136 */
138  {
139  // FRDM-STBC-AGM01
140  ADS_FAIL, // FXLS8471
141  ADS_FAIL, // FXLS8962
142  ADS_FAIL, // DIFF-P
143  ADS_FAIL, // FXLS8962
144  ADS_OK, // FXAS21002
145  ADS_FAIL, // FXLC95000
146  ADS_OK, // FXOS8700
147  ADS_FAIL, // FXPQ3115
148  ADS_FAIL, // MAG3110
149  ADS_FAIL, // MMA8491
150  ADS_FAIL, // MMA9553
151  ADS_FAIL, // DIFF-P
152  ADS_FAIL, // MPL3115
153  ADS_NULL, // MMA865x
154  },
155  {
156  // FRDM-STBC-SA9500
157  ADS_FAIL, // FXLS8471
158  ADS_FAIL, // FXLS8962
159  ADS_FAIL, // DIFF-P
160  ADS_FAIL, // FXLS8962
161  ADS_FAIL, // FXAS21002
162  ADS_OK, // FXLC95000
163  ADS_FAIL, // FXOS8700
164  ADS_FAIL, // FXPQ3115
165  ADS_FAIL, // MAG3110
166  ADS_FAIL, // MMA8491
167  ADS_FAIL, // MMA9553
168  ADS_FAIL, // DIFF-P
169  ADS_FAIL, // MPL3115
170  ADS_NULL, // MMA865x
171  },
172  {
173  // FRDMSTBC-A8471
174  ADS_OK, // FXLS8471
175  ADS_FAIL, // FXLS8962
176  ADS_FAIL, // DIFF-P
177  ADS_FAIL, // FXLS8962
178  ADS_FAIL, // FXAS21002
179  ADS_FAIL, // FXLC95000
180  ADS_FAIL, // FXOS8700
181  ADS_FAIL, // FXPQ3115
182  ADS_FAIL, // MAG3110
183  ADS_FAIL, // MMA8491
184  ADS_FAIL, // MMA9553
185  ADS_FAIL, // DIFF-P
186  ADS_FAIL, // MPL3115
187  ADS_NULL, // MMA865x
188  },
189  {
190  // FRDMSTBC-A8491
191  ADS_FAIL, // FXLS8471
192  ADS_FAIL, // FXLS8962
193  ADS_FAIL, // DIFF-P
194  ADS_FAIL, // FXLS8962
195  ADS_FAIL, // FXAS21002
196  ADS_FAIL, // FXLC95000
197  ADS_FAIL, // FXOS8700
198  ADS_FAIL, // FXPQ3115
199  ADS_FAIL, // MAG3110
200  ADS_OK, // MMA8491
201  ADS_FAIL, // MMA9553
202  ADS_FAIL, // DIFF-P
203  ADS_FAIL, // MPL3115
204  ADS_NULL, // MMA865x
205  },
206  {
207  // FRDMSTBC-P3115
208  ADS_FAIL, // FXLS8471
209  ADS_FAIL, // FXLS8962
210  ADS_FAIL, // DIFF-P
211  ADS_FAIL, // FXLS8962
212  ADS_FAIL, // FXAS21002
213  ADS_FAIL, // FXLC95000
214  ADS_FAIL, // FXOS8700
215  ADS_FAIL, // FXPQ3115
216  ADS_FAIL, // MAG3110
217  ADS_FAIL, // MMA8491
218  ADS_FAIL, // MMA9553
219  ADS_FAIL, // DIFF-P
220  ADS_OK, // MPL3115
221  ADS_NULL, // MMA865x
222  },
223  {
224  // FRDMSTBC-DIFF-P SPI
225  ADS_FAIL, // FXLS8471
226  ADS_FAIL, // FXLS8962
227  ADS_OK, // DIFF-P
228  ADS_FAIL, // FXLS8962
229  ADS_FAIL, // FXAS21002
230  ADS_FAIL, // FXLC95000
231  ADS_FAIL, // FXOS8700
232  ADS_FAIL, // FXPQ3115
233  ADS_FAIL, // MAG3110
234  ADS_FAIL, // MMA8491
235  ADS_FAIL, // MMA9553
236  ADS_FAIL, // DIFF-P
237  ADS_FAIL, // MPL3115
238  ADS_NULL, // MMA865x
239  },
240  {
241  // FRDMSTBC-DIFF-P I2C
242  ADS_FAIL, // FXLS8471
243  ADS_FAIL, // FXLS8962
244  ADS_FAIL, // DIFF-P
245  ADS_FAIL, // FXLS8962
246  ADS_FAIL, // FXAS21002
247  ADS_FAIL, // FXLC95000
248  ADS_FAIL, // FXOS8700
249  ADS_FAIL, // FXPQ3115
250  ADS_FAIL, // MAG3110
251  ADS_FAIL, // MMA8491
252  ADS_FAIL, // MMA9553
253  ADS_OK, // DIFF-P
254  ADS_FAIL, // MPL3115
255  ADS_NULL, // MMA865x
256  },
257  {
258  // FRDMSTBC-B3115
259  ADS_FAIL, // FXLS8471
260  ADS_FAIL, // FXLS8962
261  ADS_FAIL, // DIFF-P
262  ADS_FAIL, // FXLS8962
263  ADS_FAIL, // FXAS21002
264  ADS_FAIL, // FXLC95000
265  ADS_FAIL, // FXOS8700
266  ADS_OK, // FXPQ3115
267  ADS_FAIL, // MAG3110
268  ADS_FAIL, // MMA8491
269  ADS_FAIL, // MMA9553
270  ADS_FAIL, // DIFF-P
271  ADS_FAIL, // MPL3115
272  ADS_NULL, // MMA865x
273  },
274  {
275  // FRDM-STBC-AGMP03 over SPI
276  ADS_FAIL, // FXLS8471
277  ADS_OK, // FXLS8962
278  ADS_FAIL, // DIFF-P
279  ADS_FAIL, // FXLS8962
280  ADS_FAIL, // FXAS21002
281  ADS_FAIL, // FXLC95000
282  ADS_FAIL, // FXOS8700
283  ADS_FAIL, // FXPQ3115
284  ADS_OK, // MAG3110
285  ADS_FAIL, // MMA8491
286  ADS_FAIL, // MMA9553
287  ADS_FAIL, // DIFF-P
288  ADS_OK, // MPL3115
289  ADS_NULL, // MMA865x
290  },
291  {
292  // FRDM-STBC-AGMP03 over I2C
293  ADS_FAIL, // FXLS8471
294  ADS_FAIL, // FXLS8962
295  ADS_FAIL, // DIFF-P
296  ADS_OK, // FXLS8962
297  ADS_OK, // FXAS21002
298  ADS_FAIL, // FXLC95000
299  ADS_FAIL, // FXOS8700
300  ADS_FAIL, // FXPQ3115
301  ADS_OK, // MAG3110
302  ADS_FAIL, // MMA8491
303  ADS_FAIL, // MMA9553
304  ADS_FAIL, // DIFF-P
305  ADS_OK, // MPL3115
306  ADS_NULL, // MMA865x
307  },
308  {
309  // ON BOARD SENSORS (MMA865x)
310  ADS_FAIL, // FXLS8471
311  ADS_FAIL, // FXLS8962
312  ADS_FAIL, // DIFF-P
313  ADS_FAIL, // FXLS8962
314  ADS_FAIL, // FXAS21002
315  ADS_FAIL, // FXLC95000
316  ADS_FAIL, // FXOS8700
317  ADS_FAIL, // FXPQ3115
318  ADS_FAIL, // MAG3110
319  ADS_FAIL, // MMA8491
320  ADS_FAIL, // MMA9553
321  ADS_FAIL, // DIFF-P
322  ADS_FAIL, // MPL3115
323  ADS_OK, // MMA865x
324  },
325 };
326 
327 /*******************************************************************************
328  * Global Variables
329  ******************************************************************************/
330 /*!
331 * @brief This global contains the results from the sensor query.
332 */
334 
336  "FRDM-STBC-AGM01", "FRDM-STBC-SA9500", "FRDMSTBC-A8471", "FRDMSTBC-A8491",
337  "FRDMSTBC-P3115", "FRDMSTBI-DP300x", "FRDMSTBI-DP300x", "FRDMSTBC-B3115",
338  "FRDM-STBC-AGMP03", "FRDM-STBC-AGMP03", "OnBoard",
339 };
340 
341 /*!
342 * @brief These values hold the ARM CMSIS Driver interface pointers.
343 */
344 ARM_DRIVER_SPI *SPIdrv = &SPI_S_DRIVER;
345 ARM_DRIVER_I2C *I2CextDrv = &I2C_S1_DRIVER;
346 ARM_DRIVER_I2C *I2CintDrv = &I2C_BB_DRIVER;
348 
355 
356 /*******************************************************************************
357 * FXLS8471 SPI Specific Functions
358 *****************************************************************************/
359 void ADS_FXLS8471Q_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
360 {
361  spiCmdParams_t *pSlaveCmd = pCmdOut;
362 
363  uint8_t *pWBuff = spiRead_CmdBuffer;
364  uint8_t *pRBuff = spiRead_DataBuffer;
365 
366  /* Formatting for Read command of FXLS8471Q SENSOR. */
367  *(pWBuff) = offset & 0x7F; /* offset is the internal register address of the sensor at which write is performed. */
368  *(pWBuff + 1) = offset & 0x80;
369 
370  // Create the slave read command.
371  pSlaveCmd->size = size + FXLS8471Q_SPI_CMD_LEN;
372  pSlaveCmd->pWriteBuffer = pWBuff;
373  pSlaveCmd->pReadBuffer = pRBuff;
374 }
375 
376 void ADS_FXLS8471Q_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
377 {
378  spiCmdParams_t *pSlaveCmd = pCmdOut;
379 
380  uint8_t *pWBuff = spiWrite_CmdDataBuffer;
381  uint8_t *pRBuff = spiWrite_CmdDataBuffer + size + FXLS8471Q_SPI_CMD_LEN;
382 
383  /* Formatting for Write command of FXLS8471Q SENSOR. */
384  *(pWBuff) = offset | 0x80; /* offset is the internal register address of the sensor at which write is performed. */
385  *(pWBuff + 1) = offset & 0x80;
386 
387  /* Copy the slave write command */
388  memcpy(pWBuff + FXLS8471Q_SPI_CMD_LEN, pWritebuffer, size);
389 
390  /* Create the slave command. */
391  pSlaveCmd->size = size + FXLS8471Q_SPI_CMD_LEN;
392  pSlaveCmd->pWriteBuffer = pWBuff;
393  pSlaveCmd->pReadBuffer = pRBuff;
394 }
395 
397 {
400  spiParams_8471.pTargetSlavePinID = &FXLS8471_SPI_CS;
401  spiParams_8471.spiCmdLen = FXLS8471Q_SPI_CMD_LEN;
402  spiParams_8471.ssActiveValue = FXLS8471Q_SS_ACTIVE_VALUE;
403 
404  /* Initialize the Slave Select Pin. */
405  pGPIODriver->pin_init(&FXLS8471_SPI_CS, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
406  if (spiParams_8471.ssActiveValue == SPI_SS_ACTIVE_LOW)
407  {
408  pGPIODriver->set_pin(&FXLS8471_SPI_CS);
409  }
410  else
411  {
412  pGPIODriver->clr_pin(&FXLS8471_SPI_CS);
413  }
414 };
415 
416 ADS_Status_t ADS_FXLS8471Query(uint8_t whoAmiAddr, uint8_t whoAmi)
417 {
418  int32_t status;
419  uint8_t reg;
421  .deviceInstance = SPI_S_DEVICE_INDEX, .functionParam = NULL, .idleFunction = NULL};
422 
423  /*! Read and store the device's WHO_AM_I.*/
424  status = Register_SPI_Read(SPIdrv, &deviceInfo, &spiParams_8471, whoAmiAddr, 1, &reg);
425  if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
426  {
427  return ADS_FAIL;
428  }
429 
430  return ADS_OK;
431 }
432 
433 /*******************************************************************************
434 * FXLS8962 SPI Specific Functions
435 *****************************************************************************/
436 void ADS_FXLS8962_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
437 {
438  spiCmdParams_t *pSlaveCmd = pCmdOut;
439 
440  uint8_t *pWBuff = spiRead_CmdBuffer;
441  uint8_t *pRBuff = spiRead_DataBuffer;
442 
443  /* Formatting for Read command of FXLS8962 SENSOR. */
444  *(pWBuff) = offset | 0x80; /* offset is the internal register address of the sensor at which write is performed. */
445  *(pWBuff + 1) = 0x00;
446 
447  /* Create the slave read command. */
448  pSlaveCmd->size = size + FXLS8962_SPI_CMD_LEN;
449  pSlaveCmd->pWriteBuffer = pWBuff;
450  pSlaveCmd->pReadBuffer = pRBuff;
451 }
452 
453 void ADS_FXLS8962_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
454 {
455  spiCmdParams_t *pSlaveCmd = pCmdOut;
456 
457  uint8_t *pWBuff = spiWrite_CmdDataBuffer;
458  uint8_t *pRBuff = spiWrite_CmdDataBuffer + size + FXLS8962_SPI_CMD_LEN;
459 
460  /* Formatting for Write command of FXLS8962 SENSOR. */
461  *(pWBuff) = offset & 0x7F; /* offset is the internal register address of the sensor at which write is performed. */
462  *(pWBuff + 1) = 0x00;
463 
464  /* Copy the slave write command */
465  memcpy(pWBuff + FXLS8962_SPI_CMD_LEN, pWritebuffer, size);
466 
467  /* Create the slave command. */
468  pSlaveCmd->size = size + FXLS8962_SPI_CMD_LEN;
469  pSlaveCmd->pWriteBuffer = pWBuff;
470  pSlaveCmd->pReadBuffer = pRBuff;
471 }
472 
474 { /*! Initialize the sensor handle. */
477  spiParams_8962.pTargetSlavePinID = &FXLS8962_CS;
478  spiParams_8962.spiCmdLen = FXLS8962_SPI_CMD_LEN;
479  spiParams_8962.ssActiveValue = FXLS8962_SS_ACTIVE_VALUE;
480 
481  /* Initialize the Slave Select Pin. */
482  pGPIODriver->pin_init(&FXLS8962_CS, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
483  if (spiParams_8962.ssActiveValue == SPI_SS_ACTIVE_LOW)
484  {
485  pGPIODriver->set_pin(&FXLS8962_CS);
486  }
487  else
488  {
489  pGPIODriver->clr_pin(&FXLS8962_CS);
490  }
491 };
492 
493 ADS_Status_t ADS_FXLS8962Query(uint8_t whoAmiAddr, uint8_t whoAmi)
494 {
495  int32_t status;
496  uint8_t reg;
498  .deviceInstance = SPI_S_DEVICE_INDEX, .functionParam = NULL, .idleFunction = NULL};
499 
500  /*! Read and store the device's WHO_AM_I.*/
501  status = Register_SPI_Read(SPIdrv, &deviceInfo, &spiParams_8962, whoAmiAddr, 1, &reg);
502  if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
503  {
504  return ADS_FAIL;
505  }
506 
507  return ADS_OK;
508 }
509 
510 /*******************************************************************************
511 * DIFF-P SPI Specific Functions
512 *****************************************************************************/
513 void ADS_DIFF_P_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
514 {
515  spiCmdParams_t *pSlaveCmd = pCmdOut;
516 
517  uint8_t *pWBuff = spiRead_CmdBuffer;
518  uint8_t *pRBuff = spiRead_DataBuffer;
519 
520  /* Formatting for Read command of DIFF-P SENSOR. */
521  *(pWBuff) = offset & 0x7F; /* offset is the internal register address of the sensor at which write is performed. */
522 
523  // Create the slave read command.
524  pSlaveCmd->size = size + DIFF_P_SPI_CMD_LEN;
525  pSlaveCmd->pWriteBuffer = pWBuff;
526  pSlaveCmd->pReadBuffer = pRBuff;
527 }
528 
529 void ADS_DIFF_P_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
530 {
531  spiCmdParams_t *pSlaveCmd = pCmdOut;
532 
533  uint8_t *pWBuff = spiWrite_CmdDataBuffer;
534  uint8_t *pRBuff = spiWrite_CmdDataBuffer + size + DIFF_P_SPI_CMD_LEN;
535 
536  /* Formatting for Write command of DIFF-P SENSOR. */
537  *(pWBuff) = offset | 0x80; /* offset is the internal register address of the sensor at which write is performed. */
538 
539  /* Copy the slave write command */
540  memcpy(pWBuff + DIFF_P_SPI_CMD_LEN, pWritebuffer, size);
541 
542  /* Create the slave command. */
543  pSlaveCmd->size = size + DIFF_P_SPI_CMD_LEN;
544  pSlaveCmd->pWriteBuffer = pWBuff;
545  pSlaveCmd->pReadBuffer = pRBuff;
546 }
547 
549 {
552  spiParams_diff_p.pTargetSlavePinID = &DIFF_P_SPI_CS;
553  spiParams_diff_p.spiCmdLen = DIFF_P_SPI_CMD_LEN;
554  spiParams_diff_p.ssActiveValue = DIFF_P_SS_ACTIVE_VALUE;
555 
556  /* Initialize the Slave Select Pin. */
557  pGPIODriver->pin_init(&DIFF_P_SPI_CS, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
558  if (spiParams_diff_p.ssActiveValue == SPI_SS_ACTIVE_LOW)
559  {
560  pGPIODriver->set_pin(&DIFF_P_SPI_CS);
561  }
562  else
563  {
564  pGPIODriver->clr_pin(&DIFF_P_SPI_CS);
565  }
566 };
567 
568 ADS_Status_t ADS_DIFF_PQuery(uint8_t whoAmiAddr, uint8_t whoAmi)
569 {
570  int32_t status;
571  uint8_t reg;
573  .deviceInstance = SPI_S_DEVICE_INDEX, .functionParam = NULL, .idleFunction = NULL};
574 
575  /*! Read and store the device's WHO_AM_I.*/
576  status = Register_SPI_Read(SPIdrv, &deviceInfo, &spiParams_diff_p, whoAmiAddr, 1, &reg);
577  if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
578  {
579  return ADS_FAIL;
580  }
581 
582  return ADS_OK;
583 }
584 
585 /*******************************************************************************
586 * FXLC95000 Specific Functions
587 *****************************************************************************/
589 {
590  int32_t status;
591  uint16_t partNumber;
592 
594  .deviceInstance = I2C_S1_DEVICE_INDEX, .functionParam = NULL, .idleFunction = NULL};
595 
596  /* ADS is required to confirm only the presence of FXLC95000 and not the contents of its FLASH.
597  * As such we will not send command to Boot FXLC95000 to Flash.
598  * We send the Get Device Info ROM CI command and validate response. */
599  Register_I2C_BlockWrite(I2CextDrv, &deviceInfo, FXLC95000_I2C_ADDR, 0, GetDeviceInfoCmd, sizeof(GetDeviceInfoCmd));
600  BOARD_DELAY_ms(1);
601 
602  /* Read the Device Info Result.
603  * A valid response COCO indicates command acceptance and by nature Sensor Identity. */
605  FXLC95000_PART_NUMBER_SIZE, (uint8_t *)&partNumber);
606  partNumber = (partNumber >> 8) | (partNumber << 8);
607  if (ARM_DRIVER_OK != status || partNumber != FXLC95000_PART_NUMBER)
608  {
609  return ADS_FAIL;
610  }
611  return ADS_OK;
612 };
613 
614 /*******************************************************************************
615 * MMA9553 Specific Functions
616 *****************************************************************************/
618 {
619  int32_t status;
620  uint8_t cmdRespHdr[MMA9553_HDR_SIZE] = {0};
621 
623  .deviceInstance = I2C_S1_DEVICE_INDEX, .functionParam = NULL, .idleFunction = NULL};
624 
625  /* We send the Read Version Info command and validate response. */
627  sizeof(ReadVersionInfo_MMA9553));
628  BOARD_DELAY_ms(1);
629 
630  /* Read the Device Info Result.
631  * A valid response COCO and length fields indicate command acceptance and by nature Sensor Identity. */
632  status = Register_I2C_Read(I2CextDrv, &deviceInfo, MMA9553_I2C_ADDR, 0, sizeof(cmdRespHdr), cmdRespHdr);
633  if (ARM_DRIVER_OK != status || (cmdRespHdr[1] & 0x80) != 0x80 || cmdRespHdr[2] != ReadVersionInfo_MMA9553[3] ||
634  cmdRespHdr[3] != ReadVersionInfo_MMA9553[3])
635  {
636  return ADS_FAIL;
637  }
638  return ADS_OK;
639 };
640 
641 /*******************************************************************************
642  * Functions
643  *****************************************************************************/
645 {
646  int32_t status;
647 
648  /*! Initialize the Internal I2C driver. */
649  status = I2CintDrv->Initialize(I2C_BB_SIGNAL_EVENT);
650  if (ARM_DRIVER_OK != status)
651  {
652  return ARM_DRIVER_ERROR;
653  }
654 
655  /*! Set the Internal I2C Power mode. */
656  status = I2CintDrv->PowerControl(ARM_POWER_FULL);
657  if (ARM_DRIVER_OK != status)
658  {
659  return ARM_DRIVER_ERROR;
660  }
661 
662  /*! Set the Internal I2C bus speed. */
663  status = I2CintDrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
664  if (ARM_DRIVER_OK != status)
665  {
666  return ARM_DRIVER_ERROR;
667  }
668 
669  /*! Initialize the External I2C driver. */
670  status = I2CextDrv->Initialize(I2C_S1_SIGNAL_EVENT);
671  if (ARM_DRIVER_OK != status)
672  {
673  return ARM_DRIVER_ERROR;
674  }
675 
676  /*! Set the External I2C Power mode. */
677  status = I2CextDrv->PowerControl(ARM_POWER_FULL);
678  if (ARM_DRIVER_OK != status)
679  {
680  return ARM_DRIVER_ERROR;
681  }
682 
683  /*! Set the External I2C bus speed. */
684  status = I2CextDrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
685  if (ARM_DRIVER_OK != status)
686  {
687  return ARM_DRIVER_ERROR;
688  }
689 
690  return status;
691 }
692 
694 {
695  int32_t status;
696 
697  /*! Initialize the SPI driver. */
698  status = SPIdrv->Initialize(SPI_S_SIGNAL_EVENT);
699  if (ARM_DRIVER_OK != status)
700  {
701  return ARM_DRIVER_ERROR;
702  }
703 
704  /*! Set the SPI Power mode. */
705  status = SPIdrv->PowerControl(ARM_POWER_FULL);
706  if (ARM_DRIVER_OK != status)
707  {
708  return ARM_DRIVER_ERROR;
709  }
710 
711  /*! Set the SPI Slave speed. */
712  status = SPIdrv->Control(ARM_SPI_MODE_MASTER | ARM_SPI_CPOL1_CPHA0, SPI_S_BAUDRATE);
713  if (ARM_DRIVER_OK != status)
714  {
715  return ARM_DRIVER_ERROR;
716  }
717 
718  return status;
719 }
720 
722 {
723  int32_t status;
724 
725  /*! De-Initialize the Internal I2C driver. */
726  status = I2CintDrv->Uninitialize();
727  if (ARM_DRIVER_OK != status)
728  {
729  return ARM_DRIVER_ERROR;
730  }
731 
732  /*! De-Initialize the External I2C driver. */
733  status = I2CextDrv->Uninitialize();
734  if (ARM_DRIVER_OK != status)
735  {
736  return ARM_DRIVER_ERROR;
737  }
738 
739  return status;
740 }
741 
743 {
744  int32_t status;
745 
746  /*! De-Initialize the SPI0 driver. */
747  status = SPIdrv->Uninitialize();
748  if (ARM_DRIVER_OK != status)
749  {
750  return ARM_DRIVER_ERROR;
751  }
752 
753  return status;
754 }
755 
756 // Private function to detect Shield.
757 int ADS_DetectShield(char *pShieldString, size_t bufferLength)
758 {
759  int32_t status;
760  uint8_t reg;
761  bool match;
762  uint32_t boardFound = ADS_NO_SHIELD_DETECTED;
764 
765  /* We init SPI bus to test for SPI Sensors. */
766  ADS_InitSPIBus();
767 
768  // Execute the SPI queries based on the ADS_SensorQueryList.
769  for (uint32_t i = 0; i < ADS_QUERY_NUM; i++)
770  {
771  if (ADS_SPI_DEV == ADS_SensorQueryList[i].channel)
772  {
774  if (FXLS8962 == ADS_SensorQueryList[i].slaveAddr)
775  {
777  gADS_QueryResults[i] =
778  ADS_FXLS8962Query(ADS_SensorQueryList[i].whoAmIAddr, ADS_SensorQueryList[i].whoAmIValue);
779  continue;
780  }
781  if (FXLS8471 == ADS_SensorQueryList[i].slaveAddr)
782  {
784  gADS_QueryResults[i] =
785  ADS_FXLS8471Query(ADS_SensorQueryList[i].whoAmIAddr, ADS_SensorQueryList[i].whoAmIValue);
786  continue;
787  }
788  if (DIFF_P == ADS_SensorQueryList[i].slaveAddr)
789  {
791  gADS_QueryResults[i] =
792  ADS_DIFF_PQuery(ADS_SensorQueryList[i].whoAmIAddr, ADS_SensorQueryList[i].whoAmIValue);
793  continue;
794  }
795  }
796  }
797 
798  /* We now disable SPI bus and init I2C buses to test for I2C sensors. */
801 
802  // Execute the Ext I2C queries based on the ADS_SensorQueryList.
803  for (uint32_t i = 0; i < ADS_QUERY_NUM; i++)
804  {
805  if (ADS_I2C_EXT == ADS_SensorQueryList[i].channel)
806  {
808  deviceInfo.deviceInstance = I2C_S1_DEVICE_INDEX;
809  if (FXLC95000 == ADS_SensorQueryList[i].slaveAddr)
810  {
812  continue;
813  }
814  if (MMA9553 == ADS_SensorQueryList[i].slaveAddr)
815  {
817  continue;
818  }
819  if (MMA8491Q_I2C_ADDRESS == ADS_SensorQueryList[i].slaveAddr)
820  { /* Set MMA8491Q EN Pin to enable I2C communication. */
821  CLOCK_EnableClock(MMA8491_EN.clockName);
822  pGPIODriver->pin_init(&MMA8491_EN, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
823  pGPIODriver->set_pin(&MMA8491_EN);
824  BOARD_DELAY_ms(MMA8491Q_T_ON_TYPICAL); /* Wait for Bus to become active. */
826  }
827  status = Register_I2C_Read(I2CextDrv, &deviceInfo, ADS_SensorQueryList[i].slaveAddr,
828  ADS_SensorQueryList[i].whoAmIAddr, 1, &reg);
829  if ((ARM_DRIVER_OK != status) ||
830  ((ADS_SensorQueryList[i].whoAmIValue & ADS_SensorQueryList[i].whoAmIMask) !=
831  (reg & ADS_SensorQueryList[i].whoAmIMask)))
832  {
834  }
835  else
836  {
838  }
839  }
840  }
841 
842  // Execute the Int I2C queries based on the ADS_SensorQueryList.
843  for (uint32_t i = 0; i < ADS_QUERY_NUM; i++)
844  {
845  if (ADS_I2C_INT == ADS_SensorQueryList[i].channel)
846  {
848  deviceInfo.deviceInstance = I2C_BB_DEVICE_INDEX;
849  status = Register_I2C_Read(I2CintDrv, &deviceInfo, ADS_SensorQueryList[i].slaveAddr,
850  ADS_SensorQueryList[i].whoAmIAddr, 1, &reg);
851  if ((ARM_DRIVER_OK != status) || (ADS_SensorQueryList[i].whoAmIValue != reg))
852  {
854  }
855  else
856  {
858  }
859  }
860  }
861 
862  /* I2C Sensor verified, disable I2C buses. */
864 
865  // Analyze the responses and return the Sensor Shield or Reference name.
866  for (uint32_t board = 0; board < ADS_NUM_BOARDS; board++)
867  {
868  match = true;
869  for (uint32_t sensor = 0; sensor < ADS_QUERY_NUM; sensor++)
870  {
871  if (gADS_QueryMap[board][sensor] == ADS_NULL)
872  {
873  continue;
874  }
875  if (gADS_QueryMap[board][sensor] != gADS_QueryResults[sensor])
876  {
877  match = false;
878  break;
879  }
880  }
881  if (match)
882  {
883  boardFound = board;
884  break;
885  }
886  }
887 
888  // If a board was found, then put the proper string into the response.
889  if (boardFound != ADS_NO_SHIELD_DETECTED)
890  {
891  strncpy(pShieldString, ADS_ShieldList[boardFound], bufferLength);
892  status = ARM_DRIVER_OK;
893  }
894  else
895  {
896  status = ARM_DRIVER_ERROR;
897  }
898 
899  return status;
900 }
901 
902 // Private function to detect the MCU.
903 int ADS_DetectQN(char *pBoardString, size_t bufferLength)
904 {
905  int32_t status;
906 
907  // Declare the DEVID Query structure
908  mcuDEVID_t MCUInfo = {.mcuChipId = 0, .board = ADS_NO_BOARD_DETECTED};
909 
910  if (pBoardString == NULL)
911  {
912  return ARM_DRIVER_ERROR_PARAMETER;
913  }
914 
915  // Get CID3 (CHIP ID for product ID) from SYSCON CHIP_ID register.
916  MCUInfo.mcuChipId = (SYSCON->CHIP_ID & SYSCON_CHIP_ID_CID3_MASK) >> SYSCON_CHIP_ID_CID3_SHIFT;
917 
918  // Compare the values extracted to the static table and return detected board.
919  for (uint8_t i = 0; i < (sizeof(ADS_ValidDEVIDValues) / sizeof(mcuDEVID_t)); i++)
920  {
921  if ((ADS_ValidDEVIDValues[i].mcuChipIdMask & MCUInfo.mcuChipId) ==
922  (ADS_ValidDEVIDValues[i].mcuChipIdMask & ADS_ValidDEVIDValues[i].mcuChipId))
923  {
924  MCUInfo.board = ADS_ValidDEVIDValues[i].board;
925  break;
926  }
927  }
928 
929  status = ARM_DRIVER_OK;
930  // Translate the result into the string.
931  switch (MCUInfo.board)
932  {
933  case ADS_QN_9020:
934  strncpy(pBoardString, "QN9020DK", bufferLength);
935  break;
936  case ADS_QN_9080:
937  strncpy(pBoardString, "QN908XCDK", bufferLength);
938  break;
939  default:
940  status = ARM_DRIVER_ERROR;
941  break;
942  }
943 
944  return status;
945 }
946 
947 // Private function to compare flash contents.
949 {
951  uint32_t status;
952 
953  // Check that the ADS_COOKIE is as expected.
954  if (pRecord->cookie != ADS_COOKIE_VALUE)
955  {
956  return ADS_NO_FLASH_RECORD; // Flash record is not valid.
957  }
958  else
959  { // Compare the result string with the ADS stored results in Flash.
960  status = strncmp((char *)pResultString, (char *)pRecord->ADSString, pRecord->length);
961  if (status != 0)
962  {
964  }
965  else
966  {
968  }
969  }
970 }
971 
972 // Private function to update flash contents.
973 ADS_Status_t ADS_FlashUpdate(char *pResultString)
974 {
975  status_t result;
976  ADS_Status_t retVal = ADS_FAIL;
977  ADSFlashRecord_t flashRecord = {0};
978  flash_config_t s_flashDriver;
979 
980  // Create the ADS Flash Record.
981  flashRecord.cookie = ADS_COOKIE_VALUE;
982  flashRecord.length = strlen((char const *)pResultString);
983  memcpy(flashRecord.ADSString, pResultString, flashRecord.length);
984 
985  // Load default Flash configuration.
986  FLASH_GetDefaultConfig(&s_flashDriver);
987 
988  // Setup flash driver structure for device and initialize variables.
989  result = FLASH_Init(&s_flashDriver);
990  if (kStatus_FLASH_Success == result)
991  {
992  // Erase the target sector.
993  result = FLASH_Erase(&s_flashDriver, ADS_NVM_ADDR, FSL_FEATURE_FLASH_PAGE_SIZE_BYTES);
994  if (kStatus_FLASH_Success == result)
995  {
996  // Write the ADS Record to the Flash.
997  result = FLASH_Program(&s_flashDriver, ADS_NVM_ADDR, (uint32_t *)&flashRecord, sizeof(flashRecord));
998  if (kStatus_FLASH_Success == result)
999  {
1000  retVal = ADS_OK;
1001  }
1002  }
1003  }
1004 
1005  return retVal;
1006 }
1007 
1008 // API to register Application Name and trigger Board Shield detection.
1009 void BOARD_RunADS(const char *appName, char *boardString, char *shieldString, size_t bufferLength)
1010 {
1011  int32_t position, status = ADS_OK;
1012  char finalString[ADS_FLASH_STRING_LENGTH] = {0};
1013 
1014  status = ADS_DetectQN(boardString, bufferLength);
1015  if (ARM_DRIVER_ERROR == status)
1016  {
1017  strncpy(boardString, "NotDetected", bufferLength);
1018  status = ADS_FAIL;
1019  }
1020 
1021  status = ADS_DetectShield(shieldString, bufferLength);
1022  if (ARM_DRIVER_ERROR == status)
1023  {
1024  strncpy(shieldString, "NotDetected", bufferLength);
1025  status = ADS_FAIL;
1026  }
1027 
1028  // Build the string with App Name and Shield Name to write to flash.
1029  strncpy(finalString, appName, ADS_FLASH_STRING_LENGTH);
1030  position = strlen(appName);
1031 
1032  finalString[position++] = ':';
1033 
1034  strncpy(&finalString[position], shieldString, ADS_FLASH_STRING_LENGTH - position);
1035  position += strlen(shieldString);
1036 
1037  /* Fill the remaining string with 0. */
1038  memset(&finalString[position], 0, ADS_FLASH_STRING_LENGTH - position);
1039 
1040  status = ADS_FlashCompare(finalString);
1041  if (ADS_FLASH_RECORD_NO_CHANGE != status)
1042  {
1043  ADS_FlashUpdate(finalString);
1044  strcpy(finalString, shieldString);
1045  snprintf(shieldString, bufferLength, "Changed:%s", finalString);
1046  }
1047 }
ADS_Status_t ADS_FlashUpdate(char *pResultString)
The register_io_i2c.h file declares low-level interface functions for reading and writing sensor regi...
#define ADS_NVM_ADDR
start of the next to last 4K (sector size) of the 1M flash
Definition: frdm_k64f.h:174
void ADS_FXLS8962_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
ARM_DRIVER_I2C * I2CextDrv
int ADS_InitI2CBuses()
void ADS_DIFF_P_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
const ADS_Status_t gADS_QueryMap[][ADS_QUERY_NUM]
These are the expected query signatures for the shield boards.
fpSpiWritePreprocessFn_t pWritePreprocessFN
#define DIFF_P_SPI_CMD_LEN
These variables are specific to SPI access to the DIFF_P for ADS.
#define FXLC95000_I2C_ADDR
#define FXLC95000_PART_NUMBER_SIZE
The FXLC95000 Size of Part Number.
Definition: fxlc95000.h:34
char ADSString[ADS_FLASH_STRING_LENGTH]
int ADS_InitSPIBus()
#define ADS_NO_SHIELD_DETECTED
char shieldString[ADS_MAX_STRING_LENGTH]
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
Definition: Driver_GPIO.h:67
ADS_Status_t ADS_DIFF_PQuery(uint8_t whoAmiAddr, uint8_t whoAmi)
#define I2C_S1_SIGNAL_EVENT
Definition: frdm_k64f.h:93
int ADS_DetectQN(char *pBoardString, size_t bufferLength)
#define MMA8491_I2C_ADDR
#define DIFF_P_I2C_ADDR
spiSlaveSpecificParams_t spiParams_8471
uint8_t spiWrite_CmdDataBuffer[SPI_MAX_MSG_SIZE]
void ADS_FXLS8962_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
int32_t status
#define DIFF_P_SPI_CS
uint8_t spiRead_CmdBuffer[SPI_MAX_MSG_SIZE]
void ADS_InitSPI_DIFF_P()
The mma865x.h contains the MMA865xFC Digital Accelerometer Sensor register definitions, access macros, and device access functions.
#define I2C_BB_DEVICE_INDEX
Definition: frdm_k64f.h:106
void BOARD_DELAY_ms(uint32_t delay_ms)
Function to insert delays.
int ADS_DetectShield(char *pShieldString, size_t bufferLength)
#define FXPQ3115_I2C_ADDR
#define ADS_MAX_STRING_LENGTH
#define FXLS8962_SPI_CMD_LEN
These variables are specific to SPI access to the FXLS8962 for ADS.
#define FXLS8471Q_WHO_AM_I_WHOAMI_VALUE
Definition: fxls8471q.h:538
#define MMA9553_I2C_ADDR
The fxos8700.h file contains the register definitions for FXOS8700 sensor driver. ...
const uint8_t ReadVersionInfo_MMA9553[4]
The Read Version Info Command for FXLC95000.
char boardString[ADS_MAX_STRING_LENGTH]
#define ADS_QUERY_NUM
#define ADS_FLASH_STRING_LENGTH
The fxas21002.h contains the fxas21002 sensor register definitions and its bit mask.
#define DIFF_P_SS_ACTIVE_VALUE
#define FXPQ3115_WHOAMI_VALUE
Definition: fxpq3115.h:65
This defines a record type to store ADS results string in Flash memory.
#define MMA8491Q_WHO_AM_I_VALUE
#define I2C_S1_DEVICE_INDEX
Definition: frdm_k64f.h:92
void ADS_DIFF_P_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
#define I2C_S1_DRIVER
Definition: frdm_k64f.h:91
const sensorAccess_t ADS_SensorQueryList[]
This constant data structure contains the expected valid comm/sensor/who_am_i combinations.
This defines a record type to store the communication channel info and WHO_AM_I address/value for var...
#define MPL3115_WHOAMI_VALUE
Definition: mpl3115.h:65
The mma9553.h contains the MMA9553L Digital Pedometer command definitions and access macros...
int ADS_DeInitSPIBus()
#define MMA8652_I2C_ADDR
ADS_Status_t ADS_MMA9553Query()
#define MMA8491Q_I2C_ADDRESS
Definition: mma8491q.h:27
#define FXOS8700_WHO_AM_I_PROD_VALUE
Definition: fxos8700.h:172
The mag3110.h contains the MAG3110 Magnetic sensor register definitions, access macros, and device access functions.
#define MMA8652_WHOAMI_VALUE
Definition: mma865x.h:65
#define FXLS8962_I2C_ADDR
#define FXLC95000_PART_NUMBER
The FXLC95000 2-byte packed BCD encoded Part Number (BCD for Last 4 characters).
Definition: fxlc95000.h:37
int ADS_DeInitI2CBuses()
#define FXLS8471Q_SPI_CMD_LEN
These variables are specific to SPI access to the FXLS8471 for ADS.
const mcuDEVID_t ADS_ValidDEVIDValues[]
This constant data structure contains the expected valid MCU Device ID combinations. Refer : LPC5411x User manual - UM10914, Section: 33.5.12.
ADS_Status_t ADS_FXLC95000Query()
#define FXLS8962_CS
void ADS_InitSPI_FXLS8471()
The fxpq3115.h contains the FXPQ3115 Pressure sensor register definitions, access macros...
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.
#define SPI_S_DEVICE_INDEX
Definition: frdm_k64f.h:115
void(* set_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:72
ARM_DRIVER_SPI * SPIdrv
These values hold the ARM CMSIS Driver interface pointers.
registerDeviceInfo_t deviceInfo
I2C device context.
void(* clr_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:73
The mpl3115.h contains the MPL3115 Pressure sensor register definitions, access macros, and device access functions.
char ADS_ShieldList[][ADS_MAX_STRING_LENGTH]
The fxlc95000.h contains the FXLC95000L Digital Accelerometer command definitions and access macros...
ADS_SupportedBoards_t board
The SPI Slave Transfer Command Params SDK2.0 Driver.
ADS_Status_t ADS_FXLS8471Query(uint8_t whoAmiAddr, uint8_t whoAmi)
#define SPI_SS_ACTIVE_LOW
spiSlaveSpecificParams_t spiParams_diff_p
The mma8491q.h contains the MMA8491Q Multifunction Digital Accelerometer register definitions...
void ADS_FXLS8471Q_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
The fxls8471q.h file contains the register definitions for fxls8471q sensor driver.
#define ADS_NO_WHO_AM_I
void ADS_InitSPI_FXLS8962()
#define FXLS8962_SS_ACTIVE_VALUE
#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE
Definition: fxas21002.h:428
#define DIFF_P_NPS3000VV_WHOAMI_VALUE
Definition: diff_p.h:96
spiSlaveSpecificParams_t spiParams_8962
#define FXAS21002_I2C_ADDR
GENERIC_DRIVER_GPIO * pGPIODriver
#define ADS_COOKIE_VALUE
The diff_p.h contains the DIFF_P Pressure sensor register definitions, access macros, and its bit mask.
#define ADS_NUM_BOARDS
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:203
#define FXLS8471Q_SS_ACTIVE_VALUE
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
This file contains the FXLS8962 Accelerometer register definitions, access macros, and device access functions.
uint32_t size
#define MMA9553_HDR_SIZE
Size of fixed header bytes in sensor commands.
Definition: mma9553.h:13
#define MMA8491Q_STATUS_RESERVED_MASK
Definition: mma8491q.h:71
#define FXLS8471_SPI_CS
#define FXLS8962_WHOAMI_VALUE
Definition: fxls8962.h:113
ADS_FlashStatus_t
This enumeration defines the ADS Flash storage status.
enum ADS_Status ADS_Status_t
This defines the return status.
void ADS_FXLS8471Q_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
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.
#define MPL3115_I2C_ADDR
#define I2C_BB_SIGNAL_EVENT
Definition: frdm_k64f.h:107
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.
ADS_Status_t gADS_QueryResults[ADS_QUERY_NUM]
This global contains the results from the sensor query.
uint8_t spiRead_DataBuffer[SPI_MAX_MSG_SIZE]
ARM Systick Utilities.
void BOARD_RunADS(const char *appName, char *boardString, char *shieldString, size_t bufferLength)
The function to register Application Name and initialte ADS.
#define SPI_S_BAUDRATE
Transfer baudrate - 500k.
Definition: frdm_k64f.h:114
ARM_DRIVER_I2C * I2CintDrv
#define MMA8491Q_WHO_AM_I
These variables are specific to MMA8491Q which does not have a Who Am I register. ...
#define SPI_S_SIGNAL_EVENT
Definition: frdm_k64f.h:116
#define MMA8491Q_T_ON_TYPICAL
Definition: mma8491q.h:30
#define I2C_BB_DRIVER
Definition: frdm_k64f.h:105
#define MAG3110_WHOAMI_VALUE
Definition: mag3110.h:37
#define FXLC95000_PART_NUMBER_OFFSET
Offset of 2-Byte SA95000 Part Number in Device Info Response.
Definition: fxlc95000.h:31
#define SPI_MAX_MSG_SIZE
This defines a record type to store the expected field values of the LPC device ID.
This structure defines the device specific info required by register I/O.
Definition: sensor_drv.h:128
This structure defines the spi slave command format.
#define FXOS8700_I2C_ADDR
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...
#define MAG3110_I2C_ADDR
The auto_detection_shield.h file describes the definitions for Sensor I2C and SPI parameters required...
#define MMA8491_EN
ADS_Status_t ADS_FXLS8962Query(uint8_t whoAmiAddr, uint8_t whoAmi)
fpSpiReadPreprocessFn_t pReadPreprocessFN
ADS_FlashStatus_t ADS_FlashCompare(char *pResultString)
#define SPI_S_DRIVER
Definition: frdm_k64f.h:113