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
mpu60x0.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Gautier Hattenberger
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, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
28 #ifndef MPU60X0_H
29 #define MPU60X0_H
30 
31 #include "std.h"
32 
33 /* Include address and register definition */
35 
37 #define MPU60X0_DEFAULT_SMPLRT_DIV 0
38 #define MPU60X0_DEFAULT_FS_SEL MPU60X0_GYRO_RANGE_2000
40 #define MPU60X0_DEFAULT_AFS_SEL MPU60X0_ACCEL_RANGE_16G
42 #define MPU60X0_DEFAULT_DLPF_CFG MPU60X0_DLPF_42HZ
44 #define MPU60X0_DEFAULT_INT_CFG 1
46 #define MPU60X0_DEFAULT_CLK_SEL 1
48 
49 // Default number of I2C slaves
50 #ifndef MPU60X0_I2C_NB_SLAVES
51 #define MPU60X0_I2C_NB_SLAVES 5
52 #endif
53 
66 };
67 
69 typedef void (*Mpu60x0ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val);
70 
72 typedef bool (*Mpu60x0I2cSlaveConfigure)(Mpu60x0ConfigSet mpu_set, void *mpu);
73 
76 };
77 
78 struct Mpu60x0Config {
87  bool initialized;
88 
92  bool i2c_bypass;
93 
99 };
100 
101 extern void mpu60x0_set_default_config(struct Mpu60x0Config *c);
102 
104 extern void mpu60x0_send_config(Mpu60x0ConfigSet mpu_set, void *mpu, struct Mpu60x0Config *config);
105 
113 extern bool mpu60x0_configure_i2c_slaves(Mpu60x0ConfigSet mpu_set, void *mpu);
114 
115 #endif // MPU60X0_H
void mpu60x0_set_default_config(struct Mpu60x0Config *c)
Definition: mpu60x0.c:32
Mpu60x0ConfStatus
Definition: mpu60x0.h:54
Mpu60x0AccelRanges
Selectable accel range.
Definition: mpu60x0_regs.h:160
bool initialized
config done flag
Definition: mpu60x0.h:87
uint8_t smplrt_div
Sample rate divider.
Definition: mpu60x0.h:79
uint8_t nb_slave_init
number of already configured/initialized slaves
Definition: mpu60x0.h:95
enum Mpu60x0GyroRanges gyro_range
deg/s Range
Definition: mpu60x0.h:81
enum Mpu60x0AccelRanges accel_range
g Range
Definition: mpu60x0.h:82
bool drdy_int_enable
Enable Data Ready Interrupt.
Definition: mpu60x0.h:83
enum Mpu60x0DLPF dlpf_cfg
Digital Low Pass Filter.
Definition: mpu60x0.h:80
Mpu60x0I2cSlaveConfigure configure
Definition: mpu60x0.h:75
enum Mpu60x0ConfStatus init_status
init status
Definition: mpu60x0.h:86
enum Mpu60x0MstClk i2c_mst_clk
MPU I2C master clock speed.
Definition: mpu60x0.h:97
Mpu60x0GyroRanges
Selectable gyro range.
Definition: mpu60x0_regs.h:150
Mpu60x0DLPF
Digital Low Pass Filter Options DLFP is affecting both gyro and accels, with slightly different bandw...
Definition: mpu60x0_regs.h:137
#define MPU60X0_I2C_NB_SLAVES
Definition: mpu60x0.h:51
Register and address definitions for MPU-6000 and MPU-6050.
uint8_t nb_slaves
number of used I2C slaves
Definition: mpu60x0.h:94
void mpu60x0_send_config(Mpu60x0ConfigSet mpu_set, void *mpu, struct Mpu60x0Config *config)
Configuration sequence called once before normal use.
Definition: mpu60x0.c:52
uint8_t clk_sel
Clock select.
Definition: mpu60x0.h:84
Mpu60x0MstClk
I2C Master clock.
Definition: mpu60x0_regs.h:170
bool(* Mpu60x0I2cSlaveConfigure)(Mpu60x0ConfigSet mpu_set, void *mpu)
function prototype for configuration of a single I2C slave
Definition: mpu60x0.h:72
bool mpu60x0_configure_i2c_slaves(Mpu60x0ConfigSet mpu_set, void *mpu)
Configure I2C slaves of the MPU.
Definition: mpu60x0_i2c.c:134
unsigned char uint8_t
Definition: types.h:14
static const struct usb_config_descriptor config
Definition: usb_ser_hw.c:199
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.
Definition: mpu60x0.h:98
bool i2c_bypass
Bypass MPU I2C.
Definition: mpu60x0.h:92
uint8_t nb_bytes
number of bytes to read starting with MPU60X0_REG_INT_STATUS
Definition: mpu60x0.h:85
struct Mpu60x0I2cSlave slaves[MPU60X0_I2C_NB_SLAVES]
I2C slaves.
Definition: mpu60x0.h:96
void(* Mpu60x0ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
Definition: mpu60x0.h:69