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