| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fusion_exec.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Freescale Semiconductor, Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of Freescale Semiconductor, Inc. nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 // DISCLAIMED. IN NO EVENT SHALL FREESCALE SEMICONDUCTOR, INC. BE LIABLE FOR ANY
19 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 #ifndef FUSION_EXEC_H
27 #define FUSION_EXEC_H
28
29 #include "PE_Types.h"
30 #include "isf_sensor_base_types.h"
31 #include "sensor_data_types.h"
32 #include "fusion_types.h"
33 #include "fusion_config.h"
34 #include "magnetic.h"
35
36 typedef struct
37 {
38 // default quaternion type
39 quaternion_type algorithmToUse;
40
41 // counter incrementing each iteration of sensor fusion (typically 25Hz)
42 int32 loopcounter;
43
44 // sensor data structures
45 #ifdef USE_PRESSURE_SENSOR
46 // pressure sensor found flag
47 int8 usingPressureSensor;
48 uint8 pressureSampleCount;
49 isf_timestamp_t pressureTimestamp; // from the most recent sensor sample
50 struct PressureSensor thisPressure; // this pressure sensor
51 #endif
52
53 #ifdef USE_ACCELEROMETER
54 isf_timestamp_t accelTimestamp; // from the most recent sensor sample
55 struct AccelSensor thisAccel; // this accelerometer
56 #endif
57
58 #ifdef USE_MAGNETOMETER
59 struct MagSensor thisMag; // this magnetometer
60 struct MagCalibration thisMagCal; // hard and soft iron magnetic calibration
61 struct MagneticBuffer thisMagBuffer; // magnetometer measurement buffer
62 isf_timestamp_t magTimestamp; // from the most recent sensor sample
63 #endif
64
65 #ifdef USE_GYROMETER
66 struct GyroSensor thisGyro; // this gyro
67 isf_timestamp_t gyroTimestamp; // from the most recent sensor sample
68 #endif
69
70 // 1DOF pressure structure
71 #if defined COMPUTE_1DOF_P_BASIC
72 struct SV_1DOF_P_BASIC thisSV_1DOF_P_BASIC;
73 #endif
74
75 // 3DOF accelerometer (Basic) structure
76 #if defined COMPUTE_3DOF_G_BASIC
77 struct SV_3DOF_G_BASIC thisSV_3DOF_G_BASIC;
78 #endif
79
80 // 3DOF magnetometer (Basic) structure
81 #if defined COMPUTE_3DOF_B_BASIC
82 struct SV_3DOF_B_BASIC thisSV_3DOF_B_BASIC;
83 #endif
84
85 // 3DOF gyro (Basic) structure
86 #if defined COMPUTE_3DOF_Y_BASIC
87 struct SV_3DOF_Y_BASIC thisSV_3DOF_Y_BASIC;
88 #endif
89
90 // 6DOF accelerometer and magnetometer (Basic) structure
91 #if defined COMPUTE_6DOF_GB_BASIC
92 struct SV_6DOF_GB_BASIC thisSV_6DOF_GB_BASIC;
93 #endif
94
95 // 6DOF accelerometer and gyro (Kalman) structure
96 #if defined COMPUTE_6DOF_GY_KALMAN
97 struct SV_6DOF_GY_KALMAN thisSV_6DOF_GY_KALMAN;
98 #endif
99
100 // 9DOF accelerometer, magnetometer and gyro (Kalman) structure
101 #if defined COMPUTE_9DOF_GBY_KALMAN
102 struct SV_9DOF_GBY_KALMAN thisSV_9DOF_GBY_KALMAN;
103 #endif
104
105 // algorithm reset flag
106 int8 softReset;
107
108 } fusion_state_t;
109
110 extern struct PressureSensor thisPressure;
111 extern struct AccelSensor thisAccel;
112 extern struct MagSensor thisMag;
113 extern struct GyroSensor thisGyro;
114
115 // function prototypes for functions in tasks_func.c
116 void ApplyAccelHAL(struct AccelSensor *pthisAccel);
117 void ApplyMagHAL(struct MagSensor *pthisMag);
118 void ApplyGyroHAL(struct GyroSensor *pthisGyro, int16 irow);
119 void RdSensData_Init(void);
120 int32 RdSensData_Run();
121 void Fusion_Init(fusion_state_t *pState);
122 int8 Fusion_Run(fusion_state_t *pState, fusion_algorithmConfig_t *pAlgorithmConfig);
123 void MagCal_Run(fusion_state_t *pState);
124
125 #endif // #ifndef FUSION_EXEC_H
126
MagneticBuffer
Definition: magnetic.h:33
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
thisMag
struct MagSensor thisMag
ApplyMagHAL
void ApplyMagHAL(struct MagSensor *pthisMag)
ApplyAccelHAL
void ApplyAccelHAL(struct AccelSensor *pthisAccel)
thisSV_3DOF_B_BASIC
struct SV_3DOF_B_BASIC thisSV_3DOF_B_BASIC
thisMagBuffer
struct MagneticBuffer thisMagBuffer
ApplyGyroHAL
void ApplyGyroHAL(struct GyroSensor *pthisGyro, int16 irow)
Fusion_Init
void Fusion_Init(fusion_state_t *pState)
Definition: fusion_exec.c:49
fusion_state_t::gyroTimestamp
isf_timestamp_t gyroTimestamp
Definition: fusion_exec.h:67
SV_3DOF_B_BASIC
Definition: fusion_types.h:74
thisSV_6DOF_GY_KALMAN
struct SV_6DOF_GY_KALMAN thisSV_6DOF_GY_KALMAN
int8
signed char int8
Definition: basic_types.h:12
AccelSensor
Definition: sensor_data_types.h:28
SV_9DOF_GBY_KALMAN
Definition: fusion_types.h:202
MagSensor
Definition: sensor_data_types.h:39
quaternion_type
enum quaternion quaternion_type
SV_1DOF_P_BASIC
Definition: fusion_types.h:37
MagCal_Run
void MagCal_Run(fusion_state_t *pState)
Definition: fusion_exec.c:257
SV_6DOF_GY_KALMAN
Definition: fusion_types.h:153
fusion_state_t::softReset
int8 softReset
Definition: fusion_exec.h:106
thisGyro
struct GyroSensor thisGyro
RdSensData_Init
void RdSensData_Init(void)
isf_sensor_base_types.h
The isf_sensor_base_types.h file contains declarations for the general base types used in the isf sen...
RdSensData_Run
int32 RdSensData_Run()
fusion_state_t::accelTimestamp
isf_timestamp_t accelTimestamp
Definition: fusion_exec.h:54
thisSV_3DOF_Y_BASIC
struct SV_3DOF_Y_BASIC thisSV_3DOF_Y_BASIC
SV_3DOF_Y_BASIC
Definition: fusion_types.h:100
thisMagCal
struct MagCalibration thisMagCal
magnetic.h
fusion_state_t::algorithmToUse
quaternion_type algorithmToUse
Definition: fusion_exec.h:39
fusion_config.h
The fusion_config.h file contains additional static configuration for the Sensor Fusion based Virtual...
fusion_types.h
thisSV_1DOF_P_BASIC
struct SV_1DOF_P_BASIC thisSV_1DOF_P_BASIC
isf_timestamp_t
uint32 isf_timestamp_t
Standard timestamp.
Definition: isf_sensor_base_types.h:15
fusion_state_t::loopcounter
int32 loopcounter
Definition: fusion_exec.h:42
int32
long int32
This defines int32 as long.
Definition: isf_types.h:32
thisSV_3DOF_G_BASIC
struct SV_3DOF_G_BASIC thisSV_3DOF_G_BASIC
fusion_state_t
Definition: fusion_exec.h:36
int16
short int16
This defines int16 as short.
Definition: isf_types.h:23
MagCalibration
Definition: magnetic.h:42
sensor_data_types.h
thisSV_6DOF_GB_BASIC
struct SV_6DOF_GB_BASIC thisSV_6DOF_GB_BASIC
fusion_state_t::magTimestamp
isf_timestamp_t magTimestamp
Definition: fusion_exec.h:62
thisSV_9DOF_GBY_KALMAN
struct SV_9DOF_GBY_KALMAN thisSV_9DOF_GBY_KALMAN
Fusion_Run
int8 Fusion_Run(fusion_state_t *pState, fusion_algorithmConfig_t *pAlgorithmConfig)
Definition: fusion_exec.c:99
SV_6DOF_GB_BASIC
Definition: fusion_types.h:125
SV_3DOF_G_BASIC
Definition: fusion_types.h:48
thisAccel
struct AccelSensor thisAccel
fusion_algorithmConfig_t
Definition: fusion_types.h:258
GyroSensor
Definition: sensor_data_types.h:54
PressureSensor
Definition: sensor_data_types.h:15
thisPressure
struct PressureSensor thisPressure
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.