Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mpu9250.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
27 #ifndef MPU9250_H
28 #define MPU9250_H
29 
30 #include "std.h"
31 
32 /* Include address and register definition */
34 
36 #define MPU9250_DEFAULT_SMPLRT_DIV 0
37 #define MPU9250_DEFAULT_FS_SEL MPU9250_GYRO_RANGE_1000
39 #define MPU9250_DEFAULT_AFS_SEL MPU9250_ACCEL_RANGE_8G
41 #define MPU9250_DEFAULT_DLPF_ACCEL_CFG MPU9250_DLPF_ACCEL_41HZ
43 #define MPU9250_DEFAULT_DLPF_GYRO_CFG MPU9250_DLPF_GYRO_41HZ
45 #define MPU9250_DEFAULT_INT_CFG 1
47 #define MPU9250_DEFAULT_CLK_SEL 1
49 
50 // Default number of I2C slaves
51 #ifndef MPU9250_I2C_NB_SLAVES
52 #define MPU9250_I2C_NB_SLAVES 5
53 #endif
54 
68 };
69 
71 typedef void (*Mpu9250ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val);
72 
74 typedef bool (*Mpu9250I2cSlaveConfigure)(Mpu9250ConfigSet mpu_set, void *mpu);
75 
78 };
79 
80 struct Mpu9250Config {
90  bool initialized;
91 
95  bool i2c_bypass;
96 
102 };
103 
104 extern void mpu9250_set_default_config(struct Mpu9250Config *c);
105 
107 extern void mpu9250_send_config(Mpu9250ConfigSet mpu_set, void *mpu, struct Mpu9250Config *config);
108 
116 extern bool mpu9250_configure_i2c_slaves(Mpu9250ConfigSet mpu_set, void *mpu);
117 
118 #endif // MPU9250_H
enum Mpu9250MstClk i2c_mst_clk
MPU I2C master clock speed.
Definition: mpu9250.h:100
Mpu9250I2cSlaveConfigure configure
Definition: mpu9250.h:77
bool drdy_int_enable
Enable Data Ready Interrupt.
Definition: mpu9250.h:86
enum Mpu9250DLPFGyro dlpf_gyro_cfg
Digital Low Pass Filter for gyroscope.
Definition: mpu9250.h:83
Mpu9250GyroRanges
Selectable gyro range.
Definition: mpu9250_regs.h:162
enum Mpu9250GyroRanges gyro_range
deg/s Range
Definition: mpu9250.h:84
enum Mpu9250ConfStatus init_status
init status
Definition: mpu9250.h:89
uint8_t nb_bytes
number of bytes to read starting with MPU9250_REG_INT_STATUS
Definition: mpu9250.h:88
bool(* Mpu9250I2cSlaveConfigure)(Mpu9250ConfigSet mpu_set, void *mpu)
function prototype for configuration of a single I2C slave
Definition: mpu9250.h:74
uint8_t clk_sel
Clock select.
Definition: mpu9250.h:87
Mpu9250MstClk
I2C Master clock.
Definition: mpu9250_regs.h:182
enum Mpu9250DLPFAccel dlpf_accel_cfg
Digital Low Pass Filter for accelerometer.
Definition: mpu9250.h:82
Mpu9250DLPFAccel
Definition: mpu9250_regs.h:149
bool i2c_bypass
Bypass MPU I2C.
Definition: mpu9250.h:95
bool mpu9250_configure_i2c_slaves(Mpu9250ConfigSet mpu_set, void *mpu)
Configure I2C slaves of the MPU.
Definition: mpu9250_i2c.c:167
void mpu9250_send_config(Mpu9250ConfigSet mpu_set, void *mpu, struct Mpu9250Config *config)
Configuration sequence called once before normal use.
Definition: mpu9250.c:53
void(* Mpu9250ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
Definition: mpu9250.h:71
Mpu9250ConfStatus
Definition: mpu9250.h:55
uint8_t nb_slaves
number of used I2C slaves
Definition: mpu9250.h:97
Register and address definitions for MPU-9250.
enum Mpu9250AccelRanges accel_range
g Range
Definition: mpu9250.h:85
unsigned char uint8_t
Definition: types.h:14
void mpu9250_set_default_config(struct Mpu9250Config *c)
Definition: mpu9250.c:32
struct Mpu9250I2cSlave slaves[MPU9250_I2C_NB_SLAVES]
I2C slaves.
Definition: mpu9250.h:99
Mpu9250AccelRanges
Selectable accel range.
Definition: mpu9250_regs.h:172
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:199
uint8_t nb_slave_init
number of already configured/initialized slaves
Definition: mpu9250.h:98
#define MPU9250_I2C_NB_SLAVES
Definition: mpu9250.h:52
uint8_t smplrt_div
Sample rate divider.
Definition: mpu9250.h:81
bool initialized
config done flag
Definition: mpu9250.h:90
Mpu9250DLPFGyro
Digital Low Pass Filter Options.
Definition: mpu9250_regs.h:139
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.
Definition: mpu9250.h:101