Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
invensense3_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 INVENSENSE3_REGS_H
29 #define INVENSENSE3_REGS_H
30 
31 #define INV3_BANK0 0x00U
32 #define INV3_BANK1 0x01U
33 #define INV3_BANK2 0x02U
34 #define INV3_BANK3 0x03U
35 
36 
37 #define INV3REG(b, r) ((((uint16_t)b) << 8)|(r))
38 #define INV3_READ_FLAG 0x80
39 
40 //Register Map
41 #define INV3REG_DEVICE_CONFIG INV3REG(INV3_BANK0,0x11U)
42 # define BIT_DEVICE_CONFIG_SOFT_RESET_CONFIG 0x01
43 # define BIT_DEVICE_CONFIG_SPI_MODE 0x10
44 #define INV3REG_FIFO_CONFIG INV3REG(INV3_BANK0,0x16U)
45 # define FIFO_CONFIG_MODE_BYPASS 0x00
46 # define FIFO_CONFIG_MODE_STREAM_TO_FIFO 0x01
47 # define FIFO_CONFIG_MODE_STOP_ON_FULL 0x02
48 # define FIFO_CONFIG_MODE_SHIFT 0x06
49 #define INV3REG_TEMP_DATA1 INV3REG(INV3_BANK0,0x1DU)
50 #define INV3REG_ACCEL_DATA_X1 INV3REG(INV3_BANK0,0x1FU)
51 #define INV3REG_INT_STATUS INV3REG(INV3_BANK0,0x2DU)
52 #define INV3REG_FIFO_COUNTH INV3REG(INV3_BANK0,0x2EU)
53 #define INV3REG_FIFO_COUNTL INV3REG(INV3_BANK0,0x2FU)
54 #define INV3REG_FIFO_DATA INV3REG(INV3_BANK0,0x30U)
55 #define INV3REG_SIGNAL_PATH_RESET INV3REG(INV3_BANK0,0x4BU)
56 # define BIT_SIGNAL_PATH_RESET_FIFO_FLUSH 0x02
57 # define BIT_SIGNAL_PATH_RESET_TMST_STROBE 0x04
58 # define BIT_SIGNAL_PATH_RESET_ABORT_AND_RESET 0x08
59 # define BIT_SIGNAL_PATH_RESET_DMP_MEM_RESET_EN 0x20
60 # define BIT_SIGNAL_PATH_RESET_DMP_INIT_EN 0x40
61 #define INV3REG_INTF_CONFIG0 INV3REG(INV3_BANK0,0x4CU)
62 # define UI_SIFS_CFG_SPI_DIS 0x02
63 # define UI_SIFS_CFG_I2C_DIS 0x03
64 # define UI_SIFS_CFG_SHIFT 0x00
65 # define SENSOR_DATA_BIG_ENDIAN 0x10
66 # define FIFO_COUNT_BIG_ENDIAN 0x20
67 # define FIFO_COUNT_REC 0x40
68 # define FIFO_HOLD_LAST_DATA_EN 0x80
69 #define INV3REG_INTF_CONFIG1 INV3REG(INV3_BANK0,0x4DU)
70 #define INV3REG_PWR_MGMT0 INV3REG(INV3_BANK0,0x4EU)
71 # define ACCEL_MODE_OFF 0x00
72 # define ACCEL_MODE_LN 0x03
73 # define ACCEL_MODE_SHIFT 0x00
74 # define GYRO_MODE_OFF 0x00
75 # define GYRO_MODE_LN 0x03
76 # define GYRO_MODE_SHIFT 0x02
77 # define BIT_PWR_MGMT_IDLE 0x08
78 # define BIT_PWM_MGMT_TEMP_DIS 0x10
79 #define INV3REG_GYRO_CONFIG0 INV3REG(INV3_BANK0,0x4FU)
80 # define GYRO_ODR_32KHZ 0x01
81 # define GYRO_ODR_16KHZ 0x02
82 # define GYRO_ODR_8KHZ 0x03
83 # define GYRO_ODR_4KHZ 0x04
84 # define GYRO_ODR_2KHZ 0x05
85 # define GYRO_ODR_1KHZ 0x06
86 # define GYRO_ODR_200HZ 0x07
87 # define GYRO_ODR_100HZ 0x08
88 # define GYRO_ODR_50HZ 0x09
89 # define GYRO_ODR_25HZ 0x0A
90 # define GYRO_ODR_12_5HZ 0x0B
91 # define GYRO_ODR_500HZ 0x0F
92 # define GYRO_ODR_SHIFT 0x00
93 # define GYRO_FS_SEL_2000DPS 0x00
94 # define GYRO_FS_SEL_1000DPS 0x01
95 # define GYRO_FS_SEL_500DPS 0x02
96 # define GYRO_FS_SEL_250DPS 0x03
97 # define GYRO_FS_SEL_125DPS 0x04
98 # define GYRO_FS_SEL_62_5DPS 0x05
99 # define GYRO_FS_SEL_31_25DPS 0x06
100 # define GYRO_FS_SEL_15_625DPS 0x07
101 # define GYRO_FS_SEL_SHIFT 0x05
102 #define INV3REG_ACCEL_CONFIG0 INV3REG(INV3_BANK0,0x50U)
103 # define ACCEL_ODR_32KHZ 0x01
104 # define ACCEL_ODR_16KHZ 0x02
105 # define ACCEL_ODR_8KHZ 0x03
106 # define ACCEL_ODR_4KHZ 0x04
107 # define ACCEL_ODR_2KHZ 0x05
108 # define ACCEL_ODR_1KHZ 0x06
109 # define ACCEL_ODR_200HZ 0x07
110 # define ACCEL_ODR_100HZ 0x08
111 # define ACCEL_ODR_50HZ 0x09
112 # define ACCEL_ODR_25HZ 0x0A
113 # define ACCEL_ODR_12_5HZ 0x0B
114 # define ACCEL_ODR_6_25HZ 0x0C
115 # define ACCEL_ODR_3_125HZ 0x0D
116 # define ACCEL_ODR_1_5625HZ 0x0E
117 # define ACCEL_ODR_500HZ 0x0F
118 # define ACCEL_ODR_SHIFT 0x00
119 # define ACCEL_FS_SEL_16G 0x00
120 # define ACCEL_FS_SEL_8G 0x01
121 # define ACCEL_FS_SEL_4G 0x02
122 # define ACCEL_FS_SEL_2G 0x03
123 # define ACCEL_FS_SEL_SHIFT 0x05
124 #define INV3REG_GYRO_CONFIG1 INV3REG(INV3_BANK0,0x51U)
125 #define INV3REG_GYRO_ACCEL_CONFIG0 INV3REG(INV3_BANK0,0x52U)
126 #define INV3REG_ACCEL_CONFIG1 INV3REG(INV3_BANK0,0x53U)
127 #define INV3REG_TMST_CONFIG INV3REG(INV3_BANK0,0x54U)
128 # define BIT_TMST_CONFIG_TMST_EN 0x01
129 #define INV3REG_FIFO_CONFIG1 INV3REG(INV3_BANK0,0x5FU)
130 # define BIT_FIFO_CONFIG1_ACCEL_EN 0x01
131 # define BIT_FIFO_CONFIG1_GYRO_EN 0x02
132 # define BIT_FIFO_CONFIG1_TEMP_EN 0x04
133 # define BIT_FIFO_CONFIG1_TMST_FSYNC_EN 0x08
134 # define BIT_FIFO_CONFIG1_HIRES_EN 0x10
135 # define BIT_FIFO_CONFIG1_WM_GT_TH 0x20
136 # define BIT_FIFO_CONFIG1_RESUME_PARTIAL_RD 0x40
137 #define INV3REG_FIFO_CONFIG2 INV3REG(INV3_BANK0,0x60U)
138 #define INV3REG_FIFO_CONFIG3 INV3REG(INV3_BANK0,0x61U)
139 #define INV3REG_INT_SOURCE0 INV3REG(INV3_BANK0,0x65U)
140 #define INV3REG_INT_SOURCE3 INV3REG(INV3_BANK0,0x68U)
141 # define BIT_FIFO_FULL_INT_EN 0x02
142 # define BIT_FIFO_THS_INT_EN 0x04
143 # define BIT_UI_DRDY_INT_EN 0x08
144 #define INV3REG_INT_CONFIG1 INV3REG(INV3_BANK0,0x64U)
145 # define BIT_INT_ASYNC_RESET 0x10
146 #define INV3REG_WHO_AM_I INV3REG(INV3_BANK0,0x75U)
147 #define INV3REG_GYRO_CONFIG_STATIC2 INV3REG(INV3_BANK1,0x0BU)
148 # define BIT_GYRO_NF_DIS 0x01
149 # define BIT_GYRO_AAF_DIS 0x02
150 #define INV3REG_GYRO_CONFIG_STATIC3 INV3REG(INV3_BANK1,0x0CU)
151 # define GYRO_AAF_DELT_SHIFT 0x00
152 #define INV3REG_GYRO_CONFIG_STATIC4 INV3REG(INV3_BANK1,0x0DU)
153 # define GYRO_AAF_DELTSQR_LOW_SHIFT 0x00 //[0:7]
154 #define INV3REG_GYRO_CONFIG_STATIC5 INV3REG(INV3_BANK1,0x0EU)
155 # define GYRO_AAF_DELTSQR_HIGH_SHIFT 0x00 //[11:8]
156 # define GYRO_AAF_BITSHIFT_SHIFT 0x04
157 #define INV3REG_GYRO_CONFIG_STATIC6 INV3REG(INV3_BANK1,0x0FU)
158 # define GYRO_X_NF_COSWZ_LOW_SHIFT 0x00 //[0:7]
159 #define INV3REG_GYRO_CONFIG_STATIC7 INV3REG(INV3_BANK1,0x10U)
160 # define GYRO_Y_NF_COSWZ_LOW_SHIFT 0x00 //[0:7]
161 #define INV3REG_GYRO_CONFIG_STATIC8 INV3REG(INV3_BANK1,0x11U)
162 # define GYRO_Z_NF_COSWZ_LOW_SHIFT 0x00 //[0:7]
163 #define INV3REG_GYRO_CONFIG_STATIC9 INV3REG(INV3_BANK1,0x12U)
164 # define GYRO_X_NF_COSWZ_HIGH_SHIFT 0x00 //[8]
165 # define GYRO_Y_NF_COSWZ_HIGH_SHIFT 0x01 //[8]
166 # define GYRO_Z_NF_COSWZ_HIGH_SHIFT 0x02 //[8]
167 # define GYRO_X_NF_COSWZ_SEL_SHIFT 0x03 //[0]
168 # define GYRO_Y_NF_COSWZ_SEL_SHIFT 0x04 //[0]
169 # define GYRO_Z_NF_COSWZ_SEL_SHIFT 0x05 //[0]
170 #define INV3REG_GYRO_CONFIG_STATIC10 INV3REG(INV3_BANK1,0x13U)
171 # define GYRO_NF_BW_SEL_SHIFT 0x04
172 #define INV3REG_ACCEL_CONFIG_STATIC2 INV3REG(INV3_BANK2,0x03U)
173 # define ACCEL_AAF_DIS 0x01
174 # define ACCEL_AAF_DELT_SHIFT 0x01
175 #define INV3REG_ACCEL_CONFIG_STATIC3 INV3REG(INV3_BANK2,0x04U)
176 # define ACCEL_AAF_DELTSQR_LOW_SHIFT 0x00 //[0:7]
177 #define INV3REG_ACCEL_CONFIG_STATIC4 INV3REG(INV3_BANK2,0x05U)
178 # define ACCEL_AAF_DELTSQR_HIGH_SHIFT 0x00 //[11:8]
179 # define ACCEL_AAF_BITSHIFT_SHIFT 0x04
180 
181 #define INV3REG_BANK_SEL 0x76
182 
183 // WHOAMI values
184 #define INV3_WHOAMI_ICM40605 0x33
185 #define INV3_WHOAMI_ICM40609 0x3b
186 #define INV3_WHOAMI_ICM42605 0x42
187 #define INV3_WHOAMI_ICM42688 0x47
188 #define INV3_WHOAMI_IIM42652 0x6f
189 #define INV3_WHOAMI_ICM42670 0x67
190 
191 #endif /* INVENSENSE3_REGS_H */