Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
imu_navgo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Gautier Hattenberger
3  * Derived from Aspirin and ppzuavimu drivers
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  */
23 
24 #ifndef IMU_NAVGO_H
25 #define IMU_NAVGO_H
26 
27 #include "std.h"
28 #include "generated/airframe.h"
29 #include "subsystems/imu.h"
30 
31 // Default configuration
32 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
33 #define IMU_GYRO_P_SIGN 1
34 #define IMU_GYRO_Q_SIGN 1
35 #define IMU_GYRO_R_SIGN 1
36 #endif
37 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
38 #define IMU_ACCEL_X_SIGN 1
39 #define IMU_ACCEL_Y_SIGN 1
40 #define IMU_ACCEL_Z_SIGN 1
41 #endif
42 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
43 #define IMU_MAG_X_SIGN 1
44 #define IMU_MAG_Y_SIGN 1
45 #define IMU_MAG_Z_SIGN 1
46 #endif
47 
48 
49 extern volatile bool_t gyr_valid;
50 extern volatile bool_t acc_valid;
51 extern volatile bool_t mag_valid;
52 
53 /* must be defined in order to be IMU code: declared in imu.h
54 extern void imu_impl_init(void);
55 extern void imu_periodic(void);
56 */
57 
58 #define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) { \
59  imu_navgo_event(); \
60  if (gyr_valid) { \
61  gyr_valid = FALSE; \
62  _gyro_handler(); \
63  } \
64  if (acc_valid) { \
65  acc_valid = FALSE; \
66  _accel_handler(); \
67  } \
68  if (mag_valid) { \
69  mag_valid = FALSE; \
70  _mag_handler(); \
71  } \
72 }
73 
74 /* Own Extra Functions */
75 extern void imu_navgo_event( void );
76 extern void imu_navgo_downlink_raw( void );
77 
78 #endif // PPZUAVIMU_H
volatile bool_t mag_valid
Definition: imu_navgo.c:57
void imu_navgo_downlink_raw(void)
Definition: imu_navgo.c:92
volatile bool_t gyr_valid
Definition: imu_navgo.c:55
Inertial Measurement Unit interface.
void imu_navgo_event(void)
Definition: imu_navgo.c:100
volatile bool_t acc_valid
Definition: imu_navgo.c:56