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 lsm6ds0.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 lsm6ds0.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 __LSM6DS0_H
antseggs 0:5a49275457c6 41 #define __LSM6DS0_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 "imu_6axes.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 LSM6DS0
antseggs 0:5a49275457c6 59 * @{
antseggs 0:5a49275457c6 60 */
antseggs 0:5a49275457c6 61
antseggs 0:5a49275457c6 62 /** @defgroup LSM6DS0_Exported_Defines LSM6DS0_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 ACCELEROMETER AND GYROSCOPE REGISTER MAPPING **************/
antseggs 0:5a49275457c6 72 /******************************************************************************/
antseggs 0:5a49275457c6 73
antseggs 0:5a49275457c6 74
antseggs 0:5a49275457c6 75 /***************************************** COMMON REGISTERS ********************************************/
antseggs 0:5a49275457c6 76
antseggs 0:5a49275457c6 77 /**
antseggs 0:5a49275457c6 78 * @brief Interrupt config register
antseggs 0:5a49275457c6 79 * \code
antseggs 0:5a49275457c6 80 * Read/write
antseggs 0:5a49275457c6 81 * Default value: 0x00
antseggs 0:5a49275457c6 82 * [7] INT_IG_G: Gyroscope interrupt enable on INT pin
antseggs 0:5a49275457c6 83 * [6] INT_IG_XL: Accelerometer interrupt generator on INT pin
antseggs 0:5a49275457c6 84 * [5] INT_FSS5: FSS5 interrupt enable on INT pin
antseggs 0:5a49275457c6 85 * [4] INT_OVR: Overrun interrupt on INT pin
antseggs 0:5a49275457c6 86 * [3] INT_FTH: Gyroscope interrupt enable on INT pin
antseggs 0:5a49275457c6 87 * [2] INT_BOOT: Accelerometer interrupt generator on INT pin
antseggs 0:5a49275457c6 88 * [1] INT_DRDY_G: FSS5 interrupt enable on INT pin
antseggs 0:5a49275457c6 89 * [0] INT_DRDY_XL: Overrun interrupt on INT pin
antseggs 0:5a49275457c6 90 * \endcode
antseggs 0:5a49275457c6 91 */
antseggs 0:5a49275457c6 92 #define LSM6DS0_XG_INT_CTRL 0x0C
antseggs 0:5a49275457c6 93
antseggs 0:5a49275457c6 94
antseggs 0:5a49275457c6 95 /**
antseggs 0:5a49275457c6 96 * @brief Device identifier register.
antseggs 0:5a49275457c6 97 * \code
antseggs 0:5a49275457c6 98 * Read
antseggs 0:5a49275457c6 99 * Default value:
antseggs 0:5a49275457c6 100 * [7:0] This read-only register contains the device identifier
antseggs 0:5a49275457c6 101 * \endcode
antseggs 0:5a49275457c6 102 */
antseggs 0:5a49275457c6 103 #define LSM6DS0_XG_WHO_AM_I_ADDR 0x0F
antseggs 0:5a49275457c6 104
antseggs 0:5a49275457c6 105
antseggs 0:5a49275457c6 106 /**
antseggs 0:5a49275457c6 107 * @brief Control Register 4
antseggs 0:5a49275457c6 108 * \code
antseggs 0:5a49275457c6 109 * Read/write
antseggs 0:5a49275457c6 110 * Default value: 0x38
antseggs 0:5a49275457c6 111 * [5] Zen_G: Gyroscope�s Z-axis output enable
antseggs 0:5a49275457c6 112 * [4] Yen_G: Gyroscope�s Y-axis output enable
antseggs 0:5a49275457c6 113 * [3] Xen_G: Gyroscope�s X-axis output enable
antseggs 0:5a49275457c6 114 * \endcode
antseggs 0:5a49275457c6 115 */
antseggs 0:5a49275457c6 116 #define LSM6DS0_XG_CTRL_REG4 0x1E
antseggs 0:5a49275457c6 117
antseggs 0:5a49275457c6 118
antseggs 0:5a49275457c6 119 /**
antseggs 0:5a49275457c6 120 * @brief Control Register 10
antseggs 0:5a49275457c6 121 * \code
antseggs 0:5a49275457c6 122 * Read/write
antseggs 0:5a49275457c6 123 * Default value: 0x00
antseggs 0:5a49275457c6 124 * [2] ST_G: Gyro selftest disable (0) / enable (1)
antseggs 0:5a49275457c6 125 * [0] ST_XL: Accel selftest disable (0) / enable (1)
antseggs 0:5a49275457c6 126 * \endcode
antseggs 0:5a49275457c6 127 */
antseggs 0:5a49275457c6 128 #define LSM6DS0_XG_CTRL_REG10 0x24
antseggs 0:5a49275457c6 129
antseggs 0:5a49275457c6 130
antseggs 0:5a49275457c6 131 /***************************************** GYROSCOPE REGISTERS ********************************************/
antseggs 0:5a49275457c6 132
antseggs 0:5a49275457c6 133 /**
antseggs 0:5a49275457c6 134 * @brief Angular rate sensor Control Register 1
antseggs 0:5a49275457c6 135 * \code
antseggs 0:5a49275457c6 136 * Read/write
antseggs 0:5a49275457c6 137 * Default value: 0x00
antseggs 0:5a49275457c6 138 * [7:5] ODR_G2-0: Gyroscope output data rate selection
antseggs 0:5a49275457c6 139 * [4:3] FS_G1-0: Gyroscope full-scale selection
antseggs 0:5a49275457c6 140 * [2] This bit must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 141 * [1:0] BW_G1-0: Gyroscope bandwidth selection
antseggs 0:5a49275457c6 142 * \endcode
antseggs 0:5a49275457c6 143 */
antseggs 0:5a49275457c6 144 #define LSM6DS0_XG_CTRL_REG1_G 0x10
antseggs 0:5a49275457c6 145
antseggs 0:5a49275457c6 146
antseggs 0:5a49275457c6 147 /**
antseggs 0:5a49275457c6 148 * @brief Gyroscope data (LSB)
antseggs 0:5a49275457c6 149 * \code
antseggs 0:5a49275457c6 150 * Read
antseggs 0:5a49275457c6 151 * \endcode
antseggs 0:5a49275457c6 152 */
antseggs 0:5a49275457c6 153 #define LSM6DS0_XG_OUT_X_L_G 0x18
antseggs 0:5a49275457c6 154
antseggs 0:5a49275457c6 155
antseggs 0:5a49275457c6 156 /**
antseggs 0:5a49275457c6 157 * @brief Gyroscope data (MSB)
antseggs 0:5a49275457c6 158 * \code
antseggs 0:5a49275457c6 159 * Read
antseggs 0:5a49275457c6 160 * \endcode
antseggs 0:5a49275457c6 161 */
antseggs 0:5a49275457c6 162 #define LSM6DS0_XG_OUT_X_H_G 0x19
antseggs 0:5a49275457c6 163
antseggs 0:5a49275457c6 164
antseggs 0:5a49275457c6 165 /**
antseggs 0:5a49275457c6 166 * @brief Gyroscope data (LSB)
antseggs 0:5a49275457c6 167 * \code
antseggs 0:5a49275457c6 168 * Read
antseggs 0:5a49275457c6 169 * \endcode
antseggs 0:5a49275457c6 170 */
antseggs 0:5a49275457c6 171 #define LSM6DS0_XG_OUT_Y_L_G 0x1A
antseggs 0:5a49275457c6 172
antseggs 0:5a49275457c6 173
antseggs 0:5a49275457c6 174 /**
antseggs 0:5a49275457c6 175 * @brief Gyroscope data (MSB)
antseggs 0:5a49275457c6 176 * \code
antseggs 0:5a49275457c6 177 * Read
antseggs 0:5a49275457c6 178 * \endcode
antseggs 0:5a49275457c6 179 */
antseggs 0:5a49275457c6 180 #define LSM6DS0_XG_OUT_Y_H_G 0x1B
antseggs 0:5a49275457c6 181
antseggs 0:5a49275457c6 182
antseggs 0:5a49275457c6 183 /**
antseggs 0:5a49275457c6 184 * @brief Gyroscope data (LSB)
antseggs 0:5a49275457c6 185 * \code
antseggs 0:5a49275457c6 186 * Read
antseggs 0:5a49275457c6 187 * \endcode
antseggs 0:5a49275457c6 188 */
antseggs 0:5a49275457c6 189 #define LSM6DS0_XG_OUT_Z_L_G 0x1C
antseggs 0:5a49275457c6 190
antseggs 0:5a49275457c6 191
antseggs 0:5a49275457c6 192 /**
antseggs 0:5a49275457c6 193 * @brief Gyroscope data (MSB)
antseggs 0:5a49275457c6 194 * \code
antseggs 0:5a49275457c6 195 * Read
antseggs 0:5a49275457c6 196 * \endcode
antseggs 0:5a49275457c6 197 */
antseggs 0:5a49275457c6 198 #define LSM6DS0_XG_OUT_Z_H_G 0x1D
antseggs 0:5a49275457c6 199
antseggs 0:5a49275457c6 200
antseggs 0:5a49275457c6 201
antseggs 0:5a49275457c6 202 /*************************************** ACCELEROMETER REGISTERS *******************************************/
antseggs 0:5a49275457c6 203
antseggs 0:5a49275457c6 204 /**
antseggs 0:5a49275457c6 205 * @brief Linear acceleration sensor Control Register 6
antseggs 0:5a49275457c6 206 * \code
antseggs 0:5a49275457c6 207 * Read/write
antseggs 0:5a49275457c6 208 * Default value: 0x00
antseggs 0:5a49275457c6 209 * [7:5] ODR_XL2-0: Accelerometer Output data rate and power mode selection
antseggs 0:5a49275457c6 210 * [4:3] FS1_XL-FS0_XL: Accelerometer full-scale selection
antseggs 0:5a49275457c6 211 * [2] BW_SCAL_ODR: Bandwidth selection
antseggs 0:5a49275457c6 212 * [1:0] BW_XL1-0: Anti-aliasing filter bandwidth selection
antseggs 0:5a49275457c6 213 * \endcode
antseggs 0:5a49275457c6 214 */
antseggs 0:5a49275457c6 215 #define LSM6DS0_XG_CTRL_REG6_XL 0x20
antseggs 0:5a49275457c6 216
antseggs 0:5a49275457c6 217
antseggs 0:5a49275457c6 218 /**
antseggs 0:5a49275457c6 219 * @brief Linear acceleration sensor Control Register 5
antseggs 0:5a49275457c6 220 * \code
antseggs 0:5a49275457c6 221 * Read/write
antseggs 0:5a49275457c6 222 * Default value: 0x38
antseggs 0:5a49275457c6 223 * [7:6] DEC1-0: Decimation of acceleration data on OUT REG and FIFO
antseggs 0:5a49275457c6 224 * [5] Zen_XL: Accelerometer�s Z-axis output enable
antseggs 0:5a49275457c6 225 * [4] Yen_XL: Accelerometer�s Y-axis output enable
antseggs 0:5a49275457c6 226 * [3] Xen_XL: Accelerometer�s X-axis output enable
antseggs 0:5a49275457c6 227 * [2:0] These bits must be set to �0� for the correct operation of the device
antseggs 0:5a49275457c6 228 * \endcode
antseggs 0:5a49275457c6 229 */
antseggs 0:5a49275457c6 230 #define LSM6DS0_XG_CTRL_REG5_XL 0x1F
antseggs 0:5a49275457c6 231
antseggs 0:5a49275457c6 232
antseggs 0:5a49275457c6 233 /**
antseggs 0:5a49275457c6 234 * @brief Accelerometer data (LSB)
antseggs 0:5a49275457c6 235 * \code
antseggs 0:5a49275457c6 236 * Read
antseggs 0:5a49275457c6 237 * \endcode
antseggs 0:5a49275457c6 238 */
antseggs 0:5a49275457c6 239 #define LSM6DS0_XG_OUT_X_L_XL 0x28
antseggs 0:5a49275457c6 240
antseggs 0:5a49275457c6 241
antseggs 0:5a49275457c6 242 /**
antseggs 0:5a49275457c6 243 * @brief Accelerometer data (MSB)
antseggs 0:5a49275457c6 244 * \code
antseggs 0:5a49275457c6 245 * Read
antseggs 0:5a49275457c6 246 * \endcode
antseggs 0:5a49275457c6 247 */
antseggs 0:5a49275457c6 248 #define LSM6DS0_XG_OUT_X_H_XL 0x29
antseggs 0:5a49275457c6 249
antseggs 0:5a49275457c6 250
antseggs 0:5a49275457c6 251 /**
antseggs 0:5a49275457c6 252 * @brief Accelerometer data (LSB)
antseggs 0:5a49275457c6 253 * \code
antseggs 0:5a49275457c6 254 * Read
antseggs 0:5a49275457c6 255 * \endcode
antseggs 0:5a49275457c6 256 */
antseggs 0:5a49275457c6 257 #define LSM6DS0_XG_OUT_Y_L_XL 0x2A
antseggs 0:5a49275457c6 258
antseggs 0:5a49275457c6 259
antseggs 0:5a49275457c6 260 /**
antseggs 0:5a49275457c6 261 * @brief Accelerometer data (MSB)
antseggs 0:5a49275457c6 262 * \code
antseggs 0:5a49275457c6 263 * Read
antseggs 0:5a49275457c6 264 * \endcode
antseggs 0:5a49275457c6 265 */
antseggs 0:5a49275457c6 266 #define LSM6DS0_XG_OUT_Y_H_XL 0x2B
antseggs 0:5a49275457c6 267
antseggs 0:5a49275457c6 268
antseggs 0:5a49275457c6 269 /**
antseggs 0:5a49275457c6 270 * @brief Accelerometer data (LSB)
antseggs 0:5a49275457c6 271 * \code
antseggs 0:5a49275457c6 272 * Read
antseggs 0:5a49275457c6 273 * \endcode
antseggs 0:5a49275457c6 274 */
antseggs 0:5a49275457c6 275 #define LSM6DS0_XG_OUT_Z_L_XL 0x2C
antseggs 0:5a49275457c6 276
antseggs 0:5a49275457c6 277
antseggs 0:5a49275457c6 278 /**
antseggs 0:5a49275457c6 279 * @brief Accelerometer data (MSB)
antseggs 0:5a49275457c6 280 * \code
antseggs 0:5a49275457c6 281 * Read
antseggs 0:5a49275457c6 282 * \endcode
antseggs 0:5a49275457c6 283 */
antseggs 0:5a49275457c6 284 #define LSM6DS0_XG_OUT_Z_H_XL 0x2D
antseggs 0:5a49275457c6 285
antseggs 0:5a49275457c6 286 /******************************************************************************/
antseggs 0:5a49275457c6 287 /************* END ACCELEROMETER AND GYROSCOPE REGISTER MAPPING **************/
antseggs 0:5a49275457c6 288 /******************************************************************************/
antseggs 0:5a49275457c6 289
antseggs 0:5a49275457c6 290 /**
antseggs 0:5a49275457c6 291 * @brief Multiple Byte. Mask for enabling multiple byte read/write command.
antseggs 0:5a49275457c6 292 */
antseggs 0:5a49275457c6 293 #define LSM6DS0_I2C_MULTIPLEBYTE_CMD ((uint8_t)0x80)
antseggs 0:5a49275457c6 294
antseggs 0:5a49275457c6 295 /**
antseggs 0:5a49275457c6 296 * @brief Device Address
antseggs 0:5a49275457c6 297 */
antseggs 0:5a49275457c6 298 #define LSM6DS0_ADDRESS_LOW 0xD4 // SAD[0] = 0
antseggs 0:5a49275457c6 299 #define LSM6DS0_ADDRESS_HIGH 0xD6 // SAD[0] = 1
antseggs 0:5a49275457c6 300 #define LSM6DS0_XG_MEMS_ADDRESS LSM6DS0_ADDRESS_HIGH // SAD[0] = 1
antseggs 0:5a49275457c6 301
antseggs 0:5a49275457c6 302 /**
antseggs 0:5a49275457c6 303 * @brief Device Identifier. Default value of the WHO_AM_I register.
antseggs 0:5a49275457c6 304 */
antseggs 0:5a49275457c6 305 #define I_AM_LSM6DS0_XG ((uint8_t)0x68)
antseggs 0:5a49275457c6 306
antseggs 0:5a49275457c6 307
antseggs 0:5a49275457c6 308
antseggs 0:5a49275457c6 309 /************************************** GYROSCOPE REGISTERS VALUE *******************************************/
antseggs 0:5a49275457c6 310
antseggs 0:5a49275457c6 311
antseggs 0:5a49275457c6 312 /** @defgroup LSM6DS0_XG_Gyroscope_Output_Data_Rate_Selection_CTRL_REG1_G LSM6DS0_XG_Gyroscope_Output_Data_Rate_Selection_CTRL_REG1_G
antseggs 0:5a49275457c6 313 * @{
antseggs 0:5a49275457c6 314 */
antseggs 0:5a49275457c6 315 #define LSM6DS0_G_ODR_PD ((uint8_t)0x00) /*!< Output Data Rate: Power-down*/
antseggs 0:5a49275457c6 316 #define LSM6DS0_G_ODR_14_9HZ ((uint8_t)0x20) /*!< Output Data Rate: 14.9 Hz, cutoff 5Hz */
antseggs 0:5a49275457c6 317 #define LSM6DS0_G_ODR_59_5HZ ((uint8_t)0x40) /*!< Output Data Rate: 59.5 Hz, cutoff 19Hz */
antseggs 0:5a49275457c6 318 #define LSM6DS0_G_ODR_119HZ ((uint8_t)0x60) /*!< Output Data Rate: 119 Hz, cutoff 38Hz*/
antseggs 0:5a49275457c6 319 #define LSM6DS0_G_ODR_238HZ ((uint8_t)0x80) /*!< Output Data Rate: 238 Hz, cutoff 76Hz*/
antseggs 0:5a49275457c6 320 #define LSM6DS0_G_ODR_476HZ ((uint8_t)0xA0) /*!< Output Data Rate: 476 Hz, cutoff 100Hz*/
antseggs 0:5a49275457c6 321 #define LSM6DS0_G_ODR_952HZ ((uint8_t)0xC0) /*!< Output Data Rate: 952 Hz, cutoff 100Hz*/
antseggs 0:5a49275457c6 322
antseggs 0:5a49275457c6 323 #define LSM6DS0_G_ODR_MASK ((uint8_t)0xE0)
antseggs 0:5a49275457c6 324 /**
antseggs 0:5a49275457c6 325 * @}
antseggs 0:5a49275457c6 326 */
antseggs 0:5a49275457c6 327
antseggs 0:5a49275457c6 328
antseggs 0:5a49275457c6 329 /** @defgroup LSM6DS0_XG_Gyroscope_Bandwidth_Selection_CTRL_REG1_G LSM6DS0_XG_Gyroscope_Bandwidth_Selection_CTRL_REG1_G
antseggs 0:5a49275457c6 330 * @{
antseggs 0:5a49275457c6 331 */
antseggs 0:5a49275457c6 332 #define LSM6DS0_G_BW_00 ((uint8_t)0x00) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
antseggs 0:5a49275457c6 333 - cutoff = n.a. when ODR = 14.9
antseggs 0:5a49275457c6 334 - cutoff = 16 when ODR = 59.5
antseggs 0:5a49275457c6 335 - cutoff = 14 when ODR = 119
antseggs 0:5a49275457c6 336 - cutoff = 14 when ODR = 238
antseggs 0:5a49275457c6 337 - cutoff = 21 when ODR = 476
antseggs 0:5a49275457c6 338 - cutoff = 33 when ODR = 952 */
antseggs 0:5a49275457c6 339 #define LSM6DS0_G_BW_01 ((uint8_t)0x01) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
antseggs 0:5a49275457c6 340 - cutoff = n.a. when ODR = 14.9
antseggs 0:5a49275457c6 341 - cutoff = 16 when ODR = 59.5
antseggs 0:5a49275457c6 342 - cutoff = 31 when ODR = 119
antseggs 0:5a49275457c6 343 - cutoff = 29 when ODR = 238
antseggs 0:5a49275457c6 344 - cutoff = 28 when ODR = 476
antseggs 0:5a49275457c6 345 - cutoff = 40 when ODR = 952 */
antseggs 0:5a49275457c6 346 #define LSM6DS0_G_BW_10 ((uint8_t)0x02) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
antseggs 0:5a49275457c6 347 - cutoff = n.a. when ODR = 14.9
antseggs 0:5a49275457c6 348 - cutoff = 16 when ODR = 59.5
antseggs 0:5a49275457c6 349 - cutoff = 31 when ODR = 119
antseggs 0:5a49275457c6 350 - cutoff = 63 when ODR = 238
antseggs 0:5a49275457c6 351 - cutoff = 57 when ODR = 476
antseggs 0:5a49275457c6 352 - cutoff = 58 when ODR = 952 */
antseggs 0:5a49275457c6 353 #define LSM6DS0_G_BW_11 ((uint8_t)0x03) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
antseggs 0:5a49275457c6 354 - cutoff = n.a. when ODR = 14.9
antseggs 0:5a49275457c6 355 - cutoff = 16 when ODR = 59.5
antseggs 0:5a49275457c6 356 - cutoff = 31 when ODR = 119
antseggs 0:5a49275457c6 357 - cutoff = 78 when ODR = 238
antseggs 0:5a49275457c6 358 - cutoff = 100 when ODR = 476
antseggs 0:5a49275457c6 359 - cutoff = 100 when ODR = 952 */
antseggs 0:5a49275457c6 360
antseggs 0:5a49275457c6 361 #define LSM6DS0_G_BW_MASK ((uint8_t)0x03)
antseggs 0:5a49275457c6 362 /**
antseggs 0:5a49275457c6 363 * @}
antseggs 0:5a49275457c6 364 */
antseggs 0:5a49275457c6 365
antseggs 0:5a49275457c6 366 /** @defgroup LSM6DS0_XG_Gyroscope_Full_Scale_Selection_CTRL_REG1_G LSM6DS0_XG_Gyroscope_Full_Scale_Selection_CTRL_REG1_G
antseggs 0:5a49275457c6 367 * @{
antseggs 0:5a49275457c6 368 */
antseggs 0:5a49275457c6 369 #define LSM6DS0_G_FS_245 ((uint8_t)0x00) /*!< Full scale: 245 dps*/
antseggs 0:5a49275457c6 370 #define LSM6DS0_G_FS_500 ((uint8_t)0x08) /*!< Full scale: 500 dps */
antseggs 0:5a49275457c6 371 #define LSM6DS0_G_FS_2000 ((uint8_t)0x18) /*!< Full scale: 2000 dps */
antseggs 0:5a49275457c6 372
antseggs 0:5a49275457c6 373 #define LSM6DS0_G_FS_MASK ((uint8_t)0x18)
antseggs 0:5a49275457c6 374 /**
antseggs 0:5a49275457c6 375 * @}
antseggs 0:5a49275457c6 376 */
antseggs 0:5a49275457c6 377
antseggs 0:5a49275457c6 378 /** @defgroup LSM6DS0_XG_Gyroscope_Z_Axis_Output_Enable_Selection_CTRL_REG4 LSM6DS0_XG_Gyroscope_Z_Axis_Output_Enable_Selection_CTRL_REG4
antseggs 0:5a49275457c6 379 * @{
antseggs 0:5a49275457c6 380 */
antseggs 0:5a49275457c6 381 #define LSM6DS0_G_ZEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope�s Z-axis output enable: disable */
antseggs 0:5a49275457c6 382 #define LSM6DS0_G_ZEN_ENABLE ((uint8_t)0x20) /*!< Gyroscope�s Z-axis output enable: enable */
antseggs 0:5a49275457c6 383
antseggs 0:5a49275457c6 384 #define LSM6DS0_G_ZEN_MASK ((uint8_t)0x20)
antseggs 0:5a49275457c6 385 /**
antseggs 0:5a49275457c6 386 * @}
antseggs 0:5a49275457c6 387 */
antseggs 0:5a49275457c6 388
antseggs 0:5a49275457c6 389 /** @defgroup LSM6DS0_XG_Gyroscope_Y_Axis_Output_Enable_Selection_CTRL_REG4 LSM6DS0_XG_Gyroscope_Y_Axis_Output_Enable_Selection_CTRL_REG4
antseggs 0:5a49275457c6 390 * @{
antseggs 0:5a49275457c6 391 */
antseggs 0:5a49275457c6 392 #define LSM6DS0_G_YEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope�s Y-axis output enable: disable */
antseggs 0:5a49275457c6 393 #define LSM6DS0_G_YEN_ENABLE ((uint8_t)0x10) /*!< Gyroscope�s Y-axis output enable: enable */
antseggs 0:5a49275457c6 394
antseggs 0:5a49275457c6 395 #define LSM6DS0_G_YEN_MASK ((uint8_t)0x10)
antseggs 0:5a49275457c6 396 /**
antseggs 0:5a49275457c6 397 * @}
antseggs 0:5a49275457c6 398 */
antseggs 0:5a49275457c6 399
antseggs 0:5a49275457c6 400 /** @defgroup LSM6DS0_XG_Gyroscope_X_Axis_Output_Enable_Selection_CTRL_REG4 LSM6DS0_XG_Gyroscope_X_Axis_Output_Enable_Selection_CTRL_REG4
antseggs 0:5a49275457c6 401 * @{
antseggs 0:5a49275457c6 402 */
antseggs 0:5a49275457c6 403 #define LSM6DS0_G_XEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope�s X-axis output enable: disable */
antseggs 0:5a49275457c6 404 #define LSM6DS0_G_XEN_ENABLE ((uint8_t)0x08) /*!< Gyroscope�s X-axis output enable: enable */
antseggs 0:5a49275457c6 405
antseggs 0:5a49275457c6 406 #define LSM6DS0_G_XEN_MASK ((uint8_t)0x08)
antseggs 0:5a49275457c6 407 /**
antseggs 0:5a49275457c6 408 * @}
antseggs 0:5a49275457c6 409 */
antseggs 0:5a49275457c6 410
antseggs 0:5a49275457c6 411 /** @defgroup LSM6DS0_XG_Gyroscope_Selftest_Enable_Selection_CTRL_REG10 LSM6DS0_XG_Gyroscope_Selftest_Enable_Selection_CTRL_REG10
antseggs 0:5a49275457c6 412 * @{
antseggs 0:5a49275457c6 413 */
antseggs 0:5a49275457c6 414 #define LSM6DS0_G_ST_DISABLE ((uint8_t)0x00) /*!< Gyro selftest disable */
antseggs 0:5a49275457c6 415 #define LSM6DS0_G_ST_ENABLE ((uint8_t)0x04) /*!< Gyro selftest enable */
antseggs 0:5a49275457c6 416
antseggs 0:5a49275457c6 417 #define LSM6DS0_G_ST_MASK ((uint8_t)0x04)
antseggs 0:5a49275457c6 418 /**
antseggs 0:5a49275457c6 419 * @}
antseggs 0:5a49275457c6 420 */
antseggs 0:5a49275457c6 421
antseggs 0:5a49275457c6 422
antseggs 0:5a49275457c6 423 /************************************ ACCELEROMETER REGISTERS VALUE *****************************************/
antseggs 0:5a49275457c6 424
antseggs 0:5a49275457c6 425 /** @defgroup LSM6DS0_XG_Accelerometer_Output_Data_Rate_Selection_CTRL_REG6_XL LSM6DS0_XG_Accelerometer_Output_Data_Rate_Selection_CTRL_REG6_XL
antseggs 0:5a49275457c6 426 * @{
antseggs 0:5a49275457c6 427 */
antseggs 0:5a49275457c6 428 #define LSM6DS0_XL_ODR_PD ((uint8_t)0x00) /*!< Output Data Rate: Power-down*/
antseggs 0:5a49275457c6 429 #define LSM6DS0_XL_ODR_10HZ ((uint8_t)0x20) /*!< Output Data Rate: 10 Hz*/
antseggs 0:5a49275457c6 430 #define LSM6DS0_XL_ODR_50HZ ((uint8_t)0x40) /*!< Output Data Rate: 50 Hz */
antseggs 0:5a49275457c6 431 #define LSM6DS0_XL_ODR_119HZ ((uint8_t)0x60) /*!< Output Data Rate: 119 Hz */
antseggs 0:5a49275457c6 432 #define LSM6DS0_XL_ODR_238HZ ((uint8_t)0x80) /*!< Output Data Rate: 238 Hz */
antseggs 0:5a49275457c6 433 #define LSM6DS0_XL_ODR_476HZ ((uint8_t)0xA0) /*!< Output Data Rate: 476 Hz */
antseggs 0:5a49275457c6 434 #define LSM6DS0_XL_ODR_952HZ ((uint8_t)0xC0) /*!< Output Data Rate: 952 Hz */
antseggs 0:5a49275457c6 435
antseggs 0:5a49275457c6 436 #define LSM6DS0_XL_ODR_MASK ((uint8_t)0xE0)
antseggs 0:5a49275457c6 437 /**
antseggs 0:5a49275457c6 438 * @}
antseggs 0:5a49275457c6 439 */
antseggs 0:5a49275457c6 440
antseggs 0:5a49275457c6 441 /** @defgroup LSM6DS0_XG_Accelerometer_Full_Scale_Selection_CTRL_REG6_XL LSM6DS0_XG_Accelerometer_Full_Scale_Selection_CTRL_REG6_XL
antseggs 0:5a49275457c6 442 * @{
antseggs 0:5a49275457c6 443 */
antseggs 0:5a49275457c6 444 #define LSM6DS0_XL_FS_2G ((uint8_t)0x00) /*!< Full scale: +- 2g */
antseggs 0:5a49275457c6 445 #define LSM6DS0_XL_FS_4G ((uint8_t)0x10) /*!< Full scale: +- 4g */
antseggs 0:5a49275457c6 446 #define LSM6DS0_XL_FS_8G ((uint8_t)0x18) /*!< Full scale: +- 8g */
antseggs 0:5a49275457c6 447 #define LSM6DS0_XL_FS_16G ((uint8_t)0x08) /*!< Full scale: +- 16g */
antseggs 0:5a49275457c6 448
antseggs 0:5a49275457c6 449 #define LSM6DS0_XL_FS_MASK ((uint8_t)0x18)
antseggs 0:5a49275457c6 450 /**
antseggs 0:5a49275457c6 451 * @}
antseggs 0:5a49275457c6 452 */
antseggs 0:5a49275457c6 453
antseggs 0:5a49275457c6 454 /** @defgroup LSM6DS0_XG_Accelerometer_Bandwidth_Selection_CTRL_REG6_XL LSM6DS0_XG_Accelerometer_Bandwidth_Selection_CTRL_REG6_XL
antseggs 0:5a49275457c6 455 * @{
antseggs 0:5a49275457c6 456 */
antseggs 0:5a49275457c6 457 #define LSM6DS0_XL_BW_SCAL_ODR ((uint8_t)0x00) /*!< Bandwidth selection: determined by ODR:
antseggs 0:5a49275457c6 458 - BW = 408Hz when ODR = 952Hz, 50Hz, 10Hz
antseggs 0:5a49275457c6 459 - BW = 211Hz when ODR = 476Hz
antseggs 0:5a49275457c6 460 - BW = 105Hz when ODR = 238Hz
antseggs 0:5a49275457c6 461 - BW = 50Hz when ODR = 119Hz */
antseggs 0:5a49275457c6 462 #define LSM6DS0_XL_BW_SCAL_BW ((uint8_t)0x04) /*!< Bandwidth selection: selected according to Anti aliasing filter bandwidth */
antseggs 0:5a49275457c6 463
antseggs 0:5a49275457c6 464 #define LSM6DS0_XL_BW_SCAL_MASK ((uint8_t)0x04)
antseggs 0:5a49275457c6 465 /**
antseggs 0:5a49275457c6 466 * @}
antseggs 0:5a49275457c6 467 */
antseggs 0:5a49275457c6 468
antseggs 0:5a49275457c6 469
antseggs 0:5a49275457c6 470 /** @defgroup LSM6DS0_XG_Accelerometer_Anti_Aliasing_Filter_Bandwidth_Selection_CTRL_REG6_XL LSM6DS0_XG_Accelerometer_Anti_Aliasing_Filter_Bandwidth_Selection_CTRL_REG6_XL
antseggs 0:5a49275457c6 471 * @{
antseggs 0:5a49275457c6 472 */
antseggs 0:5a49275457c6 473 #define LSM6DS0_XL_BW_408HZ ((uint8_t)0x00) /*!< Anti-aliasing filter bandwidht: 408 Hz */
antseggs 0:5a49275457c6 474 #define LSM6DS0_XL_BW_211HZ ((uint8_t)0x01) /*!< Anti-aliasing filter bandwidht: 211 Hz */
antseggs 0:5a49275457c6 475 #define LSM6DS0_XL_BW_105HZ ((uint8_t)0x02) /*!< Anti-aliasing filter bandwidht: 105 Hz */
antseggs 0:5a49275457c6 476 #define LSM6DS0_XL_BW_50HZ ((uint8_t)0x03) /*!< Anti-aliasing filter bandwidht: 50 Hz */
antseggs 0:5a49275457c6 477
antseggs 0:5a49275457c6 478 #define LSM6DS0_XL_BW_MASK ((uint8_t)0x03)
antseggs 0:5a49275457c6 479 /**
antseggs 0:5a49275457c6 480 * @}
antseggs 0:5a49275457c6 481 */
antseggs 0:5a49275457c6 482
antseggs 0:5a49275457c6 483 /** @defgroup LSM6DS0_XG_Accelerometer_Decimation_Acceleration_Data_Selection_CTRL_REG5_XL LSM6DS0_XG_Accelerometer_Decimation_Acceleration_Data_Selection_CTRL_REG5_XL
antseggs 0:5a49275457c6 484 * @{
antseggs 0:5a49275457c6 485 */
antseggs 0:5a49275457c6 486 #define LSM6DS0_XL_DEC_NO ((uint8_t)0x00) /*!< Decimation of acceleration data: no decimation */
antseggs 0:5a49275457c6 487 #define LSM6DS0_XL_DEC_EVERY_2S ((uint8_t)0x40) /*!< Decimation of acceleration data: update every 2 samples */
antseggs 0:5a49275457c6 488 #define LSM6DS0_XL_DEC_EVERY_4S ((uint8_t)0x80) /*!< Decimation of acceleration data: update every 4 samples */
antseggs 0:5a49275457c6 489 #define LSM6DS0_XL_DEC_EVERY_8S ((uint8_t)0xC0) /*!< Decimation of acceleration data: update every 8 samples */
antseggs 0:5a49275457c6 490
antseggs 0:5a49275457c6 491 #define LSM6DS0_XL_DEC_MASK ((uint8_t)0xC0)
antseggs 0:5a49275457c6 492 /**
antseggs 0:5a49275457c6 493 * @}
antseggs 0:5a49275457c6 494 */
antseggs 0:5a49275457c6 495
antseggs 0:5a49275457c6 496
antseggs 0:5a49275457c6 497 /** @defgroup LSM6DS0_XG_Accelerometer_Z_Axis_Output_Enable_Selection_CTRL_REG5_XL LSM6DS0_XG_Accelerometer_Z_Axis_Output_Enable_Selection_CTRL_REG5_XL
antseggs 0:5a49275457c6 498 * @{
antseggs 0:5a49275457c6 499 */
antseggs 0:5a49275457c6 500 #define LSM6DS0_XL_ZEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer�s Z-axis output enable: disable */
antseggs 0:5a49275457c6 501 #define LSM6DS0_XL_ZEN_ENABLE ((uint8_t)0x20) /*!< Accelerometer�s Z-axis output enable: enable */
antseggs 0:5a49275457c6 502
antseggs 0:5a49275457c6 503 #define LSM6DS0_XL_ZEN_MASK ((uint8_t)0x20)
antseggs 0:5a49275457c6 504 /**
antseggs 0:5a49275457c6 505 * @}
antseggs 0:5a49275457c6 506 */
antseggs 0:5a49275457c6 507
antseggs 0:5a49275457c6 508 /** @defgroup LSM6DS0_XG_Accelerometer_Y_Axis_Output_Enable_Selection_CTRL_REG5_XL LSM6DS0_XG_Accelerometer_Y_Axis_Output_Enable_Selection_CTRL_REG5_XL
antseggs 0:5a49275457c6 509 * @{
antseggs 0:5a49275457c6 510 */
antseggs 0:5a49275457c6 511 #define LSM6DS0_XL_YEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer�s Y-axis output enable: disable */
antseggs 0:5a49275457c6 512 #define LSM6DS0_XL_YEN_ENABLE ((uint8_t)0x10) /*!< Accelerometer�s Y-axis output enable: enable */
antseggs 0:5a49275457c6 513
antseggs 0:5a49275457c6 514 #define LSM6DS0_XL_YEN_MASK ((uint8_t)0x10)
antseggs 0:5a49275457c6 515 /**
antseggs 0:5a49275457c6 516 * @}
antseggs 0:5a49275457c6 517 */
antseggs 0:5a49275457c6 518
antseggs 0:5a49275457c6 519
antseggs 0:5a49275457c6 520 /** @defgroup LSM6DS0_XG_Accelerometer_X_Axis_Output_Enable_Selection_CTRL_REG5_XL LSM6DS0_XG_Accelerometer_X_Axis_Output_Enable_Selection_CTRL_REG5_XL
antseggs 0:5a49275457c6 521 * @{
antseggs 0:5a49275457c6 522 */
antseggs 0:5a49275457c6 523 #define LSM6DS0_XL_XEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer�s X-axis output enable: disable */
antseggs 0:5a49275457c6 524 #define LSM6DS0_XL_XEN_ENABLE ((uint8_t)0x08) /*!< Accelerometer�s X-axis output enable: enable */
antseggs 0:5a49275457c6 525
antseggs 0:5a49275457c6 526 #define LSM6DS0_XL_XEN_MASK ((uint8_t)0x08)
antseggs 0:5a49275457c6 527
antseggs 0:5a49275457c6 528 /**
antseggs 0:5a49275457c6 529 * @}
antseggs 0:5a49275457c6 530 */
antseggs 0:5a49275457c6 531
antseggs 0:5a49275457c6 532
antseggs 0:5a49275457c6 533 /** @defgroup LSM6DS0_XG_Accelerometer_Selftest_Enable_Selection_CTRL_REG10 LSM6DS0_XG_Accelerometer_Selftest_Enable_Selection_CTRL_REG10
antseggs 0:5a49275457c6 534 * @{
antseggs 0:5a49275457c6 535 */
antseggs 0:5a49275457c6 536 #define LSM6DS0_XL_ST_DISABLE ((uint8_t)0x00) /*!< Accel selftest disable */
antseggs 0:5a49275457c6 537 #define LSM6DS0_XL_ST_ENABLE ((uint8_t)0x01) /*!< Accel selftest enable */
antseggs 0:5a49275457c6 538
antseggs 0:5a49275457c6 539 #define LSM6DS0_XL_ST_MASK ((uint8_t)0x01)
antseggs 0:5a49275457c6 540
antseggs 0:5a49275457c6 541 /**
antseggs 0:5a49275457c6 542 * @}
antseggs 0:5a49275457c6 543 */
antseggs 0:5a49275457c6 544
antseggs 0:5a49275457c6 545 /**
antseggs 0:5a49275457c6 546 * @}
antseggs 0:5a49275457c6 547 */
antseggs 0:5a49275457c6 548
antseggs 0:5a49275457c6 549
antseggs 0:5a49275457c6 550 /** @defgroup LSM6DS0_Imported_Functions LSM6DS0_Imported_Functions
antseggs 0:5a49275457c6 551 * @{
antseggs 0:5a49275457c6 552 */
antseggs 0:5a49275457c6 553
antseggs 0:5a49275457c6 554 /* Six axes sensor IO functions */
antseggs 0:5a49275457c6 555 extern IMU_6AXES_StatusTypeDef LSM6DS0_IO_Init(void);
antseggs 0:5a49275457c6 556 extern IMU_6AXES_StatusTypeDef LSM6DS0_IO_Write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
antseggs 0:5a49275457c6 557 uint16_t NumByteToWrite);
antseggs 0:5a49275457c6 558 extern IMU_6AXES_StatusTypeDef LSM6DS0_IO_Read(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr,
antseggs 0:5a49275457c6 559 uint16_t NumByteToRead);
antseggs 0:5a49275457c6 560 extern void LSM6DS0_IO_ITConfig( void );
antseggs 0:5a49275457c6 561
antseggs 0:5a49275457c6 562 /**
antseggs 0:5a49275457c6 563 * @}
antseggs 0:5a49275457c6 564 */
antseggs 0:5a49275457c6 565
antseggs 0:5a49275457c6 566 /* ------------------------------------------------------- */
antseggs 0:5a49275457c6 567 /* Here you should declare the internal struct of */
antseggs 0:5a49275457c6 568 /* extended features of LIS3MDL. See the example of */
antseggs 0:5a49275457c6 569 /* LSM6DS3 in lsm6ds3.h */
antseggs 0:5a49275457c6 570 /* ------------------------------------------------------- */
antseggs 0:5a49275457c6 571
antseggs 0:5a49275457c6 572 /** @addtogroup LSM6DS0_Exported_Variables LSM6DS0_Exported_Variables
antseggs 0:5a49275457c6 573 * @{
antseggs 0:5a49275457c6 574 */
antseggs 0:5a49275457c6 575
antseggs 0:5a49275457c6 576 /* Six axes sensor driver structure */
antseggs 0:5a49275457c6 577 extern IMU_6AXES_DrvTypeDef LSM6DS0Drv;
antseggs 0:5a49275457c6 578 extern IMU_6AXES_DrvExtTypeDef LSM6DS0Drv_ext;
antseggs 0:5a49275457c6 579
antseggs 0:5a49275457c6 580 /**
antseggs 0:5a49275457c6 581 * @}
antseggs 0:5a49275457c6 582 */
antseggs 0:5a49275457c6 583
antseggs 0:5a49275457c6 584 /**
antseggs 0:5a49275457c6 585 * @}
antseggs 0:5a49275457c6 586 */
antseggs 0:5a49275457c6 587
antseggs 0:5a49275457c6 588 /**
antseggs 0:5a49275457c6 589 * @}
antseggs 0:5a49275457c6 590 */
antseggs 0:5a49275457c6 591
antseggs 0:5a49275457c6 592 /**
antseggs 0:5a49275457c6 593 * @}
antseggs 0:5a49275457c6 594 */
antseggs 0:5a49275457c6 595
antseggs 0:5a49275457c6 596 #ifdef __cplusplus
antseggs 0:5a49275457c6 597 }
antseggs 0:5a49275457c6 598 #endif
antseggs 0:5a49275457c6 599
antseggs 0:5a49275457c6 600 #endif /* __LSM6DS0_H */
antseggs 0:5a49275457c6 601
antseggs 0:5a49275457c6 602 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/