ChibiOS  0.0.0
lis3mdl.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2016..2018 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 lis3mdl.h
23  * @brief LIS3MDL MEMS interface module header.
24  *
25  * @addtogroup LIS3MDL
26  * @ingroup EX_ST
27  * @{
28  */
29 #ifndef _LIS3MDL_H_
30 #define _LIS3MDL_H_
31 
32 #include "hal_compass.h"
33 
34 /*===========================================================================*/
35 /* Driver constants. */
36 /*===========================================================================*/
37 
38 /**
39  * @name Version identification
40  * @{
41  */
42 /**
43  * @brief LIS3MDL driver version string.
44  */
45 #define EX_LIS3MDL_VERSION "1.1.1"
46 
47 /**
48  * @brief LIS3MDL driver version major number.
49  */
50 #define EX_LIS3MDL_MAJOR 1
51 
52 /**
53  * @brief LIS3MDL driver version minor number.
54  */
55 #define EX_LIS3MDL_MINOR 1
56 
57 /**
58  * @brief LIS3MDL driver version patch number.
59  */
60 #define EX_LIS3MDL_PATCH 1
61 /** @} */
62 
63 /**
64  * @brief LIS3MDL compass subsystem characteristics.
65  * @note Sensitivity is expressed as G/LSB whereas G stands for Gauss.
66  * @note Bias is expressed as G.
67  *
68  * @{
69  */
70 #define LIS3MDL_COMP_NUMBER_OF_AXES 3U
71 
72 #define LIS3MDL_COMP_4GA 4.0f
73 #define LIS3MDL_COMP_8GA 8.0f
74 #define LIS3MDL_COMP_12GA 12.0f
75 #define LIS3MDL_COMP_16GA 16.0f
76 
77 #define LIS3MDL_COMP_SENS_4GA 0.00014615f
78 #define LIS3MDL_COMP_SENS_8GA 0.00029231f
79 #define LIS3MDL_COMP_SENS_12GA 0.0004384f
80 #define LIS3MDL_COMP_SENS_16GA 0.00058445f
81 
82 #define LIS3MDL_COMP_BIAS 0.0f
83 /** @} */
84 
85 /**
86  * @name LIS3MDL communication interfaces related bit masks
87  * @{
88  */
89 #define LIS3MDL_DI_MASK 0xFF
90 #define LIS3MDL_DI(n) (1 << n)
91 #define LIS3MDL_AD_MASK 0x3F
92 #define LIS3MDL_AD(n) (1 << n)
93 #define LIS3MDL_MS (1 << 6)
94 #define LIS3MDL_RW (1 << 7)
95 
96 #define LIS3MDL_SUB_MS (1 << 7)
97 /** @} */
98 
99 /**
100  * @name LIS3MDL register addresses
101  * @{
102  */
103 #define LIS3MDL_AD_WHO_AM_I 0x0F
104 #define LIS3MDL_AD_CTRL_REG1 0x20
105 #define LIS3MDL_AD_CTRL_REG2 0x21
106 #define LIS3MDL_AD_CTRL_REG3 0x22
107 #define LIS3MDL_AD_CTRL_REG4 0x23
108 #define LIS3MDL_AD_CTRL_REG5 0x24
109 #define LIS3MDL_AD_STATUS_REG 0x27
110 #define LIS3MDL_AD_OUT_X_L 0x28
111 #define LIS3MDL_AD_OUT_X_H 0x29
112 #define LIS3MDL_AD_OUT_Y_L 0x2A
113 #define LIS3MDL_AD_OUT_Y_H 0x2B
114 #define LIS3MDL_AD_OUT_Z_L 0x2C
115 #define LIS3MDL_AD_OUT_Z_H 0x2D
116 #define LIS3MDL_AD_TEMP_OUT_L 0x2E
117 #define LIS3MDL_AD_TEMP_OUT_H 0x2F
118 #define LIS3MDL_AD_INT_CFG 0x30
119 #define LIS3MDL_AD_INT_SOURCE 0x31
120 #define LIS3MDL_AD_INT_THS_L 0x32
121 #define LIS3MDL_AD_INT_THS_H 0x33
122 /** @} */
123 
124 /**
125  * @name LIS3MDL_CTRL_REG1 register bits definitions
126  * @{
127  */
128 #define LIS3MDL_CTRL_REG1_MASK 0xFF
129 #define LIS3MDL_CTRL_REG1_ST (1 << 0)
130 #define LIS3MDL_CTRL_REG1_FAST_ODR (1 << 1)
131 #define LIS3MDL_CTRL_REG1_DO0 (1 << 2)
132 #define LIS3MDL_CTRL_REG1_DO1 (1 << 3)
133 #define LIS3MDL_CTRL_REG1_DO2 (1 << 4)
134 #define LIS3MDL_CTRL_REG1_OM0 (1 << 5)
135 #define LIS3MDL_CTRL_REG1_OM1 (1 << 6)
136 #define LIS3MDL_CTRL_REG1_TEMP_EN (1 << 7)
137 /** @} */
138 
139 /**
140  * @name LIS3MDL_CTRL_REG2 register bits definitions
141  * @{
142  */
143 #define LIS3MDL_CTRL_REG2_MASK 0x6C
144 #define LIS3MDL_CTRL_REG2_SOFT_RST (1 << 2)
145 #define LIS3MDL_CTRL_REG2_REBOOT (1 << 3)
146 #define LIS3MDL_CTRL_REG2_FS_MASK 0x60
147 #define LIS3MDL_CTRL_REG2_FS0 (1 << 5)
148 #define LIS3MDL_CTRL_REG2_FS1 (1 << 6)
149 /** @} */
150 
151 /**
152  * @name LIS3MDL_CTRL_REG3 register bits definitions
153  * @{
154  */
155 #define LIS3MDL_CTRL_REG3_MASK 0x27
156 #define LIS3MDL_CTRL_REG3_MD0 (1 << 0)
157 #define LIS3MDL_CTRL_REG3_MD1 (1 << 1)
158 #define LIS3MDL_CTRL_REG3_SIM (1 << 2)
159 #define LIS3MDL_CTRL_REG3_LP (1 << 5)
160 /** @} */
161 
162 /**
163  * @name LIS3MDL_CTRL_REG4 register bits definitions
164  * @{
165  */
166 #define LIS3MDL_CTRL_REG4_MASK 0x0E
167 #define LIS3MDL_CTRL_REG4_BLE (1 << 1)
168 #define LIS3MDL_CTRL_REG4_OMZ0 (1 << 2)
169 #define LIS3MDL_CTRL_REG4_OMZ1 (1 << 3)
170 /** @} */
171 
172 /**
173  * @name LIS3MDL_CTRL_REG5 register bits definitions
174  * @{
175  */
176 #define LIS3MDL_CTRL_REG5_MASK 0xC0
177 #define LIS3MDL_CTRL_REG5_BDU (1 << 6)
178 #define LIS3MDL_CTRL_REG5_FAST_READ (1 << 7)
179 /** @} */
180 
181 /*===========================================================================*/
182 /* Driver pre-compile time settings. */
183 /*===========================================================================*/
184 
185 /**
186  * @name Configuration options
187  * @{
188  */
189 /**
190  * @brief LIS3MDL SPI interface switch.
191  * @details If set to @p TRUE the support for SPI is included.
192  * @note The default is @p FALSE.
193  */
194 #if !defined(LIS3MDL_USE_SPI) || defined(__DOXYGEN__)
195 #define LIS3MDL_USE_SPI FALSE
196 #endif
197 
198 /**
199  * @brief LIS3MDL shared SPI switch.
200  * @details If set to @p TRUE the device acquires SPI bus ownership
201  * on each transaction.
202  * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
203  */
204 #if !defined(LIS3MDL_SHARED_SPI) || defined(__DOXYGEN__)
205 #define LIS3MDL_SHARED_SPI FALSE
206 #endif
207 
208 /**
209  * @brief LIS3MDL I2C interface switch.
210  * @details If set to @p TRUE the support for I2C is included.
211  * @note The default is @p TRUE.
212  */
213 #if !defined(LIS3MDL_USE_I2C) || defined(__DOXYGEN__)
214 #define LIS3MDL_USE_I2C TRUE
215 #endif
216 
217 /**
218  * @brief LIS3MDL shared I2C switch.
219  * @details If set to @p TRUE the device acquires I2C bus ownership
220  * on each transaction.
221  * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION
222  */
223 #if !defined(LIS3MDL_SHARED_I2C) || defined(__DOXYGEN__)
224 #define LIS3MDL_SHARED_I2C FALSE
225 #endif
226 
227 /**
228  * @brief LIS3MDL advanced configurations switch.
229  * @details If set to @p TRUE more configurations are available.
230  * @note The default is @p FALSE.
231  */
232 #if !defined(LIS3MDL_COMP_USE_ADVANCED) || defined(__DOXYGEN__)
233 #define LIS3MDL_COMP_USE_ADVANCED FALSE
234 #endif
235 /** @} */
236 
237 /*===========================================================================*/
238 /* Derived constants and error checks. */
239 /*===========================================================================*/
240 
241 #if !(LIS3MDL_USE_SPI ^ LIS3MDL_USE_I2C)
242 #error "LIS3MDL_USE_SPI and LIS3MDL_USE_I2C cannot be both true or both false"
243 #endif
244 
245 #if LIS3MDL_USE_SPI && !HAL_USE_SPI
246 #error "LIS3MDL_USE_SPI requires HAL_USE_SPI"
247 #endif
248 
249 #if LIS3MDL_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
250 #error "LIS3MDL_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
251 #endif
252 
253 #if LIS3MDL_USE_I2C && !HAL_USE_I2C
254 #error "LIS3MDL_USE_I2C requires HAL_USE_I2C"
255 #endif
256 
257 #if LIS3MDL_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
258 #error "LIS3MDL_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
259 #endif
260 
261 /**
262  * @todo Add support for LIS3MDL over SPI.
263  */
264 #if LIS3MDL_USE_SPI
265 #error "LIS3MDL over SPI still not supported"
266 #endif
267 
268 /*===========================================================================*/
269 /* Driver data structures and types. */
270 /*===========================================================================*/
271 
272 /**
273  * @name LIS3MDL data structures and types
274  * @{
275  */
276 
277 /**
278  * @brief LIS3MDL slave address
279  */
280 /**
281  * @brief Structure representing a LIS3MDL driver.
282  */
284 
285 /**
286  * @brief LIS3MDL slave address
287  */
288 typedef enum {
289  LIS3MDL_SAD_GND = 0x1C, /**< Slave Address when SA1 is to GND */
290  LIS3MDL_SAD_VCC = 0x1E /**< Slave Address when SA1 is to VCC */
292 
293 /**
294  * @brief LIS3MDL full scale
295  */
296 typedef enum {
297  LIS3MDL_COMP_FS_4GA = 0x00, /**< ±4 Gauss */
298  LIS3MDL_COMP_FS_8GA = 0x20, /**< ±8 Gauss */
299  LIS3MDL_COMP_FS_12GA = 0x40, /**< ±12 Gauss */
300  LIS3MDL_COMP_FS_16GA = 0x60 /**< ±16 Gauss */
302 
303 /**
304  * @brief LIS3MDL output data rate
305  */
306 typedef enum {
307  LIS3MDL_COMP_ODR_0_625HZ = 0x00, /**< Output Data Rate = 0.625 Hz */
308  LIS3MDL_COMP_ODR_1_25HZ = 0x04, /**< Output Data Rate = 1.25 Hz */
309  LIS3MDL_COMP_ODR_2_5HZ = 0x08, /**< Output Data Rate = 2.5 Hz */
310  LIS3MDL_COMP_ODR_5HZ = 0x0C, /**< Output Data Rate = 5 Hz */
311  LIS3MDL_COMP_ODR_10HZ = 0x10, /**< Output Data Rate = 10 Hz */
312  LIS3MDL_COMP_ODR_20HZ = 0x14, /**< Output Data Rate = 20 Hz */
313  LIS3MDL_COMP_ODR_40HZ = 0x18, /**< Output Data Rate = 40 Hz */
314  LIS3MDL_COMP_ODR_80HZ = 0x1C /**< Output Data Rate = 80 Hz */
316 
317 /**
318  * @brief LIS3MDL low power mode configuration
319  */
320 typedef enum {
321  LIS3MDL_COMP_LP_DISABLED = 0x00, /**< Low Power mode disabled */
322  LIS3MDL_COMP_LP_ENABLED = 0x20 /**< Low Power mode enabled */
324 
325 /**
326  * @brief LIS3MDL conversion mode
327  */
328 typedef enum {
329  LIS3MDL_COMP_MD_CONTINUOUS = 0x00,/**< Continuous conversion mode */
330  LIS3MDL_COMP_MD_SINGLE = 0x01, /**< Single conversion mode */
331  LIS3MDL_COMP_MD_POWER_DOWN = 0x02 /**< Power down mode */
333 
334 /**
335  * @brief LIS3MDL operation mode for X and Y axes
336  */
337 typedef enum {
338  LIS3MDL_COMP_OMXY_LP = 0x00, /**< X-Y axes low power mode */
339  LIS3MDL_COMP_OMXY_MEDIUM = 0x20, /**< X-Y axes medium performance mode */
340  LIS3MDL_COMP_OMXY_HIGH = 0x40, /**< X-Y axes high performance mode */
341  LIS3MDL_COMP_OMXY_ULTRA = 0x60 /**< X-Y axes ultra performance mode */
343 
344 /**
345  * @brief LIS3MDL operation mode for Z axis
346  */
347 typedef enum {
348  LIS3MDL_COMP_OMZ_LP = 0x00, /**< Z axis low power mode */
349  LIS3MDL_COMP_OMZ_MEDIUM = 0x04, /**< Z axis medium performance mode */
350  LIS3MDL_COMP_OMZ_HIGH = 0x08, /**< Z axis high performance mode */
351  LIS3MDL_COMP_OMZ_ULTRA = 0x0C /**< Z axis ultra performance mode */
353 
354 /**
355  * @brief LIS3MDL temperature sensor enabling
356  */
357 typedef enum {
358  LIS3MDL_TEMP_DISABLED = 0x00, /**< Temperature sensor disabled. */
359  LIS3MDL_TEMP_ENABLED = 0x80 /**< Temperature sensor enabled. */
361 
362 /**
363  * @brief LIS3MDL block data update
364  */
365 typedef enum {
366  LIS3MDL_BDU_CONTINUOUS = 0x00, /**< Continuous Update */
367  LIS3MDL_BDU_BLOCKED = 0x40 /**< Block data updated after reading. */
369 
370 /**
371  * @brief LIS3MDL endianness
372  */
373 typedef enum {
374  LIS3MDL_END_LITTLE = 0x00, /**< Little endian. */
375  LIS3MDL_END_BIG = 0x02 /**< Big endian. */
377 
378 /**
379  * @brief Driver state machine possible states.
380  */
381 typedef enum {
382  LIS3MDL_UNINIT = 0, /**< Not initialized. */
383  LIS3MDL_STOP = 1, /**< Stopped. */
384  LIS3MDL_READY = 2, /**< Ready. */
386 
387 /**
388  * @brief LIS3MDL configuration structure.
389  */
390 typedef struct {
391 #if (LIS3MDL_USE_SPI) || defined(__DOXYGEN__)
392  /**
393  * @brief SPI driver associated to this LIS3MDL.
394  */
396  /**
397  * @brief SPI configuration associated to this LIS3MDL.
398  */
400 #endif /* LIS3MDL_USE_SPI */
401 #if (LIS3MDL_USE_I2C) || defined(__DOXYGEN__)
402  /**
403  * @brief I2C driver associated to this LIS3MDL.
404  */
406  /**
407  * @brief I2C configuration associated to this LIS3MDL.
408  */
410  /**
411  * @brief LIS3MDL slave address
412  */
414 #endif /* LIS3MDL_USE_I2C */
415  /**
416  * @brief LIS3MDL compass subsystem initial sensitivity.
417  */
419  /**
420  * @brief LIS3MDL compass subsystem initial bias.
421  */
422  float *compbias;
423  /**
424  * @brief LIS3MDL compass subsystem full scale.
425  */
427  /**
428  * @brief LIS3MDL compass subsystem output data rate.
429  */
431 #if LIS3MDL_COMP_USE_ADVANCED || defined(__DOXYGEN__)
432  /**
433  * @brief LIS3MDL compass subsystem low power mode configuration.
434  */
436  /**
437  * @brief LIS3MDL compass subsystem conversion mode.
438  */
440  /**
441  * @brief LIS3MDL compass subsystem operation mode for X and Y axes.
442  */
444  /**
445  * @brief LIS3MDL compass subsystem operation mode for Z axis.
446  */
448  /**
449  * @brief LIS3MDL block data update.
450  */
452  /**
453  * @brief LIS3MDL endianness.
454  */
456 #endif
457 } LIS3MDLConfig;
458 
459 /**
460  * @brief @p LIS3MDL specific methods.
461  */
462 #define _lis3msl_methods_alone \
463  /* Change full scale value of LIS3MDL compass subsystem.*/ \
464  msg_t (*comp_set_full_scale)(LIS3MDLDriver *devp, lis3mdl_comp_fs_t fs);
465 
466 /**
467  * @brief @p LIS3MDL specific methods with inherited ones.
468  */
469 #define _lis3mdl_methods \
470  _base_object_methods \
471  _lis3msl_methods_alone
472 
473 /**
474  * @extends BaseCompassVMT
475  *
476  * @brief @p LIS3MDL virtual methods table.
477  */
478 struct LIS3MDLVMT {
480 };
481 
482 /**
483  * @brief @p LIS3MDLDriver specific data.
484  */
485 #define _lis3mdl_data \
486  _base_compass_data \
487  /* Driver state.*/ \
488  lis3mdl_state_t state; \
489  /* Current configuration data.*/ \
490  const LIS3MDLConfig *config; \
491  /* Compass subsystem axes number.*/ \
492  size_t compaxes; \
493  /* Compass subsystem current sensitivity.*/ \
494  float compsensitivity[LIS3MDL_COMP_NUMBER_OF_AXES]; \
495  /* Compass subsystem current bias.*/ \
496  float compbias[LIS3MDL_COMP_NUMBER_OF_AXES]; \
497  /* Compass subsystem current full scale value.*/ \
498  float compfullscale;
499 
500 /**
501  * @brief LIS3MDL 3-axis compass class.
502  */
504  /** @brief Virtual Methods Table.*/
505  const struct LIS3MDLVMT *vmt;
506  /** @brief Base compass interface.*/
509 };
510 /** @} */
511 
512 /*===========================================================================*/
513 /* Driver macros. */
514 /*===========================================================================*/
515 
516 /**
517  * @brief Return the number of axes of the BaseCompass.
518  *
519  * @param[in] devp pointer to @p LIS3MDLDriver.
520  *
521  * @return the number of axes.
522  *
523  * @api
524  */
525 #define lis3mdlCompassGetAxesNumber(devp) \
526  compassGetAxesNumber(&((devp)->comp_if))
527 
528 /**
529  * @brief Retrieves raw data from the BaseCompass.
530  * @note This data is retrieved from MEMS register without any algebraical
531  * manipulation.
532  * @note The axes array must be at least the same size of the
533  * BaseCompass axes number.
534  *
535  * @param[in] devp pointer to @p BaseCompass interface.
536  * @param[out] axes a buffer which would be filled with raw data.
537  *
538  * @return The operation status.
539  * @retval MSG_OK if the function succeeded.
540  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
541  * be retrieved using @p i2cGetErrors().
542  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
543  *
544  * @api
545  */
546 #define lis3mdlCompassReadRaw(devp, axes) \
547  compassReadRaw(&((devp)->comp_if), axes)
548 
549 /**
550  * @brief Retrieves cooked data from the BaseCompass.
551  * @note This data is manipulated according to the formula
552  * cooked = (raw * sensitivity) - bias.
553  * @note Final data is expressed as G.
554  * @note The axes array must be at least the same size of the
555  * BaseCompass axes number.
556  *
557  * @param[in] devp pointer to @p BaseCompass interface.
558  * @param[out] axes a buffer which would be filled with cooked data.
559  *
560  * @return The operation status.
561  * @retval MSG_OK if the function succeeded.
562  * @retval MSG_RESET if one or more I2C errors occurred, the errors can
563  * be retrieved using @p i2cGetErrors().
564  * @retval MSG_TIMEOUT if a timeout occurred before operation end.
565  *
566  * @api
567  */
568 #define lis3mdlCompassReadCooked(devp, axes) \
569  compassReadCooked(&((devp)->comp_if), axes)
570 
571 /**
572  * @brief Set bias values for the BaseCompass.
573  * @note Bias must be expressed as G.
574  * @note The bias buffer must be at least the same size of the
575  * BaseCompass axes number.
576  *
577  * @param[in] devp pointer to @p BaseCompass interface.
578  * @param[in] bp a buffer which contains biases.
579  *
580  * @return The operation status.
581  * @retval MSG_OK if the function succeeded.
582  *
583  * @api
584  */
585 #define lis3mdlCompassSetBias(devp, bp) \
586  compassSetBias(&((devp)->comp_if), bp)
587 
588 /**
589  * @brief Reset bias values for the BaseCompass.
590  * @note Default biases value are obtained from device datasheet when
591  * available otherwise they are considered zero.
592  *
593  * @param[in] devp pointer to @p LIS3MDLDriver.
594  *
595  * @return The operation status.
596  * @retval MSG_OK if the function succeeded.
597  *
598  * @api
599  */
600 #define lis3mdlCompassResetBias(devp) \
601  compassResetBias(&((devp)->comp_if))
602 
603 /**
604  * @brief Set sensitivity values for the BaseCompass.
605  * @note Sensitivity must be expressed as G/LSB.
606  * @note The sensitivity buffer must be at least the same size of the
607  * BaseCompass axes number.
608  *
609  * @param[in] devp pointer to @p LIS3MDLDriver.
610  * @param[in] sp a buffer which contains sensitivities.
611  *
612  * @return The operation status.
613  * @retval MSG_OK if the function succeeded.
614  *
615  * @api
616  */
617 #define lis3mdlCompassSetSensitivity(devp, sp) \
618  compassSetSensitivity(&((devp)->comp_if), sp)
619 
620 /**
621  * @brief Reset sensitivity values for the BaseCompass.
622  * @note Default sensitivities value are obtained from device datasheet.
623  *
624  * @param[in] devp pointer to @p LIS3MDLDriver.
625  *
626  * @return The operation status.
627  * @retval MSG_OK if the function succeeded.
628  * @retval MSG_RESET otherwise.
629  *
630  * @api
631  */
632 #define lis3mdlCompassResetSensitivity(devp) \
633  compassResetSensitivity(&((devp)->comp_if))
634 
635 /**
636  * @brief Changes the LIS3MDLDriver compass fullscale value.
637  * @note This function also rescale sensitivities and biases based on
638  * previous and next fullscale value.
639  * @note A recalibration is highly suggested after calling this function.
640  *
641  * @param[in] devp pointer to @p LIS3MDLDriver.
642  * @param[in] fs new fullscale value.
643  *
644  * @return The operation status.
645  * @retval MSG_OK if the function succeeded.
646  * @retval MSG_RESET otherwise.
647  *
648  * @api
649  */
650 #define lis3mdlCompassSetFullScale(devp, fs) \
651  (devp)->vmt->comp_set_full_scale(devp, fs)
652 
653 /*===========================================================================*/
654 /* External declarations. */
655 /*===========================================================================*/
656 
657 #ifdef __cplusplus
658 extern "C" {
659 #endif
660  void lis3mdlObjectInit(LIS3MDLDriver *devp);
661  void lis3mdlStart(LIS3MDLDriver *devp, const LIS3MDLConfig *config);
662  void lis3mdlStop(LIS3MDLDriver *devp);
663 #ifdef __cplusplus
664 }
665 #endif
666 
667 #endif /* _LIS3MDL_H_ */
668 
669 /** @} */
670 
lis3mdl_comp_omxy_t
LIS3MDL operation mode for X and Y axes.
Definition: lis3mdl.h:337
void lis3mdlStop(LIS3MDLDriver *devp)
Deactivates the LIS3MDL Complex Driver peripheral.
Definition: lis3mdl.c:598
void lis3mdlObjectInit(LIS3MDLDriver *devp)
Initializes an instance.
Definition: lis3mdl.c:446
lis3mdl_bdu_t blockdataupdate
LIS3MDL block data update.
Definition: lis3mdl.h:451
lis3mdl_temp_t
LIS3MDL temperature sensor enabling.
Definition: lis3mdl.h:357
lis3mdl_comp_fs_t
LIS3MDL full scale.
Definition: lis3mdl.h:296
Type of I2C driver configuration structure.
Definition: hal_i2c_lld.h:75
#define _lis3mdl_data
LIS3MDLDriver specific data.
Definition: lis3mdl.h:485
Base compass class.
Definition: hal_compass.h:86
lis3mdl_end_t endianness
LIS3MDL endianness.
Definition: lis3mdl.h:455
lis3mdl_comp_omxy_t compoperationmodexy
LIS3MDL compass subsystem operation mode for X and Y axes.
Definition: lis3mdl.h:443
lis3mdl_comp_odr_t compoutputdatarate
LIS3MDL compass subsystem output data rate.
Definition: lis3mdl.h:430
lis3mdl_comp_odr_t
LIS3MDL output data rate.
Definition: lis3mdl.h:306
lis3mdl_comp_fs_t compfullscale
LIS3MDL compass subsystem full scale.
Definition: lis3mdl.h:426
lis3mdl_comp_md_t compconversionmode
LIS3MDL compass subsystem conversion mode.
Definition: lis3mdl.h:439
lis3mdl_comp_lp_t
LIS3MDL low power mode configuration.
Definition: lis3mdl.h:320
lis3mdl_end_t
LIS3MDL endianness.
Definition: lis3mdl.h:373
LIS3MDL configuration structure.
Definition: lis3mdl.h:390
lis3mdl_comp_lp_t complowpowermode
LIS3MDL compass subsystem low power mode configuration.
Definition: lis3mdl.h:435
Structure representing an I2C driver.
Definition: hal_i2c_lld.h:88
float * compbias
LIS3MDL compass subsystem initial bias.
Definition: lis3mdl.h:422
lis3mdl_sad_t
LIS3MDL slave address.
Definition: lis3mdl.h:288
Driver configuration structure.
Definition: hal_spi_lld.h:83
lis3mdl_bdu_t
LIS3MDL block data update.
Definition: lis3mdl.h:365
#define _lis3mdl_methods
LIS3MDL specific methods with inherited ones.
Definition: lis3mdl.h:469
SPIDriver * spip
SPI driver associated to this LIS3MDL.
Definition: lis3mdl.h:395
lis3mdl_comp_md_t
LIS3MDL conversion mode.
Definition: lis3mdl.h:328
Generic compass interface header.
lis3mdl_state_t
Driver state machine possible states.
Definition: lis3mdl.h:381
const SPIConfig * spicfg
SPI configuration associated to this LIS3MDL.
Definition: lis3mdl.h:399
float * compsensitivity
LIS3MDL compass subsystem initial sensitivity.
Definition: lis3mdl.h:418
void lis3mdlStart(LIS3MDLDriver *devp, const LIS3MDLConfig *config)
Configures and activates LIS3MDL Complex Driver peripheral.
Definition: lis3mdl.c:465
const struct LIS3MDLVMT * vmt
Virtual Methods Table.
Definition: lis3mdl.h:505
const I2CConfig * i2ccfg
I2C configuration associated to this LIS3MDL.
Definition: lis3mdl.h:409
lis3mdl_comp_omz_t compoperationmodez
LIS3MDL compass subsystem operation mode for Z axis.
Definition: lis3mdl.h:447
BaseCompass comp_if
Base compass interface.
Definition: lis3mdl.h:507
lis3mdl_sad_t slaveaddress
LIS3MDL slave address.
Definition: lis3mdl.h:413
lis3mdl_comp_omz_t
LIS3MDL operation mode for Z axis.
Definition: lis3mdl.h:347
LIS3MDL 3-axis compass class.
Definition: lis3mdl.h:503
LIS3MDL virtual methods table.
Definition: lis3mdl.h:478
Structure representing an SPI driver.
Definition: hal_spi_lld.h:128
I2CDriver * i2cp
I2C driver associated to this LIS3MDL.
Definition: lis3mdl.h:405