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_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 
33 #ifndef IMU_NAVGO_H
34 #define IMU_NAVGO_H
35 
36 #include "std.h"
37 #include "generated/airframe.h"
38 #include "subsystems/imu.h"
39 
40 #include "peripherals/itg3200.h"
42 #include "peripherals/hmc58xx.h"
43 
44 // Default configuration
45 #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
46 #define IMU_GYRO_P_SIGN 1
47 #define IMU_GYRO_Q_SIGN 1
48 #define IMU_GYRO_R_SIGN 1
49 #endif
50 #if !defined IMU_ACCEL_X_SIGN & !defined IMU_ACCEL_Y_SIGN & !defined IMU_ACCEL_Z_SIGN
51 #define IMU_ACCEL_X_SIGN 1
52 #define IMU_ACCEL_Y_SIGN 1
53 #define IMU_ACCEL_Z_SIGN 1
54 #endif
55 #if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
56 #define IMU_MAG_X_SIGN 1
57 #define IMU_MAG_Y_SIGN 1
58 #define IMU_MAG_Z_SIGN 1
59 #endif
60 
61 
62 struct ImuNavgo {
63  volatile bool_t gyr_valid;
64  volatile bool_t acc_valid;
65  volatile bool_t mag_valid;
66  struct Itg3200 itg;
67  struct Adxl345_I2c adxl;
68  struct Hmc58xx hmc;
69 };
70 
71 extern struct ImuNavgo imu_navgo;
72 
73 /* Own Extra Functions */
74 extern void imu_navgo_event( void );
75 extern void imu_navgo_downlink_raw( void );
76 
77 
78 static inline void ImuEvent(void (* _gyro_handler)(void), void (* _accel_handler)(void), void (* _mag_handler)(void)) {
80  if (imu_navgo.gyr_valid) {
82  _gyro_handler();
83  }
84  if (imu_navgo.acc_valid) {
86  _accel_handler();
87  }
88  if (imu_navgo.mag_valid) {
90  _mag_handler();
91  }
92 }
93 
94 #endif // PPZUAVIMU_H
static void ImuEvent(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
Definition: imu_navgo.h:78
#define FALSE
Definition: imu_chimu.h:141
void imu_navgo_downlink_raw(void)
Definition: imu_navgo.c:114
Driver for the gyro ITG3200 from InvenSense.
Inertial Measurement Unit interface.
struct Adxl345_I2c adxl
Definition: imu_navgo.h:67
volatile bool_t gyr_valid
Definition: imu_navgo.h:63
volatile bool_t acc_valid
Definition: imu_navgo.h:64
void imu_navgo_event(void)
Definition: imu_navgo.c:121
struct Itg3200 itg
Definition: imu_navgo.h:66
Driver for the accelerometer ADXL345 from Analog Devices using I2C.
struct Hmc58xx hmc
Definition: imu_navgo.h:68
volatile bool_t mag_valid
Definition: imu_navgo.h:65
struct ImuNavgo imu_navgo
Definition: imu_navgo.c:63