Very Simple Library for the STM32F3-Discovery.
Dependents: accelerometer_test neopixel_square accelerometer_test_minimal Colour_Video_Demo
inc/stm32f3_discovery_lsm303dlhc.h@3:ddbddb863053, 2019-04-03 (annotated)
- Committer:
- MartinJohnson
- Date:
- Wed Apr 03 20:55:48 2019 +0000
- Revision:
- 3:ddbddb863053
- Parent:
- 0:c65854d98061
remove unnecessary structures
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MartinJohnson | 0:c65854d98061 | 1 | /** |
MartinJohnson | 0:c65854d98061 | 2 | ****************************************************************************** |
MartinJohnson | 0:c65854d98061 | 3 | * @file stm32f3_discovery_lsm303dlhc.h |
MartinJohnson | 0:c65854d98061 | 4 | * @author MCD Application Team |
MartinJohnson | 0:c65854d98061 | 5 | * @version V1.1.0 |
MartinJohnson | 0:c65854d98061 | 6 | * @date 20-September-2012 |
MartinJohnson | 0:c65854d98061 | 7 | * @brief This file contains definitions for stm32f3_discovery_lsm303dlhc.c |
MartinJohnson | 0:c65854d98061 | 8 | * firmware driver. |
MartinJohnson | 0:c65854d98061 | 9 | ****************************************************************************** |
MartinJohnson | 0:c65854d98061 | 10 | * @attention |
MartinJohnson | 0:c65854d98061 | 11 | * |
MartinJohnson | 0:c65854d98061 | 12 | * <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2> |
MartinJohnson | 0:c65854d98061 | 13 | * |
MartinJohnson | 0:c65854d98061 | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
MartinJohnson | 0:c65854d98061 | 15 | * You may not use this file except in compliance with the License. |
MartinJohnson | 0:c65854d98061 | 16 | * You may obtain a copy of the License at: |
MartinJohnson | 0:c65854d98061 | 17 | * |
MartinJohnson | 0:c65854d98061 | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
MartinJohnson | 0:c65854d98061 | 19 | * |
MartinJohnson | 0:c65854d98061 | 20 | * Unless required by applicable law or agreed to in writing, software |
MartinJohnson | 0:c65854d98061 | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
MartinJohnson | 0:c65854d98061 | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MartinJohnson | 0:c65854d98061 | 23 | * See the License for the specific language governing permissions and |
MartinJohnson | 0:c65854d98061 | 24 | * limitations under the License. |
MartinJohnson | 0:c65854d98061 | 25 | * |
MartinJohnson | 0:c65854d98061 | 26 | ****************************************************************************** |
MartinJohnson | 0:c65854d98061 | 27 | */ |
MartinJohnson | 0:c65854d98061 | 28 | |
MartinJohnson | 0:c65854d98061 | 29 | |
MartinJohnson | 0:c65854d98061 | 30 | /* Define to prevent recursive inclusion -------------------------------------*/ |
MartinJohnson | 0:c65854d98061 | 31 | #ifndef __STM32F3_DISCOVERY_LSM303DLHC_H |
MartinJohnson | 0:c65854d98061 | 32 | #define __STM32F3_DISCOVERY_LSM303DLHC_H |
MartinJohnson | 0:c65854d98061 | 33 | |
MartinJohnson | 0:c65854d98061 | 34 | #ifdef __cplusplus |
MartinJohnson | 0:c65854d98061 | 35 | extern "C" { |
MartinJohnson | 0:c65854d98061 | 36 | #endif |
MartinJohnson | 0:c65854d98061 | 37 | |
MartinJohnson | 0:c65854d98061 | 38 | /* Includes ------------------------------------------------------------------*/ |
MartinJohnson | 0:c65854d98061 | 39 | #include "stm32f30x.h" |
MartinJohnson | 0:c65854d98061 | 40 | |
MartinJohnson | 0:c65854d98061 | 41 | /** @addtogroup Utilities |
MartinJohnson | 0:c65854d98061 | 42 | * @{ |
MartinJohnson | 0:c65854d98061 | 43 | */ |
MartinJohnson | 0:c65854d98061 | 44 | |
MartinJohnson | 0:c65854d98061 | 45 | /** @addtogroup STM32F3_DISCOVERY |
MartinJohnson | 0:c65854d98061 | 46 | * @{ |
MartinJohnson | 0:c65854d98061 | 47 | */ |
MartinJohnson | 0:c65854d98061 | 48 | |
MartinJohnson | 0:c65854d98061 | 49 | /** @addtogroup STM32F3_DISCOVERY_LSM303DLHC |
MartinJohnson | 0:c65854d98061 | 50 | * @{ |
MartinJohnson | 0:c65854d98061 | 51 | */ |
MartinJohnson | 0:c65854d98061 | 52 | |
MartinJohnson | 0:c65854d98061 | 53 | /** @defgroup STM32F3_DISCOVERY_LSM303DLHC_Exported_Types |
MartinJohnson | 0:c65854d98061 | 54 | * @{ |
MartinJohnson | 0:c65854d98061 | 55 | */ |
MartinJohnson | 0:c65854d98061 | 56 | |
MartinJohnson | 0:c65854d98061 | 57 | /** |
MartinJohnson | 0:c65854d98061 | 58 | * @brief LSM303DLHC Status |
MartinJohnson | 0:c65854d98061 | 59 | */ |
MartinJohnson | 0:c65854d98061 | 60 | |
MartinJohnson | 0:c65854d98061 | 61 | /******************************************************************************/ |
MartinJohnson | 0:c65854d98061 | 62 | /*************************** START REGISTER MAPPING **************************/ |
MartinJohnson | 0:c65854d98061 | 63 | /******************************************************************************/ |
MartinJohnson | 0:c65854d98061 | 64 | /* Acceleration Registers */ |
MartinJohnson | 0:c65854d98061 | 65 | #define LSM303DLHC_CTRL_REG1_A 0x20 /* Control register 1 acceleration */ |
MartinJohnson | 0:c65854d98061 | 66 | #define LSM303DLHC_CTRL_REG2_A 0x21 /* Control register 2 acceleration */ |
MartinJohnson | 0:c65854d98061 | 67 | #define LSM303DLHC_CTRL_REG3_A 0x22 /* Control register 3 acceleration */ |
MartinJohnson | 0:c65854d98061 | 68 | #define LSM303DLHC_CTRL_REG4_A 0x23 /* Control register 4 acceleration */ |
MartinJohnson | 0:c65854d98061 | 69 | #define LSM303DLHC_CTRL_REG5_A 0x24 /* Control register 5 acceleration */ |
MartinJohnson | 0:c65854d98061 | 70 | #define LSM303DLHC_CTRL_REG6_A 0x25 /* Control register 6 acceleration */ |
MartinJohnson | 0:c65854d98061 | 71 | #define LSM303DLHC_REFERENCE_A 0x26 /* Reference register acceleration */ |
MartinJohnson | 0:c65854d98061 | 72 | #define LSM303DLHC_STATUS_REG_A 0x27 /* Status register acceleration */ |
MartinJohnson | 0:c65854d98061 | 73 | #define LSM303DLHC_OUT_X_L_A 0x28 /* Output Register X acceleration */ |
MartinJohnson | 0:c65854d98061 | 74 | #define LSM303DLHC_OUT_X_H_A 0x29 /* Output Register X acceleration */ |
MartinJohnson | 0:c65854d98061 | 75 | #define LSM303DLHC_OUT_Y_L_A 0x2A /* Output Register Y acceleration */ |
MartinJohnson | 0:c65854d98061 | 76 | #define LSM303DLHC_OUT_Y_H_A 0x2B /* Output Register Y acceleration */ |
MartinJohnson | 0:c65854d98061 | 77 | #define LSM303DLHC_OUT_Z_L_A 0x2C /* Output Register Z acceleration */ |
MartinJohnson | 0:c65854d98061 | 78 | #define LSM303DLHC_OUT_Z_H_A 0x2D /* Output Register Z acceleration */ |
MartinJohnson | 0:c65854d98061 | 79 | #define LSM303DLHC_FIFO_CTRL_REG_A 0x2E /* Fifo control Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 80 | #define LSM303DLHC_FIFO_SRC_REG_A 0x2F /* Fifo src Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 81 | |
MartinJohnson | 0:c65854d98061 | 82 | #define LSM303DLHC_INT1_CFG_A 0x30 /* Interrupt 1 configuration Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 83 | #define LSM303DLHC_INT1_SOURCE_A 0x31 /* Interrupt 1 source Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 84 | #define LSM303DLHC_INT1_THS_A 0x32 /* Interrupt 1 Threshold register acceleration */ |
MartinJohnson | 0:c65854d98061 | 85 | #define LSM303DLHC_INT1_DURATION_A 0x33 /* Interrupt 1 DURATION register acceleration */ |
MartinJohnson | 0:c65854d98061 | 86 | |
MartinJohnson | 0:c65854d98061 | 87 | #define LSM303DLHC_INT2_CFG_A 0x34 /* Interrupt 2 configuration Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 88 | #define LSM303DLHC_INT2_SOURCE_A 0x35 /* Interrupt 2 source Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 89 | #define LSM303DLHC_INT2_THS_A 0x36 /* Interrupt 2 Threshold register acceleration */ |
MartinJohnson | 0:c65854d98061 | 90 | #define LSM303DLHC_INT2_DURATION_A 0x37 /* Interrupt 2 DURATION register acceleration */ |
MartinJohnson | 0:c65854d98061 | 91 | |
MartinJohnson | 0:c65854d98061 | 92 | #define LSM303DLHC_CLICK_CFG_A 0x38 /* Click configuration Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 93 | #define LSM303DLHC_CLICK_SOURCE_A 0x39 /* Click 2 source Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 94 | #define LSM303DLHC_CLICK_THS_A 0x3A /* Click 2 Threshold register acceleration */ |
MartinJohnson | 0:c65854d98061 | 95 | |
MartinJohnson | 0:c65854d98061 | 96 | #define LSM303DLHC_TIME_LIMIT_A 0x3B /* Time Limit Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 97 | #define LSM303DLHC_TIME_LATENCY_A 0x3C /* Time Latency Register acceleration */ |
MartinJohnson | 0:c65854d98061 | 98 | #define LSM303DLHC_TIME_WINDOW_A 0x3D /* Time window register acceleration */ |
MartinJohnson | 0:c65854d98061 | 99 | |
MartinJohnson | 0:c65854d98061 | 100 | /* Magnetic field Registers */ |
MartinJohnson | 0:c65854d98061 | 101 | #define LSM303DLHC_CRA_REG_M 0x00 /* Control register A magnetic field */ |
MartinJohnson | 0:c65854d98061 | 102 | #define LSM303DLHC_CRB_REG_M 0x01 /* Control register B magnetic field */ |
MartinJohnson | 0:c65854d98061 | 103 | #define LSM303DLHC_MR_REG_M 0x02 /* Control register MR magnetic field */ |
MartinJohnson | 0:c65854d98061 | 104 | #define LSM303DLHC_OUT_X_H_M 0x03 /* Output Register X magnetic field */ |
MartinJohnson | 0:c65854d98061 | 105 | #define LSM303DLHC_OUT_X_L_M 0x04 /* Output Register X magnetic field */ |
MartinJohnson | 0:c65854d98061 | 106 | #define LSM303DLHC_OUT_Z_H_M 0x05 /* Output Register Z magnetic field */ |
MartinJohnson | 0:c65854d98061 | 107 | #define LSM303DLHC_OUT_Z_L_M 0x06 /* Output Register Z magnetic field */ |
MartinJohnson | 0:c65854d98061 | 108 | #define LSM303DLHC_OUT_Y_H_M 0x07 /* Output Register Y magnetic field */ |
MartinJohnson | 0:c65854d98061 | 109 | #define LSM303DLHC_OUT_Y_L_M 0x08 /* Output Register Y magnetic field */ |
MartinJohnson | 0:c65854d98061 | 110 | |
MartinJohnson | 0:c65854d98061 | 111 | #define LSM303DLHC_SR_REG_M 0x09 /* Status Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 112 | #define LSM303DLHC_IRA_REG_M 0x0A /* IRA Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 113 | #define LSM303DLHC_IRB_REG_M 0x0B /* IRB Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 114 | #define LSM303DLHC_IRC_REG_M 0x0C /* IRC Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 115 | |
MartinJohnson | 0:c65854d98061 | 116 | #define LSM303DLHC_TEMP_OUT_H_M 0x31 /* Temperature Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 117 | #define LSM303DLHC_TEMP_OUT_L_M 0x32 /* Temperature Register magnetic field */ |
MartinJohnson | 0:c65854d98061 | 118 | /******************************************************************************/ |
MartinJohnson | 0:c65854d98061 | 119 | /**************************** END REGISTER MAPPING ***************************/ |
MartinJohnson | 0:c65854d98061 | 120 | /******************************************************************************/ |
MartinJohnson | 0:c65854d98061 | 121 | |
MartinJohnson | 0:c65854d98061 | 122 | #define ACC_I2C_ADDRESS 0x32 |
MartinJohnson | 0:c65854d98061 | 123 | #define MAG_I2C_ADDRESS 0x3C |
MartinJohnson | 0:c65854d98061 | 124 | |
MartinJohnson | 0:c65854d98061 | 125 | /** @defgroup Acc_Power_Mode_selection |
MartinJohnson | 0:c65854d98061 | 126 | * @{ |
MartinJohnson | 0:c65854d98061 | 127 | */ |
MartinJohnson | 0:c65854d98061 | 128 | #define LSM303DLHC_NORMAL_MODE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 129 | #define LSM303DLHC_LOWPOWER_MODE ((uint8_t)0x08) |
MartinJohnson | 0:c65854d98061 | 130 | /** |
MartinJohnson | 0:c65854d98061 | 131 | * @} |
MartinJohnson | 0:c65854d98061 | 132 | */ |
MartinJohnson | 0:c65854d98061 | 133 | |
MartinJohnson | 0:c65854d98061 | 134 | /** @defgroup Acc_OutPut_DataRate_Selection |
MartinJohnson | 0:c65854d98061 | 135 | * @{ |
MartinJohnson | 0:c65854d98061 | 136 | */ |
MartinJohnson | 0:c65854d98061 | 137 | #define LSM303DLHC_ODR_1_HZ ((uint8_t)0x10) /*!< Output Data Rate = 1 Hz */ |
MartinJohnson | 0:c65854d98061 | 138 | #define LSM303DLHC_ODR_10_HZ ((uint8_t)0x20) /*!< Output Data Rate = 10 Hz */ |
MartinJohnson | 0:c65854d98061 | 139 | #define LSM303DLHC_ODR_25_HZ ((uint8_t)0x30) /*!< Output Data Rate = 25 Hz */ |
MartinJohnson | 0:c65854d98061 | 140 | #define LSM303DLHC_ODR_50_HZ ((uint8_t)0x40) /*!< Output Data Rate = 50 Hz */ |
MartinJohnson | 0:c65854d98061 | 141 | #define LSM303DLHC_ODR_100_HZ ((uint8_t)0x50) /*!< Output Data Rate = 100 Hz */ |
MartinJohnson | 0:c65854d98061 | 142 | #define LSM303DLHC_ODR_200_HZ ((uint8_t)0x60) /*!< Output Data Rate = 200 Hz */ |
MartinJohnson | 0:c65854d98061 | 143 | #define LSM303DLHC_ODR_400_HZ ((uint8_t)0x70) /*!< Output Data Rate = 400 Hz */ |
MartinJohnson | 0:c65854d98061 | 144 | #define LSM303DLHC_ODR_1620_HZ_LP ((uint8_t)0x80) /*!< Output Data Rate = 1620 Hz only in Low Power Mode */ |
MartinJohnson | 0:c65854d98061 | 145 | #define LSM303DLHC_ODR_1344_HZ ((uint8_t)0x90) /*!< Output Data Rate = 1344 Hz in Normal mode and 5376 Hz in Low Power Mode */ |
MartinJohnson | 0:c65854d98061 | 146 | |
MartinJohnson | 0:c65854d98061 | 147 | /** |
MartinJohnson | 0:c65854d98061 | 148 | * @} |
MartinJohnson | 0:c65854d98061 | 149 | */ |
MartinJohnson | 0:c65854d98061 | 150 | |
MartinJohnson | 0:c65854d98061 | 151 | /** @defgroup Acc_Axes_Selection |
MartinJohnson | 0:c65854d98061 | 152 | * @{ |
MartinJohnson | 0:c65854d98061 | 153 | */ |
MartinJohnson | 0:c65854d98061 | 154 | #define LSM303DLHC_X_ENABLE ((uint8_t)0x01) |
MartinJohnson | 0:c65854d98061 | 155 | #define LSM303DLHC_Y_ENABLE ((uint8_t)0x02) |
MartinJohnson | 0:c65854d98061 | 156 | #define LSM303DLHC_Z_ENABLE ((uint8_t)0x04) |
MartinJohnson | 0:c65854d98061 | 157 | #define LSM303DLHC_AXES_ENABLE ((uint8_t)0x07) |
MartinJohnson | 0:c65854d98061 | 158 | #define LSM303DLHC_AXES_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 159 | /** |
MartinJohnson | 0:c65854d98061 | 160 | * @} |
MartinJohnson | 0:c65854d98061 | 161 | */ |
MartinJohnson | 0:c65854d98061 | 162 | |
MartinJohnson | 0:c65854d98061 | 163 | /** @defgroup Acc_High_Resolution |
MartinJohnson | 0:c65854d98061 | 164 | * @{ |
MartinJohnson | 0:c65854d98061 | 165 | */ |
MartinJohnson | 0:c65854d98061 | 166 | #define LSM303DLHC_HR_ENABLE ((uint8_t)0x08) |
MartinJohnson | 0:c65854d98061 | 167 | #define LSM303DLHC_HR_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 168 | /** |
MartinJohnson | 0:c65854d98061 | 169 | * @} |
MartinJohnson | 0:c65854d98061 | 170 | */ |
MartinJohnson | 0:c65854d98061 | 171 | |
MartinJohnson | 0:c65854d98061 | 172 | /** @defgroup Acc_Full_Scale_Selection |
MartinJohnson | 0:c65854d98061 | 173 | * @{ |
MartinJohnson | 0:c65854d98061 | 174 | */ |
MartinJohnson | 0:c65854d98061 | 175 | #define LSM303DLHC_FULLSCALE_2G ((uint8_t)0x00) /*!< �2 g */ |
MartinJohnson | 0:c65854d98061 | 176 | #define LSM303DLHC_FULLSCALE_4G ((uint8_t)0x10) /*!< �4 g */ |
MartinJohnson | 0:c65854d98061 | 177 | #define LSM303DLHC_FULLSCALE_8G ((uint8_t)0x20) /*!< �8 g */ |
MartinJohnson | 0:c65854d98061 | 178 | #define LSM303DLHC_FULLSCALE_16G ((uint8_t)0x30) /*!< �16 g */ |
MartinJohnson | 0:c65854d98061 | 179 | /** |
MartinJohnson | 0:c65854d98061 | 180 | * @} |
MartinJohnson | 0:c65854d98061 | 181 | */ |
MartinJohnson | 0:c65854d98061 | 182 | |
MartinJohnson | 0:c65854d98061 | 183 | /** @defgroup Acc_Block_Data_Update |
MartinJohnson | 0:c65854d98061 | 184 | * @{ |
MartinJohnson | 0:c65854d98061 | 185 | */ |
MartinJohnson | 0:c65854d98061 | 186 | #define LSM303DLHC_BlockUpdate_Continous ((uint8_t)0x00) /*!< Continuos Update */ |
MartinJohnson | 0:c65854d98061 | 187 | #define LSM303DLHC_BlockUpdate_Single ((uint8_t)0x80) /*!< Single Update: output registers not updated until MSB and LSB reading */ |
MartinJohnson | 0:c65854d98061 | 188 | /** |
MartinJohnson | 0:c65854d98061 | 189 | * @} |
MartinJohnson | 0:c65854d98061 | 190 | */ |
MartinJohnson | 0:c65854d98061 | 191 | |
MartinJohnson | 0:c65854d98061 | 192 | /** @defgroup Acc_Endian_Data_selection |
MartinJohnson | 0:c65854d98061 | 193 | * @{ |
MartinJohnson | 0:c65854d98061 | 194 | */ |
MartinJohnson | 0:c65854d98061 | 195 | #define LSM303DLHC_BLE_LSB ((uint8_t)0x00) /*!< Little Endian: data LSB @ lower address */ |
MartinJohnson | 0:c65854d98061 | 196 | #define LSM303DLHC_BLE_MSB ((uint8_t)0x40) /*!< Big Endian: data MSB @ lower address */ |
MartinJohnson | 0:c65854d98061 | 197 | /** |
MartinJohnson | 0:c65854d98061 | 198 | * @} |
MartinJohnson | 0:c65854d98061 | 199 | */ |
MartinJohnson | 0:c65854d98061 | 200 | |
MartinJohnson | 0:c65854d98061 | 201 | /** @defgroup Acc_Boot_Mode_selection |
MartinJohnson | 0:c65854d98061 | 202 | * @{ |
MartinJohnson | 0:c65854d98061 | 203 | */ |
MartinJohnson | 0:c65854d98061 | 204 | #define LSM303DLHC_BOOT_NORMALMODE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 205 | #define LSM303DLHC_BOOT_REBOOTMEMORY ((uint8_t)0x80) |
MartinJohnson | 0:c65854d98061 | 206 | /** |
MartinJohnson | 0:c65854d98061 | 207 | * @} |
MartinJohnson | 0:c65854d98061 | 208 | */ |
MartinJohnson | 0:c65854d98061 | 209 | |
MartinJohnson | 0:c65854d98061 | 210 | /** @defgroup Acc_High_Pass_Filter_Mode |
MartinJohnson | 0:c65854d98061 | 211 | * @{ |
MartinJohnson | 0:c65854d98061 | 212 | */ |
MartinJohnson | 0:c65854d98061 | 213 | #define LSM303DLHC_HPM_NORMAL_MODE_RES ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 214 | #define LSM303DLHC_HPM_REF_SIGNAL ((uint8_t)0x40) |
MartinJohnson | 0:c65854d98061 | 215 | #define LSM303DLHC_HPM_NORMAL_MODE ((uint8_t)0x80) |
MartinJohnson | 0:c65854d98061 | 216 | #define LSM303DLHC_HPM_AUTORESET_INT ((uint8_t)0xC0) |
MartinJohnson | 0:c65854d98061 | 217 | /** |
MartinJohnson | 0:c65854d98061 | 218 | * @} |
MartinJohnson | 0:c65854d98061 | 219 | */ |
MartinJohnson | 0:c65854d98061 | 220 | |
MartinJohnson | 0:c65854d98061 | 221 | /** @defgroup Acc_High_Pass_CUT OFF_Frequency |
MartinJohnson | 0:c65854d98061 | 222 | * @{ |
MartinJohnson | 0:c65854d98061 | 223 | */ |
MartinJohnson | 0:c65854d98061 | 224 | #define LSM303DLHC_HPFCF_8 ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 225 | #define LSM303DLHC_HPFCF_16 ((uint8_t)0x10) |
MartinJohnson | 0:c65854d98061 | 226 | #define LSM303DLHC_HPFCF_32 ((uint8_t)0x20) |
MartinJohnson | 0:c65854d98061 | 227 | #define LSM303DLHC_HPFCF_64 ((uint8_t)0x30) |
MartinJohnson | 0:c65854d98061 | 228 | /** |
MartinJohnson | 0:c65854d98061 | 229 | * @} |
MartinJohnson | 0:c65854d98061 | 230 | */ |
MartinJohnson | 0:c65854d98061 | 231 | |
MartinJohnson | 0:c65854d98061 | 232 | /** @defgroup Acc_High_Pass_Filter_status |
MartinJohnson | 0:c65854d98061 | 233 | * @{ |
MartinJohnson | 0:c65854d98061 | 234 | */ |
MartinJohnson | 0:c65854d98061 | 235 | #define LSM303DLHC_HIGHPASSFILTER_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 236 | #define LSM303DLHC_HIGHPASSFILTER_ENABLE ((uint8_t)0x08) |
MartinJohnson | 0:c65854d98061 | 237 | /** |
MartinJohnson | 0:c65854d98061 | 238 | * @} |
MartinJohnson | 0:c65854d98061 | 239 | */ |
MartinJohnson | 0:c65854d98061 | 240 | |
MartinJohnson | 0:c65854d98061 | 241 | /** @defgroup Acc_High_Pass_Filter_Click_status |
MartinJohnson | 0:c65854d98061 | 242 | * @{ |
MartinJohnson | 0:c65854d98061 | 243 | */ |
MartinJohnson | 0:c65854d98061 | 244 | #define LSM303DLHC_HPF_CLICK_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 245 | #define LSM303DLHC_HPF_CLICK_ENABLE ((uint8_t)0x04) |
MartinJohnson | 0:c65854d98061 | 246 | /** |
MartinJohnson | 0:c65854d98061 | 247 | * @} |
MartinJohnson | 0:c65854d98061 | 248 | */ |
MartinJohnson | 0:c65854d98061 | 249 | |
MartinJohnson | 0:c65854d98061 | 250 | /** @defgroup Acc_High_Pass_Filter_AOI1_status |
MartinJohnson | 0:c65854d98061 | 251 | * @{ |
MartinJohnson | 0:c65854d98061 | 252 | */ |
MartinJohnson | 0:c65854d98061 | 253 | #define LSM303DLHC_HPF_AOI1_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 254 | #define LSM303DLHC_HPF_AOI1_ENABLE ((uint8_t)0x01) |
MartinJohnson | 0:c65854d98061 | 255 | /** |
MartinJohnson | 0:c65854d98061 | 256 | * @} |
MartinJohnson | 0:c65854d98061 | 257 | */ |
MartinJohnson | 0:c65854d98061 | 258 | |
MartinJohnson | 0:c65854d98061 | 259 | /** @defgroup Acc_High_Pass_Filter_AOI2_status |
MartinJohnson | 0:c65854d98061 | 260 | * @{ |
MartinJohnson | 0:c65854d98061 | 261 | */ |
MartinJohnson | 0:c65854d98061 | 262 | #define LSM303DLHC_HPF_AOI2_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 263 | #define LSM303DLHC_HPF_AOI2_ENABLE ((uint8_t)0x02) |
MartinJohnson | 0:c65854d98061 | 264 | /** |
MartinJohnson | 0:c65854d98061 | 265 | * @} |
MartinJohnson | 0:c65854d98061 | 266 | */ |
MartinJohnson | 0:c65854d98061 | 267 | |
MartinJohnson | 0:c65854d98061 | 268 | /** @defgroup Acc_LSM303DLHC_Interrupt1_Configuration_definition |
MartinJohnson | 0:c65854d98061 | 269 | * @{ |
MartinJohnson | 0:c65854d98061 | 270 | */ |
MartinJohnson | 0:c65854d98061 | 271 | #define LSM303DLHC_IT1_CLICK ((uint8_t)0x80) |
MartinJohnson | 0:c65854d98061 | 272 | #define LSM303DLHC_IT1_AOI1 ((uint8_t)0x40) |
MartinJohnson | 0:c65854d98061 | 273 | #define LSM303DLHC_IT1_AOI2 ((uint8_t)0x20) |
MartinJohnson | 0:c65854d98061 | 274 | #define LSM303DLHC_IT1_DRY1 ((uint8_t)0x10) |
MartinJohnson | 0:c65854d98061 | 275 | #define LSM303DLHC_IT1_DRY2 ((uint8_t)0x08) |
MartinJohnson | 0:c65854d98061 | 276 | #define LSM303DLHC_IT1_WTM ((uint8_t)0x04) |
MartinJohnson | 0:c65854d98061 | 277 | #define LSM303DLHC_IT1_OVERRUN ((uint8_t)0x02) |
MartinJohnson | 0:c65854d98061 | 278 | /** |
MartinJohnson | 0:c65854d98061 | 279 | * @} |
MartinJohnson | 0:c65854d98061 | 280 | */ |
MartinJohnson | 0:c65854d98061 | 281 | |
MartinJohnson | 0:c65854d98061 | 282 | /** @defgroup Acc_LSM303DLHC_Interrupt2_Configuration_definition |
MartinJohnson | 0:c65854d98061 | 283 | * @{ |
MartinJohnson | 0:c65854d98061 | 284 | */ |
MartinJohnson | 0:c65854d98061 | 285 | #define LSM303DLHC_IT2_CLICK ((uint8_t)0x80) |
MartinJohnson | 0:c65854d98061 | 286 | #define LSM303DLHC_IT2_INT1 ((uint8_t)0x40) |
MartinJohnson | 0:c65854d98061 | 287 | #define LSM303DLHC_IT2_INT2 ((uint8_t)0x20) |
MartinJohnson | 0:c65854d98061 | 288 | #define LSM303DLHC_IT2_BOOT ((uint8_t)0x10) |
MartinJohnson | 0:c65854d98061 | 289 | #define LSM303DLHC_IT2_ACT ((uint8_t)0x08) |
MartinJohnson | 0:c65854d98061 | 290 | #define LSM303DLHC_IT2_HLACTIVE ((uint8_t)0x02) |
MartinJohnson | 0:c65854d98061 | 291 | /** |
MartinJohnson | 0:c65854d98061 | 292 | * @} |
MartinJohnson | 0:c65854d98061 | 293 | */ |
MartinJohnson | 0:c65854d98061 | 294 | |
MartinJohnson | 0:c65854d98061 | 295 | /** @defgroup Acc_INT_Combination_Status |
MartinJohnson | 0:c65854d98061 | 296 | * @{ |
MartinJohnson | 0:c65854d98061 | 297 | */ |
MartinJohnson | 0:c65854d98061 | 298 | #define LSM303DLHC_OR_COMBINATION ((uint8_t)0x00) /*!< OR combination of enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 299 | #define LSM303DLHC_AND_COMBINATION ((uint8_t)0x80) /*!< AND combination of enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 300 | #define LSM303DLHC_MOV_RECOGNITION ((uint8_t)0x40) /*!< 6D movement recognition */ |
MartinJohnson | 0:c65854d98061 | 301 | #define LSM303DLHC_POS_RECOGNITION ((uint8_t)0xC0) /*!< 6D position recognition */ |
MartinJohnson | 0:c65854d98061 | 302 | /** |
MartinJohnson | 0:c65854d98061 | 303 | * @} |
MartinJohnson | 0:c65854d98061 | 304 | */ |
MartinJohnson | 0:c65854d98061 | 305 | |
MartinJohnson | 0:c65854d98061 | 306 | /** @defgroup Acc_INT_Axes |
MartinJohnson | 0:c65854d98061 | 307 | * @{ |
MartinJohnson | 0:c65854d98061 | 308 | */ |
MartinJohnson | 0:c65854d98061 | 309 | #define LSM303DLHC_Z_HIGH ((uint8_t)0x20) /*!< Z High enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 310 | #define LSM303DLHC_Z_LOW ((uint8_t)0x10) /*!< Z low enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 311 | #define LSM303DLHC_Y_HIGH ((uint8_t)0x08) /*!< Y High enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 312 | #define LSM303DLHC_Y_LOW ((uint8_t)0x04) /*!< Y low enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 313 | #define LSM303DLHC_X_HIGH ((uint8_t)0x02) /*!< X High enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 314 | #define LSM303DLHC_X_LOW ((uint8_t)0x01) /*!< X low enabled IRQs */ |
MartinJohnson | 0:c65854d98061 | 315 | /** |
MartinJohnson | 0:c65854d98061 | 316 | * @} |
MartinJohnson | 0:c65854d98061 | 317 | */ |
MartinJohnson | 0:c65854d98061 | 318 | |
MartinJohnson | 0:c65854d98061 | 319 | /** @defgroup Acc_INT_Click |
MartinJohnson | 0:c65854d98061 | 320 | * @{ |
MartinJohnson | 0:c65854d98061 | 321 | */ |
MartinJohnson | 0:c65854d98061 | 322 | #define LSM303DLHC_Z_DOUBLE_CLICK ((uint8_t)0x20) /*!< Z double click IRQs */ |
MartinJohnson | 0:c65854d98061 | 323 | #define LSM303DLHC_Z_SINGLE_CLICK ((uint8_t)0x10) /*!< Z single click IRQs */ |
MartinJohnson | 0:c65854d98061 | 324 | #define LSM303DLHC_Y_DOUBLE_CLICK ((uint8_t)0x08) /*!< Y double click IRQs */ |
MartinJohnson | 0:c65854d98061 | 325 | #define LSM303DLHC_Y_SINGLE_CLICK ((uint8_t)0x04) /*!< Y single click IRQs */ |
MartinJohnson | 0:c65854d98061 | 326 | #define LSM303DLHC_X_DOUBLE_CLICK ((uint8_t)0x02) /*!< X double click IRQs */ |
MartinJohnson | 0:c65854d98061 | 327 | #define LSM303DLHC_X_SINGLE_CLICK ((uint8_t)0x01) /*!< X single click IRQs */ |
MartinJohnson | 0:c65854d98061 | 328 | /** |
MartinJohnson | 0:c65854d98061 | 329 | * @} |
MartinJohnson | 0:c65854d98061 | 330 | */ |
MartinJohnson | 0:c65854d98061 | 331 | |
MartinJohnson | 0:c65854d98061 | 332 | /** @defgroup Acc_INT1_Interrupt_status |
MartinJohnson | 0:c65854d98061 | 333 | * @{ |
MartinJohnson | 0:c65854d98061 | 334 | */ |
MartinJohnson | 0:c65854d98061 | 335 | #define LSM303DLHC_INT1INTERRUPT_DISABLE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 336 | #define LSM303DLHC_INT1INTERRUPT_ENABLE ((uint8_t)0x80) |
MartinJohnson | 0:c65854d98061 | 337 | /** |
MartinJohnson | 0:c65854d98061 | 338 | * @} |
MartinJohnson | 0:c65854d98061 | 339 | */ |
MartinJohnson | 0:c65854d98061 | 340 | |
MartinJohnson | 0:c65854d98061 | 341 | /** @defgroup Acc_INT1_Interrupt_ActiveEdge |
MartinJohnson | 0:c65854d98061 | 342 | * @{ |
MartinJohnson | 0:c65854d98061 | 343 | */ |
MartinJohnson | 0:c65854d98061 | 344 | #define LSM303DLHC_INT1INTERRUPT_LOW_EDGE ((uint8_t)0x20) |
MartinJohnson | 0:c65854d98061 | 345 | #define LSM303DLHC_INT1INTERRUPT_HIGH_EDGE ((uint8_t)0x00) |
MartinJohnson | 0:c65854d98061 | 346 | /** |
MartinJohnson | 0:c65854d98061 | 347 | * @} |
MartinJohnson | 0:c65854d98061 | 348 | */ |
MartinJohnson | 0:c65854d98061 | 349 | |
MartinJohnson | 0:c65854d98061 | 350 | /** @defgroup Mag_Data_Rate |
MartinJohnson | 0:c65854d98061 | 351 | * @{ |
MartinJohnson | 0:c65854d98061 | 352 | */ |
MartinJohnson | 0:c65854d98061 | 353 | #define LSM303DLHC_ODR_0_75_HZ ((uint8_t) 0x00) /*!< Output Data Rate = 0.75 Hz */ |
MartinJohnson | 0:c65854d98061 | 354 | #define LSM303DLHC_ODR_1_5_HZ ((uint8_t) 0x04) /*!< Output Data Rate = 1.5 Hz */ |
MartinJohnson | 0:c65854d98061 | 355 | #define LSM303DLHC_ODR_3_0_HZ ((uint8_t) 0x08) /*!< Output Data Rate = 3 Hz */ |
MartinJohnson | 0:c65854d98061 | 356 | #define LSM303DLHC_ODR_7_5_HZ ((uint8_t) 0x0C) /*!< Output Data Rate = 7.5 Hz */ |
MartinJohnson | 0:c65854d98061 | 357 | #define LSM303DLHC_ODR_15_HZ ((uint8_t) 0x10) /*!< Output Data Rate = 15 Hz */ |
MartinJohnson | 0:c65854d98061 | 358 | #define LSM303DLHC_ODR_30_HZ ((uint8_t) 0x14) /*!< Output Data Rate = 30 Hz */ |
MartinJohnson | 0:c65854d98061 | 359 | #define LSM303DLHC_ODR_75_HZ ((uint8_t) 0x18) /*!< Output Data Rate = 75 Hz */ |
MartinJohnson | 0:c65854d98061 | 360 | #define LSM303DLHC_ODR_220_HZ ((uint8_t) 0x1C) /*!< Output Data Rate = 220 Hz */ |
MartinJohnson | 0:c65854d98061 | 361 | /** |
MartinJohnson | 0:c65854d98061 | 362 | * @} |
MartinJohnson | 0:c65854d98061 | 363 | */ |
MartinJohnson | 0:c65854d98061 | 364 | |
MartinJohnson | 0:c65854d98061 | 365 | /** @defgroup Mag_Full_Scale |
MartinJohnson | 0:c65854d98061 | 366 | * @{ |
MartinJohnson | 0:c65854d98061 | 367 | */ |
MartinJohnson | 0:c65854d98061 | 368 | #define LSM303DLHC_FS_1_3_GA ((uint8_t) 0x20) /*!< Full scale = �1.3 Gauss */ |
MartinJohnson | 0:c65854d98061 | 369 | #define LSM303DLHC_FS_1_9_GA ((uint8_t) 0x40) /*!< Full scale = �1.9 Gauss */ |
MartinJohnson | 0:c65854d98061 | 370 | #define LSM303DLHC_FS_2_5_GA ((uint8_t) 0x60) /*!< Full scale = �2.5 Gauss */ |
MartinJohnson | 0:c65854d98061 | 371 | #define LSM303DLHC_FS_4_0_GA ((uint8_t) 0x80) /*!< Full scale = �4.0 Gauss */ |
MartinJohnson | 0:c65854d98061 | 372 | #define LSM303DLHC_FS_4_7_GA ((uint8_t) 0xA0) /*!< Full scale = �4.7 Gauss */ |
MartinJohnson | 0:c65854d98061 | 373 | #define LSM303DLHC_FS_5_6_GA ((uint8_t) 0xC0) /*!< Full scale = �5.6 Gauss */ |
MartinJohnson | 0:c65854d98061 | 374 | #define LSM303DLHC_FS_8_1_GA ((uint8_t) 0xE0) /*!< Full scale = �8.1 Gauss */ |
MartinJohnson | 0:c65854d98061 | 375 | /** |
MartinJohnson | 0:c65854d98061 | 376 | * @} |
MartinJohnson | 0:c65854d98061 | 377 | */ |
MartinJohnson | 0:c65854d98061 | 378 | |
MartinJohnson | 0:c65854d98061 | 379 | /** |
MartinJohnson | 0:c65854d98061 | 380 | * @defgroup Magnetometer_Sensitivity |
MartinJohnson | 0:c65854d98061 | 381 | * @{ |
MartinJohnson | 0:c65854d98061 | 382 | */ |
MartinJohnson | 0:c65854d98061 | 383 | #define LSM303DLHC_M_SENSITIVITY_XY_1_3Ga 1100 /*!< magnetometer X Y axes sensitivity for 1.3 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 384 | #define LSM303DLHC_M_SENSITIVITY_XY_1_9Ga 855 /*!< magnetometer X Y axes sensitivity for 1.9 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 385 | #define LSM303DLHC_M_SENSITIVITY_XY_2_5Ga 670 /*!< magnetometer X Y axes sensitivity for 2.5 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 386 | #define LSM303DLHC_M_SENSITIVITY_XY_4Ga 450 /*!< magnetometer X Y axes sensitivity for 4 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 387 | #define LSM303DLHC_M_SENSITIVITY_XY_4_7Ga 400 /*!< magnetometer X Y axes sensitivity for 4.7 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 388 | #define LSM303DLHC_M_SENSITIVITY_XY_5_6Ga 330 /*!< magnetometer X Y axes sensitivity for 5.6 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 389 | #define LSM303DLHC_M_SENSITIVITY_XY_8_1Ga 230 /*!< magnetometer X Y axes sensitivity for 8.1 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 390 | #define LSM303DLHC_M_SENSITIVITY_Z_1_3Ga 980 /*!< magnetometer Z axis sensitivity for 1.3 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 391 | #define LSM303DLHC_M_SENSITIVITY_Z_1_9Ga 760 /*!< magnetometer Z axis sensitivity for 1.9 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 392 | #define LSM303DLHC_M_SENSITIVITY_Z_2_5Ga 600 /*!< magnetometer Z axis sensitivity for 2.5 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 393 | #define LSM303DLHC_M_SENSITIVITY_Z_4Ga 400 /*!< magnetometer Z axis sensitivity for 4 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 394 | #define LSM303DLHC_M_SENSITIVITY_Z_4_7Ga 355 /*!< magnetometer Z axis sensitivity for 4.7 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 395 | #define LSM303DLHC_M_SENSITIVITY_Z_5_6Ga 295 /*!< magnetometer Z axis sensitivity for 5.6 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 396 | #define LSM303DLHC_M_SENSITIVITY_Z_8_1Ga 205 /*!< magnetometer Z axis sensitivity for 8.1 Ga full scale [LSB/Ga] */ |
MartinJohnson | 0:c65854d98061 | 397 | /** |
MartinJohnson | 0:c65854d98061 | 398 | * @} |
MartinJohnson | 0:c65854d98061 | 399 | */ |
MartinJohnson | 0:c65854d98061 | 400 | |
MartinJohnson | 0:c65854d98061 | 401 | /** @defgroup Mag_Working_Mode |
MartinJohnson | 0:c65854d98061 | 402 | * @{ |
MartinJohnson | 0:c65854d98061 | 403 | */ |
MartinJohnson | 0:c65854d98061 | 404 | #define LSM303DLHC_CONTINUOS_CONVERSION ((uint8_t) 0x00) /*!< Continuous-Conversion Mode */ |
MartinJohnson | 0:c65854d98061 | 405 | #define LSM303DLHC_SINGLE_CONVERSION ((uint8_t) 0x01) /*!< Single-Conversion Mode */ |
MartinJohnson | 0:c65854d98061 | 406 | #define LSM303DLHC_SLEEP ((uint8_t) 0x02) /*!< Sleep Mode */ |
MartinJohnson | 0:c65854d98061 | 407 | /** |
MartinJohnson | 0:c65854d98061 | 408 | * @} |
MartinJohnson | 0:c65854d98061 | 409 | */ |
MartinJohnson | 0:c65854d98061 | 410 | |
MartinJohnson | 0:c65854d98061 | 411 | /** @defgroup Mag_Temperature_Sensor |
MartinJohnson | 0:c65854d98061 | 412 | * @{ |
MartinJohnson | 0:c65854d98061 | 413 | */ |
MartinJohnson | 0:c65854d98061 | 414 | #define LSM303DLHC_TEMPSENSOR_ENABLE ((uint8_t) 0x80) /*!< Temp sensor Enable */ |
MartinJohnson | 0:c65854d98061 | 415 | #define LSM303DLHC_TEMPSENSOR_DISABLE ((uint8_t) 0x00) /*!< Temp sensor Disable */ |
MartinJohnson | 0:c65854d98061 | 416 | /** |
MartinJohnson | 0:c65854d98061 | 417 | * @} |
MartinJohnson | 0:c65854d98061 | 418 | */ |
MartinJohnson | 0:c65854d98061 | 419 | |
MartinJohnson | 0:c65854d98061 | 420 | /** @defgroup STM32F3_DISCOVERY_LSM303DLHC_Exported_Functions |
MartinJohnson | 0:c65854d98061 | 421 | * @{ |
MartinJohnson | 0:c65854d98061 | 422 | */ |
MartinJohnson | 0:c65854d98061 | 423 | #ifdef __cplusplus |
MartinJohnson | 0:c65854d98061 | 424 | } |
MartinJohnson | 0:c65854d98061 | 425 | #endif |
MartinJohnson | 0:c65854d98061 | 426 | |
MartinJohnson | 0:c65854d98061 | 427 | #endif /* __STM32F3_DISCOVERY_LSM303DLHC_H */ |
MartinJohnson | 0:c65854d98061 | 428 | /** |
MartinJohnson | 0:c65854d98061 | 429 | * @} |
MartinJohnson | 0:c65854d98061 | 430 | */ |
MartinJohnson | 0:c65854d98061 | 431 | |
MartinJohnson | 0:c65854d98061 | 432 | /** |
MartinJohnson | 0:c65854d98061 | 433 | * @} |
MartinJohnson | 0:c65854d98061 | 434 | */ |
MartinJohnson | 0:c65854d98061 | 435 | |
MartinJohnson | 0:c65854d98061 | 436 | /** |
MartinJohnson | 0:c65854d98061 | 437 | * @} |
MartinJohnson | 0:c65854d98061 | 438 | */ |
MartinJohnson | 0:c65854d98061 | 439 | |
MartinJohnson | 0:c65854d98061 | 440 | /** |
MartinJohnson | 0:c65854d98061 | 441 | * @} |
MartinJohnson | 0:c65854d98061 | 442 | */ |
MartinJohnson | 0:c65854d98061 | 443 | |
MartinJohnson | 0:c65854d98061 | 444 | |
MartinJohnson | 0:c65854d98061 | 445 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |