Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BSP_DISCO_L476VG/lsm303c.h@1:d0dfbce63a89, 2017-02-24 (annotated)
- Committer:
- elmot
- Date:
- Fri Feb 24 21:13:56 2017 +0000
- Revision:
- 1:d0dfbce63a89
Ready-to-copy
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| elmot | 1:d0dfbce63a89 | 1 | /** |
| elmot | 1:d0dfbce63a89 | 2 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 3 | * @file lsm303c.h |
| elmot | 1:d0dfbce63a89 | 4 | * @author MCD Application Team |
| elmot | 1:d0dfbce63a89 | 5 | * @version V1.0.0 |
| elmot | 1:d0dfbce63a89 | 6 | * @date 24-June-2015 |
| elmot | 1:d0dfbce63a89 | 7 | * @brief This file contains all the functions prototypes for the LSM303C.c driver. |
| elmot | 1:d0dfbce63a89 | 8 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 9 | * @attention |
| elmot | 1:d0dfbce63a89 | 10 | * |
| elmot | 1:d0dfbce63a89 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
| elmot | 1:d0dfbce63a89 | 12 | * |
| elmot | 1:d0dfbce63a89 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
| elmot | 1:d0dfbce63a89 | 14 | * are permitted provided that the following conditions are met: |
| elmot | 1:d0dfbce63a89 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
| elmot | 1:d0dfbce63a89 | 16 | * this list of conditions and the following disclaimer. |
| elmot | 1:d0dfbce63a89 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| elmot | 1:d0dfbce63a89 | 18 | * this list of conditions and the following disclaimer in the documentation |
| elmot | 1:d0dfbce63a89 | 19 | * and/or other materials provided with the distribution. |
| elmot | 1:d0dfbce63a89 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| elmot | 1:d0dfbce63a89 | 21 | * may be used to endorse or promote products derived from this software |
| elmot | 1:d0dfbce63a89 | 22 | * without specific prior written permission. |
| elmot | 1:d0dfbce63a89 | 23 | * |
| elmot | 1:d0dfbce63a89 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| elmot | 1:d0dfbce63a89 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| elmot | 1:d0dfbce63a89 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| elmot | 1:d0dfbce63a89 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| elmot | 1:d0dfbce63a89 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| elmot | 1:d0dfbce63a89 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| elmot | 1:d0dfbce63a89 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| elmot | 1:d0dfbce63a89 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| elmot | 1:d0dfbce63a89 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| elmot | 1:d0dfbce63a89 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| elmot | 1:d0dfbce63a89 | 34 | * |
| elmot | 1:d0dfbce63a89 | 35 | ****************************************************************************** |
| elmot | 1:d0dfbce63a89 | 36 | */ |
| elmot | 1:d0dfbce63a89 | 37 | |
| elmot | 1:d0dfbce63a89 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 39 | #ifndef __LSM303C_H |
| elmot | 1:d0dfbce63a89 | 40 | #define __LSM303C_H |
| elmot | 1:d0dfbce63a89 | 41 | |
| elmot | 1:d0dfbce63a89 | 42 | #ifdef __cplusplus |
| elmot | 1:d0dfbce63a89 | 43 | extern "C" { |
| elmot | 1:d0dfbce63a89 | 44 | #endif |
| elmot | 1:d0dfbce63a89 | 45 | |
| elmot | 1:d0dfbce63a89 | 46 | /* Includes ------------------------------------------------------------------*/ |
| elmot | 1:d0dfbce63a89 | 47 | #include "accelero.h" |
| elmot | 1:d0dfbce63a89 | 48 | #include "magneto.h" |
| elmot | 1:d0dfbce63a89 | 49 | |
| elmot | 1:d0dfbce63a89 | 50 | /** @addtogroup BSP |
| elmot | 1:d0dfbce63a89 | 51 | * @{ |
| elmot | 1:d0dfbce63a89 | 52 | */ |
| elmot | 1:d0dfbce63a89 | 53 | |
| elmot | 1:d0dfbce63a89 | 54 | /** @addtogroup Components |
| elmot | 1:d0dfbce63a89 | 55 | * @{ |
| elmot | 1:d0dfbce63a89 | 56 | */ |
| elmot | 1:d0dfbce63a89 | 57 | |
| elmot | 1:d0dfbce63a89 | 58 | /** @addtogroup LSM303C |
| elmot | 1:d0dfbce63a89 | 59 | * @{ |
| elmot | 1:d0dfbce63a89 | 60 | */ |
| elmot | 1:d0dfbce63a89 | 61 | |
| elmot | 1:d0dfbce63a89 | 62 | /** @defgroup LSM303C_Exported_Types |
| elmot | 1:d0dfbce63a89 | 63 | * @{ |
| elmot | 1:d0dfbce63a89 | 64 | */ |
| elmot | 1:d0dfbce63a89 | 65 | |
| elmot | 1:d0dfbce63a89 | 66 | /** |
| elmot | 1:d0dfbce63a89 | 67 | * @} |
| elmot | 1:d0dfbce63a89 | 68 | */ |
| elmot | 1:d0dfbce63a89 | 69 | |
| elmot | 1:d0dfbce63a89 | 70 | /******************************************************************************/ |
| elmot | 1:d0dfbce63a89 | 71 | /*************************** START REGISTER MAPPING **************************/ |
| elmot | 1:d0dfbce63a89 | 72 | /******************************************************************************/ |
| elmot | 1:d0dfbce63a89 | 73 | /* Acceleration Registers */ |
| elmot | 1:d0dfbce63a89 | 74 | #define LSM303C_WHO_AM_I_ADDR 0x0F /* device identification register */ |
| elmot | 1:d0dfbce63a89 | 75 | #define LSM303C_ACT_THS_A 0x1E |
| elmot | 1:d0dfbce63a89 | 76 | #define LSM303C_ACT_DUR_A 0x1F |
| elmot | 1:d0dfbce63a89 | 77 | #define LSM303C_CTRL_REG1_A 0x20 /* Control register 1 acceleration */ |
| elmot | 1:d0dfbce63a89 | 78 | #define LSM303C_CTRL_REG2_A 0x21 /* Control register 2 acceleration */ |
| elmot | 1:d0dfbce63a89 | 79 | #define LSM303C_CTRL_REG3_A 0x22 /* Control register 3 acceleration */ |
| elmot | 1:d0dfbce63a89 | 80 | #define LSM303C_CTRL_REG4_A 0x23 /* Control register 4 acceleration */ |
| elmot | 1:d0dfbce63a89 | 81 | #define LSM303C_CTRL_REG5_A 0x24 /* Control register 5 acceleration */ |
| elmot | 1:d0dfbce63a89 | 82 | #define LSM303C_CTRL_REG6_A 0x25 /* Control register 6 acceleration */ |
| elmot | 1:d0dfbce63a89 | 83 | #define LSM303C_CTRL_REG7_A 0x26 /* Control register 6 acceleration */ |
| elmot | 1:d0dfbce63a89 | 84 | #define LSM303C_STATUS_REG_A 0x27 /* Status register acceleration */ |
| elmot | 1:d0dfbce63a89 | 85 | #define LSM303C_OUT_X_L_A 0x28 /* Output Register X acceleration */ |
| elmot | 1:d0dfbce63a89 | 86 | #define LSM303C_OUT_X_H_A 0x29 /* Output Register X acceleration */ |
| elmot | 1:d0dfbce63a89 | 87 | #define LSM303C_OUT_Y_L_A 0x2A /* Output Register Y acceleration */ |
| elmot | 1:d0dfbce63a89 | 88 | #define LSM303C_OUT_Y_H_A 0x2B /* Output Register Y acceleration */ |
| elmot | 1:d0dfbce63a89 | 89 | #define LSM303C_OUT_Z_L_A 0x2C /* Output Register Z acceleration */ |
| elmot | 1:d0dfbce63a89 | 90 | #define LSM303C_OUT_Z_H_A 0x2D /* Output Register Z acceleration */ |
| elmot | 1:d0dfbce63a89 | 91 | #define LSM303C_FIFO_CTRL 0x2E /* Fifo control Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 92 | #define LSM303C_FIFO_SRC 0x2F /* Fifo src Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 93 | |
| elmot | 1:d0dfbce63a89 | 94 | #define LSM303C_IG_CFG1_A 0x30 /* Interrupt 1 configuration Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 95 | #define LSM303C_IG_SRC1_A 0x31 /* Interrupt 1 source Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 96 | #define LSM303C_IG_THS_X1_A 0x32 |
| elmot | 1:d0dfbce63a89 | 97 | #define LSM303C_IG_THS_Y1_A 0x33 |
| elmot | 1:d0dfbce63a89 | 98 | #define LSM303C_IG_THS_Z1_A 0x34 |
| elmot | 1:d0dfbce63a89 | 99 | |
| elmot | 1:d0dfbce63a89 | 100 | #define LSM303C_IG_DUR1_A 0x32 |
| elmot | 1:d0dfbce63a89 | 101 | #define LSM303C_INT1_DURATION_A 0x33 /* Interrupt 1 DURATION register acceleration */ |
| elmot | 1:d0dfbce63a89 | 102 | |
| elmot | 1:d0dfbce63a89 | 103 | #define LSM303C_INT2_CFG_A 0x34 /* Interrupt 2 configuration Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 104 | #define LSM303C_INT2_SOURCE_A 0x35 /* Interrupt 2 source Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 105 | #define LSM303C_INT2_THS_A 0x36 /* Interrupt 2 Threshold register acceleration */ |
| elmot | 1:d0dfbce63a89 | 106 | #define LSM303C_INT2_DURATION_A 0x37 /* Interrupt 2 DURATION register acceleration */ |
| elmot | 1:d0dfbce63a89 | 107 | |
| elmot | 1:d0dfbce63a89 | 108 | #define LSM303C_CLICK_CFG_A 0x38 /* Click configuration Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 109 | #define LSM303C_CLICK_SOURCE_A 0x39 /* Click 2 source Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 110 | #define LSM303C_CLICK_THS_A 0x3A /* Click 2 Threshold register acceleration */ |
| elmot | 1:d0dfbce63a89 | 111 | |
| elmot | 1:d0dfbce63a89 | 112 | #define LSM303C_TIME_LIMIT_A 0x3B /* Time Limit Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 113 | #define LSM303C_TIME_LATENCY_A 0x3C /* Time Latency Register acceleration */ |
| elmot | 1:d0dfbce63a89 | 114 | #define LSM303C_TIME_WINDOW_A 0x3D /* Time window register acceleration */ |
| elmot | 1:d0dfbce63a89 | 115 | |
| elmot | 1:d0dfbce63a89 | 116 | /* Magnetic field Registers */ |
| elmot | 1:d0dfbce63a89 | 117 | #define LSM303C_CTRL_REG1_M 0x20 /* Magnetic control register 1 */ |
| elmot | 1:d0dfbce63a89 | 118 | #define LSM303C_CTRL_REG2_M 0x21 /* Magnetic control register 2 */ |
| elmot | 1:d0dfbce63a89 | 119 | #define LSM303C_CTRL_REG3_M 0x22 /* Magnetic control register 3 */ |
| elmot | 1:d0dfbce63a89 | 120 | #define LSM303C_CTRL_REG4_M 0x23 /* Magnetic control register 4 */ |
| elmot | 1:d0dfbce63a89 | 121 | #define LSM303C_CTRL_REG5_M 0x24 /* Magnetic control register 5 */ |
| elmot | 1:d0dfbce63a89 | 122 | |
| elmot | 1:d0dfbce63a89 | 123 | #define LSM303C_STATUS_REG_M 0x27 /* Magnetic status register M */ |
| elmot | 1:d0dfbce63a89 | 124 | |
| elmot | 1:d0dfbce63a89 | 125 | #define LSM303C_OUT_X_L_M 0x28 /* Output Register X magnetic field */ |
| elmot | 1:d0dfbce63a89 | 126 | #define LSM303C_OUT_X_H_M 0x29 /* Output Register X magnetic field */ |
| elmot | 1:d0dfbce63a89 | 127 | #define LSM303C_OUT_Y_L_M 0x2A /* Output Register Y magnetic field */ |
| elmot | 1:d0dfbce63a89 | 128 | #define LSM303C_OUT_Y_H_M 0x2B /* Output Register Y magnetic field */ |
| elmot | 1:d0dfbce63a89 | 129 | #define LSM303C_OUT_Z_L_M 0x2C /* Output Register Z magnetic field */ |
| elmot | 1:d0dfbce63a89 | 130 | #define LSM303C_OUT_Z_H_M 0x2D /* Output Register Z magnetic field */ |
| elmot | 1:d0dfbce63a89 | 131 | |
| elmot | 1:d0dfbce63a89 | 132 | #define LSM303C_TEMP_OUT_L_M 0x2E /* Temperature Register magnetic field */ |
| elmot | 1:d0dfbce63a89 | 133 | #define LSM303C_TEMP_OUT_H_M 0x2F /* Temperature Register magnetic field */ |
| elmot | 1:d0dfbce63a89 | 134 | |
| elmot | 1:d0dfbce63a89 | 135 | #define LSM303C_INT_CFG_M 0x30 /* Axis interrupt configuration */ |
| elmot | 1:d0dfbce63a89 | 136 | #define LSM303C_INT_SRC_M 0x31 /* Axis interrupt source */ |
| elmot | 1:d0dfbce63a89 | 137 | #define LSM303C_INT_THS_L_M 0x32 /* Interrupt threshold L */ |
| elmot | 1:d0dfbce63a89 | 138 | #define LSM303C_INT_THS_H_M 0x33 /* Interrupt threshold M */ |
| elmot | 1:d0dfbce63a89 | 139 | |
| elmot | 1:d0dfbce63a89 | 140 | |
| elmot | 1:d0dfbce63a89 | 141 | /******************************************************************************/ |
| elmot | 1:d0dfbce63a89 | 142 | /**************************** END REGISTER MAPPING ***************************/ |
| elmot | 1:d0dfbce63a89 | 143 | /******************************************************************************/ |
| elmot | 1:d0dfbce63a89 | 144 | |
| elmot | 1:d0dfbce63a89 | 145 | /** @defgroup Power_Mode_selection |
| elmot | 1:d0dfbce63a89 | 146 | * @{ |
| elmot | 1:d0dfbce63a89 | 147 | */ |
| elmot | 1:d0dfbce63a89 | 148 | #define LMS303C_ACC_ID ((uint8_t)0x41) |
| elmot | 1:d0dfbce63a89 | 149 | #define LMS303C_MAG_ID ((uint8_t)0x3D) |
| elmot | 1:d0dfbce63a89 | 150 | /** |
| elmot | 1:d0dfbce63a89 | 151 | * @} |
| elmot | 1:d0dfbce63a89 | 152 | */ |
| elmot | 1:d0dfbce63a89 | 153 | |
| elmot | 1:d0dfbce63a89 | 154 | /** @defgroup Acc_OutPut_DataRate_Selection |
| elmot | 1:d0dfbce63a89 | 155 | * @{ |
| elmot | 1:d0dfbce63a89 | 156 | */ |
| elmot | 1:d0dfbce63a89 | 157 | #define LSM303C_ACC_ODR_BITPOSITION ((uint8_t)0x70) /*!< Output Data Rate bit position */ |
| elmot | 1:d0dfbce63a89 | 158 | #define LSM303C_ACC_ODR_OFF ((uint8_t)0x00) /*!< Output Data Rate powerdown */ |
| elmot | 1:d0dfbce63a89 | 159 | #define LSM303C_ACC_ODR_10_HZ ((uint8_t)0x10) /*!< Output Data Rate = 10 Hz */ |
| elmot | 1:d0dfbce63a89 | 160 | #define LSM303C_ACC_ODR_50_HZ ((uint8_t)0x20) /*!< Output Data Rate = 50 Hz */ |
| elmot | 1:d0dfbce63a89 | 161 | #define LSM303C_ACC_ODR_100_HZ ((uint8_t)0x30) /*!< Output Data Rate = 100 Hz */ |
| elmot | 1:d0dfbce63a89 | 162 | #define LSM303C_ACC_ODR_200_HZ ((uint8_t)0x40) /*!< Output Data Rate = 200 Hz */ |
| elmot | 1:d0dfbce63a89 | 163 | #define LSM303C_ACC_ODR_400_HZ ((uint8_t)0x50) /*!< Output Data Rate = 400 Hz */ |
| elmot | 1:d0dfbce63a89 | 164 | #define LSM303C_ACC_ODR_800_HZ ((uint8_t)0x60) /*!< Output Data Rate = 800 Hz */ |
| elmot | 1:d0dfbce63a89 | 165 | |
| elmot | 1:d0dfbce63a89 | 166 | /** |
| elmot | 1:d0dfbce63a89 | 167 | * @} |
| elmot | 1:d0dfbce63a89 | 168 | */ |
| elmot | 1:d0dfbce63a89 | 169 | |
| elmot | 1:d0dfbce63a89 | 170 | /** @defgroup Acc_Axes_Selection |
| elmot | 1:d0dfbce63a89 | 171 | * @{ |
| elmot | 1:d0dfbce63a89 | 172 | */ |
| elmot | 1:d0dfbce63a89 | 173 | #define LSM303C_ACC_X_ENABLE ((uint8_t)0x01) |
| elmot | 1:d0dfbce63a89 | 174 | #define LSM303C_ACC_Y_ENABLE ((uint8_t)0x02) |
| elmot | 1:d0dfbce63a89 | 175 | #define LSM303C_ACC_Z_ENABLE ((uint8_t)0x04) |
| elmot | 1:d0dfbce63a89 | 176 | #define LSM303C_ACC_AXES_ENABLE ((uint8_t)0x07) |
| elmot | 1:d0dfbce63a89 | 177 | #define LSM303C_ACC_AXES_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 178 | /** |
| elmot | 1:d0dfbce63a89 | 179 | * @} |
| elmot | 1:d0dfbce63a89 | 180 | */ |
| elmot | 1:d0dfbce63a89 | 181 | |
| elmot | 1:d0dfbce63a89 | 182 | /** @defgroup Acc_High_Resolution |
| elmot | 1:d0dfbce63a89 | 183 | * @{ |
| elmot | 1:d0dfbce63a89 | 184 | */ |
| elmot | 1:d0dfbce63a89 | 185 | #define LSM303C_ACC_HR_ENABLE ((uint8_t)0x80) |
| elmot | 1:d0dfbce63a89 | 186 | #define LSM303C_ACC_HR_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 187 | /** |
| elmot | 1:d0dfbce63a89 | 188 | * @} |
| elmot | 1:d0dfbce63a89 | 189 | */ |
| elmot | 1:d0dfbce63a89 | 190 | |
| elmot | 1:d0dfbce63a89 | 191 | /** @defgroup Communication_Mode |
| elmot | 1:d0dfbce63a89 | 192 | * @{ |
| elmot | 1:d0dfbce63a89 | 193 | */ |
| elmot | 1:d0dfbce63a89 | 194 | #define LSM303C_ACC_I2C_MODE ((uint8_t) 0x02) |
| elmot | 1:d0dfbce63a89 | 195 | #define LSM303C_ACC_SPI_MODE ((uint8_t) 0x01) |
| elmot | 1:d0dfbce63a89 | 196 | /** |
| elmot | 1:d0dfbce63a89 | 197 | * @} |
| elmot | 1:d0dfbce63a89 | 198 | */ |
| elmot | 1:d0dfbce63a89 | 199 | |
| elmot | 1:d0dfbce63a89 | 200 | /** @defgroup Acc_Full_Scale_Selection |
| elmot | 1:d0dfbce63a89 | 201 | * @{ |
| elmot | 1:d0dfbce63a89 | 202 | */ |
| elmot | 1:d0dfbce63a89 | 203 | #define LSM303C_ACC_FULLSCALE_2G ((uint8_t)0x00) /*!< ±2 g */ |
| elmot | 1:d0dfbce63a89 | 204 | #define LSM303C_ACC_FULLSCALE_4G ((uint8_t)0x20) /*!< ±4 g */ |
| elmot | 1:d0dfbce63a89 | 205 | #define LSM303C_ACC_FULLSCALE_8G ((uint8_t)0x30) /*!< ±8 g */ |
| elmot | 1:d0dfbce63a89 | 206 | /** |
| elmot | 1:d0dfbce63a89 | 207 | * @} |
| elmot | 1:d0dfbce63a89 | 208 | */ |
| elmot | 1:d0dfbce63a89 | 209 | |
| elmot | 1:d0dfbce63a89 | 210 | /** @defgroup Acc_Full_Scale_Selection |
| elmot | 1:d0dfbce63a89 | 211 | * @{ |
| elmot | 1:d0dfbce63a89 | 212 | */ |
| elmot | 1:d0dfbce63a89 | 213 | #define LSM303C_ACC_SENSITIVITY_2G ((uint8_t)1) /*!< accelerometer sensitivity with 2 g full scale [mg/LSB] */ |
| elmot | 1:d0dfbce63a89 | 214 | #define LSM303C_ACC_SENSITIVITY_4G ((uint8_t)2) /*!< accelerometer sensitivity with 4 g full scale [mg/LSB] */ |
| elmot | 1:d0dfbce63a89 | 215 | #define LSM303C_ACC_SENSITIVITY_8G ((uint8_t)4) /*!< accelerometer sensitivity with 8 g full scale [mg/LSB] */ |
| elmot | 1:d0dfbce63a89 | 216 | #define LSM303C_ACC_SENSITIVITY_16G ((uint8_t)12) /*!< accelerometer sensitivity with 12 g full scale [mg/LSB] */ |
| elmot | 1:d0dfbce63a89 | 217 | /** |
| elmot | 1:d0dfbce63a89 | 218 | * @} |
| elmot | 1:d0dfbce63a89 | 219 | */ |
| elmot | 1:d0dfbce63a89 | 220 | |
| elmot | 1:d0dfbce63a89 | 221 | /** @defgroup Acc_Block_Data_Update |
| elmot | 1:d0dfbce63a89 | 222 | * @{ |
| elmot | 1:d0dfbce63a89 | 223 | */ |
| elmot | 1:d0dfbce63a89 | 224 | #define LSM303C_ACC_BDU_CONTINUOUS ((uint8_t)0x00) /*!< Continuos Update */ |
| elmot | 1:d0dfbce63a89 | 225 | #define LSM303C_ACC_BDU_MSBLSB ((uint8_t)0x08) /*!< Single Update: output registers not updated until MSB and LSB reading */ |
| elmot | 1:d0dfbce63a89 | 226 | /** |
| elmot | 1:d0dfbce63a89 | 227 | * @} |
| elmot | 1:d0dfbce63a89 | 228 | */ |
| elmot | 1:d0dfbce63a89 | 229 | |
| elmot | 1:d0dfbce63a89 | 230 | /** @defgroup Acc_Endian_Data_selection |
| elmot | 1:d0dfbce63a89 | 231 | * @{ |
| elmot | 1:d0dfbce63a89 | 232 | */ |
| elmot | 1:d0dfbce63a89 | 233 | #define LSM303C_ACC_BLE_LSB ((uint8_t)0x00) /*!< Little Endian: data LSB @ lower address */ |
| elmot | 1:d0dfbce63a89 | 234 | #define LSM303C_ACC_BLE_MSB ((uint8_t)0x40) /*!< Big Endian: data MSB @ lower address */ |
| elmot | 1:d0dfbce63a89 | 235 | /** |
| elmot | 1:d0dfbce63a89 | 236 | * @} |
| elmot | 1:d0dfbce63a89 | 237 | */ |
| elmot | 1:d0dfbce63a89 | 238 | |
| elmot | 1:d0dfbce63a89 | 239 | /** @defgroup Acc_High_Pass_Filter_Mode |
| elmot | 1:d0dfbce63a89 | 240 | * @{ |
| elmot | 1:d0dfbce63a89 | 241 | */ |
| elmot | 1:d0dfbce63a89 | 242 | #define LSM303C_ACC_HPM_REF_SIGNAL ((uint8_t)0x08) |
| elmot | 1:d0dfbce63a89 | 243 | #define LSM303C_ACC_HPM_NORMAL_MODE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 244 | /** |
| elmot | 1:d0dfbce63a89 | 245 | * @} |
| elmot | 1:d0dfbce63a89 | 246 | */ |
| elmot | 1:d0dfbce63a89 | 247 | |
| elmot | 1:d0dfbce63a89 | 248 | /** @defgroup Acc_High_Pass_CUT OFF_Frequency |
| elmot | 1:d0dfbce63a89 | 249 | * @{ |
| elmot | 1:d0dfbce63a89 | 250 | */ |
| elmot | 1:d0dfbce63a89 | 251 | #define LSM303C_ACC_DFC1_ODRDIV50 ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 252 | #define LSM303C_ACC_DFC1_ODRDIV100 ((uint8_t)0x20) |
| elmot | 1:d0dfbce63a89 | 253 | #define LSM303C_ACC_DFC1_ODRDIV9 ((uint8_t)0x40) |
| elmot | 1:d0dfbce63a89 | 254 | #define LSM303C_ACC_DFC1_ODRDIV400 ((uint8_t)0x60) |
| elmot | 1:d0dfbce63a89 | 255 | /** |
| elmot | 1:d0dfbce63a89 | 256 | * @} |
| elmot | 1:d0dfbce63a89 | 257 | */ |
| elmot | 1:d0dfbce63a89 | 258 | |
| elmot | 1:d0dfbce63a89 | 259 | /** @defgroup Acc_High_Pass_Filter_status |
| elmot | 1:d0dfbce63a89 | 260 | * @{ |
| elmot | 1:d0dfbce63a89 | 261 | */ |
| elmot | 1:d0dfbce63a89 | 262 | #define LSM303C_ACC_HPF_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 263 | #define LSM303C_ACC_HPF_ENABLE ((uint8_t)0x08) |
| elmot | 1:d0dfbce63a89 | 264 | /** |
| elmot | 1:d0dfbce63a89 | 265 | * @} |
| elmot | 1:d0dfbce63a89 | 266 | */ |
| elmot | 1:d0dfbce63a89 | 267 | |
| elmot | 1:d0dfbce63a89 | 268 | /** @defgroup Acc_High_Pass_Filter_Click_status |
| elmot | 1:d0dfbce63a89 | 269 | * @{ |
| elmot | 1:d0dfbce63a89 | 270 | */ |
| elmot | 1:d0dfbce63a89 | 271 | #define LSM303C_ACC_HPF_CLICK_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 272 | #define LSM303C_ACC_HPF_CLICK_ENABLE ((uint8_t)0x04) |
| elmot | 1:d0dfbce63a89 | 273 | /** |
| elmot | 1:d0dfbce63a89 | 274 | * @} |
| elmot | 1:d0dfbce63a89 | 275 | */ |
| elmot | 1:d0dfbce63a89 | 276 | |
| elmot | 1:d0dfbce63a89 | 277 | /** @defgroup Acc_High_Pass_Filter_HPI2S_status |
| elmot | 1:d0dfbce63a89 | 278 | * @{ |
| elmot | 1:d0dfbce63a89 | 279 | */ |
| elmot | 1:d0dfbce63a89 | 280 | #define LSM303C_ACC_HPI2S_INT1_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 281 | #define LSM303C_ACC_HPI2S_INT1_ENABLE ((uint8_t)0x01) |
| elmot | 1:d0dfbce63a89 | 282 | #define LSM303C_ACC_HPI2S_INT2_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 283 | #define LSM303C_ACC_HPI2S_INT2_ENABLE ((uint8_t)0x02) |
| elmot | 1:d0dfbce63a89 | 284 | /** |
| elmot | 1:d0dfbce63a89 | 285 | * @} |
| elmot | 1:d0dfbce63a89 | 286 | */ |
| elmot | 1:d0dfbce63a89 | 287 | |
| elmot | 1:d0dfbce63a89 | 288 | /** @defgroup Acc_Interrupt1_Configuration_definition |
| elmot | 1:d0dfbce63a89 | 289 | * @{ |
| elmot | 1:d0dfbce63a89 | 290 | */ |
| elmot | 1:d0dfbce63a89 | 291 | #define LSM303C_IT1_CLICK ((uint8_t)0x80) |
| elmot | 1:d0dfbce63a89 | 292 | #define LSM303C_IT1_AOI1 ((uint8_t)0x40) |
| elmot | 1:d0dfbce63a89 | 293 | #define LSM303C_IT1_AOI2 ((uint8_t)0x20) |
| elmot | 1:d0dfbce63a89 | 294 | #define LSM303C_IT1_DRY1 ((uint8_t)0x10) |
| elmot | 1:d0dfbce63a89 | 295 | #define LSM303C_IT1_DRY2 ((uint8_t)0x08) |
| elmot | 1:d0dfbce63a89 | 296 | #define LSM303C_IT1_WTM ((uint8_t)0x04) |
| elmot | 1:d0dfbce63a89 | 297 | #define LSM303C_IT1_OVERRUN ((uint8_t)0x02) |
| elmot | 1:d0dfbce63a89 | 298 | /** |
| elmot | 1:d0dfbce63a89 | 299 | * @} |
| elmot | 1:d0dfbce63a89 | 300 | */ |
| elmot | 1:d0dfbce63a89 | 301 | |
| elmot | 1:d0dfbce63a89 | 302 | /** @defgroup Acc_Interrupt2_Configuration_definition |
| elmot | 1:d0dfbce63a89 | 303 | * @{ |
| elmot | 1:d0dfbce63a89 | 304 | */ |
| elmot | 1:d0dfbce63a89 | 305 | #define LSM303C_IT2_CLICK ((uint8_t)0x80) |
| elmot | 1:d0dfbce63a89 | 306 | #define LSM303C_IT2_INT1 ((uint8_t)0x40) |
| elmot | 1:d0dfbce63a89 | 307 | #define LSM303C_IT2_INT2 ((uint8_t)0x20) |
| elmot | 1:d0dfbce63a89 | 308 | #define LSM303C_IT2_BOOT ((uint8_t)0x10) |
| elmot | 1:d0dfbce63a89 | 309 | #define LSM303C_IT2_ACT ((uint8_t)0x08) |
| elmot | 1:d0dfbce63a89 | 310 | #define LSM303C_IT2_HLACTIVE ((uint8_t)0x02) |
| elmot | 1:d0dfbce63a89 | 311 | /** |
| elmot | 1:d0dfbce63a89 | 312 | * @} |
| elmot | 1:d0dfbce63a89 | 313 | */ |
| elmot | 1:d0dfbce63a89 | 314 | |
| elmot | 1:d0dfbce63a89 | 315 | /** @defgroup Acc_INT_Combination_Status |
| elmot | 1:d0dfbce63a89 | 316 | * @{ |
| elmot | 1:d0dfbce63a89 | 317 | */ |
| elmot | 1:d0dfbce63a89 | 318 | #define LSM303C_OR_COMBINATION ((uint8_t)0x00) /*!< OR combination of enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 319 | #define LSM303C_AND_COMBINATION ((uint8_t)0x80) /*!< AND combination of enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 320 | #define LSM303C_MOV_RECOGNITION ((uint8_t)0x40) /*!< 6D movement recognition */ |
| elmot | 1:d0dfbce63a89 | 321 | #define LSM303C_POS_RECOGNITION ((uint8_t)0xC0) /*!< 6D position recognition */ |
| elmot | 1:d0dfbce63a89 | 322 | /** |
| elmot | 1:d0dfbce63a89 | 323 | * @} |
| elmot | 1:d0dfbce63a89 | 324 | */ |
| elmot | 1:d0dfbce63a89 | 325 | |
| elmot | 1:d0dfbce63a89 | 326 | /** @defgroup Acc_INT_Axes |
| elmot | 1:d0dfbce63a89 | 327 | * @{ |
| elmot | 1:d0dfbce63a89 | 328 | */ |
| elmot | 1:d0dfbce63a89 | 329 | #define LSM303C_Z_HIGH ((uint8_t)0x20) /*!< Z High enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 330 | #define LSM303C_Z_LOW ((uint8_t)0x10) /*!< Z low enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 331 | #define LSM303C_Y_HIGH ((uint8_t)0x08) /*!< Y High enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 332 | #define LSM303C_Y_LOW ((uint8_t)0x04) /*!< Y low enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 333 | #define LSM303C_X_HIGH ((uint8_t)0x02) /*!< X High enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 334 | #define LSM303C_X_LOW ((uint8_t)0x01) /*!< X low enabled IRQs */ |
| elmot | 1:d0dfbce63a89 | 335 | /** |
| elmot | 1:d0dfbce63a89 | 336 | * @} |
| elmot | 1:d0dfbce63a89 | 337 | */ |
| elmot | 1:d0dfbce63a89 | 338 | |
| elmot | 1:d0dfbce63a89 | 339 | /** @defgroup Acc_INT_Click |
| elmot | 1:d0dfbce63a89 | 340 | * @{ |
| elmot | 1:d0dfbce63a89 | 341 | */ |
| elmot | 1:d0dfbce63a89 | 342 | #define LSM303C_Z_DOUBLE_CLICK ((uint8_t)0x20) /*!< Z double click IRQs */ |
| elmot | 1:d0dfbce63a89 | 343 | #define LSM303C_Z_SINGLE_CLICK ((uint8_t)0x10) /*!< Z single click IRQs */ |
| elmot | 1:d0dfbce63a89 | 344 | #define LSM303C_Y_DOUBLE_CLICK ((uint8_t)0x08) /*!< Y double click IRQs */ |
| elmot | 1:d0dfbce63a89 | 345 | #define LSM303C_Y_SINGLE_CLICK ((uint8_t)0x04) /*!< Y single click IRQs */ |
| elmot | 1:d0dfbce63a89 | 346 | #define LSM303C_X_DOUBLE_CLICK ((uint8_t)0x02) /*!< X double click IRQs */ |
| elmot | 1:d0dfbce63a89 | 347 | #define LSM303C_X_SINGLE_CLICK ((uint8_t)0x01) /*!< X single click IRQs */ |
| elmot | 1:d0dfbce63a89 | 348 | /** |
| elmot | 1:d0dfbce63a89 | 349 | * @} |
| elmot | 1:d0dfbce63a89 | 350 | */ |
| elmot | 1:d0dfbce63a89 | 351 | |
| elmot | 1:d0dfbce63a89 | 352 | /** @defgroup Acc_INT1_Interrupt_status |
| elmot | 1:d0dfbce63a89 | 353 | * @{ |
| elmot | 1:d0dfbce63a89 | 354 | */ |
| elmot | 1:d0dfbce63a89 | 355 | #define LSM303C_INT1INTERRUPT_DISABLE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 356 | #define LSM303C_INT1INTERRUPT_ENABLE ((uint8_t)0x80) |
| elmot | 1:d0dfbce63a89 | 357 | /** |
| elmot | 1:d0dfbce63a89 | 358 | * @} |
| elmot | 1:d0dfbce63a89 | 359 | */ |
| elmot | 1:d0dfbce63a89 | 360 | |
| elmot | 1:d0dfbce63a89 | 361 | /** @defgroup Acc_INT1_Interrupt_ActiveEdge |
| elmot | 1:d0dfbce63a89 | 362 | * @{ |
| elmot | 1:d0dfbce63a89 | 363 | */ |
| elmot | 1:d0dfbce63a89 | 364 | #define LSM303C_INT1INTERRUPT_LOW_EDGE ((uint8_t)0x20) |
| elmot | 1:d0dfbce63a89 | 365 | #define LSM303C_INT1INTERRUPT_HIGH_EDGE ((uint8_t)0x00) |
| elmot | 1:d0dfbce63a89 | 366 | /** |
| elmot | 1:d0dfbce63a89 | 367 | * @} |
| elmot | 1:d0dfbce63a89 | 368 | */ |
| elmot | 1:d0dfbce63a89 | 369 | |
| elmot | 1:d0dfbce63a89 | 370 | |
| elmot | 1:d0dfbce63a89 | 371 | /** @defgroup Mag_Temperature_Sensor |
| elmot | 1:d0dfbce63a89 | 372 | * @{ |
| elmot | 1:d0dfbce63a89 | 373 | */ |
| elmot | 1:d0dfbce63a89 | 374 | #define LSM303C_MAG_TEMPSENSOR_ENABLE ((uint8_t) 0x80) /*!< Temp sensor Enable */ |
| elmot | 1:d0dfbce63a89 | 375 | #define LSM303C_MAG_TEMPSENSOR_DISABLE ((uint8_t) 0x00) /*!< Temp sensor Disable */ |
| elmot | 1:d0dfbce63a89 | 376 | /** |
| elmot | 1:d0dfbce63a89 | 377 | * @} |
| elmot | 1:d0dfbce63a89 | 378 | */ |
| elmot | 1:d0dfbce63a89 | 379 | |
| elmot | 1:d0dfbce63a89 | 380 | /** @defgroup Mag_XY-axis_Operating_Mode |
| elmot | 1:d0dfbce63a89 | 381 | * @{ |
| elmot | 1:d0dfbce63a89 | 382 | */ |
| elmot | 1:d0dfbce63a89 | 383 | #define LSM303C_MAG_OM_XY_LOWPOWER ((uint8_t) 0x00 << 5) |
| elmot | 1:d0dfbce63a89 | 384 | #define LSM303C_MAG_OM_XY_MEDIUM ((uint8_t) 0x01 << 5) |
| elmot | 1:d0dfbce63a89 | 385 | #define LSM303C_MAG_OM_XY_HIGH ((uint8_t) 0x02 << 5) |
| elmot | 1:d0dfbce63a89 | 386 | #define LSM303C_MAG_OM_XY_ULTRAHIGH ((uint8_t) 0x03 << 5) |
| elmot | 1:d0dfbce63a89 | 387 | |
| elmot | 1:d0dfbce63a89 | 388 | /** |
| elmot | 1:d0dfbce63a89 | 389 | * @} |
| elmot | 1:d0dfbce63a89 | 390 | */ |
| elmot | 1:d0dfbce63a89 | 391 | |
| elmot | 1:d0dfbce63a89 | 392 | |
| elmot | 1:d0dfbce63a89 | 393 | /** @defgroup Mag_Data_Rate |
| elmot | 1:d0dfbce63a89 | 394 | * @{ |
| elmot | 1:d0dfbce63a89 | 395 | */ |
| elmot | 1:d0dfbce63a89 | 396 | #define LSM303C_MAG_ODR_0_625_HZ ((uint8_t) 0x00 << 2) /*!< Output Data Rate = 0.625 Hz */ |
| elmot | 1:d0dfbce63a89 | 397 | #define LSM303C_MAG_ODR_1_25_HZ ((uint8_t) 0x01 << 2) /*!< Output Data Rate = 1.25 Hz */ |
| elmot | 1:d0dfbce63a89 | 398 | #define LSM303C_MAG_ODR_2_5_HZ ((uint8_t) 0x02 << 2) /*!< Output Data Rate = 2.5 Hz */ |
| elmot | 1:d0dfbce63a89 | 399 | #define LSM303C_MAG_ODR_5_0_HZ ((uint8_t) 0x03 << 2) /*!< Output Data Rate = 5.0 Hz */ |
| elmot | 1:d0dfbce63a89 | 400 | #define LSM303C_MAG_ODR_10_HZ ((uint8_t) 0x04 << 2) /*!< Output Data Rate = 10 Hz */ |
| elmot | 1:d0dfbce63a89 | 401 | #define LSM303C_MAG_ODR_20_HZ ((uint8_t) 0x05 << 2) /*!< Output Data Rate = 20 Hz */ |
| elmot | 1:d0dfbce63a89 | 402 | #define LSM303C_MAG_ODR_40_HZ ((uint8_t) 0x06 << 2) /*!< Output Data Rate = 40 Hz */ |
| elmot | 1:d0dfbce63a89 | 403 | #define LSM303C_MAG_ODR_80_HZ ((uint8_t) 0x07 << 2) /*!< Output Data Rate = 80 Hz */ |
| elmot | 1:d0dfbce63a89 | 404 | /** |
| elmot | 1:d0dfbce63a89 | 405 | * @} |
| elmot | 1:d0dfbce63a89 | 406 | */ |
| elmot | 1:d0dfbce63a89 | 407 | |
| elmot | 1:d0dfbce63a89 | 408 | /** @defgroup Mag_Data_Rate |
| elmot | 1:d0dfbce63a89 | 409 | * @{ |
| elmot | 1:d0dfbce63a89 | 410 | */ |
| elmot | 1:d0dfbce63a89 | 411 | #define LMS303C_MAG_SELFTEST_DISABLE ((uint8_t 0x00) |
| elmot | 1:d0dfbce63a89 | 412 | #define LMS303C_MAG_SELFTEST_ENABLE ((uint8_t 0x01) |
| elmot | 1:d0dfbce63a89 | 413 | |
| elmot | 1:d0dfbce63a89 | 414 | /** @defgroup Mag_Full_Scale |
| elmot | 1:d0dfbce63a89 | 415 | * @{ |
| elmot | 1:d0dfbce63a89 | 416 | */ |
| elmot | 1:d0dfbce63a89 | 417 | #define LSM303C_MAG_FS_DEFAULT ((uint8_t) 0x00 << 5) |
| elmot | 1:d0dfbce63a89 | 418 | #define LSM303C_MAG_FS_16_GA ((uint8_t) 0x03 << 5) /*!< Full scale = ±16 Gauss */ |
| elmot | 1:d0dfbce63a89 | 419 | /** |
| elmot | 1:d0dfbce63a89 | 420 | * @} |
| elmot | 1:d0dfbce63a89 | 421 | */ |
| elmot | 1:d0dfbce63a89 | 422 | |
| elmot | 1:d0dfbce63a89 | 423 | /** @defgroup Mag_Reboot |
| elmot | 1:d0dfbce63a89 | 424 | * @{ |
| elmot | 1:d0dfbce63a89 | 425 | */ |
| elmot | 1:d0dfbce63a89 | 426 | #define LSM303C_MAG_REBOOT_DEFAULT ((uint8_t) 0x00 << 3) |
| elmot | 1:d0dfbce63a89 | 427 | #define LSM303C_MAG_REBOOT_ENABLE ((uint8_t) 0x01 << 3) |
| elmot | 1:d0dfbce63a89 | 428 | /** |
| elmot | 1:d0dfbce63a89 | 429 | * @} |
| elmot | 1:d0dfbce63a89 | 430 | */ |
| elmot | 1:d0dfbce63a89 | 431 | |
| elmot | 1:d0dfbce63a89 | 432 | /** @defgroup Mag_Soft_reset |
| elmot | 1:d0dfbce63a89 | 433 | * @{ |
| elmot | 1:d0dfbce63a89 | 434 | */ |
| elmot | 1:d0dfbce63a89 | 435 | #define LSM303C_MAG_SOFT_RESET_DEFAULT ((uint8_t) 0x00 << 2) |
| elmot | 1:d0dfbce63a89 | 436 | #define LSM303C_MAG_SOFT_RESET_ENABLE ((uint8_t) 0x01 << 2) |
| elmot | 1:d0dfbce63a89 | 437 | /** |
| elmot | 1:d0dfbce63a89 | 438 | * @} |
| elmot | 1:d0dfbce63a89 | 439 | */ |
| elmot | 1:d0dfbce63a89 | 440 | |
| elmot | 1:d0dfbce63a89 | 441 | /** @defgroup Mag_Communication_Mode |
| elmot | 1:d0dfbce63a89 | 442 | * @{ |
| elmot | 1:d0dfbce63a89 | 443 | */ |
| elmot | 1:d0dfbce63a89 | 444 | #define LSM303C_MAG_I2C_MODE ((uint8_t) 0x80) |
| elmot | 1:d0dfbce63a89 | 445 | #define LSM303C_MAG_SPI_MODE ((uint8_t) 0x04) |
| elmot | 1:d0dfbce63a89 | 446 | /** |
| elmot | 1:d0dfbce63a89 | 447 | * @} |
| elmot | 1:d0dfbce63a89 | 448 | */ |
| elmot | 1:d0dfbce63a89 | 449 | |
| elmot | 1:d0dfbce63a89 | 450 | /** @defgroup Mag_Lowpower_mode_config |
| elmot | 1:d0dfbce63a89 | 451 | * @{ |
| elmot | 1:d0dfbce63a89 | 452 | */ |
| elmot | 1:d0dfbce63a89 | 453 | #define LSM303C_MAG_CONFIG_NORMAL_MODE ((uint8_t) 0x00) |
| elmot | 1:d0dfbce63a89 | 454 | #define LSM303C_MAG_CONFIG_LOWPOWER_MODE ((uint8_t) 0x20) |
| elmot | 1:d0dfbce63a89 | 455 | /** |
| elmot | 1:d0dfbce63a89 | 456 | * @} |
| elmot | 1:d0dfbce63a89 | 457 | */ |
| elmot | 1:d0dfbce63a89 | 458 | |
| elmot | 1:d0dfbce63a89 | 459 | /** @defgroup Mag_Operation_Mode |
| elmot | 1:d0dfbce63a89 | 460 | * @{ |
| elmot | 1:d0dfbce63a89 | 461 | */ |
| elmot | 1:d0dfbce63a89 | 462 | #define LSM303C_MAG_SELECTION_MODE ((uint8_t) 0x03) |
| elmot | 1:d0dfbce63a89 | 463 | #define LSM303C_MAG_CONTINUOUS_MODE ((uint8_t) 0x00) |
| elmot | 1:d0dfbce63a89 | 464 | #define LSM303C_MAG_SINGLE_MODE ((uint8_t) 0x01) |
| elmot | 1:d0dfbce63a89 | 465 | #define LSM303C_MAG_POWERDOWN1_MODE ((uint8_t) 0x02) |
| elmot | 1:d0dfbce63a89 | 466 | #define LSM303C_MAG_POWERDOWN2_MODE ((uint8_t) 0x03) |
| elmot | 1:d0dfbce63a89 | 467 | |
| elmot | 1:d0dfbce63a89 | 468 | /** |
| elmot | 1:d0dfbce63a89 | 469 | * @} |
| elmot | 1:d0dfbce63a89 | 470 | */ |
| elmot | 1:d0dfbce63a89 | 471 | |
| elmot | 1:d0dfbce63a89 | 472 | /** @defgroup Mag_Z-axis_Operation_Mode |
| elmot | 1:d0dfbce63a89 | 473 | * @{ |
| elmot | 1:d0dfbce63a89 | 474 | */ |
| elmot | 1:d0dfbce63a89 | 475 | #define LSM303C_MAG_OM_Z_LOWPOWER ((uint8_t) 0x00 << 2) |
| elmot | 1:d0dfbce63a89 | 476 | #define LSM303C_MAG_OM_Z_MEDIUM ((uint8_t) 0x01 << 2) |
| elmot | 1:d0dfbce63a89 | 477 | #define LSM303C_MAG_OM_Z_HIGH ((uint8_t) 0x02 << 2) |
| elmot | 1:d0dfbce63a89 | 478 | #define LSM303C_MAG_OM_Z_ULTRAHIGH ((uint8_t) 0x03 << 2) |
| elmot | 1:d0dfbce63a89 | 479 | |
| elmot | 1:d0dfbce63a89 | 480 | /** |
| elmot | 1:d0dfbce63a89 | 481 | * @} |
| elmot | 1:d0dfbce63a89 | 482 | */ |
| elmot | 1:d0dfbce63a89 | 483 | |
| elmot | 1:d0dfbce63a89 | 484 | /** @defgroup Mag_Big_little-endian_selection |
| elmot | 1:d0dfbce63a89 | 485 | * @{ |
| elmot | 1:d0dfbce63a89 | 486 | */ |
| elmot | 1:d0dfbce63a89 | 487 | #define LSM303C_MAG_BLE_LSB ((uint8_t) 0x00) |
| elmot | 1:d0dfbce63a89 | 488 | #define LSM303C_MAG_BLE_MSB ((uint8_t) 0x02) |
| elmot | 1:d0dfbce63a89 | 489 | /** |
| elmot | 1:d0dfbce63a89 | 490 | * @} |
| elmot | 1:d0dfbce63a89 | 491 | */ |
| elmot | 1:d0dfbce63a89 | 492 | |
| elmot | 1:d0dfbce63a89 | 493 | /** @defgroup Mag_Bloc_update_magnetic_data |
| elmot | 1:d0dfbce63a89 | 494 | * @{ |
| elmot | 1:d0dfbce63a89 | 495 | */ |
| elmot | 1:d0dfbce63a89 | 496 | #define LSM303C_MAG_BDU_CONTINUOUS ((uint8_t) 0x00) |
| elmot | 1:d0dfbce63a89 | 497 | #define LSM303C_MAG_BDU_MSBLSB ((uint8_t) 0x40) |
| elmot | 1:d0dfbce63a89 | 498 | /** |
| elmot | 1:d0dfbce63a89 | 499 | * @} |
| elmot | 1:d0dfbce63a89 | 500 | */ |
| elmot | 1:d0dfbce63a89 | 501 | |
| elmot | 1:d0dfbce63a89 | 502 | /** |
| elmot | 1:d0dfbce63a89 | 503 | * @defgroup Magnetometer_Sensitivity |
| elmot | 1:d0dfbce63a89 | 504 | * @{ |
| elmot | 1:d0dfbce63a89 | 505 | */ |
| elmot | 1:d0dfbce63a89 | 506 | #define LSM303C_M_SENSITIVITY_XY_1_3Ga 1100 /*!< magnetometer X Y axes sensitivity for 1.3 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 507 | #define LSM303C_M_SENSITIVITY_XY_1_9Ga 855 /*!< magnetometer X Y axes sensitivity for 1.9 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 508 | #define LSM303C_M_SENSITIVITY_XY_2_5Ga 670 /*!< magnetometer X Y axes sensitivity for 2.5 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 509 | #define LSM303C_M_SENSITIVITY_XY_4Ga 450 /*!< magnetometer X Y axes sensitivity for 4 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 510 | #define LSM303C_M_SENSITIVITY_XY_4_7Ga 400 /*!< magnetometer X Y axes sensitivity for 4.7 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 511 | #define LSM303C_M_SENSITIVITY_XY_5_6Ga 330 /*!< magnetometer X Y axes sensitivity for 5.6 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 512 | #define LSM303C_M_SENSITIVITY_XY_8_1Ga 230 /*!< magnetometer X Y axes sensitivity for 8.1 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 513 | #define LSM303C_M_SENSITIVITY_Z_1_3Ga 980 /*!< magnetometer Z axis sensitivity for 1.3 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 514 | #define LSM303C_M_SENSITIVITY_Z_1_9Ga 760 /*!< magnetometer Z axis sensitivity for 1.9 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 515 | #define LSM303C_M_SENSITIVITY_Z_2_5Ga 600 /*!< magnetometer Z axis sensitivity for 2.5 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 516 | #define LSM303C_M_SENSITIVITY_Z_4Ga 400 /*!< magnetometer Z axis sensitivity for 4 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 517 | #define LSM303C_M_SENSITIVITY_Z_4_7Ga 355 /*!< magnetometer Z axis sensitivity for 4.7 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 518 | #define LSM303C_M_SENSITIVITY_Z_5_6Ga 295 /*!< magnetometer Z axis sensitivity for 5.6 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 519 | #define LSM303C_M_SENSITIVITY_Z_8_1Ga 205 /*!< magnetometer Z axis sensitivity for 8.1 Ga full scale [LSB/Ga] */ |
| elmot | 1:d0dfbce63a89 | 520 | /** |
| elmot | 1:d0dfbce63a89 | 521 | * @} |
| elmot | 1:d0dfbce63a89 | 522 | */ |
| elmot | 1:d0dfbce63a89 | 523 | |
| elmot | 1:d0dfbce63a89 | 524 | /** @defgroup Mag_Working_Mode |
| elmot | 1:d0dfbce63a89 | 525 | * @{ |
| elmot | 1:d0dfbce63a89 | 526 | */ |
| elmot | 1:d0dfbce63a89 | 527 | #define LSM303C_CONTINUOUS_CONVERSION ((uint8_t) 0x00) /*!< Continuous-Conversion Mode */ |
| elmot | 1:d0dfbce63a89 | 528 | #define LSM303C_SINGLE_CONVERSION ((uint8_t) 0x01) /*!< Single-Conversion Mode */ |
| elmot | 1:d0dfbce63a89 | 529 | #define LSM303C_SLEEP ((uint8_t) 0x02) /*!< Sleep Mode */ |
| elmot | 1:d0dfbce63a89 | 530 | /** |
| elmot | 1:d0dfbce63a89 | 531 | * @} |
| elmot | 1:d0dfbce63a89 | 532 | */ |
| elmot | 1:d0dfbce63a89 | 533 | |
| elmot | 1:d0dfbce63a89 | 534 | |
| elmot | 1:d0dfbce63a89 | 535 | /** @defgroup LSM303C_Exported_Functions |
| elmot | 1:d0dfbce63a89 | 536 | * @{ |
| elmot | 1:d0dfbce63a89 | 537 | */ |
| elmot | 1:d0dfbce63a89 | 538 | |
| elmot | 1:d0dfbce63a89 | 539 | |
| elmot | 1:d0dfbce63a89 | 540 | /* ACC driver structure */ |
| elmot | 1:d0dfbce63a89 | 541 | extern ACCELERO_DrvTypeDef Lsm303cDrv_accelero; |
| elmot | 1:d0dfbce63a89 | 542 | extern MAGNETO_DrvTypeDef Lsm303cDrv_magneto; |
| elmot | 1:d0dfbce63a89 | 543 | |
| elmot | 1:d0dfbce63a89 | 544 | /** |
| elmot | 1:d0dfbce63a89 | 545 | * @} |
| elmot | 1:d0dfbce63a89 | 546 | */ |
| elmot | 1:d0dfbce63a89 | 547 | |
| elmot | 1:d0dfbce63a89 | 548 | /** |
| elmot | 1:d0dfbce63a89 | 549 | * @} |
| elmot | 1:d0dfbce63a89 | 550 | */ |
| elmot | 1:d0dfbce63a89 | 551 | |
| elmot | 1:d0dfbce63a89 | 552 | /** |
| elmot | 1:d0dfbce63a89 | 553 | * @} |
| elmot | 1:d0dfbce63a89 | 554 | */ |
| elmot | 1:d0dfbce63a89 | 555 | |
| elmot | 1:d0dfbce63a89 | 556 | /** |
| elmot | 1:d0dfbce63a89 | 557 | * @} |
| elmot | 1:d0dfbce63a89 | 558 | */ |
| elmot | 1:d0dfbce63a89 | 559 | |
| elmot | 1:d0dfbce63a89 | 560 | #ifdef __cplusplus |
| elmot | 1:d0dfbce63a89 | 561 | } |
| elmot | 1:d0dfbce63a89 | 562 | #endif |
| elmot | 1:d0dfbce63a89 | 563 | |
| elmot | 1:d0dfbce63a89 | 564 | #endif /* __LSM303C_H */ |
| elmot | 1:d0dfbce63a89 | 565 | |
| elmot | 1:d0dfbce63a89 | 566 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |