ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fsl_fxas21002_i2cspi_3D_gyro.c
Go to the documentation of this file.
1 /**
2  ********************************************************************************
3  * File: fsl_fxas21002_i2cspi_3D_gyro.c.c
4  *
5  * Copyright (c) 2013, Freescale Semiconductor, Inc.
6  *
7  *******************************************************************************/
8 /**
9  * @file fsl_fxas21002_i2cspi_3D_gyro.c
10  * @brief The FXAS21002 is a 3-axis Angular Rate Gyroscope from Freescale that supports both I2C and SPI
11  * protocols. This source file implements the interface for the FXAS21002 Sensor Adapter.
12  * It uses Device Messaging (DM), which abstracts away the differences between the I2C and
13  * SPI protocols, to communicate with the device. This choice is made via the system
14  * communication file, isf_sysconf_comms.c. This file also uses the Bus Manager (BM) to
15  * schedule a periodic callback for reading new sensor data and sending the data to the
16  * Sensor Manager (SM).
17  */
18 #include <mqxlite.h>
19 #include <isf.h>
20 #include <isf_types.h>
21 #include <lwmem.h>
22 #include <lwsem.h>
23 #include <lwevent.h>
24 #include <isf_sm_api.h>
25 #include <isf_dsa_adapter.h>
26 #include <isf_bm.h>
27 #include <isf_sensor_types.h>
28 #include <isf_fifo.h>
29 #include <isf_gyrometer_types.h>
30 #include <isf_magnetometer_types.h>
31 #include <isf_comm.h>
32 #include <isf_util.h>
33 #include <isf_sensors.h>
34 #include "fsl_i2c_master_driver.h"
36 #include "fxas21002.h"
37 #include "lwmem.h"
38 
39 /**
40  * @brief Local function declaration for validating the Device ID using the "WHOAMI" command.
41  */
42 static fxas21002_Status_t device_check_whoami(dm_DeviceDescriptor_t* pDeviceHandle, uint8 whoami);
43 /**
44  * @brief Local function declaration for setting the appropriate power mode.
45  */
46 static fxas21002_Status_t device_set_power_mode(dm_DeviceDescriptor_t* pDeviceHandle, fxas21002_Power_t power);
47 /**
48  * @brief Local function declaration for handling the wait state during device activation.
49  */
50 static fxas21002_Status_t device_wait_for_active(dm_DeviceDescriptor_t* pDeviceHandle);
51 /**
52  * @brief Local function declaration for getting ODR value from the given sample period.
53  */
54 static int32 get_ODR(uint32 samplePeriod);
55 
57 
58 /*! @brief Supported sensor and data types for FXAS21002 */
61 
62 // Converter routines for the supported data types
63 static isf_dsa_status_t float_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample );
64 static isf_dsa_status_t fixed_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample );
65 static isf_dsa_status_t float_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample );
66 static isf_dsa_status_t fixed_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample );
67 
68 #define MAX_GYRO_FULL_SCALE_RANGE 2
69 
70 #define FXAS21002_SAMPLE_PERIOD_MAX 640000 // Maximum sample period supported by the FXAS21002.
71 #define FXAS21002_SAMPLE_PERIOD_MIN 5000 // Minimum sample period supported by the FXAS21002.
72 #define GET_ODR_CONFIG 0x0 // Flag enables the configuration value.
73 #define GET_ODR_VALUE 0x01 // Flag enables the ODR value.
74 
75 #define MAX_FXAS21002_DM_BYTES 0x16 // Maximum number of read/write using direct device messaging to address the registers. This is the maximum number of register in 8700.
76 #define NUM_INTERNAL_ADDRESS_BYTES 0x1 // Size of the internal address byte.
77 
78 /**
79  *
80  *@brief The table that describes the configuration value based on ODR (output data rate).
81  *Note: This table is irregular after the 25HZ, so can't use FLOORLOG2 algorithm.
82  */
84  { 5000, 0},
85  { 10000, 1},
86  { 20000, 2},
87  { 40000, 3},
88  { 80000, 4},
89  { 160000, 5},
90  { 320000, 6},
91  { 640000, 7},
92 };
93 /**
94  *
95  *@brief The table that describes the configuration value based on ODR (output data rate).
96  *Note: This table is irregular after the 25HZ, so can't use FLOORLOG2 algorithm.
97  */
99  { 1250, 0},
100  { 2500, 1},
101  { 5000, 2},
102  { 10000, 3},
103  { 20000, 4},
104  { 40000, 5},
105  { 80000, 6},
106  { 80000, 7},
107 };
108 /*
109  * @brief This table contains the Gyro conversion factors based on the full-scale range selected.
110  */
111 const struct
112 {
113  float floatFactor;
114  float floatOffset;
118 {
119  { 0.0625, 0.0, 4096, 0},
120  { 0.03125, 0.0, 2048, 0},
121  { 0.01563, 0.0, 1024, 0},
122  { 0.00782, 0.0, 512, 0}
123 },
125 {
126  { 0.200, 0.0, 13107, 0},
127  { 0.100, 0.0, 6554, 0},
128  { 0.050, 0.0, 3277, 0},
129  { 0.025, 0.0, 1638, 0}
130 };
131 
132 //fxas21002_DeviceDescriptor_t* gpDeviceDescriptor = NULL;
133 /**
134  *
135  *@brief The table that describes the extended address space.
136  */
138 
139 #define MAX_DATA_READ_SIZE 6 // Maximum number of data
140 #define MAX_BUF_SIZE 6 // Maximum buffer size
141 
142 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter initialization.
143  * @details This function allocates memory for the device descriptor.
144  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
145  *
146  * @return ::fsl_fxas21002_i2cspi_3D_gyro_Initialize() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
147  * @retval ::ISF_SUCCESS is returned when the device is initialized properly.
148  * @retval ::DSA_ERR_PARAM is returned when a wrong parameter was passed into the function, i.e. an invalid or NULL parameter.
149  * @retval ::DSA_ERR_INITIALIZE is returned when the driver could not be initialized successfully.
150 
151  *
152  * @Constraints None
153  *
154  * @Reentrant Yes
155  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
156  */
158 {
159  // Check the input argument
160  if (NULL == pSensorHandle) {
161  return DSA_ERR_PARAM;
162  }
163 
164  // Check if the sensor is available, and that it has already been initialized.
165  if (pSensorHandle->adapterStatus > DSA_STATE_NOT_INITIALIZED) {
166  return DSA_ERR_INITIALIZE;
167  }
168 
169  // Allocate memory for the device descriptor
170  pSensorHandle->pDeviceDescriptor = _lwmem_alloc(sizeof(DeviceDescriptor_t));
171 
172  // Hold the descriptor pointers in local variables for upcoming operations
173  DeviceDescriptor_t *pDeviceDescriptor = (DeviceDescriptor_t*)pSensorHandle->pDeviceDescriptor;
174 
175  if (NULL == pDeviceDescriptor) {
176  return DSA_ERR_INITIALIZE;
177  }
178 
179  // Allocate the current sample data buffer and initialize it.
180  pDeviceDescriptor->pCurrentSample = _lwmem_alloc_system_zero(sizeof(fxas21002_DataBuffer_t));
181  fxas21002_DataBuffer_t *pCurrentSampleBuffer = (fxas21002_DataBuffer_t *)pDeviceDescriptor->pCurrentSample;
182  pCurrentSampleBuffer->timeStamp = 0;
183  pCurrentSampleBuffer->gyro[0] = 0;
184  pCurrentSampleBuffer->gyro[1] = 0;
185  pCurrentSampleBuffer->gyro[2] = 0;
186 
187  pCurrentSampleBuffer->addr = ((i2c_device_t *)pSensorHandle->pSensorStaticConfig->commInfo)->address;
188 
189  dm_ChannelDescriptor_t * pChannelDescriptor = &pDeviceDescriptor->cDescriptor;
190 
191  // Initialize the channel
192  if(ISF_SUCCESS != dm_channel_init(pSensorHandle->pSensorStaticConfig->channelId, pChannelDescriptor)){
193  return DSA_ERR_INITIALIZE;
194  }
195  // Start the Bus
196  if(ISF_SUCCESS != dm_channel_start(pChannelDescriptor)){
197  return DSA_ERR_INITIALIZE;
198  }
199 
200  // Get the Channel state to check if it is ready to use
201  if (COMM_STATE_OK != dm_channel_get_state(pChannelDescriptor)) {
202  return DSA_ERR_INITIALIZE;
203  }
204 
205  // Open the device and get the device handler
206  if(ISF_SUCCESS != dm_device_open(pChannelDescriptor, (void *)pSensorHandle->pSensorStaticConfig->commInfo, &pDeviceDescriptor->deviceHandle)){
207  return DSA_ERR_INITIALIZE;
208  }
209 
210  // Check that it's LEON2 and not some other device with the same address
211  if ((ISF_SUCCESS != device_check_whoami(&pDeviceDescriptor->deviceHandle, FXAS21000_WHOAMI_VALUE)) || (ISF_SUCCESS != device_check_whoami(&pDeviceDescriptor->deviceHandle, FXAS21002_WHOAMI_VALUE)) ) {
212 
213  }
214  else{
215  return DSA_ERR_INITIALIZE;
216  }
217 
218  // Set the adapter state to be initialized.
219  pSensorHandle->adapterStatus = DSA_STATE_INITIALIZED;
220 
221  // Create a semaphore to synchronize the device descriptor across tasks
222  if (MQX_OK != _lwsem_create(&pDeviceDescriptor->deviceSemaphore, 1)){
223  return DSA_ERR_INITIALIZE;
224  }
225 
226  pDeviceDescriptor->skipFramecnt = 0;
227 
228  return ISF_SUCCESS;
229 }
230 
231 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for validating current settings.
232  * @details This function is responsible for validating the current settings and if the current settings are not valid settings,
233  * it provides the best suitable settings.
234  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
235  * @param[in] pSensorSettings The reference to the sensor settings.
236  *
237  * @return ::fsl_fxas21002_i2cspi_3D_gyro_ValidateSettings() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
238  * @retval ::ISF_SUCCESS is returned when the device settings are successfully validated.
239  * @retval ::DSA_RET_SETTINGS_CHANGED is returned when the current settings have been changed.
240  *
241  * @Constraints None
242  *
243  * @Reentrant Yes
244  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
245  */
247 {
248  // Check the input arguments.
249  if ((NULL == pSensorHandle) || (NULL == pSensorSettings)) {
250  return DSA_ERR_PARAM;
251  }
252 
253  // Set the default return status
254  isf_dsa_status_t retStatus = ISF_SUCCESS;
255 
256  // Check the sample period
257  int32 odr = get_ODR(pSensorSettings->nSamplePeriod);
258 
259  if (odr < 0)
260  {
261  retStatus = DSA_RET_SETTINGS_CHANGED;
262  }
263 
264  return retStatus;
265 }
266 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for configuration.
267  * @details This function resets the sensor, applies the settings, and registers a callback with the Bus Manager(BM) timer. It does
268  * not yet start the timer, as this is done by fsl_fxas21002_i2cspi_3D_gyro_StartData().
269  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21000 sensor adapter.
270  * @param[in] pSensorSettings The reference to the sensor configuration settings.
271  *
272  * @return ::fsl_fxas21002_i2cspi_3D_gyro_Configure() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
273  * @retval ::ISF_SUCCESS is returned when the device is configured successfully.
274  * @retval ::DSA_ERR_CONFIGURE is returned when the provided configuration settings could not be applied.
275  *
276  * @Constraints None
277  *
278  * @Reentrant Yes
279  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
280  */
281 //#define DEBUG_READ_ALL_REGS
282 #ifdef DEBUG_READ_ALL_REGS
283 static uint8 debugRegs[120];
284 #endif
286 {
287  // Check the input arguments
288  if ((NULL == pSensorHandle) || (NULL == pSensorSettings)) {
289  return DSA_ERR_PARAM;
290  }
291 
292  int32_t status;
294 
295  // Get the device descriptor and sensor specific settings
296  DeviceDescriptor_t* pDeviceDescriptor = pSensorHandle->pDeviceDescriptor;
297 
299 
300  // Check the device descriptor pointer.
301  if ((NULL == pDeviceDescriptor) || (NULL == pSpecificSettings))
302  {
303  return DSA_ERR_PARAM;
304  }
305 
306 
307  // Lock the device descriptor.
308  _lwsem_wait_ticks(&pDeviceDescriptor->deviceSemaphore, 0);
309 
310  // Check the driver state.
311  if (DSA_STATE_INITIALIZED > pSensorHandle->adapterStatus){
312  goto unlockdescriptor;
313  }
314 
315  // User Notice: This is a required function call. If it is not here, there may be conflicts, data loss,
316  // or any number of undesirable things may occur.
317  if (ISF_SUCCESS != dm_channel_acquire_lock(&pDeviceDescriptor->cDescriptor, 0)) {
318  goto unlockdescriptor;
319  }
320 
321  /* Set FXAS21002 into Standby before configuration */
322  {
323  uint8 buffer[1];
324  if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle,FXAS21002_CTRL_REG1, buffer, 1, 1))
325  {
326  goto unlockchannel;
327  }
328  buffer[0] = (buffer[0] & ~ (FXAS21002_ACTIVE_MASK | FXAS21002_READY_MASK ));
329  if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, FXAS21002_CTRL_REG1,buffer,1,1))
330  {
331  goto unlockchannel;
332  }
333  }
334 
335  /* Write the sensor specific data based on the pre-computed register level pairs (Addr, Value) */
336  {
337  uint8 buffer[1];
338 
339  uint32 cnt=pSpecificSettings->regCount;
341  {
342  cnt=2;
343  }
344  for (uint32 reg=0; reg < cnt ; reg++)
345  {
346  buffer[0] = pSpecificSettings->regPairs[reg].regValue;
347  if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, pSpecificSettings->regPairs[reg].regAddr,&buffer[0],1,1))
348  {
349  goto unlockchannel;
350  }
351  }
352  }
353 
354  /* Configure the ODR based on the calculated value */
355  {
356  uint8 buffer[1];
357  if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle,FXAS21002_CTRL_REG1, buffer, 1, 1))
358  {
359  goto unlockchannel;
360  }
361  buffer[0] |= FXAS21002_SET_FIELD(DR,(uint8)get_ODR(pSensorSettings->nSamplePeriod));
362  if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, FXAS21002_CTRL_REG1,buffer,1,1))
363  {
364  goto unlockchannel;
365  }
366  }
367 #ifdef DEBUG_READ_ALL_REGS
368  for (int i=0; i<sizeof(debugRegs); i++)
369  {
370  dm_device_read(&pDeviceDescriptor->deviceHandle,i, &debugRegs[i], 1, 1);
371  }
372 #endif
373  // Register to bus management timer
375 
376  // Check if there was an error registering with the bus management timer
377  if(BM_ERROR & pDeviceDescriptor->token){
378  goto unlockchannel;
379  }
380 
382  retStatus = ISF_SUCCESS;
383 
384  unlockchannel:
385  // Unlock the channel.
386  // The explicit lock must be released when the configuration is done allowing the bus to be used by others.
387  // User Notice: This is a required function call.
388  status = dm_channel_release_lock(&pDeviceDescriptor->cDescriptor);
389  if (ISF_SUCCESS != status)
390  {
391  retStatus = DSA_ERR_CONFIGURE;
392  }
393 
394  unlockdescriptor:
395 
396  // Unlock the device descriptor.
397  _lwsem_post(&pDeviceDescriptor->deviceSemaphore);
398 
399  return retStatus;
400 }
401 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for start Data.
402  * @details This function tells the Bus Manager to start the callbacks periodically as defined in the bus configuration and enable the data collection.
403  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
404  *
405  * @return ::fsl_fxas21002_i2cspi_3D_gyro_StartData() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
406  * @retval ::ISF_SUCCESS is returned when the data collection callback triggered successfully.
407  * @retval ::DSA_ERR_PARAM is returned when a wrong parameter is passed into the function such as an invalid or NULL parameter.
408  *
409  * @Constraints None
410  *
411  * @Reentrant Yes
412  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
413  */
415 {
416  // Check the input argument
417  if (NULL == pSensorHandle) {
418  return DSA_ERR_PARAM;
419  }
420 
422  // Get the device descriptor and specific settings
423  DeviceDescriptor_t* pDeviceDescriptor = pSensorHandle->pDeviceDescriptor;
424 
425  // Check the device descriptor.
426  if (NULL == pDeviceDescriptor)
427  return DSA_ERR_PARAM;
428 
429  // Lock the device descriptor.
430  _lwsem_wait_ticks(&pDeviceDescriptor->deviceSemaphore, 0);
431 
432  // Check the driver state.
433  if (DSA_STATE_CONFIGURED_STOPPED > pSensorHandle->adapterStatus)
434  {
435  goto unlockdescriptor;
436  }
437 
438  // Put the device into active mode
439  if (ISF_SUCCESS != device_set_power_mode(&pDeviceDescriptor->deviceHandle, FXAS21002_POWER_ACTIVE)) {
440  goto unlockdescriptor;
441  }
442 
443  // Wait for transition into active mode to complete
444  if (ISF_SUCCESS != device_wait_for_active(&pDeviceDescriptor->deviceHandle)) {
445  goto unlockdescriptor;
446  }
447  // Start the Bus Manager sampling timer.
448  if (BM_ERROR & bm_start(FALSE, pDeviceDescriptor->token)){ // Check for Bus Manager error and return on failure.
449  goto unlockdescriptor;
450  }
451  // Set device to active state.
453  retStatus = ISF_SUCCESS;
454 
455  unlockdescriptor:
456  // Unlock the device descriptor.
457  _lwsem_post(&pDeviceDescriptor->deviceSemaphore);
458 
459  return retStatus;
460 }
461 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for End Data.
462  * @details This function tells the Bus Manager to stop the callbacks and disable data collection.
463  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
464  *
465  * @return ::fsl_fxas21002_i2cspi_3D_gyro_EndData() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
466  * @retval ::ISF_SUCCESS is returned when the data collection stopped successfully.
467  * @retval ::DSA_ERR_PARAM is returned when a wrong parameter is passed into the function such as an invalid or NULL parameter.
468  *
469  * @Constraints None
470  *
471  * @Reentrant Yes
472  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
473  */
475 {
476  // Check pointers.
477  if(NULL == pSensorHandle){
478  return DSA_ERR_PARAM;
479  }
480  // Set the default return status
482  // Create helper reference pointers.
483  DeviceDescriptor_t* pDeviceDescriptor = (DeviceDescriptor_t*)pSensorHandle->pDeviceDescriptor;
484 
485  // Check the device descriptor.
486  if (NULL == pDeviceDescriptor)
487  return DSA_ERR_PARAM;
488 
489  // Lock the device descriptor.
490  _lwsem_wait_ticks(&pDeviceDescriptor->deviceSemaphore, 0);
491 
492  // Check the driver state.
493  if (DSA_STATE_CONFIGURED_STOPPED >= pSensorHandle->adapterStatus)
494  {
495  goto unlockdescriptor;
496  }
497 
498  // Check that the adapter is not already started.
499  if (DSA_STATE_CONFIGURED_STARTED == pSensorHandle->adapterStatus) {
500  // If it is, then stop the Bus Manager (BM) sample timer.
501  isf_status_t bmStopStatus = bm_stop(pDeviceDescriptor->token);
502  if (BM_ERROR & bmStopStatus)
503  {
504  goto unlockdescriptor;
505  }
506 
507  }
508 
509  // Put the device into standby mode
510  if (ISF_SUCCESS != device_set_power_mode(&pDeviceDescriptor->deviceHandle, FXAS21002_POWER_STANDBY)) {
511  goto unlockdescriptor;
512  }
513 
515  retStatus = ISF_SUCCESS;
516 
517 
518  unlockdescriptor:
519  // Unlock the device descriptor.
520  _lwsem_post(&pDeviceDescriptor->deviceSemaphore);
521 
522  return retStatus;
523 }
524 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for calibration .
525  * @details The FXAS21000 does not provide the capability to be dynamically calibrated. Therefore, this function simply returns success.
526  *
527  * @param[in] pSensorHandle This is a pointer to the instance of the FXAS21002 sensor adapter.
528  * @param[in] pCalData This is a void pointer to the calibration data.
529  @return ::fsl_fxas21002_i2cspi_3D_gyro_Calibrate() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
530  * @retval ::ISF_SUCCESS is returned when the device is calibrated properly.
531  * \b Note: Currently, there is no return error type defined for this API.
532  *
533  * @Constraints None
534  *
535  * @Reentrant Yes
536  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
537  */
539 {
540  return ISF_SUCCESS;
541 }
542 /*! @brief This is the concrete implementation of the FXAS21002 sensor adapter for shutdown .
543  *
544  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
545  *
546  @return ::fsl_fxas21002_i2cspi_3D_gyro_Shutdown() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
547  * @retval ::ISF_SUCCESS is returned when the device is calibrated properly.
548  * \b Note: Currently, there is no return error type defined for this API.
549  *
550  * @Constraints None
551  *
552  * @Reentrant Yes
553  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
554  */
556 {
557  if(NULL == pSensorHandle){
558  return DSA_ERR_PARAM;
559  }
560  // Set the default return status
561  isf_dsa_status_t retStatus = ISF_SUCCESS;
562  // Create helper reference pointers.
563  DeviceDescriptor_t* pDeviceDescriptor = (DeviceDescriptor_t*)pSensorHandle->pDeviceDescriptor;
564 
565  // Remove the sensor adapter from the Bus Manager callbacks.
566  if(ISF_SUCCESS != bm_unregister_callback(pDeviceDescriptor->token))
567  {
568  return DSA_ERR_SHUTDOWN;
569  }
570  pSensorHandle->adapterStatus = DSA_STATE_INITIALIZED;
571  return retStatus;
572 }
573 /*! @brief The callback function for the Bus Manager(BM).
574  * @details The Bus Manager calls this function periodically based on the period configured for the FXAS21002.
575  *
576  * @param[in] pSensorHandle This is a void pointer to the instance of the FXAS21002 sensor adapter.
577  *
578  * @return Void There is no return value.
579  *
580  * @Constraints None
581  *
582  * @Reentrant Yes
583  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
584  */
586 {
587  // Check the input argument
588  if (NULL == pSensorHandle) {
589  return;
590  }
591 
592  // Get the device descriptor and specific settings
593  volatile isf_SensorHandle_t *pSensorHdl = (isf_SensorHandle_t *)pSensorHandle;
595  DeviceDescriptor_t *pDeviceDescriptor = (DeviceDescriptor_t*)pSensorHdl->pDeviceDescriptor;
596 
597  isf_status_t st;
598  int32 numBytes;
599 
600  // Check the device descriptor
601  if (NULL == pDeviceDescriptor){
602  return;
603  }
604 
605  // Create a helper pointer to the current sample buffer.
606  fxas21002_DataBuffer_t *pCurrentSampleBuffer = (fxas21002_DataBuffer_t *)pDeviceDescriptor->pCurrentSample;
607 
608  // Apply sample skip if necessary.
609  if (pDeviceDescriptor->skipFramecnt) {
610  // Not done skipping samples.
611  --pDeviceDescriptor->skipFramecnt;
612  return;
613  }
614 
615  // Get the time stamp
616  pCurrentSampleBuffer->timeStamp = isf_time_util_get_usec();
617 
618  // Lock the device descriptor.
619  if (MQX_OK !=_lwsem_wait_ticks(&pDeviceDescriptor->deviceSemaphore, 0))
620  {
621  goto unlockdescriptor;
622  }
623 
624  // Check the driver state.
625  if (DSA_STATE_CONFIGURED_STARTED != pSensorHdl->adapterStatus)
626  {
627  goto unlockdescriptor;
628  }
629 
630  // Get the time stamp
631  pCurrentSampleBuffer->timeStamp = isf_time_util_get_usec();
632 
633 #ifdef DEBUG_READ_ALL_REGS
634  for (int i=0; i<sizeof(debugRegs); i++)
635  {
636  dm_device_read(&pDeviceDescriptor->deviceHandle,i, &debugRegs[i], 1, 1);
637  }
638 #endif
639 
640  // read the gyroscope data.
641  dm_device_read(&pDeviceDescriptor->deviceHandle, FXAS21002_OUT_X_MSB, (uint8 *)&pCurrentSampleBuffer->gyro[0], MAX_BUF_SIZE,MAX_DATA_READ_SIZE);
642 
643  // Convert the samples to big endian.
644  pCurrentSampleBuffer->gyro[0] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->gyro[0]);
645  pCurrentSampleBuffer->gyro[1] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->gyro[1]);
646  pCurrentSampleBuffer->gyro[2] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->gyro[2]);
647 
648 
649  // Lock the fifo for update.
650  if(MQX_OK != isf_fifo_lock(pFifo)){
651  return;
652  }
653 
655 
656  // write the new data
658  {
659  *pFifoEntry = *pCurrentSampleBuffer;
660  }
661  else
662  {
664  pSensorHdl,
667  pCurrentSampleBuffer,
668  pFifoEntry,
669  &numBytes);
670  }
671 
672  // Increment the fifo to the next sample entry.
673  st = isf_fifo_el_increment(pFifo);
674 
675  // Unlock the fifo.
676  isf_fifo_unlock(pFifo);
677 
678  if (st == ISF_FIFO_FULL)
679  {
680  // Notify the user using their registered event information
681  _lwevent_set(pSensorHdl->controlData.pEventGroup,(_mqx_uint)pSensorHdl->controlData.nEventFieldIndex);
682  }
683 
684  unlockdescriptor:
685  // Unlock the device descriptor.
686  _lwsem_post(&pDeviceDescriptor->deviceSemaphore);
687 
688 }
689 /*!
690  * @brief This function coverts the raw sample data to the desired output type.
691  */
693 (
694  volatile isf_SensorHandle_t *pSensorHandle,
695  isf_SensorDataTypes_t convertToType,
696  isf_dsa_result_types_t resultType,
697  void *pNativeSample,
698  void *pConvertedSample,
699  int32 *numBytes
700 )
701 {
704 
705  pConverter = NULL;
706 
707  switch (convertToType)
708  {
710  if (resultType == DSA_RESULT_TYPE_ENG_FLOAT)
711  pConverter = float_gyro3d_converter;
712  else if (resultType == DSA_RESULT_TYPE_ENG_FIXED)
713  pConverter = fixed_gyro3d_converter;
714  break;
715 
716  default:
718  }
719  if (pConverter == NULL)
721 
722  retStatus = pConverter(
724  (fxas21002_DataBuffer_t *)pNativeSample,
725  pConvertedSample
726  );
727 
728  return retStatus;
729 }
730 
731 static isf_dsa_status_t float_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample )
732 {
734  {
735  isf_AngularVelocity3D__float_t *convertedSample = (isf_AngularVelocity3D__float_t *)vpConvertedSample;
736  convertedSample->timestamp = nativeSample->timeStamp;
737  // Convert the sample based on the full-scale range.
738  convertedSample->angularVelocity[0] = nativeSample->gyro[0] * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
739  convertedSample->angularVelocity[1] = nativeSample->gyro[1] * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
740  convertedSample->angularVelocity[2] = nativeSample->gyro[2] * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
741  return ISF_SUCCESS;
742  }
744  {
745  isf_AngularVelocity3D__float_t *convertedSample = (isf_AngularVelocity3D__float_t *)vpConvertedSample;
746  convertedSample->timestamp = nativeSample->timeStamp;
747  // Convert the sample based on the full-scale range.
748  convertedSample->angularVelocity[0] = nativeSample->gyro[0] * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
749  convertedSample->angularVelocity[1] = nativeSample->gyro[1] * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
750  convertedSample->angularVelocity[2] = nativeSample->gyro[2] * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].floatOffset;
751  return ISF_SUCCESS;
752  }
753 
754  return ISF_SUCCESS;
755 }
756 
757 static isf_dsa_status_t fixed_gyro3d_converter(fxas21002_Sensor_Specific_Settings_t *pSensorSpecificConfig, fxas21002_DataBuffer_t *nativeSample, void *vpConvertedSample )
758 {
760  {
761  isf_AngularVelocity3D_EngFixed_t *convertedSample = (isf_AngularVelocity3D_EngFixed_t *)vpConvertedSample;
762  convertedSample->timestamp = nativeSample->timeStamp;
763  // Convert the sample based on the full-scale range.
764  convertedSample->angularVelocity[0] = (nativeSample->gyro[0]/4 * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
765  convertedSample->angularVelocity[1] = (nativeSample->gyro[1]/4 * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
766  convertedSample->angularVelocity[2] = (nativeSample->gyro[2]/4 * fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21000GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
767  return ISF_SUCCESS;
768  }
770  {
771  isf_AngularVelocity3D_EngFixed_t *convertedSample = (isf_AngularVelocity3D_EngFixed_t *)vpConvertedSample;
772  convertedSample->timestamp = nativeSample->timeStamp;
773  // Convert the sample based on the full-scale range.
774  convertedSample->angularVelocity[0] = (nativeSample->gyro[0]/4 * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
775  convertedSample->angularVelocity[1] = (nativeSample->gyro[1]/4 * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
776  convertedSample->angularVelocity[2] = (nativeSample->gyro[2]/4 * fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedFactor + fxas21002GyroConvTable[pSensorSpecificConfig->gyroFullScaleRange].fixedOffset);
777  return ISF_SUCCESS;
778  }
779 
780  return ISF_SUCCESS;
781 }
782 
783 /*! @brief The local function for validating the device id.
784  * @details This function reads the WHOAMI register value and compares it against the known FXAS21002 WHOAMI value.
785  *
786  * @param[in] pDeviceHandle This is a reference to the device handle holding information about the device communication.
787  * @param[in] whoami The known WHOAMI value of the FXAS21002
788  *
789  * @return ::device_check_whoami() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
790  * @retval ::ISF_SUCCESS is returned when the device is validated with its WHOAMI value.
791  * @retval ::FXAS21002_ERROR_WHOAMI is returned when device could validates with its WHOAMI value.
792  * *
793  * @Constraints None
794  *
795  * @Reentrant Yes
796  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
797  */
798 static fxas21002_Status_t device_check_whoami(dm_DeviceDescriptor_t* pDeviceHandle, uint8 whoami) {
799 
800 
801  uint8 buffer[1] = {0x00};
802 
803  dm_device_read(pDeviceHandle, FXAS21002_WHO_AM_I, buffer, 1, 1); // don't check the return code
804  whoami_read_val=buffer[0];
805  if (whoami == buffer[0]) {
806  return ISF_SUCCESS;
807  }
808  else
809  {
810  return FXAS21002_ERROR_WHOAMI;
811  }
812 }
813 
814 /*! @brief The local function to set the power mode in the FXAS21002.
815  * @details This function sets the POWER MODE from options such as ACTIVE, READY and STANDBY Mode.
816  *
817  * @param[in] pDeviceHandle This is a reference to the device handle holding information about the device communication.
818  * @param[in] power The value of the power.
819  *
820  * @return ::device_set_power_mode() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
821  * @retval ::ISF_SUCCESS is returned when the device is configured with the specified power mode.
822  * @retval ::FXAS21002_ERROR_SETPOWER is returned when the device could not be configured with the specified power mode.
823  * *
824  * @Constraints None
825  *
826  * @Reentrant Yes
827  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
828  */
829 static fxas21002_Status_t device_set_power_mode(dm_DeviceDescriptor_t* pDeviceHandle, fxas21002_Power_t power) {
830  // Read the current power mode from the device
831 
832  uint8 buffer[1];
833 
834  if (ISF_SUCCESS != dm_device_read(pDeviceHandle,FXAS21002_CTRL_REG1, buffer, 1, 1))
835  {
837  }
838 
839  // Set or clear the active bit
840  if (FXAS21002_POWER_ACTIVE == power)
841  {
842  buffer[0] |= FXAS21002_SET_FIELD(ACTIVE,1);
843  }
844  else
845  {
846  buffer[0] &= ~FXAS21002_SET_FIELD(ACTIVE,1);
847  }
848 
849  // Write the modified value back to the device
850  if (ISF_SUCCESS != dm_device_write(pDeviceHandle, FXAS21002_CTRL_REG1, buffer, 1, 1))
851  {
853  }
854 
855  return ISF_SUCCESS;
856 }
857 /*! @brief The local function to validate the device is in the active state.
858  * @details This function keeps checking the state of the device until it becomes active.
859  *
860  * @param[in] pDeviceHandle This is a reference to the device handle holding information about the device communication.
861  *
862  * @return ::device_wait_for_active() returns a value of type ::isf_dsa_status_t indicating the success or failure of the function call.
863  * @retval ::ISF_SUCCESS is returned when the device becomes active.
864  * @retval ::FXAS21002_ERROR_WAITFORACTIVE is returned when the device is unable to read the active state.
865  * *
866  * @Constraints None
867  *
868  * @Reentrant Yes
869  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
870  */
871 static fxas21002_Status_t device_wait_for_active(dm_DeviceDescriptor_t* pDeviceHandle) {
872 
873 
874  uint8 buffer[1];
875  do {
876  if (ISF_SUCCESS != dm_device_read(pDeviceHandle,FXAS21002_DR_STATUS , buffer, 1, 1))
877  {
879  }
880  _time_delay_ticks(1); // short delay to yield CPU/RTOS.
881  } while (!(buffer[0] & FXAS21002_ZYXDR_MASK));
882  return ISF_SUCCESS;
883 }
884 /*! @brief The local function to decode the ODR..
885  * @details This function decode the ODR value based on the data mode. set GET_ODR_CONFIG for register value correspond to
886  * ODR sample period else it gives ODR sample period in milli second.
887  *
888  * @param[in] samplePeriod This sample period.
889  * @param[in] mode The operational mode
890  * @param[in] dataMode The data mode in which the user requested.
891  *
892  * @return ::get_ODR() returns a value of uint32 indicating the ODR value.
893  *
894  * @Constraints None
895  *
896  * @Reentrant Yes
897  * @Libs fsl_fxas21002_i2cspi_3D_gyro.lib
898  */
899 static int32 get_ODR(uint32 samplePeriod)
900 {
901  uint8 i = 0, flag=0;
902 
904  {
905  for (i = 0; i < sizeof(fxas21000_odrTable); i++)
906  {
907  if(fxas21000_odrTable[i].periodNormalMode == samplePeriod)
908  {
909  flag=1;break;
910  }
911 
912  }
913  if(flag==1)
914  {
915  return fxas21000_odrTable[i].configVal;
916  }
917  else
918  {
919  return -1;
920  }
921  }
923  {
924  for (i = 0; i < sizeof(fxas21002_odrTable); i++)
925  {
926  if(fxas21002_odrTable[i].periodNormalMode == samplePeriod)
927  {
928  flag=1;break;
929  }
930 
931  }
932  if(flag==1)
933  {
934  return fxas21002_odrTable[i].configVal;
935  }
936  else
937  {
938  return -1;
939  }
940  } // if we found a valid ODR, then return it.
941 
942  return -1; // Should never get here.
943 }
944 
945 /*!
946 ** @}
947 */
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
This is the concrete implementation of the FXAS21002 sensor adapter for calibration ...
void * pSensorSpecificSettings
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
the structure defines the ODR table between Hybrid and normal mode of FXAS21000 operation.
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_EndData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXAS21002 sensor adapter for End Data. ...
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Convert(volatile isf_SensorHandle_t *pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void *pNativeSample, void *pConvertedSample, int32 *numBytes)
This function coverts the raw sample data to the desired output type.
fsl_i2c_master_driver.h defines structures and types for the i2c master driver.
Standard fixed type for three axis accelerometers.
int32 fxas21002_Status_t
FXAS21002 internal return codes.
#define FXAS21002_ACTIVE_MASK
Definition: fxas21002.h:154
#define MAX_DATA_READ_SIZE
const uint8 fxas21002_extendAddress[]
The table that describes the extended address space.
The isf_magnetometer_types.h file contains the ISF data type definitions for use with the ISF generic...
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
Definition: isf_util.c:52
isf_status_t dm_device_open(dm_ChannelDescriptor_t *apChannelDescriptor, void *apDevice, dm_DeviceDescriptor_t *apDeviceDescriptor)
This function creates a device handle for a device at a specified channel address.
This structure defines the dummy DSA data buffer format.
const void * commInfo
The fsl_fxas21002_i2cspi_3D_gyro.h file contains the definitions and functions supporting the FXAS210...
isf_dsa_ControlData_t controlData
isf_fifo_status_t isf_fifo_lock(isf_fifo_t *pFifo)
Lock a sample buffer for exclusive access.
Definition: isf_fifo.c:171
comm_State_t dm_channel_get_state(dm_ChannelDescriptor_t *apChannelDescriptor)
This function returns the channel state.
isf_fifo_status_t isf_fifo_unlock(isf_fifo_t *pFifo)
Release the exclusive access lock on a sample buffer.
Definition: isf_fifo.c:202
isf_SensorTypes_t fxas21002_SupportedSensorTypes[]
Supported sensor and data types for FXAS21002.
isf_fifo_status_t isf_fifo_el_increment(isf_fifo_t *pFifo)
Routine increments the insert pointer after direct access.
Definition: isf_fifo.c:240
isf_sensors.h contains the ISF Generic Sensor definitions and data structures required when a client ...
Information necessary to communicate with an I2C slave device.
#define FALSE
Definition: isf_types.h:56
API definitions, types, and macros for the Intelligent Sensing Framework (ISF) Bus Manager (BM)...
dm_DeviceDescriptor_t deviceHandle
Definition: isf_sensors.h:52
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXAS21002 sensor adapter for configuration.
#define FXAS21002_ZYXDR_MASK
Definition: fxas21002.h:84
Define the sensor device descriptor.
Definition: isf_sensors.h:49
LWSEM_STRUCT deviceSemaphore
Definition: isf_sensors.h:54
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
The fxas21002.h file contains the FXAS21002 Magnetometer register definitions, access macros...
isf_SensorTypes_t
const struct @16 fxas21002GyroConvTable[]
dm_ChannelDescriptor_t cDescriptor
Definition: isf_sensors.h:51
isf_status_t dm_device_write(dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite)
This function writes to a device.
isf_status_t bm_unregister_callback(bm_callback_token_t aToken)
This API unregisters one or more callbacks.
const fxas21002_ODR_Table_t fxas21002_odrTable[]
The table that describes the configuration value based on ODR (output data rate). Note: This table is...
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
#define FXAS21000_WHOAMI_VALUE
Definition: fxas21002.h:192
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_StartData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXAS21002 sensor adapter for start Data.
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
The isf_gyrometer_types.h file contains the ISF data type definitions for use with the ISF generic gy...
Standard fixed type for three axis accelerometers.
isf_gyrometer_dps_fixed_32s1i16_t angularVelocity[3]
const struct @16 fxas21000GyroConvTable[]
isf_status_t dm_channel_acquire_lock(dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
This function locks the channel for exclusive access.
The isf_sensor_types.h contains the enumerated list of sensor types used by ISF.
#define FXAS21002_WHOAMI_VALUE
Definition: fxas21002.h:193
The isf_util.h file contains the utility method declarations and macros.
#define FXAS21002_SET_FIELD(name, val)
Definition: fxas21002.h:70
enum isf_dsa_result_enums isf_dsa_result_types_t
bm_callback_token_t bm_register_periodic_callback(isf_duration_t aPeriod, bm_callback_t *pCallback, void *pCbData)
This API schedules a callback at the specified period.
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXAS21002 sensor adapter for validating current settings...
isf_dsa_result_types_t resultFormat
isf_SensorDataTypes_t
isf_status_t dm_channel_init(dm_ChannelId_t aChannelId, dm_ChannelDescriptor_t *apChannelDescriptor)
This function initializes a channel.
isf_status_t bm_stop(bm_callback_token_t aTokens)
This API stops one or more callback(s) by setting them to the inactive state.
const isf_SensorConfig_t * pSensorStaticConfig
isf_status_t bm_start(boolean aSync, bm_callback_token_t aTokens)
This API sets one or more callback(s) to the active state.
uint32 isf_duration_t
ISF time duration in microseconds.
Definition: isf.h:59
long int32
This defines int32 as long.
Definition: isf_types.h:32
isf_SensorDataTypes_t resultType
Main ISF header file. Contains code common to all ISF components.
LWEVENT_STRUCT * pEventGroup
The isf_sm_api.h contains the collection of APIs for the Sensor Manager as well as related defines an...
isf_dsa_AdapterStatus_t adapterStatus
sys_channelId_t channelId
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Shutdown(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXAS21002 sensor adapter for shutdown .
uint8 whoami_read_val
isf_SensorDataTypes_t fxas21002_SupportedDataTypes[]
isf_status_t dm_device_read(dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead)
This function reads from a device.
void fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(void *pSensorHandle)
The callback function for the Bus Manager(BM).
#define BM_ERROR
This value specifies a general Bus Manager error. If an error occurs in registering a callback...
Definition: isf_bm.h:57
isf_gyrometer_dps_float_t angularVelocity[3]
int32 isf_status_t
ISF return status type.
Definition: isf.h:51
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Initialize(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXAS21002 sensor adapter initialization.
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
isf_comm.h defines the common types for the Communications Service Family of the Intelligent Sensing ...
isf_dsa_SensorSettings_t sensorSettings
enum fxas21002_Power_tag fxas21002_Power_t
Enumeration for the FXAS21002 power modes.
void * isf_fifo_el_get_insert_pointer(isf_fifo_t *pFifo)
Routine returns the insert pointer for direct access.
Definition: isf_fifo.c:232
isf_status_t dm_channel_release_lock(dm_ChannelDescriptor_t *apChannelDescriptor)
This function releases exclusive channel access.
const fxas21000_ODR_Table_t fxas21000_odrTable[]
The table that describes the configuration value based on ODR (output data rate). Note: This table is...
This structure defines a handle for the device.
Definition: isf_devmsg.h:61
#define FXAS21002_READY_MASK
Definition: fxas21002.h:156
#define MAX_BUF_SIZE
fxas21002_Sensor_Specific_Reg_t regPairs[]
Definition: fxas21002.h:221
This structure is a declaration of a channel descriptor type.
Definition: isf_devmsg.h:50
#define ISF_FIFO_FULL
Definition: isf_fifo.h:32
bm_callback_token_t token
Definition: isf_sensors.h:53
the structure defines the ODR table between Hybrid and normal mode of FXAS21002 operation.