ChibiOS  21.6.0
lsm303dlhc.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2016..2019 Rocco Marco Guglielmi
3 
4  This file is part of ChibiOS.
5 
6  ChibiOS 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 3 of the License, or
9  (at your option) any later version.
10 
11  ChibiOS 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 this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 /**
22  * @file lsm303dlhc.h
23  * @brief LSM303DLHC MEMS interface module header.
24  *
25  * @addtogroup LSM303DLHC
26  * @ingroup EX_ST
27  * @{
28  */
29 #ifndef _LSM303DLHC_H_
30 #define _LSM303DLHC_H_
31 
32 #include "ex_accelerometer.h"
33 #include "ex_compass.h"
34 
35 /*===========================================================================*/
36 /* Driver constants. */
37 /*===========================================================================*/
38 
39 /**
40  * @name Version identification
41  * @{
42  */
43 /**
44  * @brief LSM303DLHC driver version string.
45  */
46 #define EX_LSM303DLHC_VERSION "1.1.2"
47 
48 /**
49  * @brief LSM303DLHC driver version major number.
50  */
51 #define EX_LSM303DLHC_MAJOR 1
52 
53 /**
54  * @brief LSM303DLHC driver version minor number.
55  */
56 #define EX_LSM303DLHC_MINOR 1
57 
58 /**
59  * @brief LSM303DLHC driver version patch number.
60  */
61 #define EX_LSM303DLHC_PATCH 2
62 /** @} */
63 
64 /**
65  * @brief LSM303DLHC accelerometer subsystem characteristics.
66  * @note Sensitivity is expressed as milli-G/LSB whereas
67  * 1 milli-G = 0.00980665 m/s^2.
68  * @note Bias is expressed as milli-G.
69  *
70  * @{
71  */
72 #define LSM303DLHC_ACC_NUMBER_OF_AXES 3U
73 
74 #define LSM303DLHC_ACC_2G 2.0f
75 #define LSM303DLHC_ACC_4G 4.0f
76 #define LSM303DLHC_ACC_8G 8.0f
77 #define LSM303DLHC_ACC_16G 16.0f
78 
79 #define LSM303DLHC_ACC_SENS_2G 0.0610f
80 #define LSM303DLHC_ACC_SENS_4G 0.1221f
81 #define LSM303DLHC_ACC_SENS_8G 0.2442f
82 #define LSM303DLHC_ACC_SENS_16G 0.4884f
83 
84 #define LSM303DLHC_ACC_BIAS 0.0f
85 /** @} */
86 
87 /**
88  * @brief LSM303DLHC compass subsystem characteristics.
89  * @note Sensitivity is expressed as G/LSB whereas G stands for Gauss.
90  * @note Bias is expressed as G.
91  *
92  * @{
93  */
94 #define LSM303DLHC_COMP_NUMBER_OF_AXES 3U
95 
96 #define LSM303DLHC_COMP_1P3GA 1.3f
97 #define LSM303DLHC_COMP_1P9GA 1.9f
98 #define LSM303DLHC_COMP_2P5GA 2.5f
99 #define LSM303DLHC_COMP_4P0GA 4.0f
100 #define LSM303DLHC_COMP_4P7GA 4.7f
101 #define LSM303DLHC_COMP_5P6GA 5.6f
102 #define LSM303DLHC_COMP_8P1GA 8.1f
103 
104 #define LSM303DLHC_COMP_SENS_XY_1P3GA 0.000909f
105 #define LSM303DLHC_COMP_SENS_XY_1P9GA 0.001169f
106 #define LSM303DLHC_COMP_SENS_XY_2P5GA 0.0014925f
107 #define LSM303DLHC_COMP_SENS_XY_4P0GA 0.0022222f
108 #define LSM303DLHC_COMP_SENS_XY_4P7GA 0.0025000f
109 #define LSM303DLHC_COMP_SENS_XY_5P6GA 0.0030303f
110 #define LSM303DLHC_COMP_SENS_XY_8P1GA 0.0043478f
111 
112 #define LSM303DLHC_COMP_SENS_Z_1P3GA 0.0010204f
113 #define LSM303DLHC_COMP_SENS_Z_1P9GA 0.0013071f
114 #define LSM303DLHC_COMP_SENS_Z_2P5GA 0.0016666f
115 #define LSM303DLHC_COMP_SENS_Z_4P0GA 0.0025000f
116 #define LSM303DLHC_COMP_SENS_Z_4P7GA 0.0028169f
117 #define LSM303DLHC_COMP_SENS_Z_5P6GA 0.0033898f
118 #define LSM303DLHC_COMP_SENS_Z_8P1GA 0.0048780f
119 
120 #define LSM303DLHC_COMP_BIAS 0.0f
121 /** @} */
122 
123 /**
124  * @name LSM303DLHC communication interfaces related bit masks
125  * @{
126  */
127 #define LSM303DLHC_DI_MASK 0xFF
128 #define LSM303DLHC_DI(n) (1 << n)
129 #define LSM303DLHC_AD_MASK 0x7F
130 #define LSM303DLHC_AD(n) (1 << n)
131 #define LSM303DLHC_MS (1 << 7)
132 /** @} */
133 
134 /**
135  * @name LSM303DLHC register addresses
136  * @{
137  */
138 #define LSM303DLHC_AD_ACC_CTRL_REG1 0x20
139 #define LSM303DLHC_AD_ACC_CTRL_REG2 0x21
140 #define LSM303DLHC_AD_ACC_CTRL_REG3 0x22
141 #define LSM303DLHC_AD_ACC_CTRL_REG4 0x23
142 #define LSM303DLHC_AD_ACC_CTRL_REG5 0x24
143 #define LSM303DLHC_AD_ACC_CTRL_REG6 0x25
144 #define LSM303DLHC_AD_ACC_REFERENCE 0x26
145 #define LSM303DLHC_AD_ACC_STATUS_REG 0x27
146 #define LSM303DLHC_AD_ACC_OUT_X_L 0x28
147 #define LSM303DLHC_AD_ACC_OUT_X_H 0x29
148 #define LSM303DLHC_AD_ACC_OUT_Y_L 0x2A
149 #define LSM303DLHC_AD_ACC_OUT_Y_H 0x2B
150 #define LSM303DLHC_AD_ACC_OUT_Z_L 0x2C
151 #define LSM303DLHC_AD_ACC_OUT_Z_H 0x2D
152 #define LSM303DLHC_AD_ACC_FIFO_CTRL_REG 0x2E
153 #define LSM303DLHC_AD_ACC_FIFO_SRC_REG 0x2F
154 #define LSM303DLHC_AD_ACC_INT1_CFG 0x30
155 #define LSM303DLHC_AD_ACC_INT1_SRC 0x31
156 #define LSM303DLHC_AD_ACC_INT1_THS 0x32
157 #define LSM303DLHC_AD_ACC_INT1_DURATION 0x33
158 #define LSM303DLHC_AD_ACC_INT2_CFG 0x34
159 #define LSM303DLHC_AD_ACC_INT2_SRC 0x35
160 #define LSM303DLHC_AD_ACC_INT2_THS 0x36
161 #define LSM303DLHC_AD_ACC_INT2_DURATION 0x37
162 #define LSM303DLHC_AD_ACC_CLICK_CFG 0x38
163 #define LSM303DLHC_AD_ACC_CLICK_SRC 0x39
164 #define LSM303DLHC_AD_ACC_CLICK_THS 0x3A
165 #define LSM303DLHC_AD_ACC_TIME_LIMIT 0x3B
166 #define LSM303DLHC_AD_ACC_TIME_LATENCY 0x3C
167 #define LSM303DLHC_AD_ACC_TIME_WINDOW 0x3D
168 #define LSM303DLHC_AD_COMP_CRA_REG 0x00
169 #define LSM303DLHC_AD_COMP_CRB_REG 0x01
170 #define LSM303DLHC_AD_COMP_MR_REG 0x02
171 #define LSM303DLHC_AD_COMP_OUT_X_H 0x03
172 #define LSM303DLHC_AD_COMP_OUT_X_L 0x04
173 #define LSM303DLHC_AD_COMP_OUT_Z_H 0x05
174 #define LSM303DLHC_AD_COMP_OUT_Z_L 0x06
175 #define LSM303DLHC_AD_COMP_OUT_Y_H 0x07
176 #define LSM303DLHC_AD_COMP_OUT_Y_L 0x08
177 #define LSM303DLHC_AD_COMP_SR_REG 0x09
178 #define LSM303DLHC_AD_COMP_IRA_REG 0x0A
179 #define LSM303DLHC_AD_COMP_IRB_REG 0x0B
180 #define LSM303DLHC_AD_COMP_IRC_REG 0x0C
181 #define LSM303DLHC_AD_COMP_TEMP_OUT_H 0x31
182 #define LSM303DLHC_AD_COMP_TEMP_OUT_L 0x32
183 /** @} */
184 
185 /**
186  * @name LSM303DLHC_CTRL_REG1_A register bits definitions
187  * @{
188  */
189 #define LSM303DLHC_CTRL_REG1_A_MASK 0xFF
190 #define LSM303DLHC_CTRL_REG1_A_XEN (1 << 0)
191 #define LSM303DLHC_CTRL_REG1_A_YEN (1 << 1)
192 #define LSM303DLHC_CTRL_REG1_A_ZEN (1 << 2)
193 #define LSM303DLHC_CTRL_REG1_A_LPEN (1 << 3)
194 #define LSM303DLHC_CTRL_REG1_A_ODR0 (1 << 4)
195 #define LSM303DLHC_CTRL_REG1_A_ODR1 (1 << 5)
196 #define LSM303DLHC_CTRL_REG1_A_ODR2 (1 << 6)
197 #define LSM303DLHC_CTRL_REG1_A_ODR3 (1 << 7)
198 /** @} */
199 
200 /**
201  * @name LSM303DLHC_CTRL_REG2_A register bits definitions
202  * @{
203  */
204 #define LSM303DLHC_CTRL_REG2_A_MASK 0xFF
205 #define LSM303DLHC_CTRL_REG2_A_HPIS1 (1 << 0)
206 #define LSM303DLHC_CTRL_REG2_A_HPIS2 (1 << 1)
207 #define LSM303DLHC_CTRL_REG2_A_HPCLICK (1 << 2)
208 #define LSM303DLHC_CTRL_REG2_A_FDS (1 << 3)
209 #define LSM303DLHC_CTRL_REG2_A_HPCF1 (1 << 4)
210 #define LSM303DLHC_CTRL_REG2_A_HPCF2 (1 << 5)
211 #define LSM303DLHC_CTRL_REG2_A_HPM0 (1 << 6)
212 #define LSM303DLHC_CTRL_REG2_A_HPM1 (1 << 7)
213 /** @} */
214 
215 /**
216  * @name LSM303DLHC_CTRL_REG3_A register bits definitions
217  * @{
218  */
219 #define LSM303DLHC_CTRL_REG3_A_MASK 0xFD
220 #define LSM303DLHC_CTRL_REG3_A_I1_OVERRUN (1 << 1)
221 #define LSM303DLHC_CTRL_REG3_A_I1_WTM (1 << 2)
222 #define LSM303DLHC_CTRL_REG3_A_I1_DRDY2 (1 << 3)
223 #define LSM303DLHC_CTRL_REG3_A_I1_DRDY1 (1 << 4)
224 #define LSM303DLHC_CTRL_REG3_A_I1_AOI2 (1 << 5)
225 #define LSM303DLHC_CTRL_REG3_A_I1_AOI1 (1 << 6)
226 #define LSM303DLHC_CTRL_REG3_A_I1_CLICK (1 << 7)
227 /** @} */
228 
229 /**
230  * @name LSM303DLHC_CTRL_REG4_A register bits definitions
231  * @{
232  */
233 #define LSM303DLHC_CTRL_REG4_A_MASK 0xF9
234 #define LSM303DLHC_CTRL_REG4_A_SIM (1 << 0)
235 #define LSM303DLHC_CTRL_REG4_A_HR (1 << 3)
236 #define LSM303DLHC_CTRL_REG4_A_FS_MASK 0x30
237 #define LSM303DLHC_CTRL_REG4_A_FS0 (1 << 4)
238 #define LSM303DLHC_CTRL_REG4_A_FS1 (1 << 5)
239 #define LSM303DLHC_CTRL_REG4_A_BLE (1 << 6)
240 #define LSM303DLHC_CTRL_REG4_A_BDU (1 << 7)
241 /** @} */
242 
243 /**
244  * @name LSM303DLHC_CTRL_REG5_A register bits definitions
245  * @{
246  */
247 #define LSM303DLHC_CTRL_REG5_A_MASK 0xCF
248 #define LSM303DLHC_CTRL_REG5_A_D4D_INT2 (1 << 0)
249 #define LSM303DLHC_CTRL_REG5_A_LIR_INT2 (1 << 1)
250 #define LSM303DLHC_CTRL_REG5_A_D4D_INT1 (1 << 2)
251 #define LSM303DLHC_CTRL_REG5_A_LIR_INT1 (1 << 3)
252 #define LSM303DLHC_CTRL_REG5_A_FIFO_EN (1 << 6)
253 #define LSM303DLHC_CTRL_REG5_A_BOOT (1 << 7)
254 /** @} */
255 
256 /**
257  * @name LSM303DLHC_CTRL_REG6_A register bits definitions
258  * @{
259  */
260 #define LSM303DLHC_CTRL_REG6_A_MASK 0xFA
261 #define LSM303DLHC_CTRL_REG6_A_H_LACTIVE (1 << 1)
262 #define LSM303DLHC_CTRL_REG6_A_P2_ACT (1 << 3)
263 #define LSM303DLHC_CTRL_REG6_A_BOOT_I1 (1 << 4)
264 #define LSM303DLHC_CTRL_REG6_A_I2_INT2 (1 << 5)
265 #define LSM303DLHC_CTRL_REG6_A_I2_INT1 (1 << 6)
266 #define LSM303DLHC_CTRL_REG6_A_I2_CLICKEN (1 << 7)
267 /** @} */
268 
269 /**
270  * @name LSM303DLHC_CRA_REG_M register bits definitions
271  * @{
272  */
273 #define LSM303DLHC_CRA_REG_M_MASK 0x9C
274 #define LSM303DLHC_CRA_REG_M_DO0 (1 << 2)
275 #define LSM303DLHC_CRA_REG_M_DO1 (1 << 3)
276 #define LSM303DLHC_CRA_REG_M_DO2 (1 << 4)
277 #define LSM303DLHC_CRA_REG_M_TEMP_EN (1 << 7)
278 /** @} */
279 
280 /**
281  * @name LSM303DLHC_CRB_REG_M register bits definitions
282  * @{
283  */
284 #define LSM303DLHC_CRB_REG_M_MASK 0xE0
285 #define LSM303DLHC_CRB_REG_M_GN_MASK 0xE0
286 #define LSM303DLHC_CRB_REG_M_GN0 (1 << 5)
287 #define LSM303DLHC_CRB_REG_M_GN1 (1 << 6)
288 #define LSM303DLHC_CRB_REG_M_GN2 (1 << 7)
289 /** @} */
290 
291 /**
292  * @name LSM303DLHC_CRB_REG_M register bits definitions
293  * @{
294  */
295 #define LSM303DLHC_MR_REG_M_MASK 0x03
296 #define LSM303DLHC_MR_REG_M_MD0 (1 << 0)
297 #define LSM303DLHC_MR_REG_M_MD1 (1 << 1)
298 /** @} */
299 
300 /*===========================================================================*/
301 /* Driver pre-compile time settings. */
302 /*===========================================================================*/
303 
304 /**
305  * @name Configuration options
306  * @{
307  */
308 /**
309  * @brief LSM303DLHC SPI interface switch.
310  * @details If set to @p TRUE the support for SPI is included.
311  * @note The default is @p FALSE.
312  */
313 #if !defined(LSM303DLHC_USE_SPI) || defined(__DOXYGEN__)
314 #define LSM303DLHC_USE_SPI FALSE
315 #endif
316 
317 /**
318  * @brief LSM303DLHC shared SPI switch.
319  * @details If set to @p TRUE the device acquires SPI bus ownership
320  * on each transaction.
321  * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
322  */
323 #if !defined(LSM303DLHC_SHARED_SPI) || defined(__DOXYGEN__)
324 #define LSM303DLHC_SHARED_SPI FALSE
325 #endif
326 
327 /**
328  * @brief LSM303DLHC I2C interface switch.
329  * @details If set to @p TRUE the support for I2C is included.
330  * @note The default is @p TRUE.
331  */
332 #if !defined(LSM303DLHC_USE_I2C) || defined(__DOXYGEN__)
333 #define LSM303DLHC_USE_I2C TRUE
334 #endif
335 
336 /**
337  * @brief LSM303DLHC shared I2C switch.
338  * @details If set to @p TRUE the device acquires I2C bus ownership
339  * on each transaction.
340  * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
341  */
342 #if !defined(LSM303DLHC_SHARED_I2C) || defined(__DOXYGEN__)
343 #define LSM303DLHC_SHARED_I2C FALSE
344 #endif
345 
346 /**
347  * @brief LSM303DLHC advanced configurations switch.
348  * @details If set to @p TRUE more configurations are available.
349  * @note The default is @p FALSE.
350  */
351 #if !defined(LSM303DLHC_USE_ADVANCED) || defined(__DOXYGEN__)
352 #define LSM303DLHC_USE_ADVANCED FALSE
353 #endif
354 /** @} */
355 
356 /*===========================================================================*/
357 /* Derived constants and error checks. */
358 /*===========================================================================*/
359 
360 #if !(LSM303DLHC_USE_SPI ^ LSM303DLHC_USE_I2C)
361 #error "LSM303DLHC_USE_SPI and LSM303DLHC_USE_I2C cannot be both true or both false"
362 #endif
363 
364 #if LSM303DLHC_USE_SPI && !HAL_USE_SPI
365 #error "LSM303DLHC_USE_SPI requires HAL_USE_SPI"
366 #endif
367 
368 #if LSM303DLHC_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
369 #error "LSM303DLHC_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
370 #endif
371 
372 #if LSM303DLHC_USE_I2C && !HAL_USE_I2C
373 #error "LSM303DLHC_USE_I2C requires HAL_USE_I2C"
374 #endif
375 
376 #if LSM303DLHC_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
377 #error "LSM303DLHC_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
378 #endif
379 
380 /*
381  * CHTODO: Add support for LSM303DLHC over SPI.
382  */
383 #if LSM303DLHC_USE_SPI
384 #error "LSM303DLHC over SPI still not supported"
385 #endif
386 
387 /*===========================================================================*/
388 /* Driver data structures and types. */
389 /*===========================================================================*/
390 
391 /**
392  * @name LSM303DLHC accelerometer subsystem data structures and types.
393  * @{
394  */
395 /**
396  * @brief Structure representing a LSM303DLHC driver.
397  */
399 
400 /**
401  * @brief LSM303DLHC accelerometer subsystem full scale.
402  */
403 typedef enum {
404  LSM303DLHC_ACC_FS_2G = 0x00, /**< Full scale �2g. */
405  LSM303DLHC_ACC_FS_4G = 0x10, /**< Full scale �4g. */
406  LSM303DLHC_ACC_FS_8G = 0x20, /**< Full scale �8g. */
407  LSM303DLHC_ACC_FS_16G = 0x30 /**< Full scale �16g. */
409 
410 /**
411  * @brief LSM303DLHC accelerometer subsystem output data rate.
412  */
413 typedef enum {
414  LSM303DLHC_ACC_ODR_PD = 0x00, /**< Power down */
415  LSM303DLHC_ACC_ODR_1Hz = 0x10, /**< ODR 1 Hz */
416  LSM303DLHC_ACC_ODR_10Hz = 0x20, /**< ODR 10 Hz */
417  LSM303DLHC_ACC_ODR_25Hz = 0x30, /**< ODR 25 Hz */
418  LSM303DLHC_ACC_ODR_50Hz = 0x40, /**< ODR 50 Hz */
419  LSM303DLHC_ACC_ODR_100Hz = 0x50, /**< ODR 100 Hz */
420  LSM303DLHC_ACC_ODR_200Hz = 0x60, /**< ODR 200 Hz */
421  LSM303DLHC_ACC_ODR_400Hz = 0x70, /**< ODR 400 Hz */
422  LSM303DLHC_ACC_ODR_1620Hz = 0x80, /**< ODR 1620 Hz (LP only) */
423  LSM303DLHC_ACC_ODR_1344Hz = 0x90 /**< ODR 1344 Hz or 5376 Hz in LP */
425 
426 /**
427  * @brief LSM303DLHC accelerometer subsystem axes enabling.
428  */
429 typedef enum {
430  LSM303DLHC_ACC_AE_DISABLED = 0x00,/**< All axes disabled. */
431  LSM303DLHC_ACC_AE_X = 0x01, /**< Only X-axis enabled. */
432  LSM303DLHC_ACC_AE_Y = 0x02, /**< Only Y-axis enabled. */
433  LSM303DLHC_ACC_AE_XY = 0x03, /**< X and Y axes enabled. */
434  LSM303DLHC_ACC_AE_Z = 0x04, /**< Only Z-axis enabled. */
435  LSM303DLHC_ACC_AE_XZ = 0x05, /**< X and Z axes enabled. */
436  LSM303DLHC_ACC_AE_YZ = 0x06, /**< Y and Z axes enabled. */
437  LSM303DLHC_ACC_AE_XYZ = 0x07 /**< All axes enabled. */
439 
440 /**
441  * @brief LSM303DLHC accelerometer subsystem low power mode.
442  */
443 typedef enum {
444  LSM303DLHC_ACC_LP_DISABLED = 0x00,/**< Low power mode disabled. */
445  LSM303DLHC_ACC_LP_ENABLED = 0x40 /**< Low power mode enabled. */
447 
448 /**
449  * @brief LSM303DLHC accelerometer subsystem high resolution mode.
450  */
451 typedef enum {
452  LSM303DLHC_ACC_HR_DISABLED = 0x00,/**< High resolution mode disabled. */
453  LSM303DLHC_ACC_HR_ENABLED = 0x08 /**< High resolution mode enabled. */
455 
456 /**
457  * @brief LSM303DLHC accelerometer subsystem block data update.
458  */
459 typedef enum {
460  LSM303DLHC_ACC_BDU_CONT = 0x00, /**< Continuous update */
461  LSM303DLHC_ACC_BDU_BLOCK = 0x80 /**< Update blocked */
463 
464 /**
465  * @brief LSM303DLHC accelerometer endianness.
466  */
467 typedef enum {
468  LSM303DLHC_ACC_END_LITTLE = 0x00, /**< Little Endian */
469  LSM303DLHC_ACC_END_BIG = 0x40 /**< Big Endian */
471 /** @} */
472 
473 /**
474  * @name LSM303DLHC compass subsystem data structures and types.
475  * @{
476  */
477 /**
478  * @brief LSM303DLHC compass subsystem full scale.
479  */
480 typedef enum {
481  LSM303DLHC_COMP_FS_1P3GA = 0x20, /**< Full scale �1.3 Gauss */
482  LSM303DLHC_COMP_FS_1P9GA = 0x40, /**< Full scale �1.9 Gauss */
483  LSM303DLHC_COMP_FS_2P5GA = 0x60, /**< Full scale �2.5 Gauss */
484  LSM303DLHC_COMP_FS_4P0GA = 0x80, /**< Full scale �4.0 Gauss */
485  LSM303DLHC_COMP_FS_4P7GA = 0xA0, /**< Full scale �4.7 Gauss */
486  LSM303DLHC_COMP_FS_5P6GA = 0xC0, /**< Full scale �5.6 Gauss */
487  LSM303DLHC_COMP_FS_8P1GA = 0xE0 /**< Full scale �8.1 Gauss */
489 
490 /**
491  * @brief LSM303DLHC compass subsystem output data rate.
492  */
493 typedef enum {
494  LSM303DLHC_COMP_ODR_0P75HZ = 0x00,/**< ODR 0.75 Hz */
495  LSM303DLHC_COMP_ODR_1P5HZ = 0x04, /**< ODR 1.5 Hz */
496  LSM303DLHC_COMP_ODR_3P0HZ = 0x08, /**< ODR 3 Hz */
497  LSM303DLHC_COMP_ODR_7P5HZ = 0x0C, /**< ODR 7.5 Hz */
498  LSM303DLHC_COMP_ODR_15HZ = 0x10, /**< ODR 15 Hz */
499  LSM303DLHC_COMP_ODR_30HZ = 0x14, /**< ODR 30 Hz */
500  LSM303DLHC_COMP_ODR_75HZ = 0x18, /**< ODR 75 Hz */
501  LSM303DLHC_COMP_ODR_220HZ = 0x1C /**< ODR 220 Hz */
503 
504 /**
505  * @brief LSM303DLHC compass subsystem working mode.
506  */
507 typedef enum {
508  LSM303DLHC_COMP_MD_CONT = 0x00, /**< Continuous-Conversion Mode */
509  LSM303DLHC_COMP_MD_BLOCK = 0x01, /**< Single-Conversion Mode */
510  LSM303DLHC_COMP_MD_SLEEP = 0x02 /**< Sleep Mode */
512 /** @} */
513 
514 /**
515  * @name LSM303DLHC main system data structures and types.
516  * @{
517  */
518 /**
519  * @brief Driver state machine possible states.
520  */
521 typedef enum {
522  LSM303DLHC_UNINIT = 0, /**< Not initialized. */
523  LSM303DLHC_STOP = 1, /**< Stopped. */
524  LSM303DLHC_READY = 2, /**< Ready. */
526 
527 /**
528  * @brief LSM303DLHC configuration structure.
529  */
530 typedef struct {
531  /**
532  * @brief I2C driver associated to this LSM303DLHC.
533  */
535  /**
536  * @brief I2C configuration associated to this LSM303DLHC.
537  */
539  /**
540  * @brief LSM303DLHC accelerometer subsystem initial sensitivity.
541  */
543  /**
544  * @brief LSM303DLHC accelerometer subsystem initial bias.
545  */
546  float *accbias;
547  /**
548  * @brief LSM303DLHC accelerometer subsystem initial full scale.
549  */
551  /**
552  * @brief LSM303DLHC accelerometer subsystem output data rate.
553  */
555 #if LSM303DLHC_USE_ADVANCED || defined(__DOXYGEN__)
556  /**
557  * @brief LSM303DLHC accelerometer subsystem low power mode.
558  */
560  /**
561  * @brief LSM303DLHC accelerometer subsystem high resolution mode.
562  */
564  /**
565  * @brief LSM303DLHC accelerometer subsystem block data update.
566  */
568  /**
569  * @brief LSM303DLHC accelerometer endianness.
570  */
572 #endif
573  /**
574  * @brief LSM303DLHC compass initial sensitivity.
575  */
577  /**
578  * @brief LSM303DLHC compass initial bias.
579  */
580  float *compbias;
581  /**
582  * @brief LSM303DLHC compass subsystem initial full scale.
583  */
585  /**
586  * @brief LSM303DLHC compass subsystem output data rate.
587  */
589 #if LSM303DLHC_USE_ADVANCED || defined(__DOXYGEN__)
590  /**
591  * @brief LSM303DLHC compass subsystem working mode.
592  */
594 #endif
596 
597 /**
598  * @brief @p LSM303DLHC specific methods.
599  */
600 #define _lsm303dlhc_methods_alone \
601  /* Change full scale value of LSM303DLHC accelerometer subsystem.*/ \
602  msg_t (*acc_set_full_scale)(LSM303DLHCDriver *devp, \
603  lsm303dlhc_acc_fs_t fs); \
604  /* Change full scale value of LSM303DLHC compass subsystem.*/ \
605  msg_t (*comp_set_full_scale)(LSM303DLHCDriver *devp, \
606  lsm303dlhc_comp_fs_t fs); \
607 
608 /**
609  * @brief @p LSM303DLHC specific methods with inherited ones.
610  */
611 #define _lsm303dlhc_methods \
612  _base_object_methods \
613  _lsm303dlhc_methods_alone
614 
615 /**
616  * @extends BaseObjectVMT
617  *
618  * @brief @p LSM303DLHC virtual methods table.
619  */
622 };
623 
624 /**
625  * @brief @p LSM303DLHCDriver specific data.
626  */
627 #define _lsm303dlhc_data \
628  _base_sensor_data \
629  /* Driver state.*/ \
630  lsm303dlhc_state_t state; \
631  /* Current configuration data.*/ \
632  const LSM303DLHCConfig *config; \
633  /* Accelerometer subsystem axes number.*/ \
634  size_t accaxes; \
635  /* Accelerometer subsystem current sensitivity.*/ \
636  float accsensitivity[LSM303DLHC_ACC_NUMBER_OF_AXES]; \
637  /* Accelerometer subsystem current bias .*/ \
638  float accbias[LSM303DLHC_ACC_NUMBER_OF_AXES]; \
639  /* Accelerometer subsystem current full scale value.*/ \
640  float accfullscale; \
641  /* Compass subsystem axes number.*/ \
642  size_t compaxes; \
643  /* Compass subsystem current sensitivity.*/ \
644  float compsensitivity[LSM303DLHC_COMP_NUMBER_OF_AXES];\
645  /* Compass subsystem current bias.*/ \
646  float compbias[LSM303DLHC_COMP_NUMBER_OF_AXES]; \
647  /* Compass subsystem current full scale value.*/ \
648  float compfullscale;
649 
650 /**
651  * @brief LSM303DLHC 6-axis accelerometer/compass class.
652  */
654  /** @brief Virtual Methods Table.*/
655  const struct LSM303DLHCVMT *vmt;
656  /** @brief Base accelerometer interface.*/
658  /** @brief Base compass interface.*/
661 };
662 /** @} */
663 
664 /*===========================================================================*/
665 /* Driver macros. */
666 /*===========================================================================*/
667 
668 /**
669  * @brief Return the number of axes of the BaseAccelerometer.
670  *
671  * @param[in] devp pointer to @p LSM303DLHCDriver.
672  *
673  * @return the number of axes.
674  *
675  * @api
676  */
677 #define lsm303dlhcAccelerometerGetAxesNumber(devp) \
678  accelerometerGetAxesNumber(&((devp)->acc_if))
679 
680 /**
681  * @brief Retrieves raw data from the BaseAccelerometer.
682  * @note This data is retrieved from MEMS register without any algebraical
683  * manipulation.
684  * @note The axes array must be at least the same size of the
685  * BaseAccelerometer axes number.
686  *
687  * @param[in] devp pointer to @p LSM303DLHCDriver.
688  * @param[out] axes a buffer which would be filled with raw data.
689  *
690  * @return The operation status.
691  * @retval MSG_OK if the function succeeded.
692  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
693  * be retrieved using @p i2cGetErrors().
694  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
695  *
696  * @api
697  */
698 #define lsm303dlhcAccelerometerReadRaw(devp, axes) \
699  accelerometerReadRaw(&((devp)->acc_if), axes)
700 
701 /**
702  * @brief Retrieves cooked data from the BaseAccelerometer.
703  * @note This data is manipulated according to the formula
704  * cooked = (raw * sensitivity) - bias.
705  * @note Final data is expressed as milli-G.
706  * @note The axes array must be at least the same size of the
707  * BaseAccelerometer axes number.
708  *
709  * @param[in] devp pointer to @p LSM303DLHCDriver.
710  * @param[out] axes a buffer which would be filled with cooked data.
711  *
712  * @return The operation status.
713  * @retval MSG_OK if the function succeeded.
714  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
715  * be retrieved using @p i2cGetErrors().
716  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
717  *
718  * @api
719  */
720 #define lsm303dlhcAccelerometerReadCooked(devp, axes) \
721  accelerometerReadCooked(&((devp)->acc_if), axes)
722 
723 /**
724  * @brief Set bias values for the BaseAccelerometer.
725  * @note Bias must be expressed as milli-G.
726  * @note The bias buffer must be at least the same size of the
727  * BaseAccelerometer axes number.
728  *
729  * @param[in] devp pointer to @p LSM303DLHCDriver.
730  * @param[in] bp a buffer which contains biases.
731  *
732  * @return The operation status.
733  * @retval MSG_OK if the function succeeded.
734  *
735  * @api
736  */
737 #define lsm303dlhcAccelerometerSetBias(devp, bp) \
738  accelerometerSetBias(&((devp)->acc_if), bp)
739 
740 /**
741  * @brief Reset bias values for the BaseAccelerometer.
742  * @note Default biases value are obtained from device datasheet when
743  * available otherwise they are considered zero.
744  *
745  * @param[in] devp pointer to @p LSM303DLHCDriver.
746  *
747  * @return The operation status.
748  * @retval MSG_OK if the function succeeded.
749  *
750  * @api
751  */
752 #define lsm303dlhcAccelerometerResetBias(devp) \
753  accelerometerResetBias(&((devp)->acc_if))
754 
755 /**
756  * @brief Set sensitivity values for the BaseAccelerometer.
757  * @note Sensitivity must be expressed as milli-G/LSB.
758  * @note The sensitivity buffer must be at least the same size of the
759  * BaseAccelerometer axes number.
760  *
761  * @param[in] devp pointer to @p LSM303DLHCDriver.
762  * @param[in] sp a buffer which contains sensitivities.
763  *
764  * @return The operation status.
765  * @retval MSG_OK if the function succeeded.
766  *
767  * @api
768  */
769 #define lsm303dlhcAccelerometerSetSensitivity(devp, sp) \
770  accelerometerSetSensitivity(&((devp)->acc_if), sp)
771 
772 /**
773  * @brief Reset sensitivity values for the BaseAccelerometer.
774  * @note Default sensitivities value are obtained from device datasheet.
775  *
776  * @param[in] devp pointer to @p LSM303DLHCDriver.
777  *
778  * @return The operation status.
779  * @retval MSG_OK if the function succeeded.
780  * @retval MSG_RESET otherwise.
781  *
782  * @api
783  */
784 #define lsm303dlhcAccelerometerResetSensitivity(devp) \
785  accelerometerResetSensitivity(&((devp)->acc_if))
786 
787 /**
788  * @brief Changes the LSM303DLHCDriver accelerometer fullscale value.
789  * @note This function also rescale sensitivities and biases based on
790  * previous and next fullscale value.
791  * @note A recalibration is highly suggested after calling this function.
792  *
793  * @param[in] devp pointer to @p LSM303DLHCDriver.
794  * @param[in] fs new fullscale value.
795  *
796  * @return The operation status.
797  * @retval MSG_OK if the function succeeded.
798  * @retval MSG_RESET otherwise.
799  *
800  * @api
801  */
802 #define lsm303dlhcAccelerometerSetFullScale(devp, fs) \
803  (devp)->vmt->acc_set_full_scale(devp, fs)
804 
805 /**
806  * @brief Return the number of axes of the BaseCompass.
807  *
808  * @param[in] devp pointer to @p LSM303DLHCDriver.
809  *
810  * @return the number of axes.
811  *
812  * @api
813  */
814 #define lsm303dlhcCompassGetAxesNumber(devp) \
815  compassGetAxesNumber(&((devp)->comp_if))
816 
817 /**
818  * @brief Retrieves raw data from the BaseCompass.
819  * @note This data is retrieved from MEMS register without any algebraical
820  * manipulation.
821  * @note The axes array must be at least the same size of the
822  * BaseCompass axes number.
823  *
824  * @param[in] devp pointer to @p BaseCompass interface.
825  * @param[out] axes a buffer which would be filled with raw data.
826  *
827  * @return The operation status.
828  * @retval MSG_OK if the function succeeded.
829  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
830  * be retrieved using @p i2cGetErrors().
831  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
832  *
833  * @api
834  */
835 #define lsm303dlhcCompassReadRaw(devp, axes) \
836  compassReadRaw(&((devp)->comp_if), axes)
837 
838 /**
839  * @brief Retrieves cooked data from the BaseCompass.
840  * @note This data is manipulated according to the formula
841  * cooked = (raw * sensitivity) - bias.
842  * @note Final data is expressed as G.
843  * @note The axes array must be at least the same size of the
844  * BaseCompass axes number.
845  *
846  * @param[in] devp pointer to @p BaseCompass interface.
847  * @param[out] axes a buffer which would be filled with cooked data.
848  *
849  * @return The operation status.
850  * @retval MSG_OK if the function succeeded.
851  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
852  * be retrieved using @p i2cGetErrors().
853  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
854  *
855  * @api
856  */
857 #define lsm303dlhcCompassReadCooked(devp, axes) \
858  compassReadCooked(&((devp)->comp_if), axes)
859 
860 /**
861  * @brief Set bias values for the BaseCompass.
862  * @note Bias must be expressed as G.
863  * @note The bias buffer must be at least the same size of the
864  * BaseCompass axes number.
865  *
866  * @param[in] devp pointer to @p BaseCompass interface.
867  * @param[in] bp a buffer which contains biases.
868  *
869  * @return The operation status.
870  * @retval MSG_OK if the function succeeded.
871  *
872  * @api
873  */
874 #define lsm303dlhcCompassSetBias(devp, bp) \
875  compassSetBias(&((devp)->comp_if), bp)
876 
877 /**
878  * @brief Reset bias values for the BaseCompass.
879  * @note Default biases value are obtained from device datasheet when
880  * available otherwise they are considered zero.
881  *
882  * @param[in] devp pointer to @p LSM303DLHCDriver.
883  *
884  * @return The operation status.
885  * @retval MSG_OK if the function succeeded.
886  *
887  * @api
888  */
889 #define lsm303dlhcCompassResetBias(devp) \
890  compassResetBias(&((devp)->comp_if))
891 
892 /**
893  * @brief Set sensitivity values for the BaseCompass.
894  * @note Sensitivity must be expressed as G/LSB.
895  * @note The sensitivity buffer must be at least the same size of the
896  * BaseCompass axes number.
897  *
898  * @param[in] devp pointer to @p LSM303DLHCDriver.
899  * @param[in] sp a buffer which contains sensitivities.
900  *
901  * @return The operation status.
902  * @retval MSG_OK if the function succeeded.
903  *
904  * @api
905  */
906 #define lsm303dlhcCompassSetSensitivity(devp, sp) \
907  compassSetSensitivity(&((devp)->comp_if), sp)
908 
909 /**
910  * @brief Reset sensitivity values for the BaseCompass.
911  * @note Default sensitivities value are obtained from device datasheet.
912  *
913  * @param[in] devp pointer to @p LSM303DLHCDriver.
914  *
915  * @return The operation status.
916  * @retval MSG_OK if the function succeeded.
917  * @retval MSG_RESET otherwise.
918  *
919  * @api
920  */
921 #define lsm303dlhcCompassResetSensitivity(devp) \
922  compassResetSensitivity(&((devp)->comp_if))
923 
924 /**
925  * @brief Changes the LSM303DLHCDriver compass fullscale value.
926  * @note This function also rescale sensitivities and biases based on
927  * previous and next fullscale value.
928  * @note A recalibration is highly suggested after calling this function.
929  *
930  * @param[in] devp pointer to @p LSM303DLHCDriver.
931  * @param[in] fs new fullscale value.
932  *
933  * @return The operation status.
934  * @retval MSG_OK if the function succeeded.
935  * @retval MSG_RESET otherwise.
936  *
937  * @api
938  */
939 #define lsm303dlhcCompassSetFullScale(devp, fs) \
940  (devp)->vmt->comp_set_full_scale(devp, fs)
941 
942 /*===========================================================================*/
943 /* External declarations. */
944 /*===========================================================================*/
945 
946 #ifdef __cplusplus
947 extern "C" {
948 #endif
950  void lsm303dlhcStart(LSM303DLHCDriver *devp, const LSM303DLHCConfig *config);
951  void lsm303dlhcStop(LSM303DLHCDriver *devp);
952 #ifdef __cplusplus
953 }
954 #endif
955 
956 #endif /* _LSM303DLHC_H_ */
957 
958 /** @} */
LSM303DLHC_ACC_END_BIG
@ LSM303DLHC_ACC_END_BIG
Definition: lsm303dlhc.h:469
I2CDriver
Structure representing an I2C driver.
Definition: hal_i2c_lld.h:88
_lsm303dlhc_data
#define _lsm303dlhc_data
LSM303DLHCDriver specific data.
Definition: lsm303dlhc.h:627
lsm303dlhc_acc_ae_t
lsm303dlhc_acc_ae_t
LSM303DLHC accelerometer subsystem axes enabling.
Definition: lsm303dlhc.h:429
LSM303DLHC_COMP_ODR_220HZ
@ LSM303DLHC_COMP_ODR_220HZ
Definition: lsm303dlhc.h:501
LSM303DLHC_COMP_FS_4P0GA
@ LSM303DLHC_COMP_FS_4P0GA
Definition: lsm303dlhc.h:484
LSM303DLHC_ACC_FS_8G
@ LSM303DLHC_ACC_FS_8G
Definition: lsm303dlhc.h:406
LSM303DLHCConfig::i2cp
I2CDriver * i2cp
I2C driver associated to this LSM303DLHC.
Definition: lsm303dlhc.h:534
LSM303DLHCConfig::compsensitivity
float * compsensitivity
LSM303DLHC compass initial sensitivity.
Definition: lsm303dlhc.h:576
lsm303dlhc_acc_lp_t
lsm303dlhc_acc_lp_t
LSM303DLHC accelerometer subsystem low power mode.
Definition: lsm303dlhc.h:443
LSM303DLHCDriver::comp_if
BaseCompass comp_if
Base compass interface.
Definition: lsm303dlhc.h:659
LSM303DLHCConfig::compbias
float * compbias
LSM303DLHC compass initial bias.
Definition: lsm303dlhc.h:580
lsm303dlhc_comp_fs_t
lsm303dlhc_comp_fs_t
LSM303DLHC compass subsystem full scale.
Definition: lsm303dlhc.h:480
LSM303DLHC_ACC_FS_2G
@ LSM303DLHC_ACC_FS_2G
Definition: lsm303dlhc.h:404
LSM303DLHC_ACC_ODR_100Hz
@ LSM303DLHC_ACC_ODR_100Hz
Definition: lsm303dlhc.h:419
LSM303DLHCConfig::accfullscale
lsm303dlhc_acc_fs_t accfullscale
LSM303DLHC accelerometer subsystem initial full scale.
Definition: lsm303dlhc.h:550
LSM303DLHCConfig::acclowpower
lsm303dlhc_acc_lp_t acclowpower
LSM303DLHC accelerometer subsystem low power mode.
Definition: lsm303dlhc.h:559
LSM303DLHC_ACC_ODR_1620Hz
@ LSM303DLHC_ACC_ODR_1620Hz
Definition: lsm303dlhc.h:422
LSM303DLHC_ACC_LP_DISABLED
@ LSM303DLHC_ACC_LP_DISABLED
Definition: lsm303dlhc.h:444
LSM303DLHC_ACC_BDU_CONT
@ LSM303DLHC_ACC_BDU_CONT
Definition: lsm303dlhc.h:460
LSM303DLHC_ACC_AE_X
@ LSM303DLHC_ACC_AE_X
Definition: lsm303dlhc.h:431
LSM303DLHC_COMP_FS_2P5GA
@ LSM303DLHC_COMP_FS_2P5GA
Definition: lsm303dlhc.h:483
LSM303DLHC_ACC_AE_XZ
@ LSM303DLHC_ACC_AE_XZ
Definition: lsm303dlhc.h:435
LSM303DLHC_ACC_BDU_BLOCK
@ LSM303DLHC_ACC_BDU_BLOCK
Definition: lsm303dlhc.h:461
LSM303DLHC_COMP_ODR_1P5HZ
@ LSM303DLHC_COMP_ODR_1P5HZ
Definition: lsm303dlhc.h:495
LSM303DLHC_COMP_ODR_30HZ
@ LSM303DLHC_COMP_ODR_30HZ
Definition: lsm303dlhc.h:499
LSM303DLHC_COMP_MD_SLEEP
@ LSM303DLHC_COMP_MD_SLEEP
Definition: lsm303dlhc.h:510
LSM303DLHC_COMP_FS_8P1GA
@ LSM303DLHC_COMP_FS_8P1GA
Definition: lsm303dlhc.h:487
LSM303DLHC_COMP_ODR_7P5HZ
@ LSM303DLHC_COMP_ODR_7P5HZ
Definition: lsm303dlhc.h:497
BaseCompass
Base compass class.
Definition: ex_compass.h:86
lsm303dlhc_acc_bdu_t
lsm303dlhc_acc_bdu_t
LSM303DLHC accelerometer subsystem block data update.
Definition: lsm303dlhc.h:459
LSM303DLHC_COMP_FS_5P6GA
@ LSM303DLHC_COMP_FS_5P6GA
Definition: lsm303dlhc.h:486
BaseAccelerometer
Base accelerometer class.
Definition: ex_accelerometer.h:85
lsm303dlhc_state_t
lsm303dlhc_state_t
Driver state machine possible states.
Definition: lsm303dlhc.h:521
LSM303DLHC_ACC_ODR_200Hz
@ LSM303DLHC_ACC_ODR_200Hz
Definition: lsm303dlhc.h:420
LSM303DLHC_COMP_FS_1P3GA
@ LSM303DLHC_COMP_FS_1P3GA
Definition: lsm303dlhc.h:481
LSM303DLHC_ACC_END_LITTLE
@ LSM303DLHC_ACC_END_LITTLE
Definition: lsm303dlhc.h:468
ex_accelerometer.h
Generic accelerometer interface header.
LSM303DLHC_ACC_AE_XY
@ LSM303DLHC_ACC_AE_XY
Definition: lsm303dlhc.h:433
lsm303dlhc_comp_odr_t
lsm303dlhc_comp_odr_t
LSM303DLHC compass subsystem output data rate.
Definition: lsm303dlhc.h:493
_lsm303dlhc_methods
#define _lsm303dlhc_methods
LSM303DLHC specific methods with inherited ones.
Definition: lsm303dlhc.h:611
LSM303DLHC_COMP_MD_BLOCK
@ LSM303DLHC_COMP_MD_BLOCK
Definition: lsm303dlhc.h:509
LSM303DLHCConfig
LSM303DLHC configuration structure.
Definition: lsm303dlhc.h:530
LSM303DLHC_ACC_AE_Y
@ LSM303DLHC_ACC_AE_Y
Definition: lsm303dlhc.h:432
LSM303DLHC_COMP_FS_1P9GA
@ LSM303DLHC_COMP_FS_1P9GA
Definition: lsm303dlhc.h:482
LSM303DLHCConfig::accendianess
lsm303dlhc_acc_end_t accendianess
LSM303DLHC accelerometer endianness.
Definition: lsm303dlhc.h:571
lsm303dlhcStop
void lsm303dlhcStop(LSM303DLHCDriver *devp)
Deactivates the LSM303DLHC Complex Driver peripheral.
Definition: lsm303dlhc.c:1142
lsm303dlhc_comp_md_t
lsm303dlhc_comp_md_t
LSM303DLHC compass subsystem working mode.
Definition: lsm303dlhc.h:507
LSM303DLHC_ACC_ODR_1344Hz
@ LSM303DLHC_ACC_ODR_1344Hz
Definition: lsm303dlhc.h:423
LSM303DLHC_COMP_FS_4P7GA
@ LSM303DLHC_COMP_FS_4P7GA
Definition: lsm303dlhc.h:485
LSM303DLHC_ACC_LP_ENABLED
@ LSM303DLHC_ACC_LP_ENABLED
Definition: lsm303dlhc.h:445
LSM303DLHC_READY
@ LSM303DLHC_READY
Definition: lsm303dlhc.h:524
LSM303DLHCConfig::accbias
float * accbias
LSM303DLHC accelerometer subsystem initial bias.
Definition: lsm303dlhc.h:546
LSM303DLHC_ACC_ODR_50Hz
@ LSM303DLHC_ACC_ODR_50Hz
Definition: lsm303dlhc.h:418
LSM303DLHCConfig::i2ccfg
const I2CConfig * i2ccfg
I2C configuration associated to this LSM303DLHC.
Definition: lsm303dlhc.h:538
LSM303DLHCDriver
LSM303DLHC 6-axis accelerometer/compass class.
Definition: lsm303dlhc.h:653
LSM303DLHCConfig::accoutdatarate
lsm303dlhc_acc_odr_t accoutdatarate
LSM303DLHC accelerometer subsystem output data rate.
Definition: lsm303dlhc.h:554
LSM303DLHC_ACC_ODR_PD
@ LSM303DLHC_ACC_ODR_PD
Definition: lsm303dlhc.h:414
LSM303DLHC_ACC_HR_ENABLED
@ LSM303DLHC_ACC_HR_ENABLED
Definition: lsm303dlhc.h:453
LSM303DLHCConfig::compoutputdatarate
lsm303dlhc_comp_odr_t compoutputdatarate
LSM303DLHC compass subsystem output data rate.
Definition: lsm303dlhc.h:588
LSM303DLHC_ACC_AE_XYZ
@ LSM303DLHC_ACC_AE_XYZ
Definition: lsm303dlhc.h:437
LSM303DLHCConfig::compfullscale
lsm303dlhc_comp_fs_t compfullscale
LSM303DLHC compass subsystem initial full scale.
Definition: lsm303dlhc.h:584
LSM303DLHC_COMP_ODR_0P75HZ
@ LSM303DLHC_COMP_ODR_0P75HZ
Definition: lsm303dlhc.h:494
LSM303DLHC_ACC_FS_4G
@ LSM303DLHC_ACC_FS_4G
Definition: lsm303dlhc.h:405
LSM303DLHC_COMP_ODR_3P0HZ
@ LSM303DLHC_COMP_ODR_3P0HZ
Definition: lsm303dlhc.h:496
lsm303dlhc_acc_hr_t
lsm303dlhc_acc_hr_t
LSM303DLHC accelerometer subsystem high resolution mode.
Definition: lsm303dlhc.h:451
lsm303dlhc_acc_fs_t
lsm303dlhc_acc_fs_t
LSM303DLHC accelerometer subsystem full scale.
Definition: lsm303dlhc.h:403
LSM303DLHCConfig::acchighresmode
lsm303dlhc_acc_hr_t acchighresmode
LSM303DLHC accelerometer subsystem high resolution mode.
Definition: lsm303dlhc.h:563
LSM303DLHC_ACC_ODR_10Hz
@ LSM303DLHC_ACC_ODR_10Hz
Definition: lsm303dlhc.h:416
ex_compass.h
Generic compass interface header.
LSM303DLHC_COMP_ODR_15HZ
@ LSM303DLHC_COMP_ODR_15HZ
Definition: lsm303dlhc.h:498
LSM303DLHC_ACC_HR_DISABLED
@ LSM303DLHC_ACC_HR_DISABLED
Definition: lsm303dlhc.h:452
LSM303DLHCConfig::accblockdataupdate
lsm303dlhc_acc_bdu_t accblockdataupdate
LSM303DLHC accelerometer subsystem block data update.
Definition: lsm303dlhc.h:567
LSM303DLHCConfig::compmode
lsm303dlhc_comp_md_t compmode
LSM303DLHC compass subsystem working mode.
Definition: lsm303dlhc.h:593
LSM303DLHC_STOP
@ LSM303DLHC_STOP
Definition: lsm303dlhc.h:523
LSM303DLHC_ACC_AE_YZ
@ LSM303DLHC_ACC_AE_YZ
Definition: lsm303dlhc.h:436
LSM303DLHCDriver::vmt
const struct LSM303DLHCVMT * vmt
Virtual Methods Table.
Definition: lsm303dlhc.h:655
LSM303DLHCVMT
LSM303DLHC virtual methods table.
Definition: lsm303dlhc.h:620
LSM303DLHC_COMP_ODR_75HZ
@ LSM303DLHC_COMP_ODR_75HZ
Definition: lsm303dlhc.h:500
LSM303DLHCDriver::acc_if
BaseAccelerometer acc_if
Base accelerometer interface.
Definition: lsm303dlhc.h:657
lsm303dlhcStart
void lsm303dlhcStart(LSM303DLHCDriver *devp, const LSM303DLHCConfig *config)
Configures and activates LSM303DLHC Complex Driver peripheral.
Definition: lsm303dlhc.c:868
LSM303DLHCConfig::accsensitivity
float * accsensitivity
LSM303DLHC accelerometer subsystem initial sensitivity.
Definition: lsm303dlhc.h:542
LSM303DLHC_ACC_AE_Z
@ LSM303DLHC_ACC_AE_Z
Definition: lsm303dlhc.h:434
LSM303DLHC_UNINIT
@ LSM303DLHC_UNINIT
Definition: lsm303dlhc.h:522
LSM303DLHC_ACC_ODR_400Hz
@ LSM303DLHC_ACC_ODR_400Hz
Definition: lsm303dlhc.h:421
lsm303dlhc_acc_end_t
lsm303dlhc_acc_end_t
LSM303DLHC accelerometer endianness.
Definition: lsm303dlhc.h:467
lsm303dlhc_acc_odr_t
lsm303dlhc_acc_odr_t
LSM303DLHC accelerometer subsystem output data rate.
Definition: lsm303dlhc.h:413
LSM303DLHC_ACC_ODR_1Hz
@ LSM303DLHC_ACC_ODR_1Hz
Definition: lsm303dlhc.h:415
LSM303DLHC_ACC_AE_DISABLED
@ LSM303DLHC_ACC_AE_DISABLED
Definition: lsm303dlhc.h:430
I2CConfig
Type of I2C driver configuration structure.
Definition: hal_i2c_lld.h:75
LSM303DLHC_COMP_MD_CONT
@ LSM303DLHC_COMP_MD_CONT
Definition: lsm303dlhc.h:508
LSM303DLHC_ACC_FS_16G
@ LSM303DLHC_ACC_FS_16G
Definition: lsm303dlhc.h:407
lsm303dlhcObjectInit
void lsm303dlhcObjectInit(LSM303DLHCDriver *devp)
Initializes an instance.
Definition: lsm303dlhc.c:847
LSM303DLHC_ACC_ODR_25Hz
@ LSM303DLHC_ACC_ODR_25Hz
Definition: lsm303dlhc.h:417