Master Thesis  V1.0
Research and Design of Sensor Node for NMSD Treatment
pinout.h
Go to the documentation of this file.
1 
2 /*************************************************/
3 /**** ********/
5 /**** ********/
6 /*************************************************/
7 
8 /***************************************************************************/
15 #define DIY 1
16 
17 /* LED */
18 
19 #if DIY == 1
20 #define LED_PORT gpioPortC
21 #define LED_PIN 10
22 #endif
23 
24  /* Interrupt Pins */
25 
26 #define ICM_20948_I2C_ADDRESS ( 0x69 << 1 )
29 #if DIY == 1
30 #define ICM_20948_POWER_PIN 4
31 #define ICM_20948_POWER_PORT gpioPortF
32 #endif
33 
34 
35 #if DIY == 0
36 #define ICM_20948_POWER_PIN 5
37 #define ICM_20948_POWER_PORT gpioPortD
38 #endif
39 
40 #define ICM_20948_INTERRUPT_PIN 2
41 #define ICM_20948_INTERRUPT_PORT gpioPortC
43 #define ICM_20948_OK 0x0000
44 #define ICM_20948_ERROR_INVALID_DEVICE_ID 0x0001
46 #define ICM_20948_WHO_AM_I 0x00
48 #define ICM_20948_CS_PIN 4
49 #define ICM_20948_CS_PORT gpioPortD
51 #define ICM_20948_CLK_PIN 12
52 #define ICM_20948_CLK_PORT gpioPortE
53 #define ICM_20948_MISO_PIN 11
54 #define ICM_20948_MISO_PORT gpioPortE
55 #define ICM_20948_MOSI_PIN 10
56 #define ICM_20948_MOSI_PORT gpioPortE
59 #define ICM_20948_SDA_PORT gpioPortD
60 #define ICM_20948_SDA_PIN 6
61 #define ICM_20948_SCL_PORT gpioPortD
62 #define ICM_20948_SCL_PIN 7
64 #define SPI USART0
66 #define SPI_PACKET_LENGTH 8
68 #define ICM_20948_REG_BANK_SEL 0x7F
70 #define ICM_20948_BANK_0 ( 0 << 7 )
71 #define ICM_20948_BANK_1 ( 1 << 7 )
72 #define ICM_20948_BANK_2 ( 2 << 7 )
73 #define ICM_20948_BANK_3 ( 3 << 7 )
75 #define ACCEL_XOUT_H ( ICM_20948_BANK_0 | 0x2D )
76 #define ACCEL_XOUT_L ( ICM_20948_BANK_0 | 0x2E )
77 #define ACCEL_YOUT_H ( ICM_20948_BANK_0 | 0x2F )
78 #define ACCEL_YOUT_L ( ICM_20948_BANK_0 | 0x30 )
79 #define ACCEL_ZOUT_H ( ICM_20948_BANK_0 | 0x31 )
80 #define ACCEL_ZOUT_L ( ICM_20948_BANK_0 | 0x32 )
82 #define GYRO_XOUT_H ( ICM_20948_BANK_0 | 0x33 )
83 #define GYRO_XOUT_L ( ICM_20948_BANK_0 | 0x34 )
84 #define GYRO_YOUT_H ( ICM_20948_BANK_0 | 0x35 )
85 #define GYRO_YOUT_L ( ICM_20948_BANK_0 | 0x36 )
86 #define GYRO_ZOUT_H ( ICM_20948_BANK_0 | 0x37 )
87 #define GYRO_ZOUT_L ( ICM_20948_BANK_0 | 0x38 )
89 #define TEMP_OUT_H ( ICM_20948_BANK_0 | 0x39 )
90 #define TEMP_OUT_L ( ICM_20948_BANK_0 | 0x3A )
94 /* Gyro Scale */
95 #define ICM_20948_SHIFT_GYRO_FS_SEL 1
97 #define ICM_20948_GYRO_FULLSCALE_250DPS (0x00 << ICM_20948_SHIFT_GYRO_FS_SEL)
98 #define ICM_20948_GYRO_FULLSCALE_500DPS (0x01 << ICM_20948_SHIFT_GYRO_FS_SEL)
99 #define ICM_20948_GYRO_FULLSCALE_1000DPS (0x02 << ICM_20948_SHIFT_GYRO_FS_SEL)
100 #define ICM_20948_GYRO_FULLSCALE_2000DPS (0x03 << ICM_20948_SHIFT_GYRO_FS_SEL)
102 #define ICM_20948_REG_GYRO_CONFIG_1 (ICM_20948_BANK_2 | 0x01)
103 #define ICM_20948_MASK_GYRO_FULLSCALE 0x06
105 #define ICM_20948_REG_INT_STATUS (ICM_20948_BANK_0 | 0x19)
106 #define ICM_20948_BIT_WOM_INT 0x08
108 #define ICM_20948_REG_INT_ENABLE (ICM_20948_BANK_0 | 0x10)
109 #define ICM_20948_BIT_WOM_INT_EN 0x08
111 #define ICM_20948_REG_INT_ENABLE_1 (ICM_20948_BANK_0 | 0x11)
112 #define ICM_20948_BIT_RAW_DATA_0_RDY_EN 0x01
115 /*******************************************************/
116 /***********************/
117 /* Bank 0 register map */
118 /***********************/
119 #define ICM_20948_REG_WHO_AM_I (ICM_20948_BANK_0 | 0x00)
121 #define ICM_20948_REG_USER_CTRL (ICM_20948_BANK_0 | 0x03)
122 #define ICM_20948_BIT_DMP_EN 0x80
123 #define ICM_20948_BIT_FIFO_EN 0x40
124 #define ICM_20948_BIT_I2C_MST_EN 0x20
125 #define ICM_20948_BIT_I2C_IF_DIS 0x10
126 #define ICM_20948_BIT_DMP_RST 0x08
127 #define ICM_20948_BIT_DIAMOND_DMP_RST 0x04
129 #define ICM_20948_REG_LP_CONFIG (ICM_20948_BANK_0 | 0x05)
130 #define ICM_20948_BIT_I2C_MST_CYCLE 0x40
131 #define ICM_20948_BIT_ACCEL_CYCLE 0x20
132 #define ICM_20948_BIT_GYRO_CYCLE 0x10
134 #define ICM_20948_REG_PWR_MGMT_1 (ICM_20948_BANK_0 | 0x06)
135 #define ICM_20948_BIT_H_RESET 0x80
136 #define ICM_20948_BIT_SLEEP 0x40
137 #define ICM_20948_BIT_LP_EN 0x20
138 #define ICM_20948_BIT_TEMP_DIS 0x08
139 #define ICM_20948_BIT_CLK_PLL 0x01
141 #define ICM_20948_REG_PWR_MGMT_2 (ICM_20948_BANK_0 | 0x07)
142 #define ICM_20948_BIT_PWR_ACCEL_STBY 0x38
143 #define ICM_20948_BIT_PWR_GYRO_STBY 0x07
144 #define ICM_20948_BIT_PWR_ALL_OFF 0x7F
146 #define ICM_20948_REG_INT_PIN_CFG (ICM_20948_BANK_0 | 0x0F)
147 #define ICM_20948_BIT_INT_ACTL 0x80
148 #define ICM_20948_BIT_INT_OPEN 0x40
149 #define ICM_20948_BIT_INT_LATCH_EN 0x20
151 #define ICM_20948_REG_INT_ENABLE (ICM_20948_BANK_0 | 0x10)
152 #define ICM_20948_BIT_WOM_INT_EN 0x08
154 #define ICM_20948_REG_INT_ENABLE_1 (ICM_20948_BANK_0 | 0x11)
155 #define ICM_20948_BIT_RAW_DATA_0_RDY_EN 0x01
157 #define ICM_20948_REG_INT_ENABLE_2 (ICM_20948_BANK_0 | 0x12)
158 #define ICM_20948_BIT_FIFO_OVERFLOW_EN_0 0x01
160 #define ICM_20948_REG_INT_ENABLE_3 (ICM_20948_BANK_0 | 0x13)
162 #define ICM_20948_REG_I2C_MST_STATUS (ICM_20948_BANK_0 | 0x17)
163 #define ICM_20948_BIT_PASS_THROUGH 0x80
164 #define ICM_20948_BIT_SLV4_DONE 0x40
165 #define ICM_20948_BIT_LOST_ARB 0x20
166 #define ICM_20948_BIT_SLV4_NACK 0x10
167 #define ICM_20948_BIT_SLV3_NACK 0x08
168 #define ICM_20948_BIT_SLV2_NACK 0x04
169 #define ICM_20948_BIT_SLV1_NACK 0x02
170 #define ICM_20948_BIT_SLV0_NACK 0x01
171 
172 #define ICM_20948_REG_INT_STATUS (ICM_20948_BANK_0 | 0x19)
173 #define ICM_20948_BIT_WOM_INT 0x08
174 #define ICM_20948_BIT_PLL_RDY 0x04
176 #define ICM_20948_REG_INT_STATUS_1 (ICM_20948_BANK_0 | 0x1A)
177 #define ICM_20948_BIT_RAW_DATA_0_RDY_INT 0x01
179 #define ICM_20948_REG_INT_STATUS_2 (ICM_20948_BANK_0 | 0x1B)
181 #define ICM_20948_REG_ACCEL_XOUT_H_SH (ICM_20948_BANK_0 | 0x2D)
182 #define ICM_20948_REG_ACCEL_XOUT_L_SH (ICM_20948_BANK_0 | 0x2E)
183 #define ICM_20948_REG_ACCEL_YOUT_H_SH (ICM_20948_BANK_0 | 0x2F)
184 #define ICM_20948_REG_ACCEL_YOUT_L_SH (ICM_20948_BANK_0 | 0x30)
185 #define ICM_20948_REG_ACCEL_ZOUT_H_SH (ICM_20948_BANK_0 | 0x31)
186 #define ICM_20948_REG_ACCEL_ZOUT_L_SH (ICM_20948_BANK_0 | 0x32)
188 #define ICM_20948_REG_GYRO_XOUT_H_SH (ICM_20948_BANK_0 | 0x33)
189 #define ICM_20948_REG_GYRO_XOUT_L_SH (ICM_20948_BANK_0 | 0x34)
190 #define ICM_20948_REG_GYRO_YOUT_H_SH (ICM_20948_BANK_0 | 0x35)
191 #define ICM_20948_REG_GYRO_YOUT_L_SH (ICM_20948_BANK_0 | 0x36)
192 #define ICM_20948_REG_GYRO_ZOUT_H_SH (ICM_20948_BANK_0 | 0x37)
193 #define ICM_20948_REG_GYRO_ZOUT_L_SH (ICM_20948_BANK_0 | 0x38)
195 #define ICM_20948_REG_TEMPERATURE_H (ICM_20948_BANK_0 | 0x39)
196 #define ICM_20948_REG_TEMPERATURE_L (ICM_20948_BANK_0 | 0x3A)
197 #define ICM_20948_REG_TEMP_CONFIG (ICM_20948_BANK_0 | 0x53)
199 #define ICM_20948_REG_FIFO_EN_1 (ICM_20948_BANK_0 | 0x66)
201 #define ICM_20948_REG_FIFO_EN_2 (ICM_20948_BANK_0 | 0x67)
202 #define ICM_20948_BIT_ACCEL_FIFO_EN 0x10
203 #define ICM_20948_BITS_GYRO_FIFO_EN 0x0E
205 #define ICM_20948_REG_FIFO_RST (ICM_20948_BANK_0 | 0x68)
206 #define ICM_20948_REG_FIFO_MODE (ICM_20948_BANK_0 | 0x69)
208 #define ICM_20948_REG_FIFO_COUNT_H (ICM_20948_BANK_0 | 0x70)
209 #define ICM_20948_REG_FIFO_COUNT_L (ICM_20948_BANK_0 | 0x71)
210 #define ICM_20948_REG_FIFO_R_W (ICM_20948_BANK_0 | 0x72)
212 #define ICM_20948_REG_DATA_RDY_STATUS (ICM_20948_BANK_0 | 0x74)
213 #define ICM_20948_BIT_RAW_DATA_0_RDY 0x01
215 #define ICM_20948_REG_FIFO_CFG (ICM_20948_BANK_0 | 0x76)
216 #define ICM_20948_BIT_MULTI_FIFO_CFG 0x01
217 #define ICM_20948_BIT_SINGLE_FIFO_CFG 0x00
219 /***********************/
220 /* Bank 1 register map */
221 /***********************/
222 #define ICM_20948_REG_XA_OFFSET_H (ICM_20948_BANK_1 | 0x14)
223 #define ICM_20948_REG_XA_OFFSET_L (ICM_20948_BANK_1 | 0x15)
224 #define ICM_20948_REG_YA_OFFSET_H (ICM_20948_BANK_1 | 0x17)
225 #define ICM_20948_REG_YA_OFFSET_L (ICM_20948_BANK_1 | 0x18)
226 #define ICM_20948_REG_ZA_OFFSET_H (ICM_20948_BANK_1 | 0x1A)
227 #define ICM_20948_REG_ZA_OFFSET_L (ICM_20948_BANK_1 | 0x1B)
229 #define ICM_20948_REG_TIMEBASE_CORR_PLL (ICM_20948_BANK_1 | 0x28)
231 /***********************/
232 /* Bank 2 register map */
233 /***********************/
234 #define ICM_20948_REG_GYRO_SMPLRT_DIV (ICM_20948_BANK_2 | 0x00)
236 #define ICM_20948_REG_GYRO_CONFIG_1 (ICM_20948_BANK_2 | 0x01)
237 #define ICM_20948_BIT_GYRO_FCHOICE 0x01
238 #define ICM_20948_SHIFT_GYRO_FS_SEL 1
239 #define ICM_20948_SHIFT_GYRO_DLPCFG 3
240 #define ICM_20948_MASK_GYRO_FULLSCALE 0x06
241 #define ICM_20948_MASK_GYRO_BW 0x39
242 #define ICM_20948_GYRO_FULLSCALE_250DPS (0x00 << ICM_20948_SHIFT_GYRO_FS_SEL)
243 #define ICM_20948_GYRO_FULLSCALE_500DPS (0x01 << ICM_20948_SHIFT_GYRO_FS_SEL)
244 #define ICM_20948_GYRO_FULLSCALE_1000DPS (0x02 << ICM_20948_SHIFT_GYRO_FS_SEL)
245 #define ICM_20948_GYRO_FULLSCALE_2000DPS (0x03 << ICM_20948_SHIFT_GYRO_FS_SEL)
246 #define ICM_20948_GYRO_BW_12100HZ (0x00 << ICM_20948_SHIFT_GYRO_DLPCFG)
247 #define ICM_20948_GYRO_BW_360HZ ( (0x07 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
248 #define ICM_20948_GYRO_BW_200HZ ( (0x00 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
249 #define ICM_20948_GYRO_BW_150HZ ( (0x01 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
250 #define ICM_20948_GYRO_BW_120HZ ( (0x02 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
251 #define ICM_20948_GYRO_BW_51HZ ( (0x03 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
252 #define ICM_20948_GYRO_BW_24HZ ( (0x04 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
253 #define ICM_20948_GYRO_BW_12HZ ( (0x05 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
254 #define ICM_20948_GYRO_BW_6HZ ( (0x06 << ICM_20948_SHIFT_GYRO_DLPCFG) | ICM_20948_BIT_GYRO_FCHOICE)
256 #define ICM_20948_REG_GYRO_CONFIG_2 (ICM_20948_BANK_2 | 0x02)
257 #define ICM_20948_BIT_GYRO_CTEN 0x38
259 #define ICM_20948_REG_XG_OFFS_USRH (ICM_20948_BANK_2 | 0x03)
260 #define ICM_20948_REG_XG_OFFS_USRL (ICM_20948_BANK_2 | 0x04)
261 #define ICM_20948_REG_YG_OFFS_USRH (ICM_20948_BANK_2 | 0x05)
262 #define ICM_20948_REG_YG_OFFS_USRL (ICM_20948_BANK_2 | 0x06)
263 #define ICM_20948_REG_ZG_OFFS_USRH (ICM_20948_BANK_2 | 0x07)
264 #define ICM_20948_REG_ZG_OFFS_USRL (ICM_20948_BANK_2 | 0x08)
266 #define ICM_20948_REG_ODR_ALIGN_EN (ICM_20948_BANK_2 | 0x09)
268 #define ICM_20948_REG_ACCEL_SMPLRT_DIV_1 (ICM_20948_BANK_2 | 0x10)
269 #define ICM_20948_REG_ACCEL_SMPLRT_DIV_2 (ICM_20948_BANK_2 | 0x11)
271 #define ICM_20948_REG_ACCEL_INTEL_CTRL (ICM_20948_BANK_2 | 0x12)
272 #define ICM_20948_BIT_ACCEL_INTEL_EN 0x02
273 #define ICM_20948_BIT_ACCEL_INTEL_MODE 0x01
275 #define ICM_20948_REG_ACCEL_WOM_THR (ICM_20948_BANK_2 | 0x13)
277 #define ICM_20948_REG_ACCEL_CONFIG (ICM_20948_BANK_2 | 0x14)
278 #define ICM_20948_BIT_ACCEL_FCHOICE 0x01
279 #define ICM_20948_SHIFT_ACCEL_FS 1
280 #define ICM_20948_SHIFT_ACCEL_DLPCFG 3
281 #define ICM_20948_MASK_ACCEL_FULLSCALE 0x06
282 #define ICM_20948_MASK_ACCEL_BW 0x39
283 #define ICM_20948_ACCEL_FULLSCALE_2G (0x00 << ICM_20948_SHIFT_ACCEL_FS)
284 #define ICM_20948_ACCEL_FULLSCALE_4G (0x01 << ICM_20948_SHIFT_ACCEL_FS)
285 #define ICM_20948_ACCEL_FULLSCALE_8G (0x02 << ICM_20948_SHIFT_ACCEL_FS)
286 #define ICM_20948_ACCEL_FULLSCALE_16G (0x03 << ICM_20948_SHIFT_ACCEL_FS)
287 #define ICM_20948_ACCEL_BW_1210HZ (0x00 << ICM_20948_SHIFT_ACCEL_DLPCFG)
288 #define ICM_20948_ACCEL_BW_470HZ ( (0x07 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
289 #define ICM_20948_ACCEL_BW_246HZ ( (0x00 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
290 #define ICM_20948_ACCEL_BW_111HZ ( (0x02 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
291 #define ICM_20948_ACCEL_BW_50HZ ( (0x03 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
292 #define ICM_20948_ACCEL_BW_24HZ ( (0x04 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
293 #define ICM_20948_ACCEL_BW_12HZ ( (0x05 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
294 #define ICM_20948_ACCEL_BW_6HZ ( (0x06 << ICM_20948_SHIFT_ACCEL_DLPCFG) | ICM_20948_BIT_ACCEL_FCHOICE)
296 #define ICM_20948_REG_ACCEL_CONFIG_2 (ICM_20948_BANK_2 | 0x15)
297 #define ICM_20948_BIT_ACCEL_CTEN 0x1C
299 /***********************/
300 /* Bank 3 register map */
301 /***********************/
302 #define ICM_20948_REG_I2C_MST_ODR_CONFIG (ICM_20948_BANK_3 | 0x00)
304 #define ICM_20948_REG_I2C_MST_CTRL (ICM_20948_BANK_3 | 0x01)
305 #define ICM_20948_BIT_I2C_MST_P_NSR 0x10
307 #define ICM_20948_REG_I2C_MST_DELAY_CTRL (ICM_20948_BANK_3 | 0x02)
308 #define ICM_20948_BIT_SLV0_DLY_EN 0x01
309 #define ICM_20948_BIT_SLV1_DLY_EN 0x02
310 #define ICM_20948_BIT_SLV2_DLY_EN 0x04
311 #define ICM_20948_BIT_SLV3_DLY_EN 0x08
313 #define ICM_20948_REG_I2C_SLV0_ADDR (ICM_20948_BANK_3 | 0x03)
314 #define ICM_20948_REG_I2C_SLV0_REG (ICM_20948_BANK_3 | 0x04)
315 #define ICM_20948_REG_I2C_SLV0_CTRL (ICM_20948_BANK_3 | 0x05)
316 #define ICM_20948_REG_I2C_SLV0_DO (ICM_20948_BANK_3 | 0x06)
318 #define ICM_20948_REG_I2C_SLV1_ADDR (ICM_20948_BANK_3 | 0x07)
319 #define ICM_20948_REG_I2C_SLV1_REG (ICM_20948_BANK_3 | 0x08)
320 #define ICM_20948_REG_I2C_SLV1_CTRL (ICM_20948_BANK_3 | 0x09)
321 #define ICM_20948_REG_I2C_SLV1_DO (ICM_20948_BANK_3 | 0x0A)
323 #define ICM_20948_REG_I2C_SLV2_ADDR (ICM_20948_BANK_3 | 0x0B)
324 #define ICM_20948_REG_I2C_SLV2_REG (ICM_20948_BANK_3 | 0x0C)
325 #define ICM_20948_REG_I2C_SLV2_CTRL (ICM_20948_BANK_3 | 0x0D)
326 #define ICM_20948_REG_I2C_SLV2_DO (ICM_20948_BANK_3 | 0x0E)
328 #define ICM_20948_REG_I2C_SLV3_ADDR (ICM_20948_BANK_3 | 0x0F)
329 #define ICM_20948_REG_I2C_SLV3_REG (ICM_20948_BANK_3 | 0x10)
330 #define ICM_20948_REG_I2C_SLV3_CTRL (ICM_20948_BANK_3 | 0x11)
331 #define ICM_20948_REG_I2C_SLV3_DO (ICM_20948_BANK_3 | 0x12)
333 #define ICM_20948_REG_I2C_SLV4_ADDR (ICM_20948_BANK_3 | 0x13)
334 #define ICM_20948_REG_I2C_SLV4_REG (ICM_20948_BANK_3 | 0x14)
335 #define ICM_20948_REG_I2C_SLV4_CTRL (ICM_20948_BANK_3 | 0x15)
336 #define ICM_20948_REG_I2C_SLV4_DO (ICM_20948_BANK_3 | 0x16)
337 #define ICM_20948_REG_I2C_SLV4_DI (ICM_20948_BANK_3 | 0x17)
339 #define ICM_20948_BIT_I2C_SLV_EN 0x80
340 #define ICM_20948_BIT_I2C_BYTE_SW 0x40
341 #define ICM_20948_BIT_I2C_REG_DIS 0x20
342 #define ICM_20948_BIT_I2C_GRP 0x10
343 #define ICM_20948_BIT_I2C_READ 0x80
345 /* Register common for all banks */
346 #define ICM_20948_REG_BANK_SEL 0x7F
349 // TODO: declaration twice, need fixing
350 #define ICM_20948_DEVICE_ID 0xE0
351 #define ICM20948_DEVICE_ID 0xEA
354 /********************************************************************/
355 
356 /* MAGNETOMETER REGISTERS */
357 
358 #define ICM_20948_I2C_MST_CTRL_CLK_400KHZ 0x07
359 #define ICM_20948_REG_EXT_SLV_SENS_DATA_00 (ICM_20948_BANK_0 | 0x3B)
360 #define ICM_20948_BIT_I2C_SLV_READ 0x80
364 /*****************************/
365 /* AK09916 register map */
366 /*****************************/
367 #define AK09916_REG_WHO_AM_I 0x01
368 #define AK09916_DEVICE_ID 0x09
370 #define AK09916_REG_STATUS_1 0x10
371 #define AK09916_BIT_DRDY 0x01
372 #define AK09916_BIT_DOR 0x02
374 #define AK09916_REG_HXL 0x11
375 #define AK09916_REG_HXH 0x12
376 #define AK09916_REG_HYL 0x13
377 #define AK09916_REG_HYH 0x14
378 #define AK09916_REG_HZL 0x15
379 #define AK09916_REG_HZH 0x16
381 #define AK09916_REG_STATUS_2 0x18
383 #define AK09916_REG_CONTROL_2 0x31
384 #define AK09916_BIT_MODE_POWER_DOWN 0x00
385 #define AK09916_MODE_SINGLE 0x01
386 #define AK09916_MODE_10HZ 0x02
387 #define AK09916_MODE_20HZ 0x04
388 #define AK09916_MODE_50HZ 0x06
389 #define AK09916_MODE_100HZ 0x08
390 #define AK09916_MODE_ST 0x16
392 #define AK09916_REG_CONTROL_3 0x32
393 #define AK09916_BIT_SRST 0x01
395 #define AK09916_REG_WHO_AM_I 0x01
396 #define AK09916_BIT_I2C_SLV_ADDR 0x0C
400 /* Retrun values Magnetometer */
401 #define ERROR 0x0001
402 #define OK 0x0000