removed X-NUCLEO-COMMON and ST-INTERFACES

Dependents:   unh-hackathon-example unh-hackathon-example-raw

Fork of X_NUCLEO_IKS01A1 by ST

Committer:
mfiore
Date:
Sat Apr 08 03:55:37 2017 +0000
Revision:
93:c7bd4f2e378c
Parent:
24:92cc9c6e4b2b
remove sub libraries

Who changed what in which revision?

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