ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
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
86 #endif
87 #ifdef USE_MAGNETOMETER
89 #endif
90 #ifdef USE_GYROMETER
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 
128 
129 typedef struct {
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 */
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
180 
182 
183 
184 /*! @brief Supported sensor and data types for MMA8652 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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.
unsigned char uint8
Definition: isf_types.h:76
Standard fixed type for three axis accelerometers.
The isf_magnetometer_types.h file contains the ISF data type definitions for use with the ISF generic...
isf_SensorDataTypes_t fsl_fusion_SupportedDataTypes[]
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.
void fsl_MagCal_task(uint32_t task_init_data)
Standard floating point type for single axis temperature sensor.
isf_SensorTypes_t fsl_fusion_SupportedSensorTypes[]
Supported sensor and data types for MMA8652.
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
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 ...
isf_SensorTypes_t
enum quaternion quaternion_type
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.
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
The isf_sensor_base_types.h file contains declarations for the general base types used in the isf sen...
The isf_gyrometer_types.h file contains the ISF data type definitions for use with the ISF generic gy...
Standard float type for three axis accelerometers.
enum isf_dsa_result_enums isf_dsa_result_types_t
The fusion_config.h file contains additional static configuration for the Sensor Fusion based Virtual...
isf_SensorDataTypes_t
The isf_altitude_types.h file contains the ISF data type definitions for use with the ISF generic alt...
The isf_temperature_fixed_t.h file contains the ISF data type definitions for use with the ISF generi...
uint32 isf_timestamp_t
Standard timestamp.
signed long int int32
Definition: isf_types.h:74
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...
void fsl_fusion_virt_3D_orient_PeriodicCallback(void *pSensorHandle)
The orientation sensor adapter's periodic processing function.
Standard float type for three axis accelerometers.
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.
void fsl_fusion_task(uint32_t task_init_data)
Standard floating point type for single axis altitude sensor.
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
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.
The isf_sm_types.h contains the collection of type definitions used in the Sensor Manager Interface a...
The isf_accelerometer_types.h file contains the ISF data type definitions for use with the ISF generi...
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 ...