33 #define LSM303D_DEFAULT_I2C_BUS 0 34 #define LSM303D_DEFAULT_I2C_ADDR 0x1e 37 #define LSM303D_CHIPID 0x49 58 LSM303D_REG_TEMP_OUT_L = 0x05,
59 LSM303D_REG_TEMP_OUT_H = 0x06,
61 LSM303D_REG_STATUS_M = 0x07,
63 LSM303D_REG_OUT_X_L_M = 0x08,
64 LSM303D_REG_OUT_X_H_M = 0x09,
65 LSM303D_REG_OUT_Y_L_M = 0x0a,
66 LSM303D_REG_OUT_Y_H_M = 0x0b,
67 LSM303D_REG_OUT_Z_L_M = 0x0c,
68 LSM303D_REG_OUT_Z_H_M = 0x0d,
72 LSM303D_REG_WHO_AM_I = 0x0f,
76 LSM303D_REG_INT_CTRL_M = 0x12,
77 LSM303D_REG_INT_SRC_M = 0x13,
78 LSM303D_REG_INT_THS_L_M = 0x14,
79 LSM303D_REG_INT_THS_H_M = 0x15,
81 LSM303D_REG_OFFSET_X_L_M = 0x16,
82 LSM303D_REG_OFFSET_X_H_M = 0x17,
83 LSM303D_REG_OFFSET_Y_L_M = 0x18,
84 LSM303D_REG_OFFSET_Y_H_M = 0x19,
85 LSM303D_REG_OFFSET_Z_L_M = 0x1a,
86 LSM303D_REG_OFFSET_Z_H_M = 0x1b,
88 LSM303D_REG_REFERENCE_X = 0x1c,
89 LSM303D_REG_REFERENCE_Y = 0x1d,
90 LSM303D_REG_REFERENCE_Z = 0x1e,
92 LSM303D_REG_CTRL0 = 0x1f,
93 LSM303D_REG_CTRL1 = 0x20,
94 LSM303D_REG_CTRL2 = 0x21,
95 LSM303D_REG_CTRL3 = 0x22,
96 LSM303D_REG_CTRL4 = 0x23,
97 LSM303D_REG_CTRL5 = 0x24,
98 LSM303D_REG_CTRL6 = 0x25,
99 LSM303D_REG_CTRL7 = 0x26,
101 LSM303D_REG_STATUS_A = 0x27,
103 LSM303D_REG_OUT_X_L_A = 0x28,
104 LSM303D_REG_OUT_X_H_A = 0x29,
105 LSM303D_REG_OUT_Y_L_A = 0x2a,
106 LSM303D_REG_OUT_Y_H_A = 0x2b,
107 LSM303D_REG_OUT_Z_L_A = 0x2c,
108 LSM303D_REG_OUT_Z_H_A = 0x2d,
110 LSM303D_REG_FIFO_CTRL = 0x2e,
111 LSM303D_REG_FIFO_SRC = 0x2f,
113 LSM303D_REG_IG_CFG1 = 0x30,
114 LSM303D_REG_IG_SRC1 = 0x31,
115 LSM303D_REG_IG_THS1 = 0x32,
116 LSM303D_REG_IG_DUR1 = 0x33,
117 LSM303D_REG_IG_CFG2 = 0x34,
118 LSM303D_REG_IG_SRC2 = 0x35,
119 LSM303D_REG_IG_THS2 = 0x36,
120 LSM303D_REG_IG_DUR2 = 0x37,
122 LSM303D_REG_CLICK_CFG = 0x38,
123 LSM303D_REG_CLICK_SRC = 0x39,
124 LSM303D_REG_CLICK_THS = 0x3a,
126 LSM303D_REG_TIME_LIMIT = 0x3b,
127 LSM303D_REG_TIME_LATENCY = 0x3c,
128 LSM303D_REG_TIME_WINDOW = 0x3d,
130 LSM303D_REG_ACT_THS = 0x3e,
131 LSM303D_REG_ACT_DUR = 0x3f,
140 LSM303D_CTRL1_AXEN = 0x01,
141 LSM303D_CTRL1_AYEN = 0x02,
142 LSM303D_CTRL1_AZEN = 0x04,
144 LSM303D_CTRL1_BDU = 0x08,
146 LSM303D_CTRL1_AODR0 = 0x10,
147 LSM303D_CTRL1_AODR1 = 0x20,
148 LSM303D_CTRL1_AODR2 = 0x40,
149 LSM303D_CTRL1_AODR3 = 0x80,
150 _LSM303D_CTRL1_AODR_MASK = 15,
151 _LSM303D_CTRL1_AODR_SHIFT = 4,
152 } LSM303D_CTRL1_BITS_T;
158 LSM303D_AODR_POWER_DOWN = 0,
159 LSM303D_AODR_3_125HZ = 1,
160 LSM303D_AODR_6_25HZ = 2,
161 LSM303D_AODR_12_5HZ = 3,
162 LSM303D_AODR_25HZ = 4,
163 LSM303D_AODR_50HZ = 5,
164 LSM303D_AODR_100HZ = 6,
165 LSM303D_AODR_200HZ = 7,
166 LSM303D_AODR_400HZ = 8,
167 LSM303D_AODR_800HZ = 9,
168 LSM303D_AODR_1600HZ = 10,
175 LSM303D_CTRL2_SIM = 0x01,
176 LSM303D_CTRL2_AST = 0x02,
180 LSM303D_CTRL2_AFS0 = 0x08,
181 LSM303D_CTRL2_AFS1 = 0x10,
182 LSM303D_CTRL2_AFS2 = 0x20,
183 _LSM303D_CTRL2_AFS_MASK = 7,
184 _LSM303D_CTRL2_AFS_SHIFT = 3,
186 LSM303D_CTRL2_ABW0 = 0x40,
187 LSM303D_CTRL2_ABW1 = 0x80,
188 _LSM303D_CTRL2_ABW_MASK = 3,
189 _LSM303D_CTRL2_ABW_SHIFT = 6,
190 } LSM303D_CTRL2_BITS_T;
207 LSM303D_CTRL5_LIR1 = 0x01,
208 LSM303D_CTRL5_LIR2 = 0x02,
210 LSM303D_CTRL5_MODR0 = 0x04,
211 LSM303D_CTRL5_MODR1 = 0x08,
212 LSM303D_CTRL5_MODR2 = 0x10,
213 _LSM303D_CTRL5_MODR_MASK = 7,
214 _LSM303D_CTRL5_MODR_SHIFT = 2,
216 LSM303D_CTRL5_M_RES0 = 0x20,
217 LSM303D_CTRL5_M_RES1 = 0x40,
218 _LSM303D_CTRL5_MRES_MASK = 3,
219 _LSM303D_CTRL5_MRES_SHIFT = 6,
221 LSM303D_CTRL5_TEMP_EN = 0x80,
222 } LSM303D_CTRL5_BITS_T;
228 LSM303D_MODR_3_125HZ = 0,
229 LSM303D_MODR_6_25HZ = 1,
230 LSM303D_MODR_12_5HZ = 2,
231 LSM303D_MODR_25HZ = 3,
232 LSM303D_MODR_50HZ = 4,
233 LSM303D_MODR_100HZ = 5,
240 LSM303D_M_RES_LOW = 0,
241 LSM303D_M_RES_HIGH = 3,
250 LSM303D_CTRL6_MFS0 = 0x20,
251 LSM303D_CTRL6_MFS1 = 0x40,
252 _LSM303D_CTRL6_MFS_MASK = 3,
253 _LSM303D_CTRL6_MFS_SHIFT = 5,
256 } LSM303D_CTRL6_BITS_T;
272 LSM303D_CTRL7_MD0 = 0x01,
273 LSM303D_CTRL7_MD1 = 0x02,
274 _LSM303D_CTRL7_MD_MASK = 3,
275 _LSM303D_CTRL7_MD_SHIFT = 0,
277 LSM303D_CTRL7_MLP = 0x04,
281 LSM303D_CTRL7_T_ONLY = 0x10,
282 LSM303D_CTRL7_AFDS = 0x20,
284 LSM303D_CTRL7_AHPM0 = 0x40,
285 LSM303D_CTRL7_AHPM1 = 0x80,
286 _LSM303D_CTRL7_AHPM_MASK = 3,
287 _LSM303D_CTRL7_AHPM_SHIFT = 6,
288 } LSM303D_CTRL7_BITS_T;
294 LSM303D_MD_CONTINUOUS = 0,
295 LSM303D_MD_SINGLE = 1,
296 LSM303D_MD_POWER_DOWN = 3,