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

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

fsl_Sensor_Custom_1_Functions.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** Filename : fsl_Sensor_Custom_1_Functions.c
3 ** Project : ISF2P2_K64F_MQX_PROJ
4 ** Processor : MK64FN1M0VLL12
5 ** Component : Events
6 ** Version : Driver 01.00
7 ** Compiler : GNU C Compiler
8 ** Date/Time : 2016-10-06, 13:38, # CodeGen: 0
9 ** Abstract :
10 ** This is user's event module.
11 ** Put your event handler code here.
12 ** Settings :
13 ** Contents :
14 ** Custom_1__Void_ - void Custom_1__Void_(void);
15 ** Custom_1_fsl_Sensor_Custom_Convert - void Custom_1_fsl_Sensor_Custom_Convert(void);
16 ** Custom_1_fsl_Sensor_Custom_PeriodicCallback - void Custom_1_fsl_Sensor_Custom_PeriodicCallback(void);
17 ** Custom_1_fsl_Sensor_Custom_Shutdown - void Custom_1_fsl_Sensor_Custom_Shutdown(void);
18 ** Custom_1_fsl_Sensor_Custom_EndData - void Custom_1_fsl_Sensor_Custom_EndData(void);
19 ** Custom_1_fsl_Sensor_Custom_StartData - void Custom_1_fsl_Sensor_Custom_StartData(void);
20 ** Custom_1_fsl_Sensor_Custom_Configure - void Custom_1_fsl_Sensor_Custom_Configure(void);
21 ** Custom_1_fsl_Sensor_Custom_ValidateSettings - void Custom_1_fsl_Sensor_Custom_ValidateSettings(void);
22 ** Custom_1_fsl_Sensor_Custom_Initialize - void Custom_1_fsl_Sensor_Custom_Initialize(void);
23 **
24 ** ###################################################################*/
25 /*!
26 ** @file fsl_Sensor_Custom_1_Functions.c
27 ** @version 01.00
28 ** @brief
29 ** This is user's event module.
30 ** Put your event handler code here.
31 */
32 /*!
33 ** @addtogroup fsl_Sensor_Custom_1_Functions_module fsl_Sensor_Custom_1_Functions module documentation
34 ** @{
35 */
36 /* MODULE fsl_Sensor_Custom_1_Functions */
37
38 #include "Cpu.h"
39 #include "Events.h"
40 #include "rtos_main_task.h"
41 #include "os_tasks.h"
42 #include "App1_Functions.h"
43 #include "BasicApp1_Functions.h"
44 #include "fsl_Sensor_Custom_1_Functions.h"
45 #include "fsl_Sensor_Analog_1_Functions.h"
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51
52 /* User includes (#include below this line is not maintained by Processor Expert) */
53
54
55 void Custom_1__Void_()
56 {} /* This function is a place holder used to contain TypeDefs and not used. */
57
58 /*! @brief Define the WHO_AM_I register values for both possible sensor variations. */
59 const uint8_t Custom_1_Who_Am_I_Values[] = {0x4A, 0x5A};
60
61 /* Updated as per MMA865x sensor configuration. */
62 Custom_1_Sensor_Specific_Settings_t Custom_1_Sensor_Specific_Config =
63 {
64 .sensorFullScaleRange = 0, // Capture the accelerometer full-scale range for use in conversion routines.
65 .regCount = 2, // Number of register pairs to follow
66 .regPairs =
67 { // System and Control registers.
68 { Custom_1_CTRL_REG1, (Custom_1_SET_FIELD(ASLP_RATE,0)) | (Custom_1_SET_FIELD(DR,0)) | (Custom_1_SET_FIELD(FREAD,0)) },
69 { Custom_1_CTRL_REG2, (Custom_1_SET_FIELD(ST,0)) | (Custom_1_SET_FIELD(RST,0)) | (Custom_1_SET_FIELD(SMODS,0)) | (Custom_1_SET_FIELD(SLPE,0)) | (Custom_1_SET_FIELD(MODS,0)) }
70 }
71 };
72
73 /*! @brief User specified settings that may change */
74 static Custom_1_Rate_Specific_Settings_t custom_1_settings;
75
76 #define Custom_1_CONVERT_FLOAT_FACTOR 0.000061
77 #define Custom_1_CONVERT_FIXED_FACTOR 4
78
79 /*! Updated as per MMA865x device settings. */
80 const i2c_device_t Custom_1_DeviceInfo =
81 {
82 .baudRate_kbps = 400, // default baud rate (kbps).
83 .address = 29 // instance specific device address.
84 };
85
86 /*! @brief Supported sensor and data types for the Sensor */
87 isf_SensorTypes_t Custom_1_SupportedSensorTypes[] =
88 { /* Updated type for MMA865x Sensor. */
89 TYPE_ACCELEROMETER_3D, TYPE_NATIVE_SENSOR_TYPE
90 };
91
92 isf_SensorDataTypes_t Custom_1_SupportedDataTypes[] =
93 { /* Updated data type for MMA865x Sensor. */
94 TYPE_RAW_ACCELERATION_3D, TYPE_NATIVE_SENSOR_DATA_TYPE
95 };
96
97 isf_dsa_status_t Custom_1_float_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
98 {
99 Custom_1_SensorData_Float_t *convertedSample = (Custom_1_SensorData_Float_t *)vpConvertedSample;
100 convertedSample->timestamp = nativeSample->timeStamp;
101 // Convert the sample based on the full-scale range.
102 convertedSample->sensorData[0] = nativeSample->data[0] * Custom_1_CONVERT_FLOAT_FACTOR;
103 convertedSample->sensorData[1] = nativeSample->data[1] * Custom_1_CONVERT_FLOAT_FACTOR;
104 convertedSample->sensorData[2] = nativeSample->data[2] * Custom_1_CONVERT_FLOAT_FACTOR;
105
106 return ISF_SUCCESS;
107 }
108
109 isf_dsa_status_t Custom_1_fixed_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
110 {
111 Custom_1_SensorData_EngFixed_t *convertedSample = (Custom_1_SensorData_EngFixed_t *)vpConvertedSample;
112 convertedSample->timestamp = nativeSample->timeStamp;
113 // Convert the sample based on the full-scale range.
114 convertedSample->sensorData[0] = nativeSample->data[0] * Custom_1_CONVERT_FIXED_FACTOR;
115 convertedSample->sensorData[1] = nativeSample->data[1] * Custom_1_CONVERT_FIXED_FACTOR;
116 convertedSample->sensorData[2] = nativeSample->data[2] * Custom_1_CONVERT_FIXED_FACTOR;
117
118 return ISF_SUCCESS;
119 }
120
121 /* Warning: Do not edit the wraper functions below, all changes should be confined to the actual functions defined later. */
122 isf_dsa_status_t fsl_Sensor_Custom_1_Convert(volatile isf_SensorHandle_t* pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void* pNativeSample, void* pConvertedSample, int32_t *numBytes)
123 {
124 uint8_t retVal = 0;
125 Custom_1_fsl_Sensor_Custom_Convert(pSensorHandle, convertToType, resultType, pNativeSample, pConvertedSample, numBytes, &retVal);
126 return retVal;
127 }
128 isf_dsa_status_t fsl_Sensor_Custom_1_Configure(isf_SensorHandle_t* pSensorHandle, isf_dsa_SensorSettings_t* pSensorSettings)
129 {
130 uint8_t retVal = 0;
131 Custom_1_fsl_Sensor_Custom_Configure(pSensorHandle, pSensorSettings, &retVal);
132 return retVal;
133 }
134 isf_dsa_status_t fsl_Sensor_Custom_1_ValidateSettings(isf_SensorHandle_t* pSensorHandle, isf_dsa_SensorSettings_t* pSensorSettings)
135 {
136 uint8_t retVal = 0;
137 Custom_1_fsl_Sensor_Custom_ValidateSettings(pSensorHandle, pSensorSettings, &retVal);
138 return retVal;
139 }
140 isf_dsa_status_t fsl_Sensor_Custom_1_Initialize(isf_SensorHandle_t* pSensorHandle)
141 {
142 uint8_t retVal = 0;
143 Custom_1_fsl_Sensor_Custom_Initialize(pSensorHandle, &retVal);
144 return retVal;
145 }
146 isf_dsa_status_t fsl_Sensor_Custom_1_StartData(isf_SensorHandle_t* pSensorHandle)
147 {
148 uint8_t retVal = 0;
149 Custom_1_fsl_Sensor_Custom_StartData(pSensorHandle, &retVal);
150 return retVal;
151 }
152 isf_dsa_status_t fsl_Sensor_Custom_1_EndData(isf_SensorHandle_t* pSensorHandle)
153 {
154 uint8_t retVal = 0;
155 Custom_1_fsl_Sensor_Custom_EndData(pSensorHandle, &retVal);
156 return retVal;
157 }
158 isf_dsa_status_t fsl_Sensor_Custom_1_Shutdown(isf_SensorHandle_t* pSensorHandle)
159 {
160 uint8_t retVal = 0;
161 Custom_1_fsl_Sensor_Custom_Shutdown(pSensorHandle, &retVal);
162 return retVal;
163 }
164
165
166 /*
167 ** ===================================================================
168 ** Event : Custom_1_fsl_Sensor_Custom_Convert (module fsl_Sensor_Custom_1_Functions)
169 **
170 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
171 ** @brief
172 ** Parameters :
173 ** NAME - DESCRIPTION
174 ** @param
175 ** @param
176 ** @param
177 ** @param
178 ** @param
179 ** @param
180 ** @param
181 ** @return
182 ** Returns : Nothing
183 ** ===================================================================
184 */
185 void Custom_1_fsl_Sensor_Custom_Convert(volatile void* pSensorHandle, uint32_t convertToType, uint8_t resultType, void* pNativeSample, void* pConvertedSample, int32_t *numBytes, uint8_t *retVal)
186 {
187 isf_dsa_status_t retStat = DSA_ERR_BAD_SENSOR_DATA_TYPE;
188 isf_dsa_status_t (*pConverter)(Custom_1_Sensor_Specific_Settings_t *, Custom_1_DataBuffer_t *, void *);
189
190 pConverter = NULL;
191 switch (convertToType)
192 {
193 case TYPE_RAW_ACCELERATION_3D:
194 if (resultType == DSA_RESULT_TYPE_ENG_FLOAT)
195 {
196 pConverter = Custom_1_float_Custom_converter;
197 }
198 else if (resultType == DSA_RESULT_TYPE_ENG_FIXED)
199 {
200 pConverter = Custom_1_fixed_Custom_converter;
201 }
202 break;
203
204 default:
205 *retVal = DSA_ERR_BAD_SENSOR_DATA_TYPE;
206 }
207 if (pConverter == NULL)
208 {
209 *retVal = DSA_ERR_BAD_RESULT_TYPE;
210 }
211
212 retStat = pConverter(
213 (Custom_1_Sensor_Specific_Settings_t*)((isf_SensorHandle_t*)pSensorHandle)->pSensorStaticConfig->pSensorSpecificSettings,
214 (Custom_1_DataBuffer_t *)pNativeSample, pConvertedSample);
215
216 *retVal = retStat;
217 }
218
219 /*
220 ** ===================================================================
221 ** Event : Custom_1_fsl_Sensor_Custom_PeriodicCallback (module fsl_Sensor_Custom_1_Functions)
222 **
223 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
224 ** @brief
225 ** Parameters :
226 ** NAME - DESCRIPTION
227 ** @param
228 ** @return
229 ** Returns : Nothing
230 ** ===================================================================
231 */
232 void Custom_1_fsl_Sensor_Custom_PeriodicCallback(void* pSensorHandle)
233 {
234 // Check the input argument
235 if (NULL == pSensorHandle)
236 {
237 return;
238 }
239
240 // Get the device descriptor and specific settings
241 volatile isf_SensorHandle_t *pSensorHdl = (isf_SensorHandle_t *)pSensorHandle;
242 isf_fifo_t *pFifo = pSensorHdl->controlData.sensorSettings.pSampleBufferInfo;
243 DeviceDescriptor_t *pDeviceDescriptor = (DeviceDescriptor_t*)pSensorHdl->pDeviceDescriptor;
244 isf_status_t st;
245 int32 numBytes;
246
247 // Check the device descriptor
248 if (NULL == pDeviceDescriptor)
249 {
250 return;
251 }
252
253 // Create a helper pointer to the current sample buffer.
254 Custom_1_DataBuffer_t *pCurrentSampleBuffer = (Custom_1_DataBuffer_t *)pDeviceDescriptor->pCurrentSample;
255
256 // Apply sample skip if necessary.
257 if (pDeviceDescriptor->skipFramecnt)
258 {// Not done skipping samples.
259 --pDeviceDescriptor->skipFramecnt;
260 return;
261 }
262
263 // Get the time stamp
264 pCurrentSampleBuffer->timeStamp = isf_time_util_get_usec();
265
266 // Lock the device descriptor.
267 if (kStatus_OSA_Success != OSA_SemaWait(&pDeviceDescriptor->deviceSemaphore, OSA_WAIT_FOREVER))
268 {
269 goto unlockdescriptor;
270 }
271
272 // Check the driver state.
273 if (DSA_STATE_CONFIGURED_STARTED != pSensorHdl->adapterStatus)
274 {
275 goto unlockdescriptor;
276 }
277
278 #define BYTES_FOR_FULL_READ 7
279 // Get sensor data.
280 uint16* pSensorData = (uint16*)&pCurrentSampleBuffer->data[0];
281 uint8 registerData[BYTES_FOR_FULL_READ];
282
283 // read the full width of the data for both full or short reads
284 if (ISF_SUCCESS == dm_device_read(&pDeviceDescriptor->deviceHandle, Custom_1_STATUS_00, registerData, BYTES_FOR_FULL_READ, BYTES_FOR_FULL_READ))
285 { // If there is any data, then format and copy it to the output buffer.
286 if ( Custom_1_GET_FIELD(ZYXDR, registerData[0] ) > 0 )
287 { // collect the full 16-bit data for each of x,y,z
288 pSensorData[0] = ((int16)registerData[1])<<8 | registerData[2];
289 pSensorData[1] = ((int16)registerData[3])<<8 | registerData[4];
290 pSensorData[2] = ((int16)registerData[5])<<8 | registerData[6];
291 }
292 }
293 // Lock the fifo for update.
294 if(kStatus_OSA_Success != isf_fifo_lock(pFifo))
295 {
296 return;
297 }
298
299 Custom_1_DataBuffer_t *pFifoEntry = (Custom_1_DataBuffer_t *)isf_fifo_el_get_insert_pointer(pFifo);
300 // write the new data
301 if (pSensorHdl->controlData.sensorSettings.resultType == TYPE_NATIVE_SENSOR_DATA_TYPE )
302 {
303 *pFifoEntry = *pCurrentSampleBuffer;
304 }
305 else
306 {
307 fsl_Sensor_Custom_1_Convert(
308 pSensorHdl,
309 pSensorHdl->controlData.sensorSettings.resultType,
310 pSensorHdl->controlData.sensorSettings.resultFormat,
311 pCurrentSampleBuffer, pFifoEntry, &numBytes);
312 }
313
314 // Increment the fifo to the next sample entry.
315 st = isf_fifo_el_increment(pFifo);
316 // Unlock the fifo.
317 isf_fifo_unlock(pFifo);
318 if (st == ISF_FIFO_FULL)
319 { // Notify the user using their registered event information
320 OSA_EventSet(pSensorHdl->controlData.pEventGroup,(uint32_t)pSensorHdl->controlData.nEventFieldIndex);
321 }
322
323 unlockdescriptor:
324 // Unlock the device descriptor.
325 OSA_SemaPost(&pDeviceDescriptor->deviceSemaphore);
326 }
327 /*
328 ** ===================================================================
329 ** Event : Custom_1_fsl_Sensor_Custom_Shutdown (module fsl_Sensor_Custom_1_Functions)
330 **
331 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
332 ** @brief
333 ** Parameters :
334 ** NAME - DESCRIPTION
335 ** @param
336 ** @param
337 ** @return
338 ** Returns : Nothing
339 ** ===================================================================
340 */
341 void Custom_1_fsl_Sensor_Custom_Shutdown(void* pSensorHandle, uint8_t *retVal)
342 {
343 if(NULL == pSensorHandle)
344 {
345 *retVal = DSA_ERR_PARAM;
346 }
347
348 // Create helper reference pointers.
349 DeviceDescriptor_t* pDeviceDescriptor = (DeviceDescriptor_t*)((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor;
350
351 // Remove the sensor adapter from the Bus Manager callbacks.
352 bm_unregister_callback(pDeviceDescriptor->token);
353 ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus = DSA_STATE_INITIALIZED;
354
355 *retVal = ISF_SUCCESS;
356 }
357
358 /*
359 ** ===================================================================
360 ** Event : Custom_1_fsl_Sensor_Custom_EndData (module fsl_Sensor_Custom_1_Functions)
361 **
362 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
363 ** @brief
364 ** Parameters :
365 ** NAME - DESCRIPTION
366 ** @param
367 ** @param
368 ** @return
369 ** Returns : Nothing
370 ** ===================================================================
371 */
372 void Custom_1_fsl_Sensor_Custom_EndData(void* pSensorHandle, uint8_t *retVal)
373 {
374 // Check pointers.
375 if(NULL == pSensorHandle)
376 {
377 *retVal = DSA_ERR_PARAM;
378 }
379
380 int32_t status = ISF_SUCCESS;
381 uint8 buffer[1] = {0x00};
382 // Set the default return status.
383 int32_t retStat = DSA_ERR_END_DATA;
384
385 // Create helper reference pointers.
386 DeviceDescriptor_t* pDeviceDescriptor = (DeviceDescriptor_t*)((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor;
387
388 // Check the device descriptor.
389 if (NULL == pDeviceDescriptor)
390 {
391 *retVal = retStat;
392 }
393
394 // Lock the device descriptor.
395 OSA_SemaWait(&pDeviceDescriptor->deviceSemaphore, OSA_WAIT_FOREVER);
396
397 // Check the driver state.
398 if (DSA_STATE_CONFIGURED_STOPPED >= ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus)
399 {
400 goto unlockdescriptor;
401 }
402
403 // Check that the adapter is not already started.
404 if (DSA_STATE_CONFIGURED_STARTED == ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus)
405 {
406 // If it is, then stop the Bus Manager (BM) sample timer.
407 isf_status_t bmStopStatus = bm_stop(pDeviceDescriptor->token);
408 if (BM_ERROR & bmStopStatus)
409 {
410 goto unlockdescriptor;
411 }
412 }
413
414 // Set the sensor into STANDBY mode for configuration.
415 if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
416 {
417 status = SENSOR_ERROR_SETMODE;
418 }
419 buffer[0] = (buffer[0] & ~Custom_1_ACTIVE_MASK);
420 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
421 {
422 status = SENSOR_ERROR_SETMODE;
423 }
424 if (ISF_SUCCESS != status)
425 {
426 goto unlockdescriptor;
427 }
428 ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus = DSA_STATE_CONFIGURED_STOPPED;
429 retStat = ISF_SUCCESS;
430
431 unlockdescriptor:
432 // Unlock the device descriptor.
433 OSA_SemaPost(&pDeviceDescriptor->deviceSemaphore);
434
435 *retVal = retStat;
436 }
437
438 /*
439 ** ===================================================================
440 ** Event : Custom_1_fsl_Sensor_Custom_StartData (module fsl_Sensor_Custom_1_Functions)
441 **
442 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
443 ** @brief
444 ** Parameters :
445 ** NAME - DESCRIPTION
446 ** @param
447 ** @param
448 ** @return
449 ** Returns : Nothing
450 ** ===================================================================
451 */
452 void Custom_1_fsl_Sensor_Custom_StartData(void* pSensorHandle, uint8_t *retVal)
453 {
454 // Check pointers.
455 if(NULL == pSensorHandle)
456 {
457 *retVal = DSA_ERR_PARAM;
458 }
459
460 int32_t status = ISF_SUCCESS;
461 uint8 buffer[1] = {0x00};
462 int32_t retStat = DSA_ERR_START_DATA;
463
464 // Create helper reference pointers.
465 DeviceDescriptor_t* pDeviceDescriptor = (DeviceDescriptor_t*)((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor;
466
467 // Check the device descriptor.
468 if (NULL == pDeviceDescriptor)
469 {
470 *retVal = DSA_ERR_PARAM;
471 }
472
473 // Lock the device descriptor.
474 OSA_SemaWait(&pDeviceDescriptor->deviceSemaphore, OSA_WAIT_FOREVER);
475
476 // Check the driver state.
477 if (DSA_STATE_CONFIGURED_STOPPED > ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus)
478 {
479 goto unlockdescriptor;
480 }
481
482 // Set the sensor into ACTIVE mode for operation.
483 // this sensor requires read-modify-write
484 if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
485 {
486 status = SENSOR_ERROR_SETMODE;
487 return;
488 }
489 buffer[0] = (buffer[0] | Custom_1_ACTIVE_MASK);
490 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
491 {
492 status = SENSOR_ERROR_SETMODE;
493 return;
494 }
495 // Read the value of the status register to wait for valid data
496 buffer[0] = 0;
497 do {
498 if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle, Custom_1_STATUS_00, buffer, 1, 1))
499 {
500 status = SENSOR_ERROR_SETMODE;
501 return;
502 }
503 OSA_TimeDelay(1); // short delay to yield CPU/RTOS.
504 } while (0 == Custom_1_GET_FIELD(ZYXDR,buffer[0]) ); // Wait for Data Ready.
505 if (ISF_SUCCESS != status)
506 {
507 goto unlockdescriptor;
508 }
509
510 // Start the Bus Manager sampling timer.
511 if (BM_ERROR & bm_start(FALSE, pDeviceDescriptor->token)) // Check for Bus Manager error and return on failure.
512 {
513 goto unlockdescriptor;
514 }
515 // Set device to active state.
516 ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus = DSA_STATE_CONFIGURED_STARTED;
517 retStat = ISF_SUCCESS;
518
519 unlockdescriptor:
520 // Unlock the device descriptor.
521 OSA_SemaPost(&pDeviceDescriptor->deviceSemaphore);
522
523 *retVal = retStat;
524 }
525
526 /*
527 ** ===================================================================
528 ** Event : Custom_1_fsl_Sensor_Custom_Configure (module fsl_Sensor_Custom_1_Functions)
529 **
530 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
531 ** @brief
532 ** Parameters :
533 ** NAME - DESCRIPTION
534 ** @param
535 ** @param
536 ** @param
537 ** @return
538 ** Returns : Nothing
539 ** ===================================================================
540 */
541 void Custom_1_fsl_Sensor_Custom_Configure(void* pSensorHandle, void* pSensorSettings, uint8_t *retVal)
542 {
543 // Check pointers.
544 if((NULL == pSensorHandle) || (NULL == pSensorSettings))
545 {
546 *retVal = DSA_ERR_PARAM;
547 }
548
549 int32_t status = ISF_SUCCESS;
550 uint8 buffer[1] = {0x00};
551 int32_t retStat = DSA_ERR_CONFIGURE; // Return Status
552
553 // Create helper reference pointers.
554 DeviceDescriptor_t *pDeviceDescriptor = (DeviceDescriptor_t*) ((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor;
555
556 // Check the device descriptor pointer.
557 if (NULL == pDeviceDescriptor)
558 {
559 *retVal = retStat;
560 }
561
562 // Lock the device descriptor.
563 OSA_SemaWait(&pDeviceDescriptor->deviceSemaphore, OSA_WAIT_FOREVER);
564
565 // Check the driver state.
566 if (DSA_STATE_INITIALIZED > ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus)
567 {
568 goto unlockdescriptor;
569 }
570
571 // User Notice: This is a required function call. If it is not here, there may be conflicts, data loss,
572 // or any number of undesirable things may occur.
573 if (ISF_SUCCESS != dm_channel_acquire_lock(&pDeviceDescriptor->cDescriptor, 0))
574 {
575 goto unlockdescriptor;
576 }
577
578 // Set the sensor into STANDBY mode for configuration.
579 if (ISF_SUCCESS != dm_device_read(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
580 {
581 status = SENSOR_ERROR_SETMODE;
582 }
583 buffer[0] = (buffer[0] & ~Custom_1_ACTIVE_MASK);
584 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
585 {
586 status = SENSOR_ERROR_SETMODE;
587 }
588 if (ISF_SUCCESS != status)
589 {
590 goto unlockchannel;
591 }
592 // Configure the sensor.
593 buffer[0] = (Custom_1_SET_FIELD(ASLP_RATE,0)) | (Custom_1_SET_FIELD(DR,0)) | (Custom_1_SET_FIELD(FREAD,0));
594 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1,&buffer[0],1,1))
595 {
596 retStat = DSA_ERR_CONFIGURE;
597 }
598 buffer[0] = (Custom_1_SET_FIELD(ST,0)) | (Custom_1_SET_FIELD(RST,0)) | (Custom_1_SET_FIELD(SMODS,0)) | (Custom_1_SET_FIELD(SLPE,0)) | (Custom_1_SET_FIELD(MODS,0));
599 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG2,&buffer[0],1,1))
600 {
601 retStat = DSA_ERR_CONFIGURE;
602 }
603
604 // Set up the Control register #1 functions: ODR override for SLEEP mode and the WAKE mode ODR.
605 buffer[0] = Custom_1_SET_FIELD(DR,custom_1_settings.sampleRateIndex);
606 if (ISF_SUCCESS != dm_device_write(&pDeviceDescriptor->deviceHandle, Custom_1_CTRL_REG1, buffer, 1, 1))
607 {
608 retStat = Custom_1_ERROR;
609 }
610 retStat = ISF_SUCCESS;
611
612 if (ISF_SUCCESS != retStat)
613 {
614 goto unlockchannel;
615 }
616
617 // Register the periodic callback function with the Bus Manager.
618 pDeviceDescriptor->token = bm_register_periodic_callback(((isf_dsa_SensorSettings_t*)pSensorSettings)->nSamplePeriod, Custom_1_fsl_Sensor_Custom_PeriodicCallback , ((isf_SensorHandle_t *)pSensorHandle));
619 if(BM_ERROR & pDeviceDescriptor->token)
620 {
621 goto unlockchannel;
622 }
623 //Store the configured settings
624 ((isf_SensorHandle_t *)pSensorHandle)->controlData.sensorSettings = *((isf_dsa_SensorSettings_t*)pSensorSettings);
625 ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus = DSA_STATE_CONFIGURED_STOPPED;
626 retStat = ISF_SUCCESS;
627
628 unlockchannel:
629 // Unlock the channel.
630 // The explicit lock must be released when the configuration is done allowing the bus to be used by others.
631 status = dm_channel_release_lock(&pDeviceDescriptor->cDescriptor);
632 if (ISF_SUCCESS != status)
633 {
634 retStat = status;
635 }
636
637 unlockdescriptor:
638 // Unlock the device descriptor.
639 OSA_SemaPost(&pDeviceDescriptor->deviceSemaphore);
640
641 *retVal = retStat;
642 }
643
644 /*
645 ** ===================================================================
646 ** Event : Custom_1_fsl_Sensor_Custom_ValidateSettings (module fsl_Sensor_Custom_1_Functions)
647 **
648 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
649 ** @brief
650 ** Parameters :
651 ** NAME - DESCRIPTION
652 ** @param
653 ** @param
654 ** @param
655 ** @return
656 ** Returns : Nothing
657 ** ===================================================================
658 */
659 void Custom_1_fsl_Sensor_Custom_ValidateSettings(void* pSensorHandle, void* pSensorSettings, uint8_t *retVal)
660 {
661 // Check the input arguments.
662 if ((NULL == pSensorHandle) || (NULL == pSensorSettings))
663 {
664 *retVal = DSA_ERR_PARAM;
665 }
666
667 // This f/n is to be used to validate sample period range setting and other configuration parameters.
668 *retVal = ISF_SUCCESS;
669 }
670
671 /*
672 ** ===================================================================
673 ** Event : Custom_1_fsl_Sensor_Custom_Initialize (module fsl_Sensor_Custom_1_Functions)
674 **
675 ** Component : Custom_1 [ISF_KSDK_Sensor_Custom_Adaptor]
676 ** @brief
677 ** Parameters :
678 ** NAME - DESCRIPTION
679 ** @param
680 ** @param
681 ** @return
682 ** Returns : Nothing
683 ** ===================================================================
684 */
685 void Custom_1_fsl_Sensor_Custom_Initialize(void* pSensorHandle, uint8_t *retVal)
686 {
687 if ( NULL == pSensorHandle)
688 {
689 *retVal = DSA_ERR_PARAM;
690 }
691
692 int32_t status;
693
694 // Check if the sensor is available, and that it has already been initialized.
695 if (((isf_SensorHandle_t *)pSensorHandle)->adapterStatus > DSA_STATE_NOT_INITIALIZED)
696 {
697 *retVal = DSA_ERR_INITIALIZE;
698 }
699
700 // Allocate the adapter specific memory for the descriptor
701 ((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor = (DeviceDescriptor_t *)OSA_MemAllocZero(sizeof(DeviceDescriptor_t));
702
703 // Create and validate helper reference pointers.
704 DeviceDescriptor_t *pDeviceDescriptor = (DeviceDescriptor_t*)((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor;
705
706 if (NULL == pDeviceDescriptor)
707 {
708 *retVal = DSA_ERR_INITIALIZE;
709 }
710
711 // Allocate the current sample data buffer and initialize it.
712 pDeviceDescriptor->pCurrentSample = OSA_MemAllocZero(sizeof(Custom_1_DataBuffer_t));
713 Custom_1_DataBuffer_t *pCurrentSampleBuffer = (Custom_1_DataBuffer_t *)pDeviceDescriptor->pCurrentSample;
714 pCurrentSampleBuffer->timeStamp = 0;
715 pCurrentSampleBuffer->data[0] = 0;
716 pCurrentSampleBuffer->data[1] = 0;
717 pCurrentSampleBuffer->data[2] = 0;
718 pCurrentSampleBuffer->addr = ((i2c_device_t *)((isf_SensorHandle_t *)pSensorHandle)->pSensorStaticConfig->commInfo)->address;
719
720 dm_ChannelDescriptor_t *pChannelDescriptor = &pDeviceDescriptor->cDescriptor;
721
722 // Initialize the channel
723 if(ISF_SUCCESS != dm_channel_init(((isf_SensorHandle_t *)pSensorHandle)->pSensorStaticConfig->channelId, pChannelDescriptor))
724 {
725 *retVal = DSA_ERR_INITIALIZE;
726 }
727 // Start the Bus
728 if(ISF_SUCCESS != dm_channel_start(pChannelDescriptor))
729 {
730 *retVal = DSA_ERR_INITIALIZE;
731 }
732
733 // Get the Channel state to check if it is ready to use
734 if (COMM_STATE_OK != dm_channel_get_state(pChannelDescriptor))
735 {
736 *retVal = DSA_ERR_INITIALIZE;
737 }
738
739 // Open the device and get the device handler
740 if(ISF_SUCCESS != dm_device_open(pChannelDescriptor, (void *)((isf_SensorHandle_t *)pSensorHandle)->pSensorStaticConfig->commInfo, &pDeviceDescriptor->deviceHandle))
741 {
742 *retVal = DSA_ERR_INITIALIZE;
743 }
744
745 // A very short delay is needed for device startup.
746 OSA_TimeDelay(1);
747
748 // Query the sensor to validate Device Messaging initialization and the sensor identity.
749 uint8 buffer[1] = {0};
750 int32 retStat = SENSOR_ERROR_CHECKID;
751 // Create and validate helper reference pointers.
752 dm_DeviceDescriptor_t* pDeviceHandle = &((DeviceDescriptor_t*)((isf_SensorHandle_t *)pSensorHandle)->pDeviceDescriptor)->deviceHandle;
753
754 if (ISF_SUCCESS != dm_device_read(pDeviceHandle, Custom_1_WHO_AM_I, &buffer[0], 1, 1))
755 {
756 status = retStat;
757 }
758 if ((Custom_1_Who_Am_I_Values[0] != buffer[0]) && (Custom_1_Who_Am_I_Values[1] != buffer[0]))
759 {
760 status = retStat;
761 }
762 status = ISF_SUCCESS;
763
764 if (ISF_SUCCESS != status)
765 {
766 *retVal = DSA_ERR_INITIALIZE;
767 }
768
769 // Set the adapter state to be initialized.
770 ((isf_SensorHandle_t *)pSensorHandle)->adapterStatus = DSA_STATE_INITIALIZED;
771 // Create a semaphore to synchronize the device descriptor across tasks
772 if (kStatus_OSA_Success != OSA_SemaCreate(&pDeviceDescriptor->deviceSemaphore, 1))
773 {
774 *retVal = DSA_ERR_INITIALIZE;
775 }
776
777 pDeviceDescriptor->skipFramecnt = 0;
778
779 *retVal = ISF_SUCCESS;
780 }
781
782 /* END fsl_Sensor_Custom_1_Functions */
783
784 #ifdef __cplusplus
785 } /* extern "C" */
786 #endif
787
788 /*!
789 ** @}
790 */
791 /*
792 ** ###################################################################
793 **
794 ** This file was created by Processor Expert 10.5 [05.21]
795 ** for the Freescale Kinetis series of microcontrollers.
796 **
797 ** ###################################################################
798 */
isf_SensorHandle_st::pDeviceDescriptor
void * pDeviceDescriptor
Definition: isf_dsa_adapter.h:109
Cpu.h
dm_channel_start
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
Definition: isf_device_messaging.c:137
Custom_1_ERROR
Definition: fsl_Sensor_Custom_1_Functions.h:179
uint8
unsigned char uint8
Definition: isf_types.h:76
Custom_1_SupportedDataTypes
isf_SensorDataTypes_t Custom_1_SupportedDataTypes[]
Definition: fsl_Sensor_Custom_1_Functions.c:92
Custom_1_float_Custom_converter
isf_dsa_status_t Custom_1_float_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
Definition: fsl_Sensor_Custom_1_Functions.c:97
DSA_ERR_BAD_RESULT_TYPE
Definition: isf_dsa_adapter.h:39
SENSOR_ERROR_SETMODE
Definition: isf_sensors.h:42
Custom_1_SensorData_EngFixed_t
Definition: fsl_Sensor_Custom_1_Functions.h:126
Custom_1_CONVERT_FLOAT_FACTOR
#define Custom_1_CONVERT_FLOAT_FACTOR
Definition: fsl_Sensor_Custom_1_Functions.c:76
ISF_SUCCESS
Definition: isf.h:31
isf_time_util_get_usec
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
Definition: isf_util.c:55
fsl_Sensor_Analog_1_Functions.h
This is user's event module. Put your event handler code here.
fsl_Sensor_Custom_1_Initialize
isf_dsa_status_t fsl_Sensor_Custom_1_Initialize(isf_SensorHandle_t *pSensorHandle)
Definition: fsl_Sensor_Custom_1_Functions.c:140
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
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
fsl_Sensor_Custom_1_EndData
isf_dsa_status_t fsl_Sensor_Custom_1_EndData(isf_SensorHandle_t *pSensorHandle)
Definition: fsl_Sensor_Custom_1_Functions.c:152
DSA_STATE_CONFIGURED_STARTED
Definition: isf_dsa_adapter.h:60
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
Custom_1_CTRL_REG2
Definition: fsl_Sensor_Custom_1_Functions.h:172
fsl_Sensor_Custom_1_Convert
isf_dsa_status_t fsl_Sensor_Custom_1_Convert(volatile isf_SensorHandle_t *pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void *pNativeSample, void *pConvertedSample, int32_t *numBytes)
Definition: fsl_Sensor_Custom_1_Functions.c:122
FALSE
#define FALSE
Definition: isf_types.h:86
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
Custom_1_DataBuffer_t::timeStamp
uint32 timeStamp
Definition: fsl_Sensor_Custom_1_Functions.h:121
DeviceDescriptor_struct::skipFramecnt
uint8 skipFramecnt
Definition: isf_sensors.h:59
Custom_1_Rate_Specific_Settings_t
This structure defines important settings.
Definition: fsl_Sensor_Custom_1_Functions.h:159
Custom_1_Sensor_Specific_Settings_t
Definition: fsl_Sensor_Custom_1_Functions.h:150
DeviceDescriptor_struct
Define the sensor device descriptor.
Definition: isf_sensors.h:49
Custom_1_fsl_Sensor_Custom_EndData
void Custom_1_fsl_Sensor_Custom_EndData(void *pSensorHandle, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:372
pSensorData
void * pSensorData[]
Definition: BasicApp1.c:408
Custom_1_Sensor_Specific_Config
Custom_1_Sensor_Specific_Settings_t Custom_1_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
Definition: fsl_Sensor_Custom_1_Functions.c:62
App1_Functions.h
This is user's event module. Put your event handler code here.
Custom_1_fsl_Sensor_Custom_Shutdown
void Custom_1_fsl_Sensor_Custom_Shutdown(void *pSensorHandle, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:341
Custom_1_DataBuffer_t::data
int16 data[3]
Definition: fsl_Sensor_Custom_1_Functions.h:122
fsl_Sensor_Custom_1_ValidateSettings
isf_dsa_status_t fsl_Sensor_Custom_1_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
Definition: fsl_Sensor_Custom_1_Functions.c:134
fsl_Sensor_Custom_1_Configure
isf_dsa_status_t fsl_Sensor_Custom_1_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
Definition: fsl_Sensor_Custom_1_Functions.c:128
isf_SensorTypes_t
isf_SensorTypes_t
Definition: isf_sensor_types.h:14
DeviceDescriptor_struct::cDescriptor
dm_ChannelDescriptor_t cDescriptor
Definition: isf_sensors.h:51
Custom_1_SensorData_EngFixed_t::timestamp
isf_timestamp_t timestamp
Definition: fsl_Sensor_Custom_1_Functions.h:127
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
Custom_1_fsl_Sensor_Custom_PeriodicCallback
void Custom_1_fsl_Sensor_Custom_PeriodicCallback(void *pSensorHandle)
Definition: fsl_Sensor_Custom_1_Functions.c:232
DSA_ERR_INITIALIZE
Definition: isf_dsa_adapter.h:29
Custom_1_CONVERT_FIXED_FACTOR
#define Custom_1_CONVERT_FIXED_FACTOR
Definition: fsl_Sensor_Custom_1_Functions.c:77
Custom_1_fixed_Custom_converter
isf_dsa_status_t Custom_1_fixed_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
Definition: fsl_Sensor_Custom_1_Functions.c:109
Custom_1_SensorData_Float_t
Standard fixed type for three axis accelerometers.
Definition: fsl_Sensor_Custom_1_Functions.h:132
SENSOR_ERROR_CHECKID
Definition: isf_sensors.h:41
DSA_ERR_END_DATA
Definition: isf_dsa_adapter.h:33
DSA_RESULT_TYPE_ENG_FIXED
Definition: isf_dsa_adapter.h:48
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
int16
signed short int int16
Definition: isf_types.h:73
BYTES_FOR_FULL_READ
#define BYTES_FOR_FULL_READ
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
fsl_Sensor_Custom_1_StartData
isf_dsa_status_t fsl_Sensor_Custom_1_StartData(isf_SensorHandle_t *pSensorHandle)
Definition: fsl_Sensor_Custom_1_Functions.c:146
isf_dsa_result_types_t
enum isf_dsa_result_enums isf_dsa_result_types_t
Custom_1_SensorData_Float_t::sensorData
isf_Custom_1_float_data_t sensorData[3]
Definition: fsl_Sensor_Custom_1_Functions.h:134
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
Custom_1_Sensor_Specific_Settings_t::sensorFullScaleRange
uint8 sensorFullScaleRange
Definition: fsl_Sensor_Custom_1_Functions.h:153
Custom_1_Who_Am_I_Values
const uint8_t Custom_1_Who_Am_I_Values[]
Define the WHO_AM_I register values for both possible sensor variations.
Definition: fsl_Sensor_Custom_1_Functions.c:59
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
Events.h
This is user's event module. Put your event handler code here.
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
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
Custom_1_ACTIVE_MASK
#define Custom_1_ACTIVE_MASK
Definition: fsl_Sensor_Custom_1_Functions.h:211
isf_dsa_SensorSettings_st::resultType
isf_SensorDataTypes_t resultType
Definition: isf_dsa_adapter.h:83
Custom_1_CTRL_REG1
Definition: fsl_Sensor_Custom_1_Functions.h:171
TYPE_ACCELEROMETER_3D
Definition: isf_sensor_types.h:20
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
uint16
unsigned short int uint16
Definition: isf_types.h:77
DSA_STATE_CONFIGURED_STOPPED
Definition: isf_dsa_adapter.h:59
DSA_ERR_PARAM
Definition: isf_dsa_adapter.h:36
DSA_RESULT_TYPE_ENG_FLOAT
Definition: isf_dsa_adapter.h:49
Custom_1_GET_FIELD
#define Custom_1_GET_FIELD(name, val)
Definition: fsl_Sensor_Custom_1_Functions.h:191
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
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
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_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
Custom_1_SupportedSensorTypes
isf_SensorTypes_t Custom_1_SupportedSensorTypes[]
Supported sensor and data types for the Sensor.
Definition: fsl_Sensor_Custom_1_Functions.c:87
Custom_1_DataBuffer_t::addr
uint8 addr
Definition: fsl_Sensor_Custom_1_Functions.h:123
DSA_STATE_NOT_INITIALIZED
Definition: isf_dsa_adapter.h:57
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
Custom_1_WHO_AM_I
Definition: fsl_Sensor_Custom_1_Functions.h:170
BasicApp1_Functions.h
This is user's event module. Put your event handler code here.
DeviceDescriptor_struct::pCurrentSample
void * pCurrentSample
Definition: isf_sensors.h:56
isf_dsa_ControlData_st::sensorSettings
isf_dsa_SensorSettings_t sensorSettings
Definition: isf_dsa_adapter.h:94
Custom_1_STATUS_00
Definition: fsl_Sensor_Custom_1_Functions.h:169
Custom_1_SET_FIELD
#define Custom_1_SET_FIELD(name, val)
Definition: fsl_Sensor_Custom_1_Functions.h:190
Custom_1_fsl_Sensor_Custom_Initialize
void Custom_1_fsl_Sensor_Custom_Initialize(void *pSensorHandle, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:685
Custom_1_SensorData_EngFixed_t::sensorData
isf_Custom_1_fixed_data_t sensorData[3]
Definition: fsl_Sensor_Custom_1_Functions.h:128
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
Custom_1__Void_
void Custom_1__Void_()
Definition: fsl_Sensor_Custom_1_Functions.c:55
Custom_1_DataBuffer_t
This structure defines the dummy DSA data buffer format.
Definition: fsl_Sensor_Custom_1_Functions.h:119
fsl_Sensor_Custom_1_Functions.h
This is user's event module. Put your event handler code here.
Custom_1_fsl_Sensor_Custom_StartData
void Custom_1_fsl_Sensor_Custom_StartData(void *pSensorHandle, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:452
Custom_1_fsl_Sensor_Custom_Configure
void Custom_1_fsl_Sensor_Custom_Configure(void *pSensorHandle, void *pSensorSettings, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:541
dm_DeviceDescriptor_struct
This structure defines a handle for the device.
Definition: isf_devmsg.h:61
Custom_1_fsl_Sensor_Custom_ValidateSettings
void Custom_1_fsl_Sensor_Custom_ValidateSettings(void *pSensorHandle, void *pSensorSettings, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:659
Custom_1_DeviceInfo
const i2c_device_t Custom_1_DeviceInfo
This allows access to the sensor communications specific configuration.
Definition: fsl_Sensor_Custom_1_Functions.c:80
TYPE_RAW_ACCELERATION_3D
Definition: isf_sensor_types.h:71
Custom_1_fsl_Sensor_Custom_Convert
void Custom_1_fsl_Sensor_Custom_Convert(volatile void *pSensorHandle, uint32_t convertToType, uint8_t resultType, void *pNativeSample, void *pConvertedSample, int32_t *numBytes, uint8_t *retVal)
Definition: fsl_Sensor_Custom_1_Functions.c:185
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
fsl_Sensor_Custom_1_Shutdown
isf_dsa_status_t fsl_Sensor_Custom_1_Shutdown(isf_SensorHandle_t *pSensorHandle)
Definition: fsl_Sensor_Custom_1_Functions.c:158
DSA_ERR_CONFIGURE
Definition: isf_dsa_adapter.h:31
DeviceDescriptor_struct::token
bm_callback_token_t token
Definition: isf_sensors.h:53
Custom_1_SensorData_Float_t::timestamp
isf_timestamp_t timestamp
Definition: fsl_Sensor_Custom_1_Functions.h:133
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.