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

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

fsl_fusion_virt_3D_orient.h
Go to the documentation of this file.
1 /*!
2 ********************************************************************************
3 * File: fsl_fusion_virt_3D_orient.c
4 *
5 * Copyright (c) 2015, Freescale Semiconductor, Inc.
6 *
7 *******************************************************************************/
8 /*!
9 /* ###################################################################
10 ** THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
11 ** Filename : fsl_fusion_virt_3D_orient.h
12 ** CDE edition : Standard
13 ** Project : Round2_KL25Z_PEX_Project
14 ** Processor : MKL25Z128VLK4
15 ** Component : ISFDSA
16 ** Version : Component 01.000, Driver 01.00, CPU db: 3.00.000
17 ** Compiler : GNU C Compiler
18 ** Abstract :
19 **
20 ** Settings :
21 ** Contents :
22 ** PeriodicCallback -
23 ** Calibrate -
24 ** EndData -
25 ** StartData -
26 ** Configure -
27 ** ValidateSettings -
28 ** Initialize -
29 **
30 ** ###################################################################*/
31 /*!
32 ** @file fsl_fusion_virt_3D_orient.h
33 ** @version 01.00
34 ** @brief
35 **
36 */
37 /*!
38 ** @addtogroup fsl_fusion_virt_3D_orient_module fsl_fusion_virt_3D_orient module documentation
39 ** @{
40 */
41
42 #ifndef __fsl_fusion_virt_3D_orient_H
43 #define __fsl_fusion_virt_3D_orient_H
44
45 /* MODULE fsl_fusion_virt_3D_orient. */
46
47 /* Include shared modules, which are used for whole project */
48 //#include "PE_Types.h"
49 //#include "PE_Error.h"
50 //#include "PE_Const.h"
51 //#include "IO_Map.h"
52 /* Include inherited components */
53
54 #include "Cpu.h"
55 #include "fusion_config.h"
56 #include "fusion_types.h"
57 #include "fusion_exec.h"
58 #include "isf_sm_types.h"
59 #include "isf_sensor_base_types.h"
60 #include "isf_dsa_adapter.h"
61 #include "magnetic.h"
62
63 #ifdef USE_ACCELEROMETER
64 # include "isf_accelerometer_types.h"
65 #endif
66 #ifdef USE_GYROMETER
67 # include "isf_gyrometer_types.h"
68 #endif
69 #ifdef USE_MAGNETOMETER
70 # include "isf_magnetometer_types.h"
71 #endif
72 #ifdef USE_PRESSURE_SENSOR
73 # include "isf_altitude_types.h"
74 # include "isf_temperature_types.h"
75 #endif
76
77 typedef struct {
78
79
80 #ifdef USE_PRESSURE_SENSOR
81 isf_Meters1D_float_t pressureData;
82 isf_DegreesCelsius1D_float_t temperatureData;
83 #endif
84 #ifdef USE_ACCELEROMETER
85 isf_Acceleration3D_Float_t accelData;
86 #endif
87 #ifdef USE_MAGNETOMETER
88 isf_MagneticFieldStrength3D_float_t magData;
89 #endif
90 #ifdef USE_GYROMETER
91 isf_AngularVelocity3D__float_t gyroData;
92 #endif
93
94 // start: elements common to all motion state vectors
95 isf_timestamp_t timestamp; // from the most recent sensor sample
96
97 // Euler angles
98 float fPhi; // roll (deg)
99 float fThe; // pitch (deg)
100 float fPsi; // yaw (deg)
101 float fRho; // compass (deg)
102 float fChi; // tilt from vertical (deg)
103 float fDelta; // inclination angle (deg)
104 // orientation matrix, quaternion and rotation vector
105 float fRmatrix[3][3]; // a posteriori orientation matrix
106 struct fquaternion fq; // a posteriori orientation quaternion
107 float fRVec[3]; // rotation vector
108 // angular velocity
109 float fOmega[3]; // angular velocity (deg/s)
110 // end: elements common to all motion state vectors
111 float faSe[3]; // linear acceleration (g, sensor frame)
112 float fHp; // Altitude (m)
113 float fTp; // Temperature (deg C)
114 // linear acceleration and displacement
115 float fAccGl[3]; // linear acceleration (g) in global frame
116 float fDisGl[3]; // displacement (m) in global frame
117 // error and offset values
118 // float fb[3]; // gyro offset (deg/s)
119 // float fThErr[3]; // orientation error (deg)
120 // float fbErr[3]; // gyro offset error (deg/s)
121 float fZErr[7]; // measurement error vector
122 float fqgErrPl[3]; // gravity vector tilt orientation quaternion error (dimensionless)
123 float fbPl[3]; // gyro offset (deg/s)
124 float fDeltaPl; // a posteriori inclination angle from Kalman filter (deg)
125 float fqmErrPl[3]; // geomagnetic vector tilt orientation quaternion error (dimensionless)
126
127 } fsl_orientation_DataBuffer_t;
128
129 typedef struct {
130 fusion_algorithmConfig_t algorithmConfig;
131 #ifdef USE_ACCELEROMETER
132 uint8 accelerometerSensorId; /* Index into the gSensorList array for the accel to use */
133 #endif
134 #ifdef USE_MAGNETOMETER
135 uint8 magnetometerSensorId; /* Index into the gSensorList array for the mag to use */
136 #endif
137 #ifdef USE_GYROMETER
138 uint8 gyroSensorId; /* Index into the gSensorList array for the gyro to use */
139 #endif
140 #ifdef USE_PRESSURE_SENSOR
141 uint8 pressureSensorId; /* Index into the gSensorList array for the pressure sensor to use */
142 #endif
143 uint8 lowPassFilterEnabled; /* Flag indicating whether the Euler Angle values should be filtered or not */
144 quaternion_type algorithmToUse; /* specifies which algorithm to take the orientation data from */
145 } fsl_fusion_Sensor_Specific_Settings_t;
146
147 typedef struct {
148
149 event_t sensorLWEvent; /* lightweight event for sensor notifications. */
150 event_t MagCalEventStruct; /* lightweight event for MagCal task */
151 semaphore_t deviceSemaphore; /*!< Task synchronization mechanism for this data structure. */
152 isf_timestamp_t timestamp; // from the most recent sensor sample
153 #ifdef USE_ACCELEROMETER
154 isf_SensorHandle_t accelHandle;
155 #endif
156 #ifdef USE_MAGNETOMETER
157 isf_SensorHandle_t magHandle;
158 #endif
159 #ifdef USE_GYROMETER
160 isf_SensorHandle_t gyroHandle;
161 #endif
162 #ifdef USE_PRESSURE_SENSOR
163 isf_SensorHandle_t pressureHandle;
164 #endif
165
166 #ifdef USE_ACCELEROMETER
167 isf_fifo_t accelFifo;
168 #endif
169 #ifdef USE_MAGNETOMETER
170 isf_fifo_t magFifo;
171 #endif
172 #ifdef USE_GYROMETER
173 isf_fifo_t gyroFifo;
174 #endif
175 #ifdef USE_PRESSURE_SENSOR
176 isf_fifo_t pressureFifo;
177 #endif
178 int32 sensorDataReady;
179 fusion_state_t fusionState;
180
181 } fsl_fusion_DeviceDescriptor_t;
182
183
184 /*! @brief Supported sensor and data types for MMA8652 */
185 extern isf_SensorTypes_t fsl_fusion_SupportedSensorTypes[];
186 extern isf_SensorDataTypes_t fsl_fusion_SupportedDataTypes[];
187
188 /*
189 ** ===================================================================
190 ** Method : fsl_fusion_virt_3D_orient_Initialize (component ISFDSA)
191 ** @brief
192 **
193 ** Parameters :
194 ** NAME - DESCRIPTION
195 ** @param
196 ** void* pSensorHandle -
197 ** @return
198 ** int32_t -
199 ** ===================================================================
200 */
201 isf_dsa_status_t fsl_fusion_virt_3D_orient_Initialize( isf_SensorHandle_t *pSensorHandle);
202
203 /*
204 ** ===================================================================
205 ** Method : fsl_fusion_virt_3D_orient_ValidateSettings (component ISFDSA)
206 ** @brief
207 **
208 ** Parameters :
209 ** NAME - DESCRIPTION
210 ** @param
211 ** void* pSensorHandle -
212 ** @param
213 ** void* pSettings -
214 ** @return
215 ** int32_t -
216 ** ===================================================================
217 */
218 isf_dsa_status_t fsl_fusion_virt_3D_orient_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSubSettings);
219
220 /*
221 ** ===================================================================
222 ** Method : fsl_fusion_virt_3D_orient_Configure (component ISFDSA)
223 ** @brief
224 **
225 ** Parameters :
226 ** NAME - DESCRIPTION
227 ** @param
228 ** void* pSensorHandle -
229 ** @param
230 ** void* pConfigSettings -
231 ** @return
232 ** int32_t -
233 ** ===================================================================
234 */
235 isf_dsa_status_t fsl_fusion_virt_3D_orient_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings);
236
237 /*
238 ** ===================================================================
239 ** Method : fsl_fusion_virt_3D_orient_StartData (component ISFDSA)
240 ** @brief
241 **
242 ** Parameters :
243 ** NAME - DESCRIPTION
244 ** @param
245 ** void* pSensorHandle -
246 ** @return
247 ** int32_t -
248 ** ===================================================================
249 */
250 isf_dsa_status_t fsl_fusion_virt_3D_orient_StartData(isf_SensorHandle_t *pSensorHandle );
251
252 /*
253 ** ===================================================================
254 ** Method : fsl_fusion_virt_3D_orient_EndData (component ISFDSA)
255 ** @brief
256 **
257 ** Parameters :
258 ** NAME - DESCRIPTION
259 ** @param
260 ** void* pSensorHandle -
261 ** @return
262 ** int32_t -
263 ** ===================================================================
264 */
265 isf_dsa_status_t fsl_fusion_virt_3D_orient_EndData(isf_SensorHandle_t *pSensorHandle );
266
267 /*
268 ** ===================================================================
269 ** Method : fsl_fusion_virt_3D_orient_Calibrate (component ISFDSA)
270 ** @brief
271 **
272 ** Parameters :
273 ** NAME - DESCRIPTION
274 ** @param
275 ** void* pSensorHandle -
276 ** @return
277 ** int32_t -
278 ** ===================================================================
279 */
280 isf_dsa_status_t fsl_fusion_virt_3D_orient_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData );
281
282 /*
283 ** ===================================================================
284 ** Method : fsl_fusion_virt_3D_orient_Shutdown (component ISFDSA)
285 ** @brief
286 **
287 ** Parameters :
288 ** NAME - DESCRIPTION
289 ** @param
290 ** void* pSensorHandle -
291 ** @return
292 ** int32_t -
293 ** ===================================================================
294 */
295 isf_dsa_status_t fsl_fusion_virt_3D_orient_Shutdown(isf_SensorHandle_t *pSensorHandle );
296
297 /*
298 ** ===================================================================
299 ** Method : fsl_fusion_virt_3D_orient_PeriodicCallback (component ISFDSA)
300 ** @brief
301 **
302 ** Parameters :
303 ** NAME - DESCRIPTION
304 ** @param
305 ** void* pSensorHandle -
306 ** @return
307 ** void -
308 ** ===================================================================
309 */
310 void fsl_fusion_virt_3D_orient_PeriodicCallback(void *pSensorHandle);
311
312 /*
313 ** ===================================================================
314 ** Method : fsl_fusion_virt_3D_orient_Convert (component ISFDSA)
315 ** @brief
316 **
317 ** Parameters :
318 ** NAME - DESCRIPTION
319 ** @param
320 ** void* pSensorHandle -
321 ** @return
322 ** void -
323 ** ===================================================================
324 */
325 isf_dsa_status_t fsl_fusion_virt_3D_orient_Convert
326 (
327 volatile isf_SensorHandle_t *pSensorHandle,
328 isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType,
329 void *pNativeSample,
330 void *pConvertedSample,
331 int32 *numBytes
332 );
333
334 /*
335 ** ===================================================================
336 ** Method : fsl_MagCal_task
337 ** @brief : Top level executive for the MagCal task
338 **
339 ** Parameters :
340 ** NAME - DESCRIPTION
341 ** @param
342 ** uint32_t task_init_data
343 ** @return
344 ** void -
345 ** ===================================================================
346 */
347 void fsl_MagCal_task(uint32_t task_init_data);
348 /*
349 ** ===================================================================
350 ** Method : fsl_fusion_task
351 ** @brief : Top level executive for the fusion task
352 **
353 ** Parameters :
354 ** NAME - DESCRIPTION
355 ** @param
356 ** uint32_t task_init_data -
357 ** @return
358 ** void -
359 ** ===================================================================
360 */
361 void fsl_fusion_task(uint32_t task_init_data);
362
363 /* END fsl_fusion_virt_3D_orient. */
364
365 #endif
366 /* ifndef __fsl_fusion_virt_3D_orient_H */
367 /*!
368 ** @}
369 */
370 /*
371 ** ###################################################################
372 **
373 ** This file was created by Processor Expert 10.3 [05.09]
374 ** for the Freescale Kinetis series of microcontrollers.
375 **
376 ** ###################################################################
377 */
Cpu.h
fsl_fusion_virt_3D_orient_Initialize
isf_dsa_status_t fsl_fusion_virt_3D_orient_Initialize(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the orientation sensor adapter initialization.
Definition: fsl_fusion_virt_3D_orient.c:154
uint8
unsigned char uint8
Definition: isf_types.h:76
fsl_fusion_Sensor_Specific_Settings_t
Definition: fsl_fusion_virt_3D_orient.h:129
isf_dsa_adapter.h
fsl_orientation_DataBuffer_t::fChi
float fChi
Definition: fsl_fusion_virt_3D_orient.h:102
isf_MagneticFieldStrength3D_float_t
Standard fixed type for three axis accelerometers.
Definition: isf_magnetometer_types.h:80
isf_magnetometer_types.h
The isf_magnetometer_types.h file contains the ISF data type definitions for use with the ISF generic...
fsl_orientation_DataBuffer_t::fHp
float fHp
Definition: fsl_fusion_virt_3D_orient.h:112
fsl_fusion_SupportedDataTypes
isf_SensorDataTypes_t fsl_fusion_SupportedDataTypes[]
Definition: fsl_fusion_virt_3D_orient.c:102
fsl_fusion_virt_3D_orient_Configure
isf_dsa_status_t fsl_fusion_virt_3D_orient_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the fusion sensor adapter configuration function.
Definition: fsl_fusion_virt_3D_orient.c:394
fsl_fusion_Sensor_Specific_Settings_t::algorithmToUse
quaternion_type algorithmToUse
Definition: fsl_fusion_virt_3D_orient.h:144
fsl_MagCal_task
void fsl_MagCal_task(uint32_t task_init_data)
Definition: fsl_fusion_virt_3D_orient.c:1225
fsl_orientation_DataBuffer_t
Definition: fsl_fusion_virt_3D_orient.h:77
isf_DegreesCelsius1D_float_t
Standard floating point type for single axis temperature sensor.
Definition: isf_temperature_types.h:35
fsl_fusion_SupportedSensorTypes
isf_SensorTypes_t fsl_fusion_SupportedSensorTypes[]
Supported sensor and data types for MMA8652.
Definition: fsl_fusion_virt_3D_orient.c:92
fsl_fusion_DeviceDescriptor_t::timestamp
isf_timestamp_t timestamp
Definition: fsl_fusion_virt_3D_orient.h:152
fsl_fusion_DeviceDescriptor_t::sensorLWEvent
event_t sensorLWEvent
Definition: fsl_fusion_virt_3D_orient.h:149
fsl_orientation_DataBuffer_t::fPsi
float fPsi
Definition: fsl_fusion_virt_3D_orient.h:100
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_fusion_DeviceDescriptor_t
Definition: fsl_fusion_virt_3D_orient.h:147
fsl_fusion_DeviceDescriptor_t::deviceSemaphore
semaphore_t deviceSemaphore
Definition: fsl_fusion_virt_3D_orient.h:151
fusion_exec.h
fsl_fusion_DeviceDescriptor_t::sensorDataReady
int32 sensorDataReady
Definition: fsl_fusion_virt_3D_orient.h:178
fsl_fusion_DeviceDescriptor_t::fusionState
fusion_state_t fusionState
Definition: fsl_fusion_virt_3D_orient.h:179
fsl_fusion_virt_3D_orient_Shutdown
isf_dsa_status_t fsl_fusion_virt_3D_orient_Shutdown(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the orientation sensor adapter for shutdown ...
Definition: fsl_fusion_virt_3D_orient.c:759
isf_SensorTypes_t
isf_SensorTypes_t
Definition: isf_sensor_types.h:14
fquaternion
Definition: fusion_types.h:58
quaternion_type
enum quaternion quaternion_type
fsl_orientation_DataBuffer_t::fPhi
float fPhi
Definition: fsl_fusion_virt_3D_orient.h:98
fsl_orientation_DataBuffer_t::fDelta
float fDelta
Definition: fsl_fusion_virt_3D_orient.h:103
fsl_fusion_virt_3D_orient_EndData
isf_dsa_status_t fsl_fusion_virt_3D_orient_EndData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the orientation sensor adapter for End Data.
Definition: fsl_fusion_virt_3D_orient.c:649
isf_dsa_status_t
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
Definition: isf_dsa_adapter.h:21
isf_sensor_base_types.h
The isf_sensor_base_types.h file contains declarations for the general base types used in the isf sen...
isf_gyrometer_types.h
The isf_gyrometer_types.h file contains the ISF data type definitions for use with the ISF generic gy...
isf_AngularVelocity3D__float_t
Standard float type for three axis accelerometers.
Definition: isf_gyrometer_types.h:76
fsl_orientation_DataBuffer_t::fTp
float fTp
Definition: fsl_fusion_virt_3D_orient.h:113
isf_dsa_result_types_t
enum isf_dsa_result_enums isf_dsa_result_types_t
fsl_orientation_DataBuffer_t::fThe
float fThe
Definition: fsl_fusion_virt_3D_orient.h:99
magnetic.h
fsl_fusion_DeviceDescriptor_t::MagCalEventStruct
event_t MagCalEventStruct
Definition: fsl_fusion_virt_3D_orient.h:150
fusion_config.h
The fusion_config.h file contains additional static configuration for the Sensor Fusion based Virtual...
fsl_fusion_Sensor_Specific_Settings_t::algorithmConfig
fusion_algorithmConfig_t algorithmConfig
Definition: fsl_fusion_virt_3D_orient.h:130
fusion_types.h
isf_SensorDataTypes_t
isf_SensorDataTypes_t
Definition: isf_sensor_types.h:61
isf_altitude_types.h
The isf_altitude_types.h file contains the ISF data type definitions for use with the ISF generic alt...
isf_temperature_types.h
The isf_temperature_fixed_t.h file contains the ISF data type definitions for use with the ISF generi...
fsl_orientation_DataBuffer_t::fRho
float fRho
Definition: fsl_fusion_virt_3D_orient.h:101
fsl_orientation_DataBuffer_t::fDeltaPl
float fDeltaPl
Definition: fsl_fusion_virt_3D_orient.h:124
isf_timestamp_t
uint32 isf_timestamp_t
Standard timestamp.
Definition: isf_sensor_base_types.h:15
isf_fifo_t
Definition: isf_fifo.h:19
fusion_state_t
Definition: fusion_exec.h:36
int32
signed long int int32
Definition: isf_types.h:74
fsl_fusion_virt_3D_orient_ValidateSettings
isf_dsa_status_t fsl_fusion_virt_3D_orient_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSubSettings)
This is the concrete implementation of the orientation sensor adapter for validating current settings...
Definition: fsl_fusion_virt_3D_orient.c:322
fsl_fusion_virt_3D_orient_PeriodicCallback
void fsl_fusion_virt_3D_orient_PeriodicCallback(void *pSensorHandle)
The orientation sensor adapter's periodic processing function.
Definition: fsl_fusion_virt_3D_orient.c:801
isf_Acceleration3D_Float_t
Standard float type for three axis accelerometers.
Definition: isf_accelerometer_types.h:80
fsl_fusion_virt_3D_orient_StartData
isf_dsa_status_t fsl_fusion_virt_3D_orient_StartData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the orientation sensor adapter for start Data.
Definition: fsl_fusion_virt_3D_orient.c:555
fsl_fusion_task
void fsl_fusion_task(uint32_t task_init_data)
Definition: fsl_fusion_virt_3D_orient.c:1144
isf_Meters1D_float_t
Standard floating point type for single axis altitude sensor.
Definition: isf_altitude_types.h:36
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
fsl_orientation_DataBuffer_t::timestamp
isf_timestamp_t timestamp
Definition: fsl_fusion_virt_3D_orient.h:95
fsl_fusion_Sensor_Specific_Settings_t::lowPassFilterEnabled
uint8 lowPassFilterEnabled
Definition: fsl_fusion_virt_3D_orient.h:143
fsl_fusion_virt_3D_orient_Convert
isf_dsa_status_t fsl_fusion_virt_3D_orient_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_fusion_virt_3D_orient.c:1257
isf_sm_types.h
The isf_sm_types.h contains the collection of type definitions used in the Sensor Manager Interface a...
isf_accelerometer_types.h
The isf_accelerometer_types.h file contains the ISF data type definitions for use with the ISF generi...
fusion_algorithmConfig_t
Definition: fusion_types.h:264
fsl_fusion_virt_3D_orient_Calibrate
isf_dsa_status_t fsl_fusion_virt_3D_orient_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
This is the concrete implementation of the orientation sensor adapter for calibration ...
Definition: fsl_fusion_virt_3D_orient.c:742
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.