Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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"
33
34/* Include address and register definition */
36
38#define MPU9250_DEFAULT_SMPLRT_DIV 0
40#define MPU9250_DEFAULT_FS_SEL MPU9250_GYRO_RANGE_1000
42#define MPU9250_DEFAULT_AFS_SEL MPU9250_ACCEL_RANGE_8G
44#define MPU9250_DEFAULT_DLPF_ACCEL_CFG MPU9250_DLPF_ACCEL_41HZ
46#define MPU9250_DEFAULT_DLPF_GYRO_CFG MPU9250_DLPF_GYRO_41HZ
48#define MPU9250_DEFAULT_INT_CFG 1
50#define MPU9250_DEFAULT_CLK_SEL 1
51
52// Default number of I2C slaves
53#ifndef MPU9250_I2C_NB_SLAVES
54#define MPU9250_I2C_NB_SLAVES 5
55#endif
56
62#define MPU9250_GYRO_SENS_250 0.544883
63#define MPU9250_GYRO_SENS_500 1.08977
64#define MPU9250_GYRO_SENS_1000 2.17953
65#define MPU9250_GYRO_SENS_2000 4.35906
66
67// Get default sensitivity from a table
68extern const float MPU9250_GYRO_SENS[4];
69// Get default sensitivity numerator and denominator from a table
70extern const struct FloatRates MPU9250_GYRO_SENS_F[4];
71
77#define MPU9250_ACCEL_SENS_2G 0.613125
78#define MPU9250_ACCEL_SENS_4G 1.22625
79#define MPU9250_ACCEL_SENS_8G 2.4525
80#define MPU9250_ACCEL_SENS_16G 4.905
81
82// Get default sensitivity from a table
83extern const float MPU9250_ACCEL_SENS[4];
84// Get default sensitivity numerator and denominator from a table
85extern const struct FloatVect3 MPU9250_ACCEL_SENS_F[4];
86
101
104
107
111
135
136extern void mpu9250_set_default_config(struct Mpu9250Config *c);
137
139extern void mpu9250_send_config(Mpu9250ConfigSet mpu_set, void *mpu, struct Mpu9250Config *config);
140
149
150#endif // MPU9250_H
angular rates
uint16_t foo
Definition main_demo5.c:58
enum Mpu9250DLPFGyro dlpf_gyro_cfg
Digital Low Pass Filter for gyroscope.
Definition mpu9250.h:115
uint8_t clk_sel
Clock select.
Definition mpu9250.h:119
Mpu9250I2cSlaveConfigure configure
Definition mpu9250.h:109
const struct FloatRates MPU9250_GYRO_SENS_F[4]
Definition mpu9250.c:39
const struct FloatVect3 MPU9250_ACCEL_SENS_F[4]
Definition mpu9250.c:53
void(* Mpu9250ConfigSet)(void *mpu, uint8_t _reg, uint8_t _val)
Configuration function prototype.
Definition mpu9250.h:103
bool(* Mpu9250I2cSlaveConfigure)(Mpu9250ConfigSet mpu_set, void *mpu)
function prototype for configuration of a single I2C slave
Definition mpu9250.h:106
uint8_t nb_slave_init
number of already configured/initialized slaves
Definition mpu9250.h:130
void mpu9250_send_config(Mpu9250ConfigSet mpu_set, void *mpu, struct Mpu9250Config *config)
Configuration sequence called once before normal use.
Definition mpu9250.c:81
uint8_t i2c_mst_delay
MPU I2C slaves delayed sample rate.
Definition mpu9250.h:133
enum Mpu9250MstClk i2c_mst_clk
MPU I2C master clock speed.
Definition mpu9250.h:132
const float MPU9250_GYRO_SENS[4]
Definition mpu9250.c:32
uint8_t nb_slaves
number of used I2C slaves
Definition mpu9250.h:129
enum Mpu9250GyroRanges gyro_range
deg/s Range
Definition mpu9250.h:116
uint8_t nb_bytes
number of bytes to read starting with MPU9250_REG_INT_STATUS
Definition mpu9250.h:120
#define MPU9250_I2C_NB_SLAVES
Definition mpu9250.h:54
bool i2c_bypass
Bypass MPU I2C.
Definition mpu9250.h:127
const float MPU9250_ACCEL_SENS[4]
Definition mpu9250.c:46
enum Mpu9250DLPFAccel dlpf_accel_cfg
Digital Low Pass Filter for accelerometer.
Definition mpu9250.h:114
void mpu9250_set_default_config(struct Mpu9250Config *c)
Definition mpu9250.c:60
uint8_t smplrt_div
Sample rate divider.
Definition mpu9250.h:113
enum Mpu9250ConfStatus init_status
init status
Definition mpu9250.h:121
enum Mpu9250AccelRanges accel_range
g Range
Definition mpu9250.h:117
bool mpu9250_configure_i2c_slaves(Mpu9250ConfigSet mpu_set, void *mpu)
Configure I2C slaves of the MPU.
struct Mpu9250I2cSlave slaves[MPU9250_I2C_NB_SLAVES]
I2C slaves.
Definition mpu9250.h:131
Mpu9250ConfStatus
Definition mpu9250.h:87
@ MPU9250_CONF_ACCEL
Definition mpu9250.h:96
@ MPU9250_CONF_RESET
Definition mpu9250.h:89
@ MPU9250_CONF_GYRO
Definition mpu9250.h:95
@ MPU9250_CONF_UNINIT
Definition mpu9250.h:88
@ MPU9250_CONF_DONE
Definition mpu9250.h:99
@ MPU9250_CONF_DLPF_GYRO
Definition mpu9250.h:94
@ MPU9250_CONF_USER_RESET
Definition mpu9250.h:90
@ MPU9250_CONF_SD
Definition mpu9250.h:92
@ MPU9250_CONF_INT_ENABLE
Definition mpu9250.h:98
@ MPU9250_CONF_I2C_SLAVES
Definition mpu9250.h:97
@ MPU9250_CONF_DLPF_ACCEL
Definition mpu9250.h:93
@ MPU9250_CONF_PWR
Definition mpu9250.h:91
bool drdy_int_enable
Enable Data Ready Interrupt.
Definition mpu9250.h:118
bool initialized
config done flag
Definition mpu9250.h:122
Register and address definitions for MPU-9250.
Mpu9250DLPFGyro
Digital Low Pass Filter Options.
Mpu9250GyroRanges
Selectable gyro range.
Mpu9250MstClk
I2C Master clock.
Mpu9250AccelRanges
Selectable accel range.
Mpu9250DLPFAccel
Paparazzi floating point algebra.
Paparazzi fixed point algebra.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.