ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Committer:
julientiron
Date:
Tue May 19 16:53:44 2015 +0000
Revision:
1:bdbf36f8408d
ddd; ;

Who changed what in which revision?

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