Due Ingegneri Ed Un Controllore / Giroscopio

Dependencies:   X_NUCLEO_COMMON

Dependents:   Giroscopio_main

Fork of X_NUCLEO_IKS01A1-f2df by Ant Robinson

Committer:
antseggs
Date:
Tue May 17 15:40:45 2016 +0000
Revision:
0:5a49275457c6
Watchdog in place

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antseggs 0:5a49275457c6 1 /**
antseggs 0:5a49275457c6 2 ******************************************************************************
antseggs 0:5a49275457c6 3 * @file lis3mdl.h
antseggs 0:5a49275457c6 4 * @author MEMS Application Team
antseggs 0:5a49275457c6 5 * @version V1.3.0
antseggs 0:5a49275457c6 6 * @date 28-May-2015
antseggs 0:5a49275457c6 7 * @brief This file contains definitions for the lis3mdl.c
antseggs 0:5a49275457c6 8 * firmware driver.
antseggs 0:5a49275457c6 9 ******************************************************************************
antseggs 0:5a49275457c6 10 * @attention
antseggs 0:5a49275457c6 11 *
antseggs 0:5a49275457c6 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
antseggs 0:5a49275457c6 13 *
antseggs 0:5a49275457c6 14 * Redistribution and use in source and binary forms, with or without modification,
antseggs 0:5a49275457c6 15 * are permitted provided that the following conditions are met:
antseggs 0:5a49275457c6 16 * 1. Redistributions of source code must retain the above copyright notice,
antseggs 0:5a49275457c6 17 * this list of conditions and the following disclaimer.
antseggs 0:5a49275457c6 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
antseggs 0:5a49275457c6 19 * this list of conditions and the following disclaimer in the documentation
antseggs 0:5a49275457c6 20 * and/or other materials provided with the distribution.
antseggs 0:5a49275457c6 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
antseggs 0:5a49275457c6 22 * may be used to endorse or promote products derived from this software
antseggs 0:5a49275457c6 23 * without specific prior written permission.
antseggs 0:5a49275457c6 24 *
antseggs 0:5a49275457c6 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
antseggs 0:5a49275457c6 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
antseggs 0:5a49275457c6 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
antseggs 0:5a49275457c6 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
antseggs 0:5a49275457c6 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
antseggs 0:5a49275457c6 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
antseggs 0:5a49275457c6 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
antseggs 0:5a49275457c6 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
antseggs 0:5a49275457c6 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
antseggs 0:5a49275457c6 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
antseggs 0:5a49275457c6 35 *
antseggs 0:5a49275457c6 36 ******************************************************************************
antseggs 0:5a49275457c6 37 */
antseggs 0:5a49275457c6 38
antseggs 0:5a49275457c6 39 /* Define to prevent recursive inclusion -------------------------------------*/
antseggs 0:5a49275457c6 40 #ifndef __LIS3MDL_H
antseggs 0:5a49275457c6 41 #define __LIS3MDL_H
antseggs 0:5a49275457c6 42
antseggs 0:5a49275457c6 43 #ifdef __cplusplus
antseggs 0:5a49275457c6 44 extern "C" {
antseggs 0:5a49275457c6 45 #endif
antseggs 0:5a49275457c6 46
antseggs 0:5a49275457c6 47 /* Includes ------------------------------------------------------------------*/
antseggs 0:5a49275457c6 48 #include "magneto.h"
antseggs 0:5a49275457c6 49
antseggs 0:5a49275457c6 50 /** @addtogroup BSP
antseggs 0:5a49275457c6 51 * @{
antseggs 0:5a49275457c6 52 */
antseggs 0:5a49275457c6 53
antseggs 0:5a49275457c6 54 /** @addtogroup Components
antseggs 0:5a49275457c6 55 * @{
antseggs 0:5a49275457c6 56 */
antseggs 0:5a49275457c6 57
antseggs 0:5a49275457c6 58 /** @addtogroup LIS3MDL
antseggs 0:5a49275457c6 59 * @{
antseggs 0:5a49275457c6 60 */
antseggs 0:5a49275457c6 61
antseggs 0:5a49275457c6 62 /** @defgroup LIS3MDL_Exported_Defines LIS3MDL_Exported_Defines
antseggs 0:5a49275457c6 63 * @{
antseggs 0:5a49275457c6 64 */
antseggs 0:5a49275457c6 65 #ifndef NULL
antseggs 0:5a49275457c6 66 #define NULL (void *) 0
antseggs 0:5a49275457c6 67 #endif
antseggs 0:5a49275457c6 68
antseggs 0:5a49275457c6 69
antseggs 0:5a49275457c6 70 /******************************************************************************/
antseggs 0:5a49275457c6 71 /***************** START MAGNETIC SENSOR REGISTER MAPPING ********************/
antseggs 0:5a49275457c6 72 /******************************************************************************/
antseggs 0:5a49275457c6 73
antseggs 0:5a49275457c6 74 /**
antseggs 0:5a49275457c6 75 * @brief Device identifier register.
antseggs 0:5a49275457c6 76 * \code
antseggs 0:5a49275457c6 77 * Read
antseggs 0:5a49275457c6 78 * Default value:
antseggs 0:5a49275457c6 79 * 7:0 This read-only register contains the device identifier
antseggs 0:5a49275457c6 80 * \endcode
antseggs 0:5a49275457c6 81 */
antseggs 0:5a49275457c6 82 #define LIS3MDL_M_WHO_AM_I_ADDR 0x0F
antseggs 0:5a49275457c6 83
antseggs 0:5a49275457c6 84
antseggs 0:5a49275457c6 85 /**
antseggs 0:5a49275457c6 86 * @brief Magnetic sensor Control Register 1
antseggs 0:5a49275457c6 87 * \code
antseggs 0:5a49275457c6 88 * Read/write
antseggs 0:5a49275457c6 89 * Default value: 0x10
antseggs 0:5a49275457c6 90 * [7] TEMP_COMP: Temperature compensation enable
antseggs 0:5a49275457c6 91 * [6:5] OM1-0: X and Y axes operative mode selection
antseggs 0:5a49275457c6 92 * [4:2] DO2-0: Output data rate selection
antseggs 0:5a49275457c6 93 * [1] This bit must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 94 * [0] ST: Self-test enable
antseggs 0:5a49275457c6 95 * \endcode
antseggs 0:5a49275457c6 96 */
antseggs 0:5a49275457c6 97 #define LIS3MDL_M_CTRL_REG1_M 0x20
antseggs 0:5a49275457c6 98
antseggs 0:5a49275457c6 99
antseggs 0:5a49275457c6 100 /**
antseggs 0:5a49275457c6 101 * @brief Magnetic sensor Control Register 2
antseggs 0:5a49275457c6 102 * \code
antseggs 0:5a49275457c6 103 * Read/write
antseggs 0:5a49275457c6 104 * Default value: 0x00
antseggs 0:5a49275457c6 105 * [7] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 106 * [6:5] FS1-0: Full-scale configuration
antseggs 0:5a49275457c6 107 * [4] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 108 * [3] REBOOT: Reboot memory content
antseggs 0:5a49275457c6 109 * [2] SOFT_RST: Configuration registers and user register reset function
antseggs 0:5a49275457c6 110 * [1:0] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 111 * \endcode
antseggs 0:5a49275457c6 112 */
antseggs 0:5a49275457c6 113 #define LIS3MDL_M_CTRL_REG2_M 0x21
antseggs 0:5a49275457c6 114
antseggs 0:5a49275457c6 115
antseggs 0:5a49275457c6 116 /**
antseggs 0:5a49275457c6 117 * @brief Magnetic sensor Control Register 3
antseggs 0:5a49275457c6 118 * \code
antseggs 0:5a49275457c6 119 * Read/write
antseggs 0:5a49275457c6 120 * Default value: 0x03
antseggs 0:5a49275457c6 121 * [7] I2C_DISABLE: Disable I2C interface
antseggs 0:5a49275457c6 122 * [6] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 123 * [5] LP: Low-power mode configuration
antseggs 0:5a49275457c6 124 * [4:3] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 125 * [2] SIM: SPI Serial Interface mode selection
antseggs 0:5a49275457c6 126 * [1:0] MD1-0: Operating mode selection
antseggs 0:5a49275457c6 127 * \endcode
antseggs 0:5a49275457c6 128 */
antseggs 0:5a49275457c6 129 #define LIS3MDL_M_CTRL_REG3_M 0x22
antseggs 0:5a49275457c6 130
antseggs 0:5a49275457c6 131
antseggs 0:5a49275457c6 132 /**
antseggs 0:5a49275457c6 133 * @brief Magnetic sensor data (LSB)
antseggs 0:5a49275457c6 134 * \code
antseggs 0:5a49275457c6 135 * Read
antseggs 0:5a49275457c6 136 * \endcode
antseggs 0:5a49275457c6 137 */
antseggs 0:5a49275457c6 138 #define LIS3MDL_M_OUT_X_L_M 0x28
antseggs 0:5a49275457c6 139
antseggs 0:5a49275457c6 140
antseggs 0:5a49275457c6 141 /**
antseggs 0:5a49275457c6 142 * @brief Magnetic sensor data (MSB)
antseggs 0:5a49275457c6 143 * \code
antseggs 0:5a49275457c6 144 * Read
antseggs 0:5a49275457c6 145 * \endcode
antseggs 0:5a49275457c6 146 */
antseggs 0:5a49275457c6 147 #define LIS3MDL_M_OUT_X_H_M 0x29
antseggs 0:5a49275457c6 148
antseggs 0:5a49275457c6 149
antseggs 0:5a49275457c6 150 /**
antseggs 0:5a49275457c6 151 * @brief Magnetic sensor data (LSB)
antseggs 0:5a49275457c6 152 * \code
antseggs 0:5a49275457c6 153 * Read
antseggs 0:5a49275457c6 154 * \endcode
antseggs 0:5a49275457c6 155 */
antseggs 0:5a49275457c6 156 #define LIS3MDL_M_OUT_Y_L_M 0x2A
antseggs 0:5a49275457c6 157
antseggs 0:5a49275457c6 158
antseggs 0:5a49275457c6 159 /**
antseggs 0:5a49275457c6 160 * @brief Magnetic sensor data (MSB)
antseggs 0:5a49275457c6 161 * \code
antseggs 0:5a49275457c6 162 * Read
antseggs 0:5a49275457c6 163 * \endcode
antseggs 0:5a49275457c6 164 */
antseggs 0:5a49275457c6 165 #define LIS3MDL_M_OUT_Y_H_M 0x2B
antseggs 0:5a49275457c6 166
antseggs 0:5a49275457c6 167
antseggs 0:5a49275457c6 168 /**
antseggs 0:5a49275457c6 169 * @brief Magnetic sensor data (LSB)
antseggs 0:5a49275457c6 170 * \code
antseggs 0:5a49275457c6 171 * Read
antseggs 0:5a49275457c6 172 * \endcode
antseggs 0:5a49275457c6 173 */
antseggs 0:5a49275457c6 174 #define LIS3MDL_M_OUT_Z_L_M 0x2C
antseggs 0:5a49275457c6 175
antseggs 0:5a49275457c6 176
antseggs 0:5a49275457c6 177 /**
antseggs 0:5a49275457c6 178 * @brief Magnetic sensor data (MSB)
antseggs 0:5a49275457c6 179 * \code
antseggs 0:5a49275457c6 180 * Read
antseggs 0:5a49275457c6 181 * \endcode
antseggs 0:5a49275457c6 182 */
antseggs 0:5a49275457c6 183 #define LIS3MDL_M_OUT_Z_H_M 0x2D
antseggs 0:5a49275457c6 184
antseggs 0:5a49275457c6 185
antseggs 0:5a49275457c6 186 /**
antseggs 0:5a49275457c6 187 * @brief Magnetic sensor Interrupt config register
antseggs 0:5a49275457c6 188 * \code
antseggs 0:5a49275457c6 189 * Read/write
antseggs 0:5a49275457c6 190 * Default value: 0x00
antseggs 0:5a49275457c6 191 * [7] XIEN: Enable interrupt generation on X axis
antseggs 0:5a49275457c6 192 * [6] YIEN: Enable interrupt generation on Y axis
antseggs 0:5a49275457c6 193 * [5] ZIEN: Enable interrupt generation on Z axis
antseggs 0:5a49275457c6 194 * [4:3] Must be 0
antseggs 0:5a49275457c6 195 * [2] IEA: Interrupt active configuration on INT
antseggs 0:5a49275457c6 196 * [1] LIR: Latch interrupt request
antseggs 0:5a49275457c6 197 * [0] IEN: Interrupt enable on INT pin
antseggs 0:5a49275457c6 198 * \endcode
antseggs 0:5a49275457c6 199 */
antseggs 0:5a49275457c6 200 #define LIS3MDL_M_INT_CFG 0x30
antseggs 0:5a49275457c6 201
antseggs 0:5a49275457c6 202
antseggs 0:5a49275457c6 203 /**
antseggs 0:5a49275457c6 204 * @brief Magnetic sensor Interrupt source register
antseggs 0:5a49275457c6 205 * \code
antseggs 0:5a49275457c6 206 * Read/write
antseggs 0:5a49275457c6 207 * Default value: 0x00
antseggs 0:5a49275457c6 208 * [7] PTH_X: Value on X-axis exceeds the threshold on the positive side
antseggs 0:5a49275457c6 209 * [6] PTH_Y: Value on Y-axis exceeds the threshold on the positive side
antseggs 0:5a49275457c6 210 * [5] PTH_Z: Value on Z-axis exceeds the threshold on the positive side
antseggs 0:5a49275457c6 211 * [4] NTH_X: Value on X-axis exceeds the threshold on the negative side
antseggs 0:5a49275457c6 212 * [3] NTH_Y: Value on Y-axis exceeds the threshold on the negative side
antseggs 0:5a49275457c6 213 * [2] NTH_Z: Value on Z-axis exceeds the threshold on the negative side
antseggs 0:5a49275457c6 214 * [1] MROI: Internal measurement range overflow on magnetic value
antseggs 0:5a49275457c6 215 * [0] INT: This bit signals when interrupt event occours
antseggs 0:5a49275457c6 216 * \endcode
antseggs 0:5a49275457c6 217 */
antseggs 0:5a49275457c6 218 #define LIS3MDL_M_INT_SRC 0x31
antseggs 0:5a49275457c6 219
antseggs 0:5a49275457c6 220
antseggs 0:5a49275457c6 221 /**
antseggs 0:5a49275457c6 222 * @brief Magnetic sensor Interrupt threshold register low
antseggs 0:5a49275457c6 223 * \code
antseggs 0:5a49275457c6 224 * Read/write
antseggs 0:5a49275457c6 225 * Default value: 0x00
antseggs 0:5a49275457c6 226 * [7:0] THS7-0: Least 8 significant bits of interrupt threshold
antseggs 0:5a49275457c6 227 * \endcode
antseggs 0:5a49275457c6 228 */
antseggs 0:5a49275457c6 229 #define LIS3MDL_M_INT_THS_L_M 0x32
antseggs 0:5a49275457c6 230
antseggs 0:5a49275457c6 231
antseggs 0:5a49275457c6 232 /**
antseggs 0:5a49275457c6 233 * @brief Magnetic sensor Interrupt threshold register high
antseggs 0:5a49275457c6 234 * \code
antseggs 0:5a49275457c6 235 * Read/write
antseggs 0:5a49275457c6 236 * Default value: 0x00
antseggs 0:5a49275457c6 237 * [7] Must be 0
antseggs 0:5a49275457c6 238 * [6:0] THS14-8: Most 7 significant bits of interrupt threshold
antseggs 0:5a49275457c6 239 * \endcode
antseggs 0:5a49275457c6 240 */
antseggs 0:5a49275457c6 241 #define LIS3MDL_M_INT_THS_H_M 0x33
antseggs 0:5a49275457c6 242
antseggs 0:5a49275457c6 243 /******************************************************************************/
antseggs 0:5a49275457c6 244 /******************* END MAGNETIC SENSOR REGISTER MAPPING ********************/
antseggs 0:5a49275457c6 245 /******************************************************************************/
antseggs 0:5a49275457c6 246
antseggs 0:5a49275457c6 247 /**
antseggs 0:5a49275457c6 248 * @brief Multiple Byte. Mask for enabling multiple byte read/write command.
antseggs 0:5a49275457c6 249 */
antseggs 0:5a49275457c6 250 #define LIS3MDL_I2C_MULTIPLEBYTE_CMD ((uint8_t)0x80)
antseggs 0:5a49275457c6 251
antseggs 0:5a49275457c6 252 /**
antseggs 0:5a49275457c6 253 * @brief Device Address
antseggs 0:5a49275457c6 254 */
antseggs 0:5a49275457c6 255
antseggs 0:5a49275457c6 256 #define LIS3MDL_M_MEMS_ADDRESS 0x3C // SAD[1] = 1
antseggs 0:5a49275457c6 257
antseggs 0:5a49275457c6 258 /**
antseggs 0:5a49275457c6 259 * @brief Device Identifier. Default value of the WHO_AM_I register.
antseggs 0:5a49275457c6 260 */
antseggs 0:5a49275457c6 261 #define I_AM_LIS3MDL_M ((uint8_t)0x3D)
antseggs 0:5a49275457c6 262
antseggs 0:5a49275457c6 263
antseggs 0:5a49275457c6 264 /*********************************** MAGNETIC SENSOR REGISTERS VALUE ****************************************/
antseggs 0:5a49275457c6 265
antseggs 0:5a49275457c6 266 /** @defgroup LIS3MDL_M_Temperature_Compensation_Enable_Selection_CTRL_REG1_M LIS3MDL_M_Temperature_Compensation_Enable_Selection_CTRL_REG1_M
antseggs 0:5a49275457c6 267 * @{
antseggs 0:5a49275457c6 268 */
antseggs 0:5a49275457c6 269 #define LIS3MDL_M_TEMP_COMP_DISABLE ((uint8_t)0x00) /*!< Temperature compensation: disable */
antseggs 0:5a49275457c6 270 #define LIS3MDL_M_TEMP_COMP_ENABLE ((uint8_t)0x80) /*!< Temperature compensation: enable */
antseggs 0:5a49275457c6 271
antseggs 0:5a49275457c6 272 #define LIS3MDL_M_TEMP_COMP_MASK ((uint8_t)0x80)
antseggs 0:5a49275457c6 273 /**
antseggs 0:5a49275457c6 274 * @}
antseggs 0:5a49275457c6 275 */
antseggs 0:5a49275457c6 276
antseggs 0:5a49275457c6 277 /** @defgroup LIS3MDL_M_X_And_Y_Axes_Operative_Mode_Selection_CTRL_REG1_M LIS3MDL_M_X_And_Y_Axes_Operative_Mode_Selection_CTRL_REG1_M
antseggs 0:5a49275457c6 278 * @{
antseggs 0:5a49275457c6 279 */
antseggs 0:5a49275457c6 280 #define LIS3MDL_M_OM_LP ((uint8_t)0x00) /*!< X and Y axes operative mode: Low-power mode */
antseggs 0:5a49275457c6 281 #define LIS3MDL_M_OM_MP ((uint8_t)0x20) /*!< X and Y axes operative mode: Medium-performance mode */
antseggs 0:5a49275457c6 282 #define LIS3MDL_M_OM_HP ((uint8_t)0x40) /*!< X and Y axes operative mode: High-performance mode */
antseggs 0:5a49275457c6 283 #define LIS3MDL_M_OM_UHP ((uint8_t)0x60) /*!< X and Y axes operative mode: Ultra-high performance mode */
antseggs 0:5a49275457c6 284
antseggs 0:5a49275457c6 285 #define LIS3MDL_M_OM_MASK ((uint8_t)0x60)
antseggs 0:5a49275457c6 286 /**
antseggs 0:5a49275457c6 287 * @}
antseggs 0:5a49275457c6 288 */
antseggs 0:5a49275457c6 289
antseggs 0:5a49275457c6 290 /** @defgroup LIS3MDL_M_Output_Data_Rate_Selection_CTRL_REG1_M LIS3MDL_M_Output_Data_Rate_Selection_CTRL_REG1_M
antseggs 0:5a49275457c6 291 * @{
antseggs 0:5a49275457c6 292 */
antseggs 0:5a49275457c6 293 #define LIS3MDL_M_DO_0_625 ((uint8_t)0x00) /*!< Output data rate selection: 0.625 */
antseggs 0:5a49275457c6 294 #define LIS3MDL_M_DO_1_25 ((uint8_t)0x04) /*!< Output data rate selection: 1.25 */
antseggs 0:5a49275457c6 295 #define LIS3MDL_M_DO_2_5 ((uint8_t)0x08) /*!< Output data rate selection: 2.5 */
antseggs 0:5a49275457c6 296 #define LIS3MDL_M_DO_5 ((uint8_t)0x0C) /*!< Output data rate selection: 5 */
antseggs 0:5a49275457c6 297 #define LIS3MDL_M_DO_10 ((uint8_t)0x10) /*!< Output data rate selection: 10 */
antseggs 0:5a49275457c6 298 #define LIS3MDL_M_DO_20 ((uint8_t)0x14) /*!< Output data rate selection: 20 */
antseggs 0:5a49275457c6 299 #define LIS3MDL_M_DO_40 ((uint8_t)0x18) /*!< Output data rate selection: 40 */
antseggs 0:5a49275457c6 300 #define LIS3MDL_M_DO_80 ((uint8_t)0x1C) /*!< Output data rate selection: 80 */
antseggs 0:5a49275457c6 301
antseggs 0:5a49275457c6 302 #define LIS3MDL_M_DO_MASK ((uint8_t)0x1C)
antseggs 0:5a49275457c6 303 /**
antseggs 0:5a49275457c6 304 * @}
antseggs 0:5a49275457c6 305 */
antseggs 0:5a49275457c6 306
antseggs 0:5a49275457c6 307 /** @defgroup LIS3MDL_M_Self_Test_Enable_Selection_CTRL_REG1_M LIS3MDL_M_Self_Test_Enable_Selection_CTRL_REG1_M
antseggs 0:5a49275457c6 308 * @{
antseggs 0:5a49275457c6 309 */
antseggs 0:5a49275457c6 310 #define LIS3MDL_M_ST_DISABLE ((uint8_t)0x00) /*!< Self-test: disable */
antseggs 0:5a49275457c6 311 #define LIS3MDL_M_ST_ENABLE ((uint8_t)0x01) /*!< Self-test: enable */
antseggs 0:5a49275457c6 312
antseggs 0:5a49275457c6 313 #define LIS3MDL_M_ST_MASK ((uint8_t)0x01)
antseggs 0:5a49275457c6 314 /**
antseggs 0:5a49275457c6 315 * @}
antseggs 0:5a49275457c6 316 */
antseggs 0:5a49275457c6 317
antseggs 0:5a49275457c6 318 /** @defgroup LIS3MDL_M_Full_Scale_Selection_CTRL_REG2_M LIS3MDL_M_Full_Scale_Selection_CTRL_REG2_M
antseggs 0:5a49275457c6 319 * @{
antseggs 0:5a49275457c6 320 */
antseggs 0:5a49275457c6 321 #define LIS3MDL_M_FS_4 ((uint8_t)0x00) /*!< Full scale: +-4 guass */
antseggs 0:5a49275457c6 322 #define LIS3MDL_M_FS_8 ((uint8_t)0x20) /*!< Full scale: +-8 gauss */
antseggs 0:5a49275457c6 323 #define LIS3MDL_M_FS_12 ((uint8_t)0x40) /*!< Full scale: +-12 gauss */
antseggs 0:5a49275457c6 324 #define LIS3MDL_M_FS_16 ((uint8_t)0x60) /*!< Full scale: +-16 gauss */
antseggs 0:5a49275457c6 325
antseggs 0:5a49275457c6 326 #define LIS3MDL_M_FS_MASK ((uint8_t)0x60)
antseggs 0:5a49275457c6 327 /**
antseggs 0:5a49275457c6 328 * @}
antseggs 0:5a49275457c6 329 */
antseggs 0:5a49275457c6 330
antseggs 0:5a49275457c6 331 /** @defgroup LIS3MDL_M_Reboot_Memory_Selection_CTRL_REG2_M LIS3MDL_M_Reboot_Memory_Selection_CTRL_REG2_M
antseggs 0:5a49275457c6 332 * @{
antseggs 0:5a49275457c6 333 */
antseggs 0:5a49275457c6 334 #define LIS3MDL_M_REBOOT_NORMAL ((uint8_t)0x00) /*!< Reboot mode: normal mode */
antseggs 0:5a49275457c6 335 #define LIS3MDL_M_REBOOT_MEM_CONTENT ((uint8_t)0x08) /*!< Reboot mode: reboot memory content */
antseggs 0:5a49275457c6 336
antseggs 0:5a49275457c6 337 #define LIS3MDL_M_REBOOT_MASK ((uint8_t)0x08)
antseggs 0:5a49275457c6 338 /**
antseggs 0:5a49275457c6 339 * @}
antseggs 0:5a49275457c6 340 */
antseggs 0:5a49275457c6 341
antseggs 0:5a49275457c6 342 /** @defgroup LIS3MDL_M_Configuration_Registers_And_User_Register_Reset_CTRL_REG2_M LIS3MDL_M_Configuration_Registers_And_User_Register_Reset_CTRL_REG2_M
antseggs 0:5a49275457c6 343 * @{
antseggs 0:5a49275457c6 344 */
antseggs 0:5a49275457c6 345 #define LIS3MDL_M_SOFT_RST_DEFAULT ((uint8_t)0x00) /*!< Reset function: default value */
antseggs 0:5a49275457c6 346 #define LIS3MDL_M_SOFT_RST_RESET ((uint8_t)0x04) /*!< Reset function: reset operation */
antseggs 0:5a49275457c6 347
antseggs 0:5a49275457c6 348 #define LIS3MDL_M_SOFT_RST_MASK ((uint8_t)0x04)
antseggs 0:5a49275457c6 349 /**
antseggs 0:5a49275457c6 350 * @}
antseggs 0:5a49275457c6 351 */
antseggs 0:5a49275457c6 352
antseggs 0:5a49275457c6 353 /** @defgroup LIS3MDL_M_Disable_I2C_Interface_Selection_CTRL_REG3_M LIS3MDL_M_Disable_I2C_Interface_Selection_CTRL_REG3_M
antseggs 0:5a49275457c6 354 * @{
antseggs 0:5a49275457c6 355 */
antseggs 0:5a49275457c6 356 #define LIS3MDL_M_I2C_ENABLE ((uint8_t)0x00) /*!< I2C interface: enable */
antseggs 0:5a49275457c6 357 #define LIS3MDL_M_I2C_DISABLE ((uint8_t)0x80) /*!< I2C interface: disable */
antseggs 0:5a49275457c6 358
antseggs 0:5a49275457c6 359 #define LIS3MDL_M_I2C_MASK ((uint8_t)0x80)
antseggs 0:5a49275457c6 360 /**
antseggs 0:5a49275457c6 361 * @}
antseggs 0:5a49275457c6 362 */
antseggs 0:5a49275457c6 363
antseggs 0:5a49275457c6 364 /** @defgroup LIS3MDL_M_Low_Power_Mode_Selection_CTRL_REG3_M LIS3MDL_M_Low_Power_Mode_Selection_CTRL_REG3_M
antseggs 0:5a49275457c6 365 * @{
antseggs 0:5a49275457c6 366 */
antseggs 0:5a49275457c6 367 #define LIS3MDL_M_LP_ENABLE ((uint8_t)0x00) /*!< Low-power mode: magnetic data rate is configured by
antseggs 0:5a49275457c6 368 the DO bits in the CTRL_REG1_M */
antseggs 0:5a49275457c6 369 #define LIS3MDL_M_LP_DISABLE ((uint8_t)0x20) /*!< Low-power mode: the DO bits is set to 0.625 Hz and the system performs,
antseggs 0:5a49275457c6 370 for each channel, the minimum number of averages */
antseggs 0:5a49275457c6 371
antseggs 0:5a49275457c6 372 #define LIS3MDL_M_LP_MASK ((uint8_t)0x20)
antseggs 0:5a49275457c6 373 /**
antseggs 0:5a49275457c6 374 * @}
antseggs 0:5a49275457c6 375 */
antseggs 0:5a49275457c6 376
antseggs 0:5a49275457c6 377 /** @defgroup LIS3MDL_M_SPI_Serial_Interface_Mode_Selection_CTRL_REG3_M LIS3MDL_M_SPI_Serial_Interface_Mode_Selection_CTRL_REG3_M
antseggs 0:5a49275457c6 378 * @{
antseggs 0:5a49275457c6 379 */
antseggs 0:5a49275457c6 380 #define LIS3MDL_M_SPI_R_ENABLE ((uint8_t)0x00) /*!< SPI Serial Interface mode: only write operations enabled */
antseggs 0:5a49275457c6 381 #define LIS3MDL_M_SPI_R_DISABLE ((uint8_t)0x40) /*!< SPI Serial Interface mode: read and write operations enable */
antseggs 0:5a49275457c6 382
antseggs 0:5a49275457c6 383 #define LIS3MDL_M_SPI_R_MASK ((uint8_t)0x40)
antseggs 0:5a49275457c6 384 /**
antseggs 0:5a49275457c6 385 * @}
antseggs 0:5a49275457c6 386 */
antseggs 0:5a49275457c6 387
antseggs 0:5a49275457c6 388 /** @defgroup LIS3MDL_M_Operating_Mode_Selection_CTRL_REG3_M LIS3MDL_M_Operating_Mode_Selection_CTRL_REG3_M
antseggs 0:5a49275457c6 389 * @{
antseggs 0:5a49275457c6 390 */
antseggs 0:5a49275457c6 391 #define LIS3MDL_M_MD_CONTINUOUS ((uint8_t)0x00) /*!< Operating mode: Continuous-conversion mode */
antseggs 0:5a49275457c6 392 #define LIS3MDL_M_MD_SINGLE ((uint8_t)0x01) /*!< Operating mode: Single-conversion mode has to be used with sampling frequency from 0.625 Hz to 80 Hz. */
antseggs 0:5a49275457c6 393 #define LIS3MDL_M_MD_PD ((uint8_t)0x02) /*!< Operating mode: Power-down mode */
antseggs 0:5a49275457c6 394
antseggs 0:5a49275457c6 395 #define LIS3MDL_M_MD_MASK ((uint8_t)0x03)
antseggs 0:5a49275457c6 396 /**
antseggs 0:5a49275457c6 397 * @}
antseggs 0:5a49275457c6 398 */
antseggs 0:5a49275457c6 399
antseggs 0:5a49275457c6 400 /**
antseggs 0:5a49275457c6 401 * @}
antseggs 0:5a49275457c6 402 */
antseggs 0:5a49275457c6 403
antseggs 0:5a49275457c6 404 /** @defgroup LIS3MDL_Imported_Functions LIS3MDL_Imported_Functions
antseggs 0:5a49275457c6 405 * @{
antseggs 0:5a49275457c6 406 */
antseggs 0:5a49275457c6 407
antseggs 0:5a49275457c6 408 /* Magneto sensor IO functions */
antseggs 0:5a49275457c6 409 extern MAGNETO_StatusTypeDef LIS3MDL_IO_Init(void);
antseggs 0:5a49275457c6 410 extern MAGNETO_StatusTypeDef LIS3MDL_IO_Write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
antseggs 0:5a49275457c6 411 uint16_t NumByteToWrite);
antseggs 0:5a49275457c6 412 extern MAGNETO_StatusTypeDef LIS3MDL_IO_Read(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
antseggs 0:5a49275457c6 413 uint16_t NumByteToRead);
antseggs 0:5a49275457c6 414 extern void LIS3MDL_IO_ITConfig( void );
antseggs 0:5a49275457c6 415
antseggs 0:5a49275457c6 416 /**
antseggs 0:5a49275457c6 417 * @}
antseggs 0:5a49275457c6 418 */
antseggs 0:5a49275457c6 419
antseggs 0:5a49275457c6 420 /* ------------------------------------------------------- */
antseggs 0:5a49275457c6 421 /* Here you should declare the internal struct of */
antseggs 0:5a49275457c6 422 /* extended features of LSM6DS0. See the example of */
antseggs 0:5a49275457c6 423 /* LSM6DS3 in lsm6ds3.h */
antseggs 0:5a49275457c6 424 /* ------------------------------------------------------- */
antseggs 0:5a49275457c6 425
antseggs 0:5a49275457c6 426 /** @addtogroup LIS3MDL_Exported_Variables LIS3MDL_Exported_Variables
antseggs 0:5a49275457c6 427 * @{
antseggs 0:5a49275457c6 428 */
antseggs 0:5a49275457c6 429 /* Magneto sensor driver structure */
antseggs 0:5a49275457c6 430 extern MAGNETO_DrvTypeDef LIS3MDLDrv;
antseggs 0:5a49275457c6 431 extern MAGNETO_DrvExtTypeDef LIS3MDLDrv_ext;
antseggs 0:5a49275457c6 432
antseggs 0:5a49275457c6 433 /**
antseggs 0:5a49275457c6 434 * @}
antseggs 0:5a49275457c6 435 */
antseggs 0:5a49275457c6 436
antseggs 0:5a49275457c6 437 /**
antseggs 0:5a49275457c6 438 * @}
antseggs 0:5a49275457c6 439 */
antseggs 0:5a49275457c6 440
antseggs 0:5a49275457c6 441 /**
antseggs 0:5a49275457c6 442 * @}
antseggs 0:5a49275457c6 443 */
antseggs 0:5a49275457c6 444
antseggs 0:5a49275457c6 445 /**
antseggs 0:5a49275457c6 446 * @}
antseggs 0:5a49275457c6 447 */
antseggs 0:5a49275457c6 448
antseggs 0:5a49275457c6 449 #ifdef __cplusplus
antseggs 0:5a49275457c6 450 }
antseggs 0:5a49275457c6 451 #endif
antseggs 0:5a49275457c6 452
antseggs 0:5a49275457c6 453 #endif /* __LIS3MDL_H */
antseggs 0:5a49275457c6 454
antseggs 0:5a49275457c6 455 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/