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