| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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