C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
config_MPU6050.h
1#pragma once
2
3//-----------------------------------------------------------------------------
4// MPU device_config
5//-----------------------------------------------------------------------------
6
7//set Digital Low-Pass Filter bandwidth
8// Accelero | Gyro
9#define DLPF_CFG_250HZ 0x00 // BW = 260Hz | delai = 0.0ms | BW = 256Hz | delai = 0.98ms | gyro_sampling_rate = 8kHz
10#define DLPF_CFG_200HZ 0x01 // BW = 184Hz | delai = 2.0ms | BW = 188Hz | delai = 1.90ms | gyro_sampling_rate = 1kHz
11#define DLPF_CFG_100HZ 0x02 // BW = 94Hz | delai = 3.0ms | BW = 98Hz | delai = 2.80ms | gyro_sampling_rate = 1kHz
12#define DLPF_CFG_50HZ 0x03 // BW = 44Hz | delai = 4.9ms | BW = 42Hz | delai = 4.80ms | gyro_sampling_rate = 1kHz
13#define DLPF_CFG_20HZ 0x04 // BW = 21Hz | delai = 8.5ms | BW = 20Hz | delai = 8.30ms | gyro_sampling_rate = 1kHz
14#define DLPF_CFG_10HZ 0x05 // BW = 10Hz | delai = 13.8ms | BW = 10Hz | delai = 13.40ms | gyro_sampling_rate = 1kHz
15#define DLPF_CFG_5HZ 0x06 // BW = 5Hz | delai = 19.0ms | BW = 5Hz | delai = 18.60ms | gyro_sampling_rate = 1kHz
16
17// set external FSYNC
18// values to be selected
19#define EXT_SYNC_SET_DISABLED 0x00 <<3
20#define EXT_SYNC_SET_TEMP_OUT_L 0x01 <<3
21#define EXT_SYNC_SET_GYRO_XOUT_L 0x02 <<3
22#define EXT_SYNC_SET_GYRO_YOUT_L 0x03 <<3
23#define EXT_SYNC_SET_GYRO_ZOUT_L 0x04 <<3
24#define EXT_SYNC_SET_ACCEL_XOUT_L 0x05 <<3
25#define EXT_SYNC_SET_ACCEL_YOUT_L 0x06 <<3
26#define EXT_SYNC_SET_ACCEL_ZOUT_L 0x07 <<3
27// end values
28
29// ==== Register 27 0x1B– Gyroscope Configuration
30#define GYRO_RANGE_250DPS 0x00 << 3
31#define GYRO_RANGE_500DPS 0x01 << 3
32#define GYRO_RANGE_1000DPS 0x02 << 3
33#define GYRO_RANGE_2000DPS 0x03 << 3
34
35
36// ==== Register 28 0x1C– Accelerometer Configuration
37#define ACCEL_RANGE_2G 0x00 << 3
38#define ACCEL_RANGE_4G 0x01 << 3
39#define ACCEL_RANGE_8G 0x02 << 3
40#define ACCEL_RANGE_16G 0x03 << 3
41
42
43// ==== Register 35 0x23– FIFO Enable : device_config which measures will be written into the FIFO
44// values to be selected :
45#define FIFO_NO_SELECTION 0x00
46#define GYRO_FIFO_EN XG_FIFO_EN | YG_FIFO_EN | ZG_FIFO_EN
47#define TEMP_FIFO_EN 0x80
48#define XG_FIFO_EN 0x40
49#define YG_FIFO_EN 0x20
50#define ZG_FIFO_EN 0x10
51#define ACCEL_FIFO_EN 0x08
52#define SLV2_FIFO_EN 0x04
53#define SLV1_FIFO_EN 0x02
54#define SLV0_FIFO_EN 0x01
55// end values
56
57// ==== Register 55 0x37– INT Pin / Bypass Enable Configuration
58// values to be selected :
59#define INT_LEVEL 0x80 // INT pin active LOW
60#define INT_OPEN 0x40 // INT pin open drain
61#define LATCH_INT_EN 0x20 // INT pin held Hi until INT cleared
62#define INT_RD_CLEAR 0x10 // INT pin cleared by any read
63#define FSYNC_INT_LEVEL 0x08
64#define FSYNC_INT_EN 0x04
65#define I2C_BYPASS_EN 0x02
66// end values
67
68// ==== Register 56 0x38– Interrupt Enable
69// values to be selected :
70#define FIFO_OFLOW_EN 0x10
71#define I2C_MST_INT_EN 0x08
72#define DATA_RDY_EN 0x01
73// end values
74
75// ==== Register 58 0x3A– read Interrupt Status
76// values explaining reading
77#define FIFO_OFLOW_INT 0x10
78#define I2C_MST_INT 0x08
79#define DATA_RDY_INT 0x01
80// end values
81
82// ==== Register 104 0x68– Signal Path Reset
83// values to be selected
84#define NO_PATH_RESET 0x00
85#define GYRO_RESET 0x04
86#define ACCEL_RESET 0x02
87#define TEMP_RESET 0x01
88// end values
89
90// ==== Register 106 0x6A– User Control
91// device_config FIFO, I2C, signal path
92#define FIFO_DISABLE 0x00 // disable FIFO operations
93#define FIFO_EN 0x40 // enables FIFO operations
94#define I2C_MST_EN 0x20 // enables I2C master mode
95#define I2C_IF_DIS 0x10 // MPU6000 only
96#define FIFO_RESET 0x04 // reset and disables FIFO
97#define I2C_MST_RESET 0x02 // reset I2C master while I2C_MST_EN = 0x00
98#define SIG_COND_RESET 0x01 // reset all sensors processing and registers
99
100// Register 107 0x6B– Power Management 1
101// values to be selected as CLKSEL
102#define CLKSEL_INTERNAL 0x00
103#define CLKSEL_X_PLL 0x01
104#define CLKSEL_Y_PLL 0x02
105#define CLKSEL_Z_PLL 0x03
106// values to be selected as DEVICE_RESET
107#define DEVICE_RESET 0x80
108// end values