-
Notifications
You must be signed in to change notification settings - Fork 0
/
MEMSAlgLib_Fusion.h
executable file
·136 lines (113 loc) · 3.52 KB
/
MEMSAlgLib_Fusion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
*
* File Name : MEMSAlgLib_Fusion.h
* Authors : ST Motion Sensors & iNEMO
* : Travis Tu (travis.tu@st.com)
* Version : V 1.43
* Date : 2011/11/08
* Description : iNEMO 9-axis Fusion Algorithm Library. For the Release Version,
* : Pls contact with Vincent Xu (vincent.xu@st.com)
*******************************************************************************/
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __MEMSALGLIB_FUSION_H
#define __MEMSALGLIB_FUSION_H
typedef struct
{
long ax;
long ay;
long az;
long mx;
long my;
long mz;
long gx;
long gy;
long gz;
long Azimuth;
long pitch;
long roll;
long time; //system time in ms
}NineAxisTypeDef;
typedef struct
{
float a;
float b;
float c;
float d;
}QuaternionTypeDef;
typedef struct
{
float x;
float y;
float z;
}GravityTypeDef;
typedef struct
{
float x;
float y;
float z;
}LinearAccTypeDef;
typedef struct
{
float x;
float y;
float z;
}AccTypeDef;
typedef struct
{
QuaternionTypeDef q;
GravityTypeDef g;
LinearAccTypeDef l;
}FusionTypeDef;
typedef struct
{
float pitch;
float roll;
float yaw;
}PRYTypeDef;
//void MEMSAlgLib_Fusion_Init(long oneGravityValue, long oneGaussValue, float oneDSPValue);
//gyro in ST's LSB short to long
//acc in mGravity
//mag in mGauss
FusionTypeDef MEMSAlgLib_Fusion_Update(NineAxisTypeDef v);
//to get the version of this algorithm
float MEMSAlgLib_Fusion_Get_Version(void);
//to get the filted ACC value after LPF.
AccTypeDef MEMSAlgLib_Fusion_Get_ACC(void);
//as an Air Mouse Mode in arc
//Picth: Vertical move, up Positive
//Roll: Scroll move, anti-clockwise Positive
//Yaw: Horizontal move, right Positive
PRYTypeDef GetAirMouseMove(void);
//to get gyro 0-rate offset
void MEMSAlgLib_Fusion_Get_GyroOffset(float *x, float *y, float *z); //unit: same LSB as input structure
//to get the record data
int MEMSAlgLib_Fusion_GetStoreValuesLength(void);
void MEMSAlgLib_Fusion_GetStoreValues(unsigned char* buf);
void MEMSAlgLib_Fusion_SetStoreValues(unsigned char* buf);
//property API
//algorithm customization API
void MEMSAlgLib_Fusion_SetMode(int mode); //default 9-axis fusion, //0-GyroMode, 1-AccMagMode, 2-AccMagGyroMode, 3-AccGyroMode
void MEMSAlgLib_FuSION_LPF(int active); //default on
void MEMSAlgLib_FuSION_AntiInterfere(int active); //default off
void MEMSAlgLib_Fusion_SelfLearning(int acitve); //default on
char MEMSAlgLib_Fusion_SelfLenrning_DoneON_XYZ(int idXYZ); //whether self learning is done on axis x 0 / y 1 /z 2
//Supplier property API
void MEMSAlgLib_Config(int id, float value); //only for professional.
long MEMSAlgLib_Get(int id); //only for professional.
QuaternionTypeDef MEMSAlgLib_GetQ3(void);
QuaternionTypeDef MEMSAlgLib_GetQ6(void);
#endif