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_gl1.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  * 2013 Eduardo Lavratti <agressiva@hotmail.com>
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
30 #ifndef IMU_GL1_H
31 #define IMU_GL1_H
32 
33 #include "generated/airframe.h"
34 #include "subsystems/imu.h"
35 
36 /* include default GL1 sensitivity/channel definitions */
38 
39 #include "peripherals/l3g4200.h"
40 #include "peripherals/hmc58xx.h"
42 
43 struct ImuGL1I2c {
44  volatile uint8_t accel_valid;
45  volatile uint8_t gyro_valid;
46  volatile uint8_t mag_valid;
48  struct L3g4200 gyro_l3g;
49  struct Hmc58xx mag_hmc;
50 };
51 
52 extern struct ImuGL1I2c imu_gl1;
53 
54 extern void imu_gl1_i2c_event(void);
55 
56 static inline void ImuEvent(void (* _gyro_handler)(void), void (* _accel_handler)(void), void (* _mag_handler)(void)) {
58  if (imu_gl1.gyro_valid) {
60  _gyro_handler();
61  }
62  if (imu_gl1.accel_valid) {
64  _accel_handler();
65  }
66  if (imu_gl1.mag_valid) {
68  _mag_handler();
69  }
70 }
71 
72 #endif /* IMU_GL1_H */
volatile uint8_t accel_valid
Definition: imu_gl1.h:44
struct Adxl345_I2c acc_adxl
Definition: imu_gl1.h:47
#define FALSE
Definition: imu_chimu.h:141
struct ImuGL1I2c imu_gl1
Definition: imu_gl1.c:77
Default sensitivity definitions for IMU GL1.
volatile uint8_t gyro_valid
Definition: imu_gl1.h:45
struct L3g4200 gyro_l3g
Definition: imu_gl1.h:48
void imu_gl1_i2c_event(void)
Definition: imu_gl1.c:121
Inertial Measurement Unit interface.
static void ImuEvent(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
Definition: imu_gl1.h:56
unsigned char uint8_t
Definition: types.h:14
struct Hmc58xx mag_hmc
Definition: imu_gl1.h:49
Driver for the accelerometer ADXL345 from Analog Devices using I2C.
volatile uint8_t mag_valid
Definition: imu_gl1.h:46
Driver for the gyro L3G4200 From ST.