Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
lsm303d_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Felix Ruess <felix.ruess@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 
31 #ifndef LSM303D_REGS_H
32 #define LSM303D_REGS_H
33 
34 /* Registers */
35 #define LSM303D_REG_TEMP_OUT_L 0x05
36 #define LSM303D_REG_TEMP_OUT_H 0x06
37 #define LSM303D_REG_STATUS_M 0x07
38 #define LSM303D_REG_OUT_X_L_M 0x08
39 #define LSM303D_REG_OUT_X_H_M 0x09
40 #define LSM303D_REG_OUT_Y_L_M 0x0A
41 #define LSM303D_REG_OUT_Y_H_M 0x0B
42 #define LSM303D_REG_OUT_Z_L_M 0x0C
43 #define LSM303D_REG_OUT_Z_H_M 0x0D
44 
45 #define LSM303D_REG_WHO_AM_I 0x0F
46 
47 #define LSM303D_REG_INT_CTRL_M 0x12
48 #define LSM303D_REG_INT_SRC_M 0x13
49 #define LSM303D_REG_INT_THS_L_M 0x14
50 #define LSM303D_REG_INT_THS_H_M 0x15
51 #define LSM303D_REG_OFFSET_X_L_M 0x16
52 #define LSM303D_REG_OFFSET_X_H_M 0x17
53 #define LSM303D_REG_OFFSET_Y_L_M 0x18
54 #define LSM303D_REG_OFFSET_Y_H_M 0x19
55 #define LSM303D_REG_OFFSET_Z_L_M 0x1A
56 #define LSM303D_REG_OFFSET_Z_H_M 0x1B
57 #define LSM303D_REG_REFERENCE_X 0x1C
58 #define LSM303D_REG_REFERENCE_Y 0x1D
59 #define LSM303D_REG_REFERENCE_Z 0x1E
60 #define LSM303D_REG_CTRL0 0x1F
61 #define LSM303D_REG_CTRL1 0x20
62 #define LSM303D_REG_CTRL2 0x21
63 #define LSM303D_REG_CTRL3 0x22
64 #define LSM303D_REG_CTRL4 0x23
65 #define LSM303D_REG_CTRL5 0x24
66 #define LSM303D_REG_CTRL6 0x25
67 #define LSM303D_REG_CTRL7 0x26
68 #define LSM303D_REG_STATUS_A 0x27
69 #define LSM303D_REG_OUT_X_L_A 0x28
70 #define LSM303D_REG_OUT_X_H_A 0x29
71 #define LSM303D_REG_OUT_Y_L_A 0x2A
72 #define LSM303D_REG_OUT_Y_H_A 0x2B
73 #define LSM303D_REG_OUT_Z_L_A 0x2C
74 #define LSM303D_REG_OUT_Z_H_A 0x2D
75 #define LSM303D_REG_FIFO_CTRL 0x2E
76 #define LSM303D_REG_FIFO_SRC 0x2F
77 #define LSM303D_REG_IG_CFG1 0x30
78 #define LSM303D_REG_IG_SRC1 0x31
79 #define LSM303D_REG_IG_THS1 0x32
80 #define LSM303D_REG_IG_DUR1 0x33
81 #define LSM303D_REG_IG_CFG2 0x34
82 #define LSM303D_REG_IG_SRC2 0x35
83 #define LSM303D_REG_IG_THS2 0x36
84 #define LSM303D_REG_IG_DUR2 0x37
85 #define LSM303D_REG_CLICK_CFG 0x38
86 #define LSM303D_REG_CLICK_SRC 0x39
87 #define LSM303D_REG_CLICK_THS 0x3A
88 #define LSM303D_REG_TIME_LIMIT 0x3B
89 #define LSM303D_REG_TIME_LATENCY 0x3C
90 #define LSM303D_REG_TIME_WINDOW 0x3D
91 #define LSM303D_REG_ACT_THS 0x3E
92 #define LSM303D_REG_ACT_DUR 0x3F
93 
95 #define LSM303D_REG_WHO_I_AM 0x49
96 
97 /* Bit definitions for LSM303D_REG_CTRL1 */
98 #define LSM303D_AXEN (0x01 << 0)
99 #define LSM303D_AYEN (0x01 << 1)
100 #define LSM303D_AZEN (0x01 << 2)
101 #define LSM303D_ABDU (0x01 << 3)
102 #define LSM303D_AODR_MASK (0x0F << 4)
103 
117 };
118 
119 /* Bit definitions for LSM303D_REG_CTRL2 */
120 #define LSM303D_ASIM (0x01 << 0)
121 #define LSM303D_AAST (0x01 << 1)
122 #define LSM303D_AFS_MASK (0x07 << 3)
123 #define LSM303D_ABW_MASK (0x03 << 6)
124 
131 };
132 
140 };
141 
142 /* Bit definitions for LSM303D_REG_CTRL3 */
143 #define LSM303D_INT1_EMPTY (0x01 << 0)
144 #define LSM303D_INT1_DRDY_M (0x01 << 1)
145 #define LSM303D_INT1_DRDY_A (0x01 << 2)
146 #define LSM303D_INT1_IGM (0x01 << 3)
147 #define LSM303D_INT1_IG2 (0x01 << 4)
148 #define LSM303D_INT1_IG1 (0x01 << 5)
149 #define LSM303D_INT1_Click (0x01 << 6)
150 #define LSM303D_INT1_BOOT (0x01 << 7)
151 
152 /* Bit definitions for LSM303D_REG_CTRL4 */
153 #define LSM303D_INT2_FTH (0x01 << 0)
154 #define LSM303D_INT2_Overrun (0x01 << 1)
155 #define LSM303D_INT2_DRDY_M (0x01 << 2)
156 #define LSM303D_INT2_DRDY_A (0x01 << 3)
157 #define LSM303D_INT2_INTM (0x01 << 4)
158 #define LSM303D_INT2_INT2 (0x01 << 5)
159 #define LSM303D_INT2_INT1 (0x01 << 6)
160 #define LSM303D_INT2_Click (0x01 << 7)
161 
162 
163 /* Bit definitions for LSM303D_REG_CTRL5 */
164 #define LSM303D_LIR1 (0x01 << 0)
165 #define LSM303D_LIR2 (0x01 << 1)
166 #define LSM303D_M_ODR_MASK (0x07 << 2)
167 #define LSM303D_M_RES (0x03 << 5)
168 #define LSM303D_TEMP_EN (0x01 << 7)
169 
178 };
179 
180 
181 /* Bit definitions for LSM303D_REG_CTRL6 */
182 #define LSM303D_MFS_MASK (0x03 << 5)
183 
190 };
191 
192 /* Bit definitions for LSM303D_REG_CTRL7 */
193 #define LSM303D_MD_MASK (0x03 << 0)
194 #define LSM303D_MLP (0x01 << 2)
195 #define LSM303D_T_ONLY (0x01 << 4)
196 #define LSM303D_AFDS (0x01 << 5)
197 #define LSM303D_AHPM_MASK (0x03 << 6)
198 
203  //LSM303D_MAG_MODE_POWER_DOWN = 0x02,
205 };
206 
207 /* Bit definitions for LSM303D_REG_STATUS_A */
208 #define LSM303D_XADA (0x01 << 0)
209 #define LSM303D_YADA (0x01 << 1)
210 #define LSM303D_ZADA (0x01 << 2)
211 #define LSM303D_ZYXADA (0x01 << 3)
212 #define LSM303D_XAOR (0x01 << 4)
213 #define LSM303D_YAOR (0x01 << 5)
214 #define LSM303D_ZAOR (0x01 << 6)
215 #define LSM303D_ZYXAOR (0x01 << 7)
216 
217 /* Bit definitions for LSM303D_REG_STATUS_M */
218 #define LSM303D_XMDA (0x01 << 0)
219 #define LSM303D_YMDA (0x01 << 1)
220 #define LSM303D_ZMDA (0x01 << 2)
221 #define LSM303D_ZYXMDA (0x01 << 3)
222 #define LSM303D_XMOR (0x01 << 4)
223 #define LSM303D_YMOR (0x01 << 5)
224 #define LSM303D_ZMOR (0x01 << 6)
225 #define LSM303D_ZYXMOR (0x01 << 7)
226 
227 #endif // LSM303D_REGS_H
LSM303D_ACC_RANGE_4G
@ LSM303D_ACC_RANGE_4G
Definition: lsm303d_regs.h:136
LSM303D_MAG_RATE_50HZ
@ LSM303D_MAG_RATE_50HZ
Definition: lsm303d_regs.h:176
LSM303D_MAG_RATE_3_125HZ
@ LSM303D_MAG_RATE_3_125HZ
Definition: lsm303d_regs.h:172
LSM303D_ACC_RANGE_2G
@ LSM303D_ACC_RANGE_2G
Definition: lsm303d_regs.h:135
LSM303D_MAG_RATE_100HZ
@ LSM303D_MAG_RATE_100HZ
Definition: lsm303d_regs.h:177
LSM303D_ACC_RATE_50HZ
@ LSM303D_ACC_RATE_50HZ
Definition: lsm303d_regs.h:111
LSM303D_MAG_RATE_6_25HZ
@ LSM303D_MAG_RATE_6_25HZ
Definition: lsm303d_regs.h:173
Lsm303dAccelRanges
Lsm303dAccelRanges
LSM303D accelerometer anti-alias filter bandwidth (ODR bits 3-5 in LSM303D_REG_CTRL2)
Definition: lsm303d_regs.h:134
LSM303D_MAG_MODE_SINGLE_CONVERSION
@ LSM303D_MAG_MODE_SINGLE_CONVERSION
Definition: lsm303d_regs.h:202
LSM303D_ACC_RANGE_8G
@ LSM303D_ACC_RANGE_8G
Definition: lsm303d_regs.h:138
Lsm303dMagMode
Lsm303dMagMode
LSM303D magnetic sensor mode selection (MD bits 0-1 in LSM303D_REG_CTRL7)
Definition: lsm303d_regs.h:200
LSM303D_ACC_RANGE_16G
@ LSM303D_ACC_RANGE_16G
Definition: lsm303d_regs.h:139
LSM303D_ACC_RATE_6_25HZ
@ LSM303D_ACC_RATE_6_25HZ
Definition: lsm303d_regs.h:108
LSM303D_ACC_RATE_1600HZ
@ LSM303D_ACC_RATE_1600HZ
Definition: lsm303d_regs.h:116
LSM303D_MAG_RANGE_12GAUSS
@ LSM303D_MAG_RANGE_12GAUSS
Definition: lsm303d_regs.h:189
LSM303D_MAG_RATE_12_5HZ
@ LSM303D_MAG_RATE_12_5HZ
Definition: lsm303d_regs.h:174
LSM303D_MAG_MODE_CONTINOUS_CONVERSION
@ LSM303D_MAG_MODE_CONTINOUS_CONVERSION
Definition: lsm303d_regs.h:201
Lsm303dMagRange
Lsm303dMagRange
LSM303D magnetic range (MFS bits 5-6 in LSM303D_REG_CTRL6)
Definition: lsm303d_regs.h:185
LSM303D_ACC_RATE_100HZ
@ LSM303D_ACC_RATE_100HZ
Definition: lsm303d_regs.h:112
LSM303D_ACC_RATE_3_125HZ
@ LSM303D_ACC_RATE_3_125HZ
Definition: lsm303d_regs.h:107
LSM303D_MAG_RATE_25HZ
@ LSM303D_MAG_RATE_25HZ
Definition: lsm303d_regs.h:175
Lsm303dAccelRates
Lsm303dAccelRates
LSM303D acceleration data rate (bits 4-7 in LSM303D_REG_CTRL1)
Definition: lsm303d_regs.h:105
Lsm303dAccelBandwidth
Lsm303dAccelBandwidth
LSM303D accelerometer anti-alias filter bandwidth (BW bits 6-7 in LSM303D_REG_CTRL2)
Definition: lsm303d_regs.h:126
LSM303D_MAG_MODE_POWER_DOWN
@ LSM303D_MAG_MODE_POWER_DOWN
Definition: lsm303d_regs.h:204
LSM303D_ACC_BW_50HZ
@ LSM303D_ACC_BW_50HZ
Definition: lsm303d_regs.h:130
LSM303D_ACC_BW_773HZ
@ LSM303D_ACC_BW_773HZ
Definition: lsm303d_regs.h:127
LSM303D_ACC_BW_194HZ
@ LSM303D_ACC_BW_194HZ
Definition: lsm303d_regs.h:128
LSM303D_ACC_RATE_25HZ
@ LSM303D_ACC_RATE_25HZ
Definition: lsm303d_regs.h:110
LSM303D_ACC_RATE_12_5HZ
@ LSM303D_ACC_RATE_12_5HZ
Definition: lsm303d_regs.h:109
LSM303D_ACC_RANGE_6G
@ LSM303D_ACC_RANGE_6G
Definition: lsm303d_regs.h:137
LSM303D_ACC_RATE_800HZ
@ LSM303D_ACC_RATE_800HZ
Definition: lsm303d_regs.h:115
LSM303D_MAG_RANGE_2GAUSS
@ LSM303D_MAG_RANGE_2GAUSS
Definition: lsm303d_regs.h:186
LSM303D_MAG_RANGE_8GAUSS
@ LSM303D_MAG_RANGE_8GAUSS
Definition: lsm303d_regs.h:188
LSM303D_ACC_RATE_200HZ
@ LSM303D_ACC_RATE_200HZ
Definition: lsm303d_regs.h:113
LSM303D_ACC_RATE_OFF
@ LSM303D_ACC_RATE_OFF
Definition: lsm303d_regs.h:106
LSM303D_ACC_RATE_400HZ
@ LSM303D_ACC_RATE_400HZ
Definition: lsm303d_regs.h:114
LSM303D_ACC_BW_362HZ
@ LSM303D_ACC_BW_362HZ
Definition: lsm303d_regs.h:129
Lsm303dMagRates
Lsm303dMagRates
LSM303D magnetic data rate (MODR bits 2-4 in LSM303D_REG_CTRL5)
Definition: lsm303d_regs.h:171
LSM303D_MAG_RANGE_4GAUSS
@ LSM303D_MAG_RANGE_4GAUSS
Definition: lsm303d_regs.h:187