Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
imu_b2.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
3  * Copyright (C) 2012 Gautier Hattenberger
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, write to
19  * the Free Software Foundation, 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 
30 #ifndef IMU_B2_H
31 #define IMU_B2_H
32 
33 #include "generated/airframe.h"
34 
35 #include "peripherals/max1168.h"
36 
37 /* type of magnetometer */
38 #define IMU_B2_MAG_NONE 0
39 #define IMU_B2_MAG_MS2100 1
40 #define IMU_B2_MAG_AMI601 2
41 #define IMU_B2_MAG_HMC5843 3
42 #define IMU_B2_MAG_HMC58XX 4
43 
44 #if defined IMU_B2_MAG_TYPE
45 #if IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC58XX
46 #include "peripherals/hmc58xx.h"
47 #elif IMU_B2_MAG_TYPE == IMU_B2_MAG_MS2100
48 #include "peripherals/ms2100.h"
49 #elif IMU_B2_MAG_TYPE == IMU_B2_MAG_AMI601
50 #include "peripherals/ami601.h"
51 #elif IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC5843
52 #include "peripherals/hmc5843.h"
53 #endif
54 #endif
55 
56 #ifdef IMU_B2_VERSION_1_0
57 /* Default IMU b2 sensors connection */
58 #if !defined IMU_GYRO_P_CHAN & !defined IMU_GYRO_Q_CHAN & !defined IMU_GYRO_R_CHAN
59 #define IMU_GYRO_P_CHAN 1
60 #define IMU_GYRO_Q_CHAN 0
61 #define IMU_GYRO_R_CHAN 2
62 #endif
63 #if !defined IMU_ACCEL_X_CHAN & !defined IMU_ACCEL_Y_CHAN & !defined IMU_ACCEL_Z_CHAN
64 #define IMU_ACCEL_X_CHAN 3
65 #define IMU_ACCEL_Y_CHAN 5
66 #define IMU_ACCEL_Z_CHAN 6
67 #endif
68 #if !defined IMU_MAG_X_CHAN & !defined IMU_MAG_Y_CHAN & !defined IMU_MAG_Z_CHAN
69 #define IMU_MAG_X_CHAN 0
70 #define IMU_MAG_Y_CHAN 1
71 #define IMU_MAG_Z_CHAN 2
72 #endif
73 
74 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
75 #define IMU_GYRO_P_SIGN 1
76 #define IMU_GYRO_Q_SIGN -1
77 #define IMU_GYRO_R_SIGN -1
78 #endif
79 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
80 #define IMU_ACCEL_X_SIGN -1
81 #define IMU_ACCEL_Y_SIGN -1
82 #define IMU_ACCEL_Z_SIGN -1
83 #endif
84 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
85 #define IMU_MAG_X_SIGN 1
86 #define IMU_MAG_Y_SIGN -1
87 #define IMU_MAG_Z_SIGN -1
88 #endif
89 #endif /* IMU_B2_VERSION_1_0 */
90 
91 
92 #ifdef IMU_B2_VERSION_1_1
93 /* Default IMU b2 sensors connection */
94 #if !defined IMU_GYRO_P_CHAN & !defined IMU_GYRO_Q_CHAN & !defined IMU_GYRO_R_CHAN
95 #define IMU_GYRO_P_CHAN 1
96 #define IMU_GYRO_Q_CHAN 0
97 #define IMU_GYRO_R_CHAN 2
98 #endif
99 #if !defined IMU_ACCEL_X_CHAN & !defined IMU_ACCEL_Y_CHAN & !defined IMU_ACCEL_Z_CHAN
100 #define IMU_ACCEL_X_CHAN 5
101 #define IMU_ACCEL_Y_CHAN 3
102 #define IMU_ACCEL_Z_CHAN 4
103 #endif
104 #if !defined IMU_MAG_X_CHAN & !defined IMU_MAG_Y_CHAN & !defined IMU_MAG_Z_CHAN
105 #define IMU_MAG_X_CHAN 0
106 #define IMU_MAG_Y_CHAN 1
107 #define IMU_MAG_Z_CHAN 2
108 #endif
109 
110 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
111 #define IMU_GYRO_P_SIGN 1
112 #define IMU_GYRO_Q_SIGN -1
113 #define IMU_GYRO_R_SIGN -1
114 #endif
115 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
116 #define IMU_ACCEL_X_SIGN -1
117 #define IMU_ACCEL_Y_SIGN -1
118 #define IMU_ACCEL_Z_SIGN -1
119 #endif
120 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
121 #define IMU_MAG_X_SIGN 1
122 #define IMU_MAG_Y_SIGN -1
123 #define IMU_MAG_Z_SIGN -1
124 #endif
125 #endif /* IMU_B2_VERSION_1_1 */
126 
127 #ifdef IMU_B2_VERSION_1_2
128 /* Default IMU b2 sensors connection */
129 #if !defined IMU_GYRO_P_CHAN & !defined IMU_GYRO_Q_CHAN & !defined IMU_GYRO_R_CHAN
130 #define IMU_GYRO_P_CHAN 1
131 #define IMU_GYRO_Q_CHAN 0
132 #define IMU_GYRO_R_CHAN 2
133 #endif
134 #if !defined IMU_ACCEL_X_CHAN & !defined IMU_ACCEL_Y_CHAN & !defined IMU_ACCEL_Z_CHAN
135 #define IMU_ACCEL_X_CHAN 4
136 #define IMU_ACCEL_Y_CHAN 5
137 #define IMU_ACCEL_Z_CHAN 3
138 #endif
139 #if !defined IMU_MAG_X_CHAN & !defined IMU_MAG_Y_CHAN & !defined IMU_MAG_Z_CHAN
140 #define IMU_MAG_X_CHAN 0
141 #define IMU_MAG_Y_CHAN 1
142 #define IMU_MAG_Z_CHAN 2
143 #endif
144 
145 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
146 #define IMU_GYRO_P_SIGN 1
147 #define IMU_GYRO_Q_SIGN -1
148 #define IMU_GYRO_R_SIGN -1
149 #endif
150 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
151 #define IMU_ACCEL_X_SIGN 1
152 #define IMU_ACCEL_Y_SIGN -1
153 #define IMU_ACCEL_Z_SIGN 1
154 #endif
155 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
156 #define IMU_MAG_X_SIGN -1
157 #define IMU_MAG_Y_SIGN -1
158 #define IMU_MAG_Z_SIGN 1
159 #endif
160 #endif /* IMU_B2_VERSION_1_2 */
161 
162 /*
163  * we include imh.h after the definitions channels and signs
164  */
165 #include "subsystems/imu.h"
166 
167 
168 struct ImuBooz2 {
169 #if defined IMU_B2_MAG_TYPE && IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC58XX
170  struct Hmc58xx mag_hmc;
171 #endif
172 };
173 
174 extern struct ImuBooz2 imu_b2;
175 
176 extern void imu_b2_init(void);
177 extern void imu_b2_periodic(void);
178 extern void imu_b2_event(void);
179 
180 #endif /* IMU_B2_H */
imu_b2_init
void imu_b2_init(void)
Definition: imu_b2.c:38
imu_b2_periodic
void imu_b2_periodic(void)
Definition: imu_b2.c:57
ms2100.h
ImuBooz2
Definition: imu_b2.h:168
max1168.h
imu.h
ami601.h
imu_b2_event
void imu_b2_event(void)
Definition: imu_b2.c:152
hmc5843.h
imu_b2
struct ImuBooz2 imu_b2
Definition: imu_b2.c:34
hmc58xx.h
Hmc58xx
Definition: hmc58xx.h:60