Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_apogee.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Gautier Hattenberger
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
30 #ifndef IMU_APOGEE_H
31 #define IMU_APOGEE_H
32 
33 #include "std.h"
34 #include "generated/airframe.h"
35 #include "subsystems/imu.h"
36 
38 
39 // Default configuration
40 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
41 #define IMU_GYRO_P_SIGN 1
42 #define IMU_GYRO_Q_SIGN 1
43 #define IMU_GYRO_R_SIGN 1
44 #endif
45 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
46 #define IMU_ACCEL_X_SIGN 1
47 #define IMU_ACCEL_Y_SIGN 1
48 #define IMU_ACCEL_Z_SIGN 1
49 #endif
50 
56 #if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
57 // FIXME
58 #define IMU_GYRO_P_SENS 2.17953
59 #define IMU_GYRO_P_SENS_NUM 18271
60 #define IMU_GYRO_P_SENS_DEN 8383
61 #define IMU_GYRO_Q_SENS 2.17953
62 #define IMU_GYRO_Q_SENS_NUM 18271
63 #define IMU_GYRO_Q_SENS_DEN 8383
64 #define IMU_GYRO_R_SENS 2.17953
65 #define IMU_GYRO_R_SENS_NUM 18271
66 #define IMU_GYRO_R_SENS_DEN 8383
67 #endif
68 #if !defined IMU_GYRO_P_NEUTRAL & !defined IMU_GYRO_Q_NEUTRAL & !defined IMU_GYRO_R_NEUTRAL
69 #define IMU_GYRO_P_NEUTRAL 0
70 #define IMU_GYRO_Q_NEUTRAL 0
71 #define IMU_GYRO_R_NEUTRAL 0
72 #endif
73 
74 
79 #if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
80 // FIXME
81 #define IMU_ACCEL_X_SENS 2.4525
82 #define IMU_ACCEL_X_SENS_NUM 981
83 #define IMU_ACCEL_X_SENS_DEN 400
84 #define IMU_ACCEL_Y_SENS 2.4525
85 #define IMU_ACCEL_Y_SENS_NUM 981
86 #define IMU_ACCEL_Y_SENS_DEN 400
87 #define IMU_ACCEL_Z_SENS 2.4525
88 #define IMU_ACCEL_Z_SENS_NUM 981
89 #define IMU_ACCEL_Z_SENS_DEN 400
90 #endif
91 #if !defined IMU_ACCEL_X_NEUTRAL & !defined IMU_ACCEL_Y_NEUTRAL & !defined IMU_ACCEL_Z_NEUTRAL
92 #define IMU_ACCEL_X_NEUTRAL 0
93 #define IMU_ACCEL_Y_NEUTRAL 0
94 #define IMU_ACCEL_Z_NEUTRAL 0
95 #endif
96 
97 struct ImuApogee {
98  volatile bool_t gyr_valid;
99  volatile bool_t acc_valid;
100  struct Mpu60x0_I2c mpu;
101 };
102 
103 extern struct ImuApogee imu_apogee;
104 
105 
106 /* must be defined in order to be IMU code: declared in imu.h
107 extern void imu_impl_init(void);
108 extern void imu_periodic(void);
109 */
110 
111 /* Own Extra Functions */
112 extern void imu_apogee_event( void );
113 extern void imu_apogee_downlink_raw( void );
114 
115 
116 static inline void ImuEvent(void (* _gyro_handler)(void), void (* _accel_handler)(void), void (* _mag_handler)(void) __attribute__((unused))) {
118  if (imu_apogee.gyr_valid) {
120  _gyro_handler();
121  }
122  if (imu_apogee.acc_valid) {
124  _accel_handler();
125  }
126 }
127 
128 #endif // IMU_APOGEE_H
void imu_apogee_downlink_raw(void)
Definition: imu_apogee.c:95
volatile bool_t acc_valid
Definition: imu_apogee.h:99
void imu_apogee_event(void)
Definition: imu_apogee.c:102
#define FALSE
Definition: imu_chimu.h:141
static void ImuEvent(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
Definition: imu_apogee.h:116
Inertial Measurement Unit interface.
Driver for the MPU-60X0 using I2C.
struct Mpu60x0_I2c mpu
Definition: imu_apogee.h:100
volatile bool_t gyr_valid
Definition: imu_apogee.h:98
struct ImuApogee imu_apogee
Definition: imu_apogee.c:59