ISSDK  1.7
IoT Sensing Software Development Kit
data_logger_demo.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 data_logger_demo.c
37  * @brief The data_logger_demo.c file implements the ISSDK Data Logger for RD-KL25-AGMP01
38  * example demonstration with one sensor in Interrupt mode and other two in polling mode.
39  * MPL3115 is in One-Shot Poll Mode.
40  * FXOS8700 is @200Hz Hybrid Poll Mode.
41  * FXAS21002 is @200Hz Interrupt Mode.
42  * Data from MPL3115, FXOS8700 and FXAS21002 is only read when INT from FXAS21002 is received.
43  * The FXAS21002 ODR serves as the application ODR time keeper.
44  */
45 
46 //-----------------------------------------------------------------------
47 // SDK Includes
48 //-----------------------------------------------------------------------
49 #include "board.h"
50 #include "pin_mux.h"
51 #include "clock_config.h"
52 
53 //-----------------------------------------------------------------------
54 // CMSIS Includes
55 //-----------------------------------------------------------------------
56 #include "Driver_I2C.h"
57 #include "Driver_USART.h"
58 
59 //-----------------------------------------------------------------------
60 // ISSDK Includes
61 //-----------------------------------------------------------------------
62 #include "issdk_hal.h"
63 #include "gpio_driver.h"
64 #include "mpl3115_drv.h"
65 #include "fxos8700_drv.h"
66 #include "fxas21002_drv.h"
67 #include "host_io_uart.h"
68 #include "systick_utils.h"
69 #include "auto_detection_service.h"
70 
71 //-----------------------------------------------------------------------
72 // Macros
73 //-----------------------------------------------------------------------
74 #define STREAMING_PKT_TIMESTAMP_LEN (4)
75 #define FXOS8700_ACCEL_DATA_SIZE (6)
76 #define FXOS8700_MAG_DATA_SIZE (6)
77 #define MPL3115_PADDING_SIZE (1)
78 #define MPL3115_PRESSURE_DATA_SIZE (3)
79 #define MPL3115_TEMPERATURE_DATA_SIZE (2)
80 
81 #define FXOS8700_DATA_SIZE (FXOS8700_ACCEL_DATA_SIZE + FXOS8700_MAG_DATA_SIZE)
82 #define FXAS21002_DATA_SIZE (FXAS21002_GYRO_DATA_SIZE)
83 #define MPL3115_DATA_SIZE (MPL3115_PRESSURE_DATA_SIZE + MPL3115_TEMPERATURE_DATA_SIZE)
84 
85 /* Toggle LED after every 100 saples are processed. */
86 #define LED_TOGGLE_RATE (100)
87 #define STREAMING_PAYLOAD_LEN \
88  (STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_DATA_SIZE + FXAS21002_DATA_SIZE + MPL3115_DATA_SIZE + MPL3115_PADDING_SIZE)
89 #define STREAMING_PAYLOAD_SHORT_LEN (STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_DATA_SIZE + FXAS21002_DATA_SIZE)
90 
91 /* Mask out default NMI handler to work around FXOS8700 Init time halt on RD-KL25-AGMP01. */
92 #define nmi_handler NMI_Handler
93 
94 /*! @brief Unique Name for this application which should match the target GUI pkg name. */
95 #define APPLICATION_NAME "Generic Data Logger Demo"
96 /*! @brief Version to distinguish between instances the same application based on target Shield and updates. */
97 #define APPLICATION_VERSION "2.5"
98 
99 //-----------------------------------------------------------------------
100 // Constants
101 //-----------------------------------------------------------------------
102 /*! Prepare the register write list to configure FXOS8700 in Hybrid mode. */
104  /*! System and Control registers. */
105  /*! Configure the FXOS8700 to 200Hz sampling rate. */
108  FXOS8700_M_CTRL_REG1_M_ACAL_MASK | FXOS8700_M_CTRL_REG1_M_HMS_MASK}, /*! Enable the Hybrid Mode. */
110  FXOS8700_M_CTRL_REG2_M_AUTOINC_MASK | FXOS8700_M_CTRL_REG2_M_RST_CNT_MASK}, /*! Enable the Data read with Hybrid Mode. */
112 
113 /*! Command definition to read the Accel + Mag Data */
116 
117 /*! Prepare the register write list to configure FXAS21002 in Interrupt Mode. */
119  /*! Configure CTRL_REG1 register to put FXAS21002 to 200Hz sampling rate. */
121  /*! Configure CTRL_REG2 register to set interrupt configuration settings. */
126 
127 /*! Prepare the register read list to read the raw gyro data from the FXAS21002. */
130 
131 /*! @brief Register settings for Triggring One-Shot Sampling. */
133  /* Set the One ShoT Bit. */
136 
137 /*! @brief Address of Register containing OST Bit. */
139 
140 /*! @brief Address and size of Raw Pressure+Temperature Data in Normal Mode. */
143 
144 //-----------------------------------------------------------------------
145 // Global Variables
146 //-----------------------------------------------------------------------
149 volatile bool bStreamingEnabled = false, bFxas21002DataReady = false, bDataLoggerReady = false;
150 uint8_t gPrimaryStreamID; /* The auto assigned Stream ID to be used to stream complete data. */
153 
154 //-----------------------------------------------------------------------
155 // Functions
156 //-----------------------------------------------------------------------
157 /*! Handler for NMI Interrupt. */
158 void nmi_handler(void *pUserData)
159 { /* Ignore NMI interrupt which may be caused due to FXOS8700 INT1 being connected to NMI. */
160  __NOP();
161 }
162 
163 /* This is the Sensor Data Ready ISR implementation.*/
164 void fxas21002_isr(void *pUserData)
165 { /*! @brief Set flag to indicate Sensor has signalled data ready. */
166  bFxas21002DataReady = true;
167 }
168 
169 /* Handler for Device Info and Streaming Control Commands. */
171  uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
172 {
173  bool success = false;
174 
175  /* If it is Host requesting Device Info, send Board Name and Shield Name. */
176  if (tag == HOST_PRO_INT_DEV_TAG)
177  { /* Byte 1 : Payload - Length of APPLICATION_NAME (b)
178  * Bytes=b : Payload Application Name
179  * Byte b+1 : Payload - Length of BOARD_NAME (s)
180  * Bytes=s : Payload Board Name
181  * Byte b+s+2 : Payload - Length of SHIELD_NAME (v)
182  * Bytes=v : Payload Shield Name */
183 
184  size_t appNameLen = strlen(embAppName);
185  size_t boardNameLen = strlen(boardString);
186  size_t shieldNameLen = strlen(shieldString);
187 
188  if (respBufferSize >= boardNameLen + shieldNameLen + appNameLen + 3)
189  { /* We have sufficient buffer. */
190  *hostMsgSize = 0;
191  }
192  else
193  {
194  return false;
195  }
196 
197  hostResponse[*hostMsgSize] = appNameLen;
198  *hostMsgSize += 1;
199 
200  memcpy(hostResponse + *hostMsgSize, embAppName, appNameLen);
201  *hostMsgSize += appNameLen;
202 
203  hostResponse[*hostMsgSize] = boardNameLen;
204  *hostMsgSize += 1;
205 
206  memcpy(hostResponse + *hostMsgSize, boardString, boardNameLen);
207  *hostMsgSize += boardNameLen;
208 
209  hostResponse[*hostMsgSize] = shieldNameLen;
210  *hostMsgSize += 1;
211 
212  memcpy(hostResponse + *hostMsgSize, shieldString, shieldNameLen);
213  *hostMsgSize += shieldNameLen;
214 
215  return true;
216  }
217 
218  /* If it is Host sending Streaming Commands, take necessary actions. */
219  if ((tag == (HOST_PRO_INT_CMD_TAG | HOST_PRO_CMD_W_CFG_TAG)) &&
221  { /* Byte 1 : Payload - Operation Code (Start/Stop Operation Code)
222  * Byte 2 : Payload - Stream ID (Target Stream for carrying out operation) */
223  switch (hostCommand[0]) /* Execute desired operation (Start/Stop) on the requested Stream. */
224  {
225  case HOST_CMD_START:
226  if (hostCommand[1] == gPrimaryStreamID && bDataLoggerReady && bStreamingEnabled == false)
227  {
229  bStreamingEnabled = true;
230  success = true;
231  }
232  break;
233  case HOST_CMD_STOP:
234  if (hostCommand[1] == gPrimaryStreamID && bDataLoggerReady && bStreamingEnabled == true)
235  {
236  pGpioDriver->clr_pin(&LED_GREEN);
237  bStreamingEnabled = false;
238  success = true;
239  }
240  break;
241  default:
242  break;
243  }
244  *hostMsgSize = 0; /* Zero payload in response. */
245  }
246 
247  return success;
248 }
249 
250 /*!
251  * @brief Main function
252  */
253 int main(void)
254 {
255  size_t payLoadLen;
256  int32_t status;
257  uint8_t secondaryStreamID1, secondaryStreamID2, /* The auto assigned Stream ID not to be used to stream data. */
258  dataReady_3115, toggle_pin = 0, /* The MPL3115 sensor data ready flag and LED Toggle Counter. */
261 
262  fxos8700_accelmagdata_t rawData_fxos8700;
263  fxas21002_gyrodata_t rawData_fxas21002;
264  mpl3115_pressuredata_t rawData_mpl3115;
265 
266  ARM_DRIVER_I2C *pI2cDriver = &I2C_S_DRIVER;
267  ARM_DRIVER_USART *pUartDriver = &HOST_S_DRIVER;
268 
269  mpl3115_i2c_sensorhandle_t mpl3115Driver;
270  fxos8700_i2c_sensorhandle_t fxos8700Driver;
271  fxas21002_i2c_sensorhandle_t fxas21002Driver;
272 
273  /*! Initialize the MCU hardware. */
276 
277  /* Create the Short Application Name String for ADS. */
278  sprintf(embAppName, "%s:%s", APPLICATION_NAME, APPLICATION_VERSION);
279 
280  /* Run ADS. */
282 
283  /* Create the Full Application Name String for Device Info Response. */
285 
286  /*! Initialize INT1 FXAS21002 pin used by RD board */
287  pGpioDriver->pin_init(&INT1_FXAS21002, GPIO_DIRECTION_IN, NULL, &fxas21002_isr, NULL);
288 
289  /*! Initialize GREEN LED pin used by RD board */
290  pGpioDriver->pin_init(&LED_GREEN, GPIO_DIRECTION_OUT, NULL, NULL, NULL);
291  pGpioDriver->set_pin(&LED_GREEN); /* Clear LED to indicate application is not ready. */
292 
293  /*! Initialize the I2C driver. */
294  status = pI2cDriver->Initialize(I2C_S_SIGNAL_EVENT);
295  if (ARM_DRIVER_OK != status)
296  {
297  return -1;
298  }
299 
300  /*! Set the I2C Power mode. */
301  status = pI2cDriver->PowerControl(ARM_POWER_FULL);
302  if (ARM_DRIVER_OK != status)
303  {
304  return -1;
305  }
306 
307  /*! Set the I2C bus speed. */
308  status = pI2cDriver->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
309  if (ARM_DRIVER_OK != status)
310  {
311  return -1;
312  }
313 
314  /*! Initialize the UART driver. */
315  status = pUartDriver->Initialize(HOST_S_SIGNAL_EVENT);
316  if (ARM_DRIVER_OK != status)
317  {
318  return -1;
319  }
320 
321  /*! Set the UART Power mode. */
322  status = pUartDriver->PowerControl(ARM_POWER_FULL);
323  if (ARM_DRIVER_OK != status)
324  {
325  return -1;
326  }
327 
328  /*! Set UART Baud Rate. */
329  status = pUartDriver->Control(ARM_USART_MODE_ASYNCHRONOUS, BOARD_DEBUG_UART_BAUDRATE);
330  if (ARM_DRIVER_OK != status)
331  {
332  return -1;
333  }
334 
335  do
336  {
337  /*! Initialize the MPL3115 sensor driver. */
340  if (SENSOR_ERROR_NONE != status)
341  {
342  break;
343  }
344  /*! Initialize the FXOS8700 sensor driver. */
347  if (SENSOR_ERROR_NONE != status)
348  {
349  break;
350  }
351  /*! Initialize the FXAS21002 sensor driver. */
354  if (SENSOR_ERROR_NONE != status)
355  {
356  break;
357  }
358 
359  /*! Set the task to be executed while waiting for I2C transactions to complete. */
361  FXOS8700_I2C_SetIdleTask(&fxos8700Driver, (registeridlefunction_t)SMC_SetPowerModeWait, SMC);
362  FXAS21002_I2C_SetIdleTask(&fxas21002Driver, (registeridlefunction_t)SMC_SetPowerModeWait, SMC);
363 
364  /*! Configure the fxos8700 sensor driver. */
365  status = FXOS8700_I2C_Configure(&fxos8700Driver, fxos8700_Config_Hybrid);
366  if (SENSOR_ERROR_NONE != status)
367  {
368  break;
369  }
370  /*! Configure the FXAS21002 sensor driver. */
371  status = FXAS21002_I2C_Configure(&fxas21002Driver, fxas21002_Config_Isr);
372  if (SENSOR_ERROR_NONE != status)
373  {
374  break;
375  }
376  /*! In One-Shot Mode we do not need to Configure MPL3115, instead we will set OST bit directly. */
377 
378  /* If we reach here then all sensors have been initialized, configured and GDL is ready. */
379  bDataLoggerReady = true;
380 
381  } while (false);
382 
383  /*! Initialize streaming and assign a Stream IDs. */
385  Host_IO_Init(pUartDriver, (void *)mpl3115Driver.pCommDrv, &mpl3115Driver.deviceInfo, NULL, MPL3115_I2C_ADDR);
386  /* Confirm if a valid Stream ID has been allocated for this stream. */
387  if (0 == gPrimaryStreamID)
388  {
389  bDataLoggerReady = false;
390  }
391  secondaryStreamID1 = /* This is required for registering the slave address with Host I/O for Register Read/Write. */
392  Host_IO_Init(pUartDriver, (void *)fxos8700Driver.pCommDrv, &fxos8700Driver.deviceInfo, NULL, FXOS8700_I2C_ADDR);
393  /* Confirm if a valid Stream ID has been allocated for this stream. */
394  if (0 == secondaryStreamID1)
395  {
396  bDataLoggerReady = false;
397  }
398  secondaryStreamID2 = /* This is required for registering the slave address with Host I/O for Register Read/Write. */
399  Host_IO_Init(pUartDriver, (void *)fxas21002Driver.pCommDrv, &fxas21002Driver.deviceInfo, NULL,
401  /* Confirm if a valid Stream ID has been allocated for this stream. */
402  if (0 == secondaryStreamID2)
403  {
404  bDataLoggerReady = false;
405  }
406 
407  if (true == bDataLoggerReady)
408  {
409  *((uint32_t *)&streamingPacket[STREAMING_HEADER_LEN]) = 0; /* Initialize time stamp field. */
410  pGpioDriver->clr_pin(&LED_GREEN); /* Set LED to indicate application is ready. */
411  }
412 
413  for (;;) /* Forever loop */
414  { /* Check for incoming commands from Host. */
416 
417  /* Process packets only if streaming has been enabled by Host and ISR is available.
418  * In ISR Mode we do not need to check Data Ready Register.
419  * The receipt of interrupt will indicate data is ready. */
420  if (false == bStreamingEnabled || false == bFxas21002DataReady)
421  {
422  SMC_SetPowerModeWait(SMC); /* Power save, wait if nothing to do. */
423  continue;
424  }
425  else
426  { /*! Clear the data ready flag, it will be set again by the ISR. */
427  bFxas21002DataReady = false;
428  }
429 
430  /* Read timestamp from Systick framework. */
431  *((uint32_t *)&streamingPacket[STREAMING_HEADER_LEN]) += BOARD_SystickElapsedTime_us(&gSystick);
432 
433  /*! Read the raw sensor data from the fxos8700. */
434  status = FXOS8700_I2C_ReadData(&fxos8700Driver, fxos8700_Output_values, data);
435  if (ARM_DRIVER_OK != status)
436  {
437  return -1;
438  }
439 
440  /* Convert to Little Endian, Right Justified, Even Padded Signed integer counts. */
441  rawData_fxos8700.accel[0] = ((int16_t)data[0] << 8) | data[1];
442  rawData_fxos8700.accel[0] /= 4;
443  rawData_fxos8700.accel[1] = ((int16_t)data[2] << 8) | data[3];
444  rawData_fxos8700.accel[1] /= 4;
445  rawData_fxos8700.accel[2] = ((int16_t)data[4] << 8) | data[5];
446  rawData_fxos8700.accel[2] /= 4;
447  rawData_fxos8700.mag[0] = ((int16_t)data[6] << 8) | data[7];
448  rawData_fxos8700.mag[1] = ((int16_t)data[8] << 8) | data[9];
449  rawData_fxos8700.mag[2] = ((int16_t)data[10] << 8) | data[11];
450 
451  /* Copy the converted sample to the streaming buffer. */
452  memcpy(streamingPacket + STREAMING_HEADER_LEN + STREAMING_PKT_TIMESTAMP_LEN, &rawData_fxos8700.accel,
453  sizeof(rawData_fxos8700.accel));
454  memcpy(streamingPacket + STREAMING_HEADER_LEN + STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_ACCEL_DATA_SIZE,
455  &rawData_fxos8700.mag, sizeof(rawData_fxos8700.mag));
456 
457  /*! Read the raw sensor data from the FXAS21002. */
458  status = FXAS21002_I2C_ReadData(&fxas21002Driver, fxas21002_Output_Values, data + FXOS8700_DATA_SIZE);
459  if (ARM_DRIVER_OK != status)
460  {
461  return -1;
462  }
463 
464  /* Convert to Little Endian, Right Justified, Even Padded Signed integer counts. */
465  rawData_fxas21002.gyro[0] = ((int16_t)data[12] << 8) | data[13];
466  rawData_fxas21002.gyro[1] = ((int16_t)data[14] << 8) | data[15];
467  rawData_fxas21002.gyro[2] = ((int16_t)data[16] << 8) | data[17];
468 
469  /* Copy the converted sample to the streaming buffer. */
470  memcpy(streamingPacket + STREAMING_HEADER_LEN + STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_DATA_SIZE,
471  &rawData_fxas21002.gyro, sizeof(rawData_fxas21002.gyro));
472 
473  /*! MPL3115 is in One-Shot Mode so we have to trigger acquizition of new sample based on OST bit. */
474  status = MPL3115_I2C_ReadData(&mpl3115Driver, cMpl3115GetOST, &dataReady_3115);
475  if (ARM_DRIVER_OK != status)
476  {
477  return -1;
478  }
480  {
481  /*! Read raw sensor data from the MPL3115. */
482  status = MPL3115_I2C_ReadData(&mpl3115Driver, mpl3115_Output_Values,
484  if (ARM_DRIVER_OK != status)
485  {
486  return -1;
487  }
488 
489  /* Convert to Little Endian, Right Justified, Even Padded Signed integer counts. */
490  rawData_mpl3115.pressure = (uint32_t)((data[18]) << 16) | ((data[19]) << 8) | ((data[20]));
491  rawData_mpl3115.pressure /= 16;
492  rawData_mpl3115.temperature = (int16_t)((data[21]) << 8) | (data[22]);
493  rawData_mpl3115.temperature /= 16;
494 
495  /* Copy the converted sample to the streaming buffer. */
496  memcpy(streamingPacket + STREAMING_HEADER_LEN + STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_DATA_SIZE +
498  &rawData_mpl3115.pressure, sizeof(rawData_mpl3115.pressure));
499  memcpy(streamingPacket + STREAMING_HEADER_LEN + STREAMING_PKT_TIMESTAMP_LEN + FXOS8700_DATA_SIZE +
501  &rawData_mpl3115.temperature, sizeof(rawData_mpl3115.temperature));
502 
503  /* Trigger acquisition of New Sample. */
504  status = Sensor_I2C_Write(mpl3115Driver.pCommDrv, &mpl3115Driver.deviceInfo, mpl3115Driver.slaveAddress,
505  cMpl3115SetOST);
506  if (ARM_DRIVER_OK != status)
507  {
508  return -1;
509  }
510  payLoadLen = STREAMING_PAYLOAD_LEN;
511  }
512  else
513  {
514  payLoadLen = STREAMING_PAYLOAD_SHORT_LEN;
515  }
516 
517  /*! Populate streaming header. */
518  Host_IO_Add_ISO_Header(gPrimaryStreamID, streamingPacket, payLoadLen);
519  /* Send streaming packet to Host. */
520  Host_IO_Send(streamingPacket, STREAMING_HEADER_LEN + payLoadLen, HOST_FORMAT_HDLC);
521 
522  if (toggle_pin++ == LED_TOGGLE_RATE)
523  { /* Toggle LED at slow refresh rate to make it perceivable. */
524  toggle_pin = 0; /* Toggle LED to indicate application is active. */
525  pGpioDriver->toggle_pin(&LED_GREEN);
526  }
527  }
528 }
#define FXOS8700_M_CTRL_REG1_M_HMS_MASK
Definition: fxos8700.h:2573
registerDeviceInfo_t deviceInfo
Definition: mpl3115_drv.h:64
uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart)
Function to compute the Elapsed Time.
Definition: systick_utils.c:99
#define STREAMING_PAYLOAD_SHORT_LEN
#define FXAS21002_CTRL_REG2_INT_EN_DRDY_MASK
Definition: fxas21002.h:783
#define FXAS21002_CTRL_REG2_INT_CFG_DRDY_INT1
Definition: fxas21002.h:812
#define FXOS8700_M_CTRL_REG1_M_ACAL_EN
Definition: fxos8700.h:2592
const registerwritelist_t cMpl3115SetOST[]
Register settings for Triggring One-Shot Sampling.
#define FXAS21002_CTRL_REG2_IPOL_MASK
Definition: fxas21002.h:780
ARM_DRIVER_I2C * pCommDrv
Definition: mpl3115_drv.h:65
#define __END_WRITE_DATA__
Definition: sensor_drv.h:71
int main(void)
Main function.
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
#define HOST_PRO_CMD_W_CFG_TAG
Definition: host_io_uart.h:89
int32_t gSystick
This structure defines the fxos8700 raw data buffer.
Definition: fxos8700_drv.h:79
volatile bool bDataLoggerReady
void FXOS8700_I2C_SetIdleTask(fxos8700_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
Definition: fxos8700_drv.c:278
int32_t MPL3115_I2C_Initialize(mpl3115_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
Definition: mpl3115_drv.c:48
#define HOST_S_SIGNAL_EVENT
Definition: frdm_k64f.h:120
char shieldString[ADS_MAX_STRING_LENGTH]
void Host_IO_Receive(host_cmd_proc_fn_t process_host_command, uint8_t encoding)
Definition: host_io_uart.c:233
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
Definition: Driver_GPIO.h:67
#define BOARD_BootClockRUN
Definition: clock_config.h:45
#define FXAS21002_CTRL_REG1_DR_MASK
Definition: fxas21002.h:710
#define LED_TOGGLE_RATE
volatile bool bStreamingEnabled
const registerwritelist_t fxas21002_Config_Isr[]
#define MPL3115_PADDING_SIZE
uint8_t data[FXLS8962_DATA_SIZE]
int32_t MPL3115_I2C_ReadData(mpl3115_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: mpl3115_drv.c:130
#define MPL3115_CTRL_REG1_OST_SET
Definition: mpl3115.h:871
int32_t status
#define FXAS21002_CTRL_REG2_INT_EN_DRDY_ENABLE
Definition: fxas21002.h:809
void(* toggle_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:74
#define INT1_FXAS21002
Definition: rd_kl25z_gdl.h:49
#define SHIELD_NAME
ARM_DRIVER_I2C * pCommDrv
Definition: fxos8700_drv.h:73
#define ADS_MAX_STRING_LENGTH
#define MPL3115_CTRL_REG1_OST_MASK
Definition: mpl3115.h:849
#define HOST_PRO_INT_DEV_TAG
Definition: host_io_uart.h:85
uint8_t streamingPacket[STREAMING_HEADER_LEN+FXLS8962_STREAM_DATA_SIZE]
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
Definition: sensor_drv.h:123
This defines the sensor specific information for I2C.
Definition: fxos8700_drv.h:70
const registerreadlist_t fxas21002_Output_Values[]
The fxas21002_drv.h file describes the fxas21002 driver interface and structures. ...
#define HOST_PRO_INT_CMD_TAG
Bit aligned values for Host Protocol Interface IDs (Bits 5-6).
Definition: host_io_uart.h:83
char boardString[ADS_MAX_STRING_LENGTH]
#define FXOS8700_M_CTRL_REG2_M_RST_CNT_DISABLE
Definition: fxos8700.h:2693
bool process_host_command(uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
#define __END_READ_DATA__
Definition: sensor_drv.h:77
void MPL3115_I2C_SetIdleTask(mpl3115_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
Definition: mpl3115_drv.c:79
#define MPL3115_WHOAMI_VALUE
Definition: mpl3115.h:65
const registerwritelist_t fxos8700_Config_Hybrid[]
#define FXAS21002_CTRL_REG2_INT_CFG_DRDY_MASK
Definition: fxas21002.h:786
#define FXOS8700_WHO_AM_I_PROD_VALUE
Definition: fxos8700.h:172
#define MPL3115_DATA_SIZE
This defines the sensor specific information.
Definition: mpl3115_drv.h:62
This structure defines the fxas21002 raw data buffer.
Definition: fxas21002_drv.h:79
This defines the sensor specific information for I2C.
Definition: fxas21002_drv.h:70
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_MASK
Definition: fxos8700.h:2660
#define FXOS8700_M_CTRL_REG1_M_ACAL_MASK
Definition: fxos8700.h:2585
#define FXOS8700_ACCEL_DATA_SIZE
#define APPLICATION_NAME
Unique Name for this application which should match the target GUI pkg name.
const registerreadlist_t fxos8700_Output_values[]
#define nmi_handler
void Host_IO_Add_ISO_Header(uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload)
Definition: host_io_uart.c:112
void Host_IO_Send(uint8_t *pMsg, size_t size, uint8_t encoding)
Definition: host_io_uart.c:162
void(* set_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:72
void(* clr_pin)(pinID_t aPinId)
Definition: Driver_GPIO.h:73
int32_t FXOS8700_I2C_Initialize(fxos8700_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
Definition: fxos8700_drv.c:248
#define MPL3115_PRESSURE_DATA_SIZE
int32_t FXAS21002_I2C_ReadData(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
void BOARD_SystickEnable(void)
Function to enable systicks framework.
Definition: systick_utils.c:70
int32_t FXOS8700_I2C_ReadData(fxos8700_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: fxos8700_drv.c:331
registerDeviceInfo_t deviceInfo
Definition: fxos8700_drv.h:72
#define FXOS8700_M_CTRL_REG2_M_AUTOINC_HYBRID_MODE
Definition: fxos8700.h:2667
#define I2C_S_DEVICE_INDEX
Definition: issdk_hal.h:61
#define APPLICATION_VERSION
Version to distinguish between instances the same application based on target Shield and updates...
#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE
Definition: fxas21002.h:428
#define FXAS21002_I2C_ADDR
int32_t FXAS21002_I2C_Configure(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define I2C_S_DRIVER
Definition: issdk_hal.h:59
void fxas21002_isr(void *pUserData)
#define FXOS8700_M_CTRL_REG2_M_RST_CNT_MASK
Definition: fxos8700.h:2648
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Definition: gpio_driver.c:203
const registerreadlist_t mpl3115_Output_Values[]
Address and size of Raw Pressure+Temperature Data in Normal Mode.
int32_t FXOS8700_I2C_Configure(fxos8700_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
Definition: fxos8700_drv.c:286
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
void FXAS21002_I2C_SetIdleTask(fxas21002_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
#define BOARD_DEBUG_UART_BAUDRATE
Definition: board.h:57
The mpl3115_drv.h file describes the MPL3115 driver interface and structures.
#define FXOS8700_CTRL_REG1_DR_MASK
Definition: fxos8700.h:1530
Access structure of the GPIO Driver.
Definition: Driver_GPIO.h:64
#define MPL3115_I2C_ADDR
void BOARD_SystickStart(int32_t *pStart)
Function to Record the Start systick.
Definition: systick_utils.c:79
const registerreadlist_t cMpl3115GetOST[]
Address of Register containing OST Bit.
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.
uint8_t gPrimaryStreamID
uint8_t Host_IO_Init(ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress)
Definition: host_io_uart.c:126
This structure defines the Write command List.
Definition: sensor_drv.h:94
This structure defines the Read command List.
Definition: sensor_drv.h:104
#define SMC
Definition: lpc54114.h:144
#define LED_GREEN
Definition: rd_kl25z_gdl.h:58
volatile bool bFxas21002DataReady
#define FXOS8700_DATA_SIZE
The host_io_uart.h file contains the Host Protocol interface definitions and configuration.
#define FXAS21002_CTRL_REG1_DR_200HZ
Definition: fxas21002.h:732
#define STREAMING_HEADER_LEN
Definition: host_io_uart.h:51
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
Definition: lpc54114.c:181
#define FXAS21002_DATA_SIZE
#define STREAMING_PKT_TIMESTAMP_LEN
char embAppName[ADS_MAX_STRING_LENGTH]
#define FXAS21002_CTRL_REG2_IPOL_ACTIVE_HIGH
Definition: fxas21002.h:808
#define FXOS8700_I2C_ADDR
#define FXOS8700_CTRL_REG1_DR_HYBRID_200_HZ
Definition: fxos8700.h:1553
#define FXOS8700_M_CTRL_REG1_M_HMS_HYBRID_MODE
Definition: fxos8700.h:2621
#define STREAMING_PAYLOAD_LEN
This structure defines the mpl3115 data buffer in Pressure Mode.
Definition: mpl3115_drv.h:71
#define MPL3115_CTRL_REG1_OST_RESET
Definition: mpl3115.h:870
GENERIC_DRIVER_GPIO * pGpioDriver
#define I2C_S_SIGNAL_EVENT
Definition: issdk_hal.h:60
#define HOST_S_DRIVER
Definition: frdm_k64f.h:119
int32_t FXAS21002_I2C_Initialize(fxas21002_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
Definition: sensor_io_i2c.c:97
registerDeviceInfo_t deviceInfo
Definition: fxas21002_drv.h:72