class IMU nucleo

Dependents:   Coupe-Robotique-FIP-Main

Fork of IMU_FIP by Robotique FIP

Committer:
quentin9696
Date:
Thu May 21 11:21:58 2015 +0000
Revision:
5:e2e603447679
Parent:
0:528e23a13fb7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
quentin9696 0:528e23a13fb7 1 /**
quentin9696 0:528e23a13fb7 2 ******************************************************************************
quentin9696 0:528e23a13fb7 3 * @file lsm6ds0.h
quentin9696 0:528e23a13fb7 4 * @author MEMS Application Team
quentin9696 0:528e23a13fb7 5 * @version V1.0.0
quentin9696 0:528e23a13fb7 6 * @date 30-July-2014
quentin9696 0:528e23a13fb7 7 * @brief This file contains definitions for the lsm6ds0.c
quentin9696 0:528e23a13fb7 8 * firmware driver.
quentin9696 0:528e23a13fb7 9 ******************************************************************************
quentin9696 0:528e23a13fb7 10 * @attention
quentin9696 0:528e23a13fb7 11 *
quentin9696 0:528e23a13fb7 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
quentin9696 0:528e23a13fb7 13 *
quentin9696 0:528e23a13fb7 14 * Redistribution and use in source and binary forms, with or without modification,
quentin9696 0:528e23a13fb7 15 * are permitted provided that the following conditions are met:
quentin9696 0:528e23a13fb7 16 * 1. Redistributions of source code must retain the above copyright notice,
quentin9696 0:528e23a13fb7 17 * this list of conditions and the following disclaimer.
quentin9696 0:528e23a13fb7 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
quentin9696 0:528e23a13fb7 19 * this list of conditions and the following disclaimer in the documentation
quentin9696 0:528e23a13fb7 20 * and/or other materials provided with the distribution.
quentin9696 0:528e23a13fb7 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
quentin9696 0:528e23a13fb7 22 * may be used to endorse or promote products derived from this software
quentin9696 0:528e23a13fb7 23 * without specific prior written permission.
quentin9696 0:528e23a13fb7 24 *
quentin9696 0:528e23a13fb7 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
quentin9696 0:528e23a13fb7 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
quentin9696 0:528e23a13fb7 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
quentin9696 0:528e23a13fb7 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
quentin9696 0:528e23a13fb7 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
quentin9696 0:528e23a13fb7 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
quentin9696 0:528e23a13fb7 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
quentin9696 0:528e23a13fb7 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
quentin9696 0:528e23a13fb7 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
quentin9696 0:528e23a13fb7 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
quentin9696 0:528e23a13fb7 35 *
quentin9696 0:528e23a13fb7 36 ******************************************************************************
quentin9696 0:528e23a13fb7 37 */
quentin9696 0:528e23a13fb7 38
quentin9696 0:528e23a13fb7 39 /* Define to prevent recursive inclusion -------------------------------------*/
quentin9696 0:528e23a13fb7 40 #ifndef __LSM6DS0_PLATFORM_H
quentin9696 0:528e23a13fb7 41 #define __LSM6DS0_PLATFORM_H
quentin9696 0:528e23a13fb7 42
quentin9696 0:528e23a13fb7 43
quentin9696 0:528e23a13fb7 44 /******************************************************************************/
quentin9696 0:528e23a13fb7 45 /*********** START ACCELEROMETER AND GYROSCOPE REGISTER MAPPING **************/
quentin9696 0:528e23a13fb7 46 /******************************************************************************/
quentin9696 0:528e23a13fb7 47
quentin9696 0:528e23a13fb7 48
quentin9696 0:528e23a13fb7 49 /***************************************** COMMON REGISTERS ********************************************/
quentin9696 0:528e23a13fb7 50
quentin9696 0:528e23a13fb7 51 /**
quentin9696 0:528e23a13fb7 52 * @brief Interrupt config register
quentin9696 0:528e23a13fb7 53 * \code
quentin9696 0:528e23a13fb7 54 * Read/write
quentin9696 0:528e23a13fb7 55 * Default value: 0x00
quentin9696 0:528e23a13fb7 56 * [7] INT_IG_G: Gyroscope interrupt enable on INT pin
quentin9696 0:528e23a13fb7 57 * [6] INT_IG_XL: Accelerometer interrupt generator on INT pin
quentin9696 0:528e23a13fb7 58 * [5] INT_FSS5: FSS5 interrupt enable on INT pin
quentin9696 0:528e23a13fb7 59 * [4] INT_OVR: Overrun interrupt on INT pin
quentin9696 0:528e23a13fb7 60 * [3] INT_FTH: Gyroscope interrupt enable on INT pin
quentin9696 0:528e23a13fb7 61 * [2] INT_BOOT: Accelerometer interrupt generator on INT pin
quentin9696 0:528e23a13fb7 62 * [1] INT_DRDY_G: FSS5 interrupt enable on INT pin
quentin9696 0:528e23a13fb7 63 * [0] INT_DRDY_XL: Overrun interrupt on INT pin
quentin9696 0:528e23a13fb7 64 * \endcode
quentin9696 0:528e23a13fb7 65 */
quentin9696 0:528e23a13fb7 66 #define LSM6DS0_XG_INT_CTRL 0x0C
quentin9696 0:528e23a13fb7 67
quentin9696 0:528e23a13fb7 68
quentin9696 0:528e23a13fb7 69 /**
quentin9696 0:528e23a13fb7 70 * @brief Device identifier register.
quentin9696 0:528e23a13fb7 71 * \code
quentin9696 0:528e23a13fb7 72 * Read
quentin9696 0:528e23a13fb7 73 * Default value:
quentin9696 0:528e23a13fb7 74 * [7:0] This read-only register contains the device identifier
quentin9696 0:528e23a13fb7 75 * \endcode
quentin9696 0:528e23a13fb7 76 */
quentin9696 0:528e23a13fb7 77 #define LSM6DS0_XG_WHO_AM_I_ADDR 0x0F
quentin9696 0:528e23a13fb7 78
quentin9696 0:528e23a13fb7 79
quentin9696 0:528e23a13fb7 80 /**
quentin9696 0:528e23a13fb7 81 * @brief Control Register 4
quentin9696 0:528e23a13fb7 82 * \code
quentin9696 0:528e23a13fb7 83 * Read/write
quentin9696 0:528e23a13fb7 84 * Default value: 0x38
quentin9696 0:528e23a13fb7 85 * [5] Zen_G: Gyroscope’s Z-axis output enable
quentin9696 0:528e23a13fb7 86 * [4] Yen_G: Gyroscope’s Y-axis output enable
quentin9696 0:528e23a13fb7 87 * [3] Xen_G: Gyroscope’s X-axis output enable
quentin9696 0:528e23a13fb7 88 * \endcode
quentin9696 0:528e23a13fb7 89 */
quentin9696 0:528e23a13fb7 90 #define LSM6DS0_XG_CTRL_REG4 0x1E
quentin9696 0:528e23a13fb7 91
quentin9696 0:528e23a13fb7 92
quentin9696 0:528e23a13fb7 93 /**
quentin9696 0:528e23a13fb7 94 * @brief Control Register 10
quentin9696 0:528e23a13fb7 95 * \code
quentin9696 0:528e23a13fb7 96 * Read/write
quentin9696 0:528e23a13fb7 97 * Default value: 0x00
quentin9696 0:528e23a13fb7 98 * [2] ST_G: Gyro selftest disable (0) / enable (1)
quentin9696 0:528e23a13fb7 99 * [0] ST_XL: Accel selftest disable (0) / enable (1)
quentin9696 0:528e23a13fb7 100 * \endcode
quentin9696 0:528e23a13fb7 101 */
quentin9696 0:528e23a13fb7 102 #define LSM6DS0_XG_CTRL_REG10 0x24
quentin9696 0:528e23a13fb7 103
quentin9696 0:528e23a13fb7 104
quentin9696 0:528e23a13fb7 105 /***************************************** GYROSCOPE REGISTERS ********************************************/
quentin9696 0:528e23a13fb7 106
quentin9696 0:528e23a13fb7 107 /**
quentin9696 0:528e23a13fb7 108 * @brief Angular rate sensor Control Register 1
quentin9696 0:528e23a13fb7 109 * \code
quentin9696 0:528e23a13fb7 110 * Read/write
quentin9696 0:528e23a13fb7 111 * Default value: 0x00
quentin9696 0:528e23a13fb7 112 * [7:5] ODR_G2-0: Gyroscope output data rate selection
quentin9696 0:528e23a13fb7 113 * [4:3] FS_G1-0: Gyroscope full-scale selection
quentin9696 0:528e23a13fb7 114 * [2] This bit must be set to ‘0’ for the correct operation of the device
quentin9696 0:528e23a13fb7 115 * [1:0] BW_G1-0: Gyroscope bandwidth selection
quentin9696 0:528e23a13fb7 116 * \endcode
quentin9696 0:528e23a13fb7 117 */
quentin9696 0:528e23a13fb7 118 #define LSM6DS0_XG_CTRL_REG1_G 0x10
quentin9696 0:528e23a13fb7 119
quentin9696 0:528e23a13fb7 120
quentin9696 0:528e23a13fb7 121 /**
quentin9696 0:528e23a13fb7 122 * @brief Gyroscope data (LSB)
quentin9696 0:528e23a13fb7 123 * \code
quentin9696 0:528e23a13fb7 124 * Read
quentin9696 0:528e23a13fb7 125 * \endcode
quentin9696 0:528e23a13fb7 126 */
quentin9696 0:528e23a13fb7 127 #define LSM6DS0_XG_OUT_X_L_G 0x18
quentin9696 0:528e23a13fb7 128
quentin9696 0:528e23a13fb7 129
quentin9696 0:528e23a13fb7 130 /**
quentin9696 0:528e23a13fb7 131 * @brief Gyroscope data (MSB)
quentin9696 0:528e23a13fb7 132 * \code
quentin9696 0:528e23a13fb7 133 * Read
quentin9696 0:528e23a13fb7 134 * \endcode
quentin9696 0:528e23a13fb7 135 */
quentin9696 0:528e23a13fb7 136 #define LSM6DS0_XG_OUT_X_H_G 0x19
quentin9696 0:528e23a13fb7 137
quentin9696 0:528e23a13fb7 138
quentin9696 0:528e23a13fb7 139 /**
quentin9696 0:528e23a13fb7 140 * @brief Gyroscope data (LSB)
quentin9696 0:528e23a13fb7 141 * \code
quentin9696 0:528e23a13fb7 142 * Read
quentin9696 0:528e23a13fb7 143 * \endcode
quentin9696 0:528e23a13fb7 144 */
quentin9696 0:528e23a13fb7 145 #define LSM6DS0_XG_OUT_Y_L_G 0x1A
quentin9696 0:528e23a13fb7 146
quentin9696 0:528e23a13fb7 147
quentin9696 0:528e23a13fb7 148 /**
quentin9696 0:528e23a13fb7 149 * @brief Gyroscope data (MSB)
quentin9696 0:528e23a13fb7 150 * \code
quentin9696 0:528e23a13fb7 151 * Read
quentin9696 0:528e23a13fb7 152 * \endcode
quentin9696 0:528e23a13fb7 153 */
quentin9696 0:528e23a13fb7 154 #define LSM6DS0_XG_OUT_Y_H_G 0x1B
quentin9696 0:528e23a13fb7 155
quentin9696 0:528e23a13fb7 156
quentin9696 0:528e23a13fb7 157 /**
quentin9696 0:528e23a13fb7 158 * @brief Gyroscope data (LSB)
quentin9696 0:528e23a13fb7 159 * \code
quentin9696 0:528e23a13fb7 160 * Read
quentin9696 0:528e23a13fb7 161 * \endcode
quentin9696 0:528e23a13fb7 162 */
quentin9696 0:528e23a13fb7 163 #define LSM6DS0_XG_OUT_Z_L_G 0x1C
quentin9696 0:528e23a13fb7 164
quentin9696 0:528e23a13fb7 165
quentin9696 0:528e23a13fb7 166 /**
quentin9696 0:528e23a13fb7 167 * @brief Gyroscope data (MSB)
quentin9696 0:528e23a13fb7 168 * \code
quentin9696 0:528e23a13fb7 169 * Read
quentin9696 0:528e23a13fb7 170 * \endcode
quentin9696 0:528e23a13fb7 171 */
quentin9696 0:528e23a13fb7 172 #define LSM6DS0_XG_OUT_Z_H_G 0x1D
quentin9696 0:528e23a13fb7 173
quentin9696 0:528e23a13fb7 174
quentin9696 0:528e23a13fb7 175
quentin9696 0:528e23a13fb7 176 /*************************************** ACCELEROMETER REGISTERS *******************************************/
quentin9696 0:528e23a13fb7 177
quentin9696 0:528e23a13fb7 178 /**
quentin9696 0:528e23a13fb7 179 * @brief Linear acceleration sensor Control Register 6
quentin9696 0:528e23a13fb7 180 * \code
quentin9696 0:528e23a13fb7 181 * Read/write
quentin9696 0:528e23a13fb7 182 * Default value: 0x00
quentin9696 0:528e23a13fb7 183 * [7:5] ODR_XL2-0: Accelerometer Output data rate and power mode selection
quentin9696 0:528e23a13fb7 184 * [4:3] FS1_XL-FS0_XL: Accelerometer full-scale selection
quentin9696 0:528e23a13fb7 185 * [2] BW_SCAL_ODR: Bandwidth selection
quentin9696 0:528e23a13fb7 186 * [1:0] BW_XL1-0: Anti-aliasing filter bandwidth selection
quentin9696 0:528e23a13fb7 187 * \endcode
quentin9696 0:528e23a13fb7 188 */
quentin9696 0:528e23a13fb7 189 #define LSM6DS0_XG_CTRL_REG6_XL 0x20
quentin9696 0:528e23a13fb7 190
quentin9696 0:528e23a13fb7 191
quentin9696 0:528e23a13fb7 192 /**
quentin9696 0:528e23a13fb7 193 * @brief Linear acceleration sensor Control Register 5
quentin9696 0:528e23a13fb7 194 * \code
quentin9696 0:528e23a13fb7 195 * Read/write
quentin9696 0:528e23a13fb7 196 * Default value: 0x38
quentin9696 0:528e23a13fb7 197 * [7:6] DEC1-0: Decimation of acceleration data on OUT REG and FIFO
quentin9696 0:528e23a13fb7 198 * [5] Zen_XL: Accelerometer’s Z-axis output enable
quentin9696 0:528e23a13fb7 199 * [4] Yen_XL: Accelerometer’s Y-axis output enable
quentin9696 0:528e23a13fb7 200 * [3] Xen_XL: Accelerometer’s X-axis output enable
quentin9696 0:528e23a13fb7 201 * [2:0] These bits must be set to ‘0’ for the correct operation of the device
quentin9696 0:528e23a13fb7 202 * \endcode
quentin9696 0:528e23a13fb7 203 */
quentin9696 0:528e23a13fb7 204 #define LSM6DS0_XG_CTRL_REG5_XL 0x1F
quentin9696 0:528e23a13fb7 205
quentin9696 0:528e23a13fb7 206
quentin9696 0:528e23a13fb7 207 /**
quentin9696 0:528e23a13fb7 208 * @brief Accelerometer data (LSB)
quentin9696 0:528e23a13fb7 209 * \code
quentin9696 0:528e23a13fb7 210 * Read
quentin9696 0:528e23a13fb7 211 * \endcode
quentin9696 0:528e23a13fb7 212 */
quentin9696 0:528e23a13fb7 213 #define LSM6DS0_XG_OUT_X_L_XL 0x28
quentin9696 0:528e23a13fb7 214
quentin9696 0:528e23a13fb7 215
quentin9696 0:528e23a13fb7 216 /**
quentin9696 0:528e23a13fb7 217 * @brief Accelerometer data (MSB)
quentin9696 0:528e23a13fb7 218 * \code
quentin9696 0:528e23a13fb7 219 * Read
quentin9696 0:528e23a13fb7 220 * \endcode
quentin9696 0:528e23a13fb7 221 */
quentin9696 0:528e23a13fb7 222 #define LSM6DS0_XG_OUT_X_H_XL 0x29
quentin9696 0:528e23a13fb7 223
quentin9696 0:528e23a13fb7 224
quentin9696 0:528e23a13fb7 225 /**
quentin9696 0:528e23a13fb7 226 * @brief Accelerometer data (LSB)
quentin9696 0:528e23a13fb7 227 * \code
quentin9696 0:528e23a13fb7 228 * Read
quentin9696 0:528e23a13fb7 229 * \endcode
quentin9696 0:528e23a13fb7 230 */
quentin9696 0:528e23a13fb7 231 #define LSM6DS0_XG_OUT_Y_L_XL 0x2A
quentin9696 0:528e23a13fb7 232
quentin9696 0:528e23a13fb7 233
quentin9696 0:528e23a13fb7 234 /**
quentin9696 0:528e23a13fb7 235 * @brief Accelerometer data (MSB)
quentin9696 0:528e23a13fb7 236 * \code
quentin9696 0:528e23a13fb7 237 * Read
quentin9696 0:528e23a13fb7 238 * \endcode
quentin9696 0:528e23a13fb7 239 */
quentin9696 0:528e23a13fb7 240 #define LSM6DS0_XG_OUT_Y_H_XL 0x2B
quentin9696 0:528e23a13fb7 241
quentin9696 0:528e23a13fb7 242
quentin9696 0:528e23a13fb7 243 /**
quentin9696 0:528e23a13fb7 244 * @brief Accelerometer data (LSB)
quentin9696 0:528e23a13fb7 245 * \code
quentin9696 0:528e23a13fb7 246 * Read
quentin9696 0:528e23a13fb7 247 * \endcode
quentin9696 0:528e23a13fb7 248 */
quentin9696 0:528e23a13fb7 249 #define LSM6DS0_XG_OUT_Z_L_XL 0x2C
quentin9696 0:528e23a13fb7 250
quentin9696 0:528e23a13fb7 251
quentin9696 0:528e23a13fb7 252 /**
quentin9696 0:528e23a13fb7 253 * @brief Accelerometer data (MSB)
quentin9696 0:528e23a13fb7 254 * \code
quentin9696 0:528e23a13fb7 255 * Read
quentin9696 0:528e23a13fb7 256 * \endcode
quentin9696 0:528e23a13fb7 257 */
quentin9696 0:528e23a13fb7 258 #define LSM6DS0_XG_OUT_Z_H_XL 0x2D
quentin9696 0:528e23a13fb7 259
quentin9696 0:528e23a13fb7 260 /******************************************************************************/
quentin9696 0:528e23a13fb7 261 /************* END ACCELEROMETER AND GYROSCOPE REGISTER MAPPING **************/
quentin9696 0:528e23a13fb7 262 /******************************************************************************/
quentin9696 0:528e23a13fb7 263
quentin9696 0:528e23a13fb7 264
quentin9696 0:528e23a13fb7 265
quentin9696 0:528e23a13fb7 266 /**
quentin9696 0:528e23a13fb7 267 * @brief Device Address
quentin9696 0:528e23a13fb7 268 */
quentin9696 0:528e23a13fb7 269
quentin9696 0:528e23a13fb7 270 #define LSM6DS0_XG_MEMS_ADDRESS 0xD6 // SAD[0] = 1
quentin9696 0:528e23a13fb7 271
quentin9696 0:528e23a13fb7 272 /**
quentin9696 0:528e23a13fb7 273 * @brief Device Identifier. Default value of the WHO_AM_I register.
quentin9696 0:528e23a13fb7 274 */
quentin9696 0:528e23a13fb7 275 #define I_AM_LSM6DS0_XG ((uint8_t)0x68)
quentin9696 0:528e23a13fb7 276
quentin9696 0:528e23a13fb7 277
quentin9696 0:528e23a13fb7 278
quentin9696 0:528e23a13fb7 279 /************************************** GYROSCOPE REGISTERS VALUE *******************************************/
quentin9696 0:528e23a13fb7 280
quentin9696 0:528e23a13fb7 281
quentin9696 0:528e23a13fb7 282 /** @defgroup LSM6DS0_XG Gyroscope Output Data Rate selection CTRL_REG1_G
quentin9696 0:528e23a13fb7 283 * @{
quentin9696 0:528e23a13fb7 284 */
quentin9696 0:528e23a13fb7 285 #define LSM6DS0_G_ODR_PD ((uint8_t)0x00) /*!< Output Data Rate: Power-down*/
quentin9696 0:528e23a13fb7 286 #define LSM6DS0_G_ODR_14_9HZ ((uint8_t)0x20) /*!< Output Data Rate: 14.9 Hz, cutoff 5Hz */
quentin9696 0:528e23a13fb7 287 #define LSM6DS0_G_ODR_59_5HZ ((uint8_t)0x40) /*!< Output Data Rate: 59.5 Hz, cutoff 19Hz */
quentin9696 0:528e23a13fb7 288 #define LSM6DS0_G_ODR_119HZ ((uint8_t)0x60) /*!< Output Data Rate: 119 Hz, cutoff 38Hz*/
quentin9696 0:528e23a13fb7 289 #define LSM6DS0_G_ODR_238HZ ((uint8_t)0x80) /*!< Output Data Rate: 238 Hz, cutoff 76Hz*/
quentin9696 0:528e23a13fb7 290 #define LSM6DS0_G_ODR_476HZ ((uint8_t)0xA0) /*!< Output Data Rate: 476 Hz, cutoff 100Hz*/
quentin9696 0:528e23a13fb7 291 #define LSM6DS0_G_ODR_952HZ ((uint8_t)0xC0) /*!< Output Data Rate: 952 Hz, cutoff 100Hz*/
quentin9696 0:528e23a13fb7 292
quentin9696 0:528e23a13fb7 293 #define LSM6DS0_G_ODR_MASK ((uint8_t)0xE0)
quentin9696 0:528e23a13fb7 294
quentin9696 0:528e23a13fb7 295
quentin9696 0:528e23a13fb7 296
quentin9696 0:528e23a13fb7 297 /** @defgroup LSM6DS0_XG Gyroscope Bandwidth selection CTRL_REG1_G
quentin9696 0:528e23a13fb7 298 * @{
quentin9696 0:528e23a13fb7 299 */
quentin9696 0:528e23a13fb7 300 #define LSM6DS0_G_BW_00 ((uint8_t)0x00) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
quentin9696 0:528e23a13fb7 301 - cutoff = n.a. when ODR = 14.9
quentin9696 0:528e23a13fb7 302 - cutoff = 16 when ODR = 59.5
quentin9696 0:528e23a13fb7 303 - cutoff = 14 when ODR = 119
quentin9696 0:528e23a13fb7 304 - cutoff = 14 when ODR = 238
quentin9696 0:528e23a13fb7 305 - cutoff = 21 when ODR = 476
quentin9696 0:528e23a13fb7 306 - cutoff = 33 when ODR = 952 */
quentin9696 0:528e23a13fb7 307 #define LSM6DS0_G_BW_01 ((uint8_t)0x01) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
quentin9696 0:528e23a13fb7 308 - cutoff = n.a. when ODR = 14.9
quentin9696 0:528e23a13fb7 309 - cutoff = 16 when ODR = 59.5
quentin9696 0:528e23a13fb7 310 - cutoff = 31 when ODR = 119
quentin9696 0:528e23a13fb7 311 - cutoff = 29 when ODR = 238
quentin9696 0:528e23a13fb7 312 - cutoff = 28 when ODR = 476
quentin9696 0:528e23a13fb7 313 - cutoff = 40 when ODR = 952 */
quentin9696 0:528e23a13fb7 314 #define LSM6DS0_G_BW_10 ((uint8_t)0x02) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
quentin9696 0:528e23a13fb7 315 - cutoff = n.a. when ODR = 14.9
quentin9696 0:528e23a13fb7 316 - cutoff = 16 when ODR = 59.5
quentin9696 0:528e23a13fb7 317 - cutoff = 31 when ODR = 119
quentin9696 0:528e23a13fb7 318 - cutoff = 63 when ODR = 238
quentin9696 0:528e23a13fb7 319 - cutoff = 57 when ODR = 476
quentin9696 0:528e23a13fb7 320 - cutoff = 58 when ODR = 952 */
quentin9696 0:528e23a13fb7 321 #define LSM6DS0_G_BW_11 ((uint8_t)0x03) /*!< Bandwidth selection: - cutoff = n.a. when ODR = Power-down
quentin9696 0:528e23a13fb7 322 - cutoff = n.a. when ODR = 14.9
quentin9696 0:528e23a13fb7 323 - cutoff = 16 when ODR = 59.5
quentin9696 0:528e23a13fb7 324 - cutoff = 31 when ODR = 119
quentin9696 0:528e23a13fb7 325 - cutoff = 78 when ODR = 238
quentin9696 0:528e23a13fb7 326 - cutoff = 100 when ODR = 476
quentin9696 0:528e23a13fb7 327 - cutoff = 100 when ODR = 952 */
quentin9696 0:528e23a13fb7 328
quentin9696 0:528e23a13fb7 329 #define LSM6DS0_G_BW_MASK ((uint8_t)0x03)
quentin9696 0:528e23a13fb7 330
quentin9696 0:528e23a13fb7 331
quentin9696 0:528e23a13fb7 332 /** @defgroup LSM6DS0_XG Gyroscope Full scale selection CTRL_REG1_G
quentin9696 0:528e23a13fb7 333 * @{
quentin9696 0:528e23a13fb7 334 */
quentin9696 0:528e23a13fb7 335 #define LSM6DS0_G_FS_245 ((uint8_t)0x00) /*!< Full scale: 245 dps*/
quentin9696 0:528e23a13fb7 336 #define LSM6DS0_G_FS_500 ((uint8_t)0x08) /*!< Full scale: 500 dps */
quentin9696 0:528e23a13fb7 337 #define LSM6DS0_G_FS_2000 ((uint8_t)0x18) /*!< Full scale: 2000 dps */
quentin9696 0:528e23a13fb7 338
quentin9696 0:528e23a13fb7 339 #define LSM6DS0_G_FS_MASK ((uint8_t)0x18)
quentin9696 0:528e23a13fb7 340
quentin9696 0:528e23a13fb7 341
quentin9696 0:528e23a13fb7 342 /** @defgroup LSM6DS0_XG Gyroscope’s Z-axis output enable selection CTRL_REG4
quentin9696 0:528e23a13fb7 343 * @{
quentin9696 0:528e23a13fb7 344 */
quentin9696 0:528e23a13fb7 345 #define LSM6DS0_G_ZEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope’s Z-axis output enable: disable */
quentin9696 0:528e23a13fb7 346 #define LSM6DS0_G_ZEN_ENABLE ((uint8_t)0x20) /*!< Gyroscope’s Z-axis output enable: enable */
quentin9696 0:528e23a13fb7 347
quentin9696 0:528e23a13fb7 348 #define LSM6DS0_G_ZEN_MASK ((uint8_t)0x20)
quentin9696 0:528e23a13fb7 349
quentin9696 0:528e23a13fb7 350
quentin9696 0:528e23a13fb7 351 /** @defgroup LSM6DS0_XG Gyroscope’s Y-axis output enable selection CTRL_REG4
quentin9696 0:528e23a13fb7 352 * @{
quentin9696 0:528e23a13fb7 353 */
quentin9696 0:528e23a13fb7 354 #define LSM6DS0_G_YEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope’s Y-axis output enable: disable */
quentin9696 0:528e23a13fb7 355 #define LSM6DS0_G_YEN_ENABLE ((uint8_t)0x10) /*!< Gyroscope’s Y-axis output enable: enable */
quentin9696 0:528e23a13fb7 356
quentin9696 0:528e23a13fb7 357 #define LSM6DS0_G_YEN_MASK ((uint8_t)0x10)
quentin9696 0:528e23a13fb7 358
quentin9696 0:528e23a13fb7 359
quentin9696 0:528e23a13fb7 360 /** @defgroup LSM6DS0_XG Gyroscope’s X-axis output enable selection CTRL_REG4
quentin9696 0:528e23a13fb7 361 * @{
quentin9696 0:528e23a13fb7 362 */
quentin9696 0:528e23a13fb7 363 #define LSM6DS0_G_XEN_DISABLE ((uint8_t)0x00) /*!< Gyroscope’s X-axis output enable: disable */
quentin9696 0:528e23a13fb7 364 #define LSM6DS0_G_XEN_ENABLE ((uint8_t)0x08) /*!< Gyroscope’s X-axis output enable: enable */
quentin9696 0:528e23a13fb7 365
quentin9696 0:528e23a13fb7 366 #define LSM6DS0_G_XEN_MASK ((uint8_t)0x08)
quentin9696 0:528e23a13fb7 367
quentin9696 0:528e23a13fb7 368
quentin9696 0:528e23a13fb7 369 /** @defgroup LSM6DS0 Gyro selftest en/dis - LSM6DS0_XG_CTRL_REG10
quentin9696 0:528e23a13fb7 370 * @{
quentin9696 0:528e23a13fb7 371 */
quentin9696 0:528e23a13fb7 372 #define LSM6DS0_G_ST_DISABLE ((uint8_t)0x00) /*!< Gyro selftest disable */
quentin9696 0:528e23a13fb7 373 #define LSM6DS0_G_ST_ENABLE ((uint8_t)0x04) /*!< Gyro selftest enable */
quentin9696 0:528e23a13fb7 374
quentin9696 0:528e23a13fb7 375 #define LSM6DS0_G_ST_MASK ((uint8_t)0x04)
quentin9696 0:528e23a13fb7 376
quentin9696 0:528e23a13fb7 377 /**
quentin9696 0:528e23a13fb7 378 * @}
quentin9696 0:528e23a13fb7 379 */
quentin9696 0:528e23a13fb7 380
quentin9696 0:528e23a13fb7 381
quentin9696 0:528e23a13fb7 382 /************************************ ACCELEROMETER REGISTERS VALUE *****************************************/
quentin9696 0:528e23a13fb7 383
quentin9696 0:528e23a13fb7 384 /** @defgroup LSM6DS0_XG Accelerometer Output Data Rate selection CTRL_REG6_XL
quentin9696 0:528e23a13fb7 385 * @{
quentin9696 0:528e23a13fb7 386 */
quentin9696 0:528e23a13fb7 387 #define LSM6DS0_XL_ODR_PD ((uint8_t)0x00) /*!< Output Data Rate: Power-down*/
quentin9696 0:528e23a13fb7 388 #define LSM6DS0_XL_ODR_10HZ ((uint8_t)0x20) /*!< Output Data Rate: 10 Hz*/
quentin9696 0:528e23a13fb7 389 #define LSM6DS0_XL_ODR_50HZ ((uint8_t)0x40) /*!< Output Data Rate: 50 Hz */
quentin9696 0:528e23a13fb7 390 #define LSM6DS0_XL_ODR_119HZ ((uint8_t)0x60) /*!< Output Data Rate: 119 Hz */
quentin9696 0:528e23a13fb7 391 #define LSM6DS0_XL_ODR_238HZ ((uint8_t)0x80) /*!< Output Data Rate: 238 Hz */
quentin9696 0:528e23a13fb7 392 #define LSM6DS0_XL_ODR_476HZ ((uint8_t)0xA0) /*!< Output Data Rate: 476 Hz */
quentin9696 0:528e23a13fb7 393 #define LSM6DS0_XL_ODR_952HZ ((uint8_t)0xC0) /*!< Output Data Rate: 952 Hz */
quentin9696 0:528e23a13fb7 394
quentin9696 0:528e23a13fb7 395 #define LSM6DS0_XL_ODR_MASK ((uint8_t)0xE0)
quentin9696 0:528e23a13fb7 396
quentin9696 0:528e23a13fb7 397
quentin9696 0:528e23a13fb7 398 /** @defgroup LSM6DS0_XG Accelerometer Full scale selection CTRL_REG6_XL
quentin9696 0:528e23a13fb7 399 * @{
quentin9696 0:528e23a13fb7 400 */
quentin9696 0:528e23a13fb7 401 #define LSM6DS0_XL_FS_2G ((uint8_t)0x00) /*!< Full scale: +- 2g */
quentin9696 0:528e23a13fb7 402 #define LSM6DS0_XL_FS_4G ((uint8_t)0x10) /*!< Full scale: +- 4g */
quentin9696 0:528e23a13fb7 403 #define LSM6DS0_XL_FS_8G ((uint8_t)0x18) /*!< Full scale: +- 8g */
quentin9696 0:528e23a13fb7 404
quentin9696 0:528e23a13fb7 405 #define LSM6DS0_XL_FS_MASK ((uint8_t)0x18)
quentin9696 0:528e23a13fb7 406
quentin9696 0:528e23a13fb7 407
quentin9696 0:528e23a13fb7 408 /** @defgroup LSM6DS0_XG Accelerometer Bandwidth selection CTRL_REG6_XL
quentin9696 0:528e23a13fb7 409 * @{
quentin9696 0:528e23a13fb7 410 */
quentin9696 0:528e23a13fb7 411 #define LSM6DS0_XL_BW_SCAL_ODR ((uint8_t)0x00) /*!< Bandwidth selection: determined by ODR:
quentin9696 0:528e23a13fb7 412 - BW = 408Hz when ODR = 952Hz, 50Hz, 10Hz
quentin9696 0:528e23a13fb7 413 - BW = 211Hz when ODR = 476Hz
quentin9696 0:528e23a13fb7 414 - BW = 105Hz when ODR = 238Hz
quentin9696 0:528e23a13fb7 415 - BW = 50Hz when ODR = 119Hz */
quentin9696 0:528e23a13fb7 416 #define LSM6DS0_XL_BW_SCAL_BW ((uint8_t)0x04) /*!< Bandwidth selection: selected according to Anti aliasing filter bandwidth */
quentin9696 0:528e23a13fb7 417
quentin9696 0:528e23a13fb7 418 #define LSM6DS0_XL_BW_SCAL_MASK ((uint8_t)0x04)
quentin9696 0:528e23a13fb7 419
quentin9696 0:528e23a13fb7 420
quentin9696 0:528e23a13fb7 421 /** @defgroup LSM6DS0_XG Accelerometer Anti aliasing filter bandwidth selection CTRL_REG6_XL
quentin9696 0:528e23a13fb7 422 * @{
quentin9696 0:528e23a13fb7 423 */
quentin9696 0:528e23a13fb7 424 #define LSM6DS0_XL_BW_408HZ ((uint8_t)0x00) /*!< Anti-aliasing filter bandwidht: 408 Hz */
quentin9696 0:528e23a13fb7 425 #define LSM6DS0_XL_BW_211HZ ((uint8_t)0x01) /*!< Anti-aliasing filter bandwidht: 211 Hz */
quentin9696 0:528e23a13fb7 426 #define LSM6DS0_XL_BW_105HZ ((uint8_t)0x02) /*!< Anti-aliasing filter bandwidht: 105 Hz */
quentin9696 0:528e23a13fb7 427 #define LSM6DS0_XL_BW_50HZ ((uint8_t)0x03) /*!< Anti-aliasing filter bandwidht: 50 Hz */
quentin9696 0:528e23a13fb7 428
quentin9696 0:528e23a13fb7 429 #define LSM6DS0_XL_BW_MASK ((uint8_t)0x03)
quentin9696 0:528e23a13fb7 430
quentin9696 0:528e23a13fb7 431
quentin9696 0:528e23a13fb7 432 /** @defgroup LSM6DS0_XG Accelerometer Decimation of acceleration data selection CTRL_REG5_XL
quentin9696 0:528e23a13fb7 433 * @{
quentin9696 0:528e23a13fb7 434 */
quentin9696 0:528e23a13fb7 435 #define LSM6DS0_XL_DEC_NO ((uint8_t)0x00) /*!< Decimation of acceleration data: no decimation */
quentin9696 0:528e23a13fb7 436 #define LSM6DS0_XL_DEC_EVERY_2S ((uint8_t)0x40) /*!< Decimation of acceleration data: update every 2 samples */
quentin9696 0:528e23a13fb7 437 #define LSM6DS0_XL_DEC_EVERY_4S ((uint8_t)0x80) /*!< Decimation of acceleration data: update every 4 samples */
quentin9696 0:528e23a13fb7 438 #define LSM6DS0_XL_DEC_EVERY_8S ((uint8_t)0xC0) /*!< Decimation of acceleration data: update every 8 samples */
quentin9696 0:528e23a13fb7 439
quentin9696 0:528e23a13fb7 440 #define LSM6DS0_XL_DEC_MASK ((uint8_t)0xC0)
quentin9696 0:528e23a13fb7 441
quentin9696 0:528e23a13fb7 442
quentin9696 0:528e23a13fb7 443 /** @defgroup LSM6DS0_XG Accelerometer’s Z-axis output enable selection CTRL_REG5_XL
quentin9696 0:528e23a13fb7 444 * @{
quentin9696 0:528e23a13fb7 445 */
quentin9696 0:528e23a13fb7 446 #define LSM6DS0_XL_ZEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer’s Z-axis output enable: disable */
quentin9696 0:528e23a13fb7 447 #define LSM6DS0_XL_ZEN_ENABLE ((uint8_t)0x20) /*!< Accelerometer’s Z-axis output enable: enable */
quentin9696 0:528e23a13fb7 448
quentin9696 0:528e23a13fb7 449 #define LSM6DS0_XL_ZEN_MASK ((uint8_t)0x20)
quentin9696 0:528e23a13fb7 450
quentin9696 0:528e23a13fb7 451
quentin9696 0:528e23a13fb7 452 /** @defgroup LSM6DS0_XG Accelerometer’s Y-axis output enable selection CTRL_REG5_XL
quentin9696 0:528e23a13fb7 453 * @{
quentin9696 0:528e23a13fb7 454 */
quentin9696 0:528e23a13fb7 455 #define LSM6DS0_XL_YEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer’s Y-axis output enable: disable */
quentin9696 0:528e23a13fb7 456 #define LSM6DS0_XL_YEN_ENABLE ((uint8_t)0x10) /*!< Accelerometer’s Y-axis output enable: enable */
quentin9696 0:528e23a13fb7 457
quentin9696 0:528e23a13fb7 458 #define LSM6DS0_XL_YEN_MASK ((uint8_t)0x10)
quentin9696 0:528e23a13fb7 459
quentin9696 0:528e23a13fb7 460
quentin9696 0:528e23a13fb7 461 /** @defgroup LSM6DS0_XG Accelerometer’s X-axis output enable selection CTRL_REG5_XL
quentin9696 0:528e23a13fb7 462 * @{
quentin9696 0:528e23a13fb7 463 */
quentin9696 0:528e23a13fb7 464 #define LSM6DS0_XL_XEN_DISABLE ((uint8_t)0x00) /*!< Accelerometer’s X-axis output enable: disable */
quentin9696 0:528e23a13fb7 465 #define LSM6DS0_XL_XEN_ENABLE ((uint8_t)0x08) /*!< Accelerometer’s X-axis output enable: enable */
quentin9696 0:528e23a13fb7 466
quentin9696 0:528e23a13fb7 467 #define LSM6DS0_XL_XEN_MASK ((uint8_t)0x08)
quentin9696 0:528e23a13fb7 468
quentin9696 0:528e23a13fb7 469 /**
quentin9696 0:528e23a13fb7 470 * @}
quentin9696 0:528e23a13fb7 471 */
quentin9696 0:528e23a13fb7 472
quentin9696 0:528e23a13fb7 473
quentin9696 0:528e23a13fb7 474 /** @defgroup LSM6DS0 Accel selftest en/dis - LSM6DS0_XG_CTRL_REG10
quentin9696 0:528e23a13fb7 475 * @{
quentin9696 0:528e23a13fb7 476 */
quentin9696 0:528e23a13fb7 477 #define LSM6DS0_XL_ST_DISABLE ((uint8_t)0x00) /*!< Accel selftest disable */
quentin9696 0:528e23a13fb7 478 #define LSM6DS0_XL_ST_ENABLE ((uint8_t)0x01) /*!< Accel selftest enable */
quentin9696 0:528e23a13fb7 479
quentin9696 0:528e23a13fb7 480 #define LSM6DS0_XL_ST_MASK ((uint8_t)0x01)
quentin9696 0:528e23a13fb7 481
quentin9696 0:528e23a13fb7 482
quentin9696 0:528e23a13fb7 483 #endif /* __LSM6DS0_PLATFORM_H */
quentin9696 0:528e23a13fb7 484
quentin9696 0:528e23a13fb7 485 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
quentin9696 0:528e23a13fb7 486