Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_ppzuav.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Antoine Drouin <poinix@gmail.com>
3  * 2013 Felix Ruess <felix.ruess@gmail.com>
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 
32 #ifndef IMU_PPZUAV_H
33 #define IMU_PPZUAV_H
34 
35 #include "generated/airframe.h"
36 #include "subsystems/imu.h"
37 
38 #include "peripherals/itg3200.h"
39 #include "peripherals/hmc58xx.h"
41 
42 #if !defined IMU_GYRO_P_SENS & !defined IMU_GYRO_Q_SENS & !defined IMU_GYRO_R_SENS
43 
48 #define IMU_GYRO_P_SENS 4.973
49 #define IMU_GYRO_P_SENS_NUM 4973
50 #define IMU_GYRO_P_SENS_DEN 1000
51 #define IMU_GYRO_Q_SENS 4.973
52 #define IMU_GYRO_Q_SENS_NUM 4973
53 #define IMU_GYRO_Q_SENS_DEN 1000
54 #define IMU_GYRO_R_SENS 4.973
55 #define IMU_GYRO_R_SENS_NUM 4973
56 #define IMU_GYRO_R_SENS_DEN 1000
57 #endif
58 
59 
60 #if !defined IMU_ACCEL_X_SENS & !defined IMU_ACCEL_Y_SENS & !defined IMU_ACCEL_Z_SENS
61 
70 #define IMU_ACCEL_X_SENS 37.91
71 #define IMU_ACCEL_X_SENS_NUM 3791
72 #define IMU_ACCEL_X_SENS_DEN 100
73 #define IMU_ACCEL_Y_SENS 37.91
74 #define IMU_ACCEL_Y_SENS_NUM 3791
75 #define IMU_ACCEL_Y_SENS_DEN 100
76 #define IMU_ACCEL_Z_SENS 39.24
77 #define IMU_ACCEL_Z_SENS_NUM 3924
78 #define IMU_ACCEL_Z_SENS_DEN 100
79 #endif
80 
81 
82 struct ImuPpzuav {
83  volatile uint8_t accel_valid;
84  volatile uint8_t gyro_valid;
85  volatile uint8_t mag_valid;
87  struct Itg3200 gyro_itg;
88  struct Hmc58xx mag_hmc;
89 };
90 
91 extern struct ImuPpzuav imu_ppzuav;
92 
93 extern void imu_ppzuav_event(void);
94 
95 static inline void ImuEvent(void (* _gyro_handler)(void), void (* _accel_handler)(void), void (* _mag_handler)(void)) {
97  if (imu_ppzuav.gyro_valid) {
99  _gyro_handler();
100  }
101  if (imu_ppzuav.accel_valid) {
103  _accel_handler();
104  }
105  if (imu_ppzuav.mag_valid) {
107  _mag_handler();
108  }
109 }
110 
111 #endif /* IMU_PPZUAV_H */
volatile uint8_t gyro_valid
Definition: imu_ppzuav.h:84
#define FALSE
Definition: imu_chimu.h:141
void imu_ppzuav_event(void)
Definition: imu_ppzuav.c:115
static void ImuEvent(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
Definition: imu_ppzuav.h:95
struct Adxl345_I2c acc_adxl
Definition: imu_ppzuav.h:86
Driver for the gyro ITG3200 from InvenSense.
struct Hmc58xx mag_hmc
Definition: imu_ppzuav.h:88
Inertial Measurement Unit interface.
struct ImuPpzuav imu_ppzuav
Definition: imu_ppzuav.c:78
unsigned char uint8_t
Definition: types.h:14
volatile uint8_t mag_valid
Definition: imu_ppzuav.h:85
struct Itg3200 gyro_itg
Definition: imu_ppzuav.h:87
volatile uint8_t accel_valid
Definition: imu_ppzuav.h:83
Driver for the accelerometer ADXL345 from Analog Devices using I2C.