Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
invensense2_regs.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2022 Freek van Tienen <freek.v.tienen@gmail.com>
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 INVENSENSE2_REGS_H
29
#define INVENSENSE2_REGS_H
30
31
#define INV2_BANK0 0x00U
32
#define INV2_BANK1 0x01U
33
#define INV2_BANK2 0x02U
34
#define INV2_BANK3 0x03U
35
36
37
#define INV2REG(b, r) ((((uint16_t)b) << 8)|(r))
38
#define INV2_READ_FLAG 0x80
39
40
//Register Map
41
#define INV2REG_WHO_AM_I INV2REG(INV2_BANK0,0x00U)
42
#define INV2REG_USER_CTRL INV2REG(INV2_BANK0,0x03U)
43
# define BIT_USER_CTRL_I2C_MST_RESET 0x02
// reset I2C Master (only applicable if I2C_MST_EN bit is set)
44
# define BIT_USER_CTRL_SRAM_RESET 0x04
// Reset (i.e. clear) FIFO buffer
45
# define BIT_USER_CTRL_DMP_RESET 0x08
// Reset DMP
46
# define BIT_USER_CTRL_I2C_IF_DIS 0x10
// Disable primary I2C interface and enable hal.spi->interface
47
# define BIT_USER_CTRL_I2C_MST_EN 0x20
// Enable MPU to act as the I2C Master to external slave sensors
48
# define BIT_USER_CTRL_FIFO_EN 0x40
// Enable FIFO operations
49
# define BIT_USER_CTRL_DMP_EN 0x80
// Enable DMP operations
50
#define INV2REG_LP_CONFIG INV2REG(INV2_BANK0,0x05U)
51
#define INV2REG_PWR_MGMT_1 INV2REG(INV2_BANK0,0x06U)
52
# define BIT_PWR_MGMT_1_CLK_INTERNAL 0x00
// clock set to internal 8Mhz oscillator
53
# define BIT_PWR_MGMT_1_CLK_AUTO 0x01
// PLL with X axis gyroscope reference
54
# define BIT_PWR_MGMT_1_CLK_STOP 0x07
// Stops the clock and keeps the timing generator in reset
55
# define BIT_PWR_MGMT_1_TEMP_DIS 0x08
// disable temperature sensor
56
# define BIT_PWR_MGMT_1_SLEEP 0x40
// put sensor into low power sleep mode
57
# define BIT_PWR_MGMT_1_DEVICE_RESET 0x80
// reset entire device
58
#define INV2REG_PWR_MGMT_2 INV2REG(INV2_BANK0,0x07U)
59
#define INV2REG_INT_PIN_CFG INV2REG(INV2_BANK0,0x0FU)
60
# define BIT_BYPASS_EN 0x02
61
# define BIT_INT_RD_CLEAR 0x10
// clear the interrupt when any read occurs
62
# define BIT_LATCH_INT_EN 0x20
// latch data ready pin
63
#define INV2REG_INT_ENABLE INV2REG(INV2_BANK0,0x10U)
64
# define BIT_PLL_RDY_EN 0x04
65
#define INV2REG_INT_ENABLE_1 INV2REG(INV2_BANK0,0x11U)
66
#define INV2REG_INT_ENABLE_2 INV2REG(INV2_BANK0,0x12U)
67
#define INV2REG_INT_ENABLE_3 INV2REG(INV2_BANK0,0x13U)
68
#define INV2REG_I2C_MST_STATUS INV2REG(INV2_BANK0,0x17U)
69
#define INV2REG_INT_STATUS INV2REG(INV2_BANK0,0x19U)
70
71
#define INV2REG_INT_STATUS_1 INV2REG(INV2_BANK0,0x1AU)
72
#define INV2REG_INT_STATUS_2 INV2REG(INV2_BANK0,0x1BU)
73
#define INV2REG_INT_STATUS_3 INV2REG(INV2_BANK0,0x1CU)
74
#define INV2REG_DELAY_TIMEH INV2REG(INV2_BANK0,0x28U)
75
#define INV2REG_DELAY_TIMEL INV2REG(INV2_BANK0,0x29U)
76
#define INV2REG_ACCEL_XOUT_H INV2REG(INV2_BANK0,0x2DU)
77
#define INV2REG_ACCEL_XOUT_L INV2REG(INV2_BANK0,0x2EU)
78
#define INV2REG_ACCEL_YOUT_H INV2REG(INV2_BANK0,0x2FU)
79
#define INV2REG_ACCEL_YOUT_L INV2REG(INV2_BANK0,0x30U)
80
#define INV2REG_ACCEL_ZOUT_H INV2REG(INV2_BANK0,0x31U)
81
#define INV2REG_ACCEL_ZOUT_L INV2REG(INV2_BANK0,0x32U)
82
#define INV2REG_GYRO_XOUT_H INV2REG(INV2_BANK0,0x33U)
83
#define INV2REG_GYRO_XOUT_L INV2REG(INV2_BANK0,0x34U)
84
#define INV2REG_GYRO_YOUT_H INV2REG(INV2_BANK0,0x35U)
85
#define INV2REG_GYRO_YOUT_L INV2REG(INV2_BANK0,0x36U)
86
#define INV2REG_GYRO_ZOUT_H INV2REG(INV2_BANK0,0x37U)
87
#define INV2REG_GYRO_ZOUT_L INV2REG(INV2_BANK0,0x38U)
88
#define INV2REG_TEMP_OUT_H INV2REG(INV2_BANK0,0x39U)
89
#define INV2REG_TEMP_OUT_L INV2REG(INV2_BANK0,0x3AU)
90
#define INV2REG_EXT_SLV_SENS_DATA_00 INV2REG(INV2_BANK0,0x3BU)
91
#define INV2REG_EXT_SLV_SENS_DATA_01 INV2REG(INV2_BANK0,0x3CU)
92
#define INV2REG_EXT_SLV_SENS_DATA_02 INV2REG(INV2_BANK0,0x3DU)
93
#define INV2REG_EXT_SLV_SENS_DATA_03 INV2REG(INV2_BANK0,0x3EU)
94
#define INV2REG_EXT_SLV_SENS_DATA_04 INV2REG(INV2_BANK0,0x3FU)
95
#define INV2REG_EXT_SLV_SENS_DATA_05 INV2REG(INV2_BANK0,0x40U)
96
#define INV2REG_EXT_SLV_SENS_DATA_06 INV2REG(INV2_BANK0,0x41U)
97
#define INV2REG_EXT_SLV_SENS_DATA_07 INV2REG(INV2_BANK0,0x42U)
98
#define INV2REG_EXT_SLV_SENS_DATA_08 INV2REG(INV2_BANK0,0x43U)
99
#define INV2REG_EXT_SLV_SENS_DATA_09 INV2REG(INV2_BANK0,0x44U)
100
#define INV2REG_EXT_SLV_SENS_DATA_10 INV2REG(INV2_BANK0,0x45U)
101
#define INV2REG_EXT_SLV_SENS_DATA_11 INV2REG(INV2_BANK0,0x46U)
102
#define INV2REG_EXT_SLV_SENS_DATA_12 INV2REG(INV2_BANK0,0x47U)
103
#define INV2REG_EXT_SLV_SENS_DATA_13 INV2REG(INV2_BANK0,0x48U)
104
#define INV2REG_EXT_SLV_SENS_DATA_14 INV2REG(INV2_BANK0,0x49U)
105
#define INV2REG_EXT_SLV_SENS_DATA_15 INV2REG(INV2_BANK0,0x4AU)
106
#define INV2REG_EXT_SLV_SENS_DATA_16 INV2REG(INV2_BANK0,0x4BU)
107
#define INV2REG_EXT_SLV_SENS_DATA_17 INV2REG(INV2_BANK0,0x4CU)
108
#define INV2REG_EXT_SLV_SENS_DATA_18 INV2REG(INV2_BANK0,0x4DU)
109
#define INV2REG_EXT_SLV_SENS_DATA_19 INV2REG(INV2_BANK0,0x4EU)
110
#define INV2REG_EXT_SLV_SENS_DATA_20 INV2REG(INV2_BANK0,0x4FU)
111
#define INV2REG_EXT_SLV_SENS_DATA_21 INV2REG(INV2_BANK0,0x50U)
112
#define INV2REG_EXT_SLV_SENS_DATA_22 INV2REG(INV2_BANK0,0x51U)
113
#define INV2REG_EXT_SLV_SENS_DATA_23 INV2REG(INV2_BANK0,0x52U)
114
#define INV2REG_FIFO_EN_1 INV2REG(INV2_BANK0,0x66U)
115
# define BIT_SLV3_FIFO_EN 0x08
116
# define BIT_SLV2_FIFO_EN 0x04
117
# define BIT_SLV1_FIFO_EN 0x02
118
# define BIT_SLV0_FIFI_EN0 0x01
119
#define INV2REG_FIFO_EN_2 INV2REG(INV2_BANK0,0x67U)
120
# define BIT_ACCEL_FIFO_EN 0x10
121
# define BIT_ZG_FIFO_EN 0x08
122
# define BIT_YG_FIFO_EN 0x04
123
# define BIT_XG_FIFO_EN 0x02
124
# define BIT_TEMP_FIFO_EN 0x01
125
#define INV2REG_FIFO_RST INV2REG(INV2_BANK0,0x68U)
126
#define INV2REG_FIFO_MODE INV2REG(INV2_BANK0,0x69U)
127
#define INV2REG_FIFO_COUNTH INV2REG(INV2_BANK0,0x70U)
128
#define INV2REG_FIFO_COUNTL INV2REG(INV2_BANK0,0x71U)
129
#define INV2REG_FIFO_R_W INV2REG(INV2_BANK0,0x72U)
130
#define INV2REG_DATA_RDY_STATUS INV2REG(INV2_BANK0,0x74U)
131
#define INV2REG_FIFO_CFG INV2REG(INV2_BANK0,0x76U)
132
133
#define INV2REG_SELF_TEST_X_GYRO INV2REG(INV2_BANK1,0x02U)
134
#define INV2REG_SELF_TEST_Y_GYRO INV2REG(INV2_BANK1,0x03U)
135
#define INV2REG_SELF_TEST_Z_GYRO INV2REG(INV2_BANK1,0x04U)
136
#define INV2REG_SELF_TEST_X_ACCEL INV2REG(INV2_BANK1,0x0EU)
137
#define INV2REG_SELF_TEST_Y_ACCEL INV2REG(INV2_BANK1,0x0FU)
138
#define INV2REG_SELF_TEST_Z_ACCEL INV2REG(INV2_BANK1,0x10U)
139
#define INV2REG_XA_OFFS_H INV2REG(INV2_BANK1,0x14U)
140
#define INV2REG_XA_OFFS_L INV2REG(INV2_BANK1,0x15U)
141
#define INV2REG_YA_OFFS_H INV2REG(INV2_BANK1,0x17U)
142
#define INV2REG_YA_OFFS_L INV2REG(INV2_BANK1,0x18U)
143
#define INV2REG_ZA_OFFS_H INV2REG(INV2_BANK1,0x1AU)
144
#define INV2REG_ZA_OFFS_L INV2REG(INV2_BANK1,0x1BU)
145
#define INV2REG_TIMEBASE_CORRECTIO INV2REG(INV2_BANK1,0x28U)
146
147
#define INV2REG_GYRO_SMPLRT_DIV INV2REG(INV2_BANK2,0x00U)
148
#define INV2REG_GYRO_CONFIG_1 INV2REG(INV2_BANK2,0x01U)
149
# define BIT_GYRO_NODLPF_9KHZ 0x00
150
# define BIT_GYRO_DLPF_ENABLE 0x01
151
# define GYRO_DLPF_CFG_229HZ 0x00
152
# define GYRO_DLPF_CFG_188HZ 0x01
153
# define GYRO_DLPF_CFG_154HZ 0x02
154
# define GYRO_DLPF_CFG_73HZ 0x03
155
# define GYRO_DLPF_CFG_35HZ 0x04
156
# define GYRO_DLPF_CFG_17HZ 0x05
157
# define GYRO_DLPF_CFG_9HZ 0x06
158
# define GYRO_DLPF_CFG_377HZ 0x07
159
# define GYRO_DLPF_CFG_SHIFT 0x03
160
# define GYRO_FS_SEL_250DPS 0x00
161
# define GYRO_FS_SEL_500DPS 0x01
162
# define GYRO_FS_SEL_1000DPS 0x02
163
# define GYRO_FS_SEL_2000DPS 0x03
164
# define GYRO_FS_SEL_SHIFT 0x01
165
#define INV2REG_GYRO_CONFIG_2 INV2REG(INV2_BANK2,0x02U)
166
#define INV2REG_XG_OFFS_USRH INV2REG(INV2_BANK2,0x03U)
167
#define INV2REG_XG_OFFS_USRL INV2REG(INV2_BANK2,0x04U)
168
#define INV2REG_YG_OFFS_USRH INV2REG(INV2_BANK2,0x05U)
169
#define INV2REG_YG_OFFS_USRL INV2REG(INV2_BANK2,0x06U)
170
#define INV2REG_ZG_OFFS_USRH INV2REG(INV2_BANK2,0x07U)
171
#define INV2REG_ZG_OFFS_USRL INV2REG(INV2_BANK2,0x08U)
172
#define INV2REG_ODR_ALIGN_EN INV2REG(INV2_BANK2,0x09U)
173
#define INV2REG_ACCEL_SMPLRT_DIV_1 INV2REG(INV2_BANK2,0x10U)
174
#define INV2REG_ACCEL_SMPLRT_DIV_2 INV2REG(INV2_BANK2,0x11U)
175
#define INV2REG_ACCEL_INTEL_CTRL INV2REG(INV2_BANK2,0x12U)
176
#define INV2REG_ACCEL_WOM_THR INV2REG(INV2_BANK2,0x13U)
177
#define INV2REG_ACCEL_CONFIG INV2REG(INV2_BANK2,0x14U)
178
# define BIT_ACCEL_NODLPF_4_5KHZ 0x00
179
# define BIT_ACCEL_DLPF_ENABLE 0x01
180
# define ACCEL_DLPF_CFG_265HZ 0x00
181
# define ACCEL_DLPF_CFG_136HZ 0x02
182
# define ACCEL_DLPF_CFG_69HZ 0x03
183
# define ACCEL_DLPF_CFG_34HZ 0x04
184
# define ACCEL_DLPF_CFG_17HZ 0x05
185
# define ACCEL_DLPF_CFG_8HZ 0x06
186
# define ACCEL_DLPF_CFG_499HZ 0x07
187
# define ACCEL_DLPF_CFG_SHIFT 0x03
188
# define ACCEL_FS_SEL_2G 0x00
189
# define ACCEL_FS_SEL_4G 0x01
190
# define ACCEL_FS_SEL_8G 0x02
191
# define ACCEL_FS_SEL_16G 0x03
192
# define ACCEL_FS_SEL_SHIFT 0x01
193
#define INV2REG_FSYNC_CONFIG INV2REG(INV2_BANK2,0x52U)
194
# define FSYNC_CONFIG_EXT_SYNC_TEMP 0x01
195
# define FSYNC_CONFIG_EXT_SYNC_GX 0x02
196
# define FSYNC_CONFIG_EXT_SYNC_GY 0x03
197
# define FSYNC_CONFIG_EXT_SYNC_GZ 0x04
198
# define FSYNC_CONFIG_EXT_SYNC_AX 0x05
199
# define FSYNC_CONFIG_EXT_SYNC_AY 0x06
200
# define FSYNC_CONFIG_EXT_SYNC_AZ 0x07
201
#define INV2REG_TEMP_CONFIG INV2REG(INV2_BANK2,0x53U)
202
#define INV2REG_MOD_CTRL_USR INV2REG(INV2_BANK2,0x54U)
203
204
#define INV2REG_I2C_MST_ODR_CONFIG INV2REG(INV2_BANK3,0x00U)
205
#define INV2REG_I2C_MST_CTRL INV2REG(INV2_BANK3,0x01U)
206
# define BIT_I2C_MST_P_NSR 0x10
207
# define BIT_I2C_MST_CLK_400KHZ 0x0D
208
#define INV2REG_I2C_MST_DELAY_CTRL INV2REG(INV2_BANK3,0x02U)
209
# define BIT_I2C_SLV0_DLY_EN 0x01
210
# define BIT_I2C_SLV1_DLY_EN 0x02
211
# define BIT_I2C_SLV2_DLY_EN 0x04
212
# define BIT_I2C_SLV3_DLY_EN 0x08
213
#define INV2REG_I2C_SLV0_ADDR INV2REG(INV2_BANK3,0x03U)
214
#define INV2REG_I2C_SLV0_REG INV2REG(INV2_BANK3,0x04U)
215
#define INV2REG_I2C_SLV0_CTRL INV2REG(INV2_BANK3,0x05U)
216
#define INV2REG_I2C_SLV0_DO INV2REG(INV2_BANK3,0x06U)
217
#define INV2REG_I2C_SLV1_ADDR INV2REG(INV2_BANK3,0x07U)
218
#define INV2REG_I2C_SLV1_REG INV2REG(INV2_BANK3,0x08U)
219
#define INV2REG_I2C_SLV1_CTRL INV2REG(INV2_BANK3,0x09U)
220
#define INV2REG_I2C_SLV1_DO INV2REG(INV2_BANK3,0x0AU)
221
#define INV2REG_I2C_SLV2_ADDR INV2REG(INV2_BANK3,0x0BU)
222
#define INV2REG_I2C_SLV2_REG INV2REG(INV2_BANK3,0x0CU)
223
#define INV2REG_I2C_SLV2_CTRL INV2REG(INV2_BANK3,0x0DU)
224
#define INV2REG_I2C_SLV2_DO INV2REG(INV2_BANK3,0x0EU)
225
#define INV2REG_I2C_SLV3_ADDR INV2REG(INV2_BANK3,0x0FU)
226
#define INV2REG_I2C_SLV3_REG INV2REG(INV2_BANK3,0x10U)
227
#define INV2REG_I2C_SLV3_CTRL INV2REG(INV2_BANK3,0x11U)
228
#define INV2REG_I2C_SLV3_DO INV2REG(INV2_BANK3,0x12U)
229
#define INV2REG_I2C_SLV4_ADDR INV2REG(INV2_BANK3,0x13U)
230
#define INV2REG_I2C_SLV4_REG INV2REG(INV2_BANK3,0x14U)
231
#define INV2REG_I2C_SLV4_CTRL INV2REG(INV2_BANK3,0x15U)
232
#define INV2REG_I2C_SLV4_DO INV2REG(INV2_BANK3,0x16U)
233
#define INV2REG_I2C_SLV4_DI INV2REG(INV2_BANK3,0x17U)
234
235
#define INV2REG_BANK_SEL 0x7F
236
237
// WHOAMI values
238
#define INV2_WHOAMI_ICM20648 0xe0
239
#define INV2_WHOAMI_ICM20948 0xea
240
#define INV2_WHOAMI_ICM20649 0xe1
241
242
#endif
/* INVENSENSE2_REGS_H */
sw
airborne
peripherals
invensense2_regs.h
Generated on Fri Nov 8 2024 14:10:47 for Paparazzi UAS by
1.9.1