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.
Dependencies: CMSIS_STM32L4xx CMSIS_DSP_401 STM32L4xx_HAL_Driver
Disco/stm32l476g_discovery_gyroscope.c@0:ad9dfc0179dc, 2015-11-02 (annotated)
- Committer:
- EricLew
- Date:
- Mon Nov 02 19:38:36 2015 +0000
- Revision:
- 0:ad9dfc0179dc
commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| EricLew | 0:ad9dfc0179dc | 1 | /** |
| EricLew | 0:ad9dfc0179dc | 2 | ****************************************************************************** |
| EricLew | 0:ad9dfc0179dc | 3 | * @file stm32l476g_discovery_gyroscope.c |
| EricLew | 0:ad9dfc0179dc | 4 | * @author MCD Application Team |
| EricLew | 0:ad9dfc0179dc | 5 | * @version V1.0.1 |
| EricLew | 0:ad9dfc0179dc | 6 | * @date 16-September-2015 |
| EricLew | 0:ad9dfc0179dc | 7 | * @brief This file provides a set of functions needed to manage the L3GD20 |
| EricLew | 0:ad9dfc0179dc | 8 | * MEMS accelerometer available on STM32L476G-Discovery board. |
| EricLew | 0:ad9dfc0179dc | 9 | ****************************************************************************** |
| EricLew | 0:ad9dfc0179dc | 10 | * @attention |
| EricLew | 0:ad9dfc0179dc | 11 | * |
| EricLew | 0:ad9dfc0179dc | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
| EricLew | 0:ad9dfc0179dc | 13 | * |
| EricLew | 0:ad9dfc0179dc | 14 | * Redistribution and use in source and binary forms, with or without modification, |
| EricLew | 0:ad9dfc0179dc | 15 | * are permitted provided that the following conditions are met: |
| EricLew | 0:ad9dfc0179dc | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
| EricLew | 0:ad9dfc0179dc | 17 | * this list of conditions and the following disclaimer. |
| EricLew | 0:ad9dfc0179dc | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| EricLew | 0:ad9dfc0179dc | 19 | * this list of conditions and the following disclaimer in the documentation |
| EricLew | 0:ad9dfc0179dc | 20 | * and/or other materials provided with the distribution. |
| EricLew | 0:ad9dfc0179dc | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| EricLew | 0:ad9dfc0179dc | 22 | * may be used to endorse or promote products derived from this software |
| EricLew | 0:ad9dfc0179dc | 23 | * without specific prior written permission. |
| EricLew | 0:ad9dfc0179dc | 24 | * |
| EricLew | 0:ad9dfc0179dc | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| EricLew | 0:ad9dfc0179dc | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| EricLew | 0:ad9dfc0179dc | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| EricLew | 0:ad9dfc0179dc | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| EricLew | 0:ad9dfc0179dc | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| EricLew | 0:ad9dfc0179dc | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| EricLew | 0:ad9dfc0179dc | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| EricLew | 0:ad9dfc0179dc | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| EricLew | 0:ad9dfc0179dc | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| EricLew | 0:ad9dfc0179dc | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| EricLew | 0:ad9dfc0179dc | 35 | * |
| EricLew | 0:ad9dfc0179dc | 36 | ****************************************************************************** |
| EricLew | 0:ad9dfc0179dc | 37 | */ |
| EricLew | 0:ad9dfc0179dc | 38 | |
| EricLew | 0:ad9dfc0179dc | 39 | /* Includes ------------------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 40 | #include "stm32l476g_discovery_gyroscope.h" |
| EricLew | 0:ad9dfc0179dc | 41 | |
| EricLew | 0:ad9dfc0179dc | 42 | /** @addtogroup BSP |
| EricLew | 0:ad9dfc0179dc | 43 | * @{ |
| EricLew | 0:ad9dfc0179dc | 44 | */ |
| EricLew | 0:ad9dfc0179dc | 45 | |
| EricLew | 0:ad9dfc0179dc | 46 | /** @addtogroup STM32L476G_DISCOVERY |
| EricLew | 0:ad9dfc0179dc | 47 | * @{ |
| EricLew | 0:ad9dfc0179dc | 48 | */ |
| EricLew | 0:ad9dfc0179dc | 49 | |
| EricLew | 0:ad9dfc0179dc | 50 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE STM32L476G-DISCOVERY GYROSCOPE |
| EricLew | 0:ad9dfc0179dc | 51 | * @{ |
| EricLew | 0:ad9dfc0179dc | 52 | */ |
| EricLew | 0:ad9dfc0179dc | 53 | |
| EricLew | 0:ad9dfc0179dc | 54 | /* Private typedef -----------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 55 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE_Private_Types Private Types |
| EricLew | 0:ad9dfc0179dc | 56 | * @{ |
| EricLew | 0:ad9dfc0179dc | 57 | */ |
| EricLew | 0:ad9dfc0179dc | 58 | /** |
| EricLew | 0:ad9dfc0179dc | 59 | * @} |
| EricLew | 0:ad9dfc0179dc | 60 | */ |
| EricLew | 0:ad9dfc0179dc | 61 | |
| EricLew | 0:ad9dfc0179dc | 62 | /* Private defines ------------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 63 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE_Private_Constants Private Constants |
| EricLew | 0:ad9dfc0179dc | 64 | * @{ |
| EricLew | 0:ad9dfc0179dc | 65 | */ |
| EricLew | 0:ad9dfc0179dc | 66 | /** |
| EricLew | 0:ad9dfc0179dc | 67 | * @} |
| EricLew | 0:ad9dfc0179dc | 68 | */ |
| EricLew | 0:ad9dfc0179dc | 69 | |
| EricLew | 0:ad9dfc0179dc | 70 | /* Private macros ------------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 71 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE_Private_Macros Private Macros |
| EricLew | 0:ad9dfc0179dc | 72 | * @{ |
| EricLew | 0:ad9dfc0179dc | 73 | */ |
| EricLew | 0:ad9dfc0179dc | 74 | /** |
| EricLew | 0:ad9dfc0179dc | 75 | * @} |
| EricLew | 0:ad9dfc0179dc | 76 | */ |
| EricLew | 0:ad9dfc0179dc | 77 | |
| EricLew | 0:ad9dfc0179dc | 78 | /* Private variables ---------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 79 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE_Private_Variables Private Variables |
| EricLew | 0:ad9dfc0179dc | 80 | * @{ |
| EricLew | 0:ad9dfc0179dc | 81 | */ |
| EricLew | 0:ad9dfc0179dc | 82 | static GYRO_DrvTypeDef *GyroscopeDrv; |
| EricLew | 0:ad9dfc0179dc | 83 | |
| EricLew | 0:ad9dfc0179dc | 84 | /** |
| EricLew | 0:ad9dfc0179dc | 85 | * @} |
| EricLew | 0:ad9dfc0179dc | 86 | */ |
| EricLew | 0:ad9dfc0179dc | 87 | |
| EricLew | 0:ad9dfc0179dc | 88 | /* Private function prototypes -----------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 89 | /** @defgroup STM32L476G_DISCOVERY_GYROSCOPE_Private_FunctionPrototypes Private Functions |
| EricLew | 0:ad9dfc0179dc | 90 | * @{ |
| EricLew | 0:ad9dfc0179dc | 91 | */ |
| EricLew | 0:ad9dfc0179dc | 92 | /** |
| EricLew | 0:ad9dfc0179dc | 93 | * @} |
| EricLew | 0:ad9dfc0179dc | 94 | */ |
| EricLew | 0:ad9dfc0179dc | 95 | |
| EricLew | 0:ad9dfc0179dc | 96 | /* Exported functions --------------------------------------------------------*/ |
| EricLew | 0:ad9dfc0179dc | 97 | /** @addtogroup STM32L476G_DISCOVERY_GYROSCOPE_Exported_Functions |
| EricLew | 0:ad9dfc0179dc | 98 | * @{ |
| EricLew | 0:ad9dfc0179dc | 99 | */ |
| EricLew | 0:ad9dfc0179dc | 100 | |
| EricLew | 0:ad9dfc0179dc | 101 | /** |
| EricLew | 0:ad9dfc0179dc | 102 | * @brief Initialize Gyroscope. |
| EricLew | 0:ad9dfc0179dc | 103 | * @retval GYRO_OK or GYRO_ERROR |
| EricLew | 0:ad9dfc0179dc | 104 | */ |
| EricLew | 0:ad9dfc0179dc | 105 | uint8_t BSP_GYRO_Init(void) |
| EricLew | 0:ad9dfc0179dc | 106 | { |
| EricLew | 0:ad9dfc0179dc | 107 | uint8_t ret = GYRO_ERROR; |
| EricLew | 0:ad9dfc0179dc | 108 | uint16_t ctrl = 0x0000; |
| EricLew | 0:ad9dfc0179dc | 109 | GYRO_InitTypeDef L3GD20_InitStructure; |
| EricLew | 0:ad9dfc0179dc | 110 | GYRO_FilterConfigTypeDef L3GD20_FilterStructure={0,0}; |
| EricLew | 0:ad9dfc0179dc | 111 | |
| EricLew | 0:ad9dfc0179dc | 112 | if((L3gd20Drv.ReadID() == I_AM_L3GD20) || (L3gd20Drv.ReadID() == I_AM_L3GD20_TR)) |
| EricLew | 0:ad9dfc0179dc | 113 | { |
| EricLew | 0:ad9dfc0179dc | 114 | /* Initialize the gyroscope driver structure */ |
| EricLew | 0:ad9dfc0179dc | 115 | GyroscopeDrv = &L3gd20Drv; |
| EricLew | 0:ad9dfc0179dc | 116 | |
| EricLew | 0:ad9dfc0179dc | 117 | /* Configure Mems : data rate, power mode, full scale and axes */ |
| EricLew | 0:ad9dfc0179dc | 118 | L3GD20_InitStructure.Power_Mode = L3GD20_MODE_ACTIVE; |
| EricLew | 0:ad9dfc0179dc | 119 | L3GD20_InitStructure.Output_DataRate = L3GD20_OUTPUT_DATARATE_1; |
| EricLew | 0:ad9dfc0179dc | 120 | L3GD20_InitStructure.Axes_Enable = L3GD20_AXES_ENABLE; |
| EricLew | 0:ad9dfc0179dc | 121 | L3GD20_InitStructure.Band_Width = L3GD20_BANDWIDTH_4; |
| EricLew | 0:ad9dfc0179dc | 122 | L3GD20_InitStructure.BlockData_Update = L3GD20_BlockDataUpdate_Continous; |
| EricLew | 0:ad9dfc0179dc | 123 | L3GD20_InitStructure.Endianness = L3GD20_BLE_LSB; |
| EricLew | 0:ad9dfc0179dc | 124 | L3GD20_InitStructure.Full_Scale = L3GD20_FULLSCALE_500; |
| EricLew | 0:ad9dfc0179dc | 125 | |
| EricLew | 0:ad9dfc0179dc | 126 | /* Configure MEMS: data rate, power mode, full scale and axes */ |
| EricLew | 0:ad9dfc0179dc | 127 | ctrl = (uint16_t) (L3GD20_InitStructure.Power_Mode | L3GD20_InitStructure.Output_DataRate | \ |
| EricLew | 0:ad9dfc0179dc | 128 | L3GD20_InitStructure.Axes_Enable | L3GD20_InitStructure.Band_Width); |
| EricLew | 0:ad9dfc0179dc | 129 | |
| EricLew | 0:ad9dfc0179dc | 130 | ctrl |= (uint16_t) ((L3GD20_InitStructure.BlockData_Update | L3GD20_InitStructure.Endianness | \ |
| EricLew | 0:ad9dfc0179dc | 131 | L3GD20_InitStructure.Full_Scale) << 8); |
| EricLew | 0:ad9dfc0179dc | 132 | |
| EricLew | 0:ad9dfc0179dc | 133 | /* Initialize component */ |
| EricLew | 0:ad9dfc0179dc | 134 | GyroscopeDrv->Init(ctrl); |
| EricLew | 0:ad9dfc0179dc | 135 | |
| EricLew | 0:ad9dfc0179dc | 136 | L3GD20_FilterStructure.HighPassFilter_Mode_Selection =L3GD20_HPM_NORMAL_MODE_RES; |
| EricLew | 0:ad9dfc0179dc | 137 | L3GD20_FilterStructure.HighPassFilter_CutOff_Frequency = L3GD20_HPFCF_0; |
| EricLew | 0:ad9dfc0179dc | 138 | |
| EricLew | 0:ad9dfc0179dc | 139 | ctrl = (uint8_t) ((L3GD20_FilterStructure.HighPassFilter_Mode_Selection |\ |
| EricLew | 0:ad9dfc0179dc | 140 | L3GD20_FilterStructure.HighPassFilter_CutOff_Frequency)); |
| EricLew | 0:ad9dfc0179dc | 141 | |
| EricLew | 0:ad9dfc0179dc | 142 | /* Configure component filter */ |
| EricLew | 0:ad9dfc0179dc | 143 | GyroscopeDrv->FilterConfig(ctrl) ; |
| EricLew | 0:ad9dfc0179dc | 144 | |
| EricLew | 0:ad9dfc0179dc | 145 | /* Enable component filter */ |
| EricLew | 0:ad9dfc0179dc | 146 | GyroscopeDrv->FilterCmd(L3GD20_HIGHPASSFILTER_ENABLE); |
| EricLew | 0:ad9dfc0179dc | 147 | |
| EricLew | 0:ad9dfc0179dc | 148 | ret = GYRO_OK; |
| EricLew | 0:ad9dfc0179dc | 149 | } |
| EricLew | 0:ad9dfc0179dc | 150 | else |
| EricLew | 0:ad9dfc0179dc | 151 | { |
| EricLew | 0:ad9dfc0179dc | 152 | ret = GYRO_ERROR; |
| EricLew | 0:ad9dfc0179dc | 153 | } |
| EricLew | 0:ad9dfc0179dc | 154 | |
| EricLew | 0:ad9dfc0179dc | 155 | return ret; |
| EricLew | 0:ad9dfc0179dc | 156 | } |
| EricLew | 0:ad9dfc0179dc | 157 | |
| EricLew | 0:ad9dfc0179dc | 158 | |
| EricLew | 0:ad9dfc0179dc | 159 | /** |
| EricLew | 0:ad9dfc0179dc | 160 | * @brief DeInitialize Gyroscope. |
| EricLew | 0:ad9dfc0179dc | 161 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 162 | */ |
| EricLew | 0:ad9dfc0179dc | 163 | void BSP_GYRO_DeInit(void) |
| EricLew | 0:ad9dfc0179dc | 164 | { |
| EricLew | 0:ad9dfc0179dc | 165 | GYRO_IO_DeInit(); |
| EricLew | 0:ad9dfc0179dc | 166 | } |
| EricLew | 0:ad9dfc0179dc | 167 | |
| EricLew | 0:ad9dfc0179dc | 168 | |
| EricLew | 0:ad9dfc0179dc | 169 | /** |
| EricLew | 0:ad9dfc0179dc | 170 | * @brief Put Gyroscope in low power mode. |
| EricLew | 0:ad9dfc0179dc | 171 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 172 | */ |
| EricLew | 0:ad9dfc0179dc | 173 | void BSP_GYRO_LowPower(void) |
| EricLew | 0:ad9dfc0179dc | 174 | { |
| EricLew | 0:ad9dfc0179dc | 175 | uint16_t ctrl = 0x0000; |
| EricLew | 0:ad9dfc0179dc | 176 | GYRO_InitTypeDef L3GD20_InitStructure; |
| EricLew | 0:ad9dfc0179dc | 177 | |
| EricLew | 0:ad9dfc0179dc | 178 | /* configure only Power_Mode field */ |
| EricLew | 0:ad9dfc0179dc | 179 | L3GD20_InitStructure.Power_Mode = L3GD20_MODE_POWERDOWN; |
| EricLew | 0:ad9dfc0179dc | 180 | |
| EricLew | 0:ad9dfc0179dc | 181 | ctrl = (uint16_t) (L3GD20_InitStructure.Power_Mode); |
| EricLew | 0:ad9dfc0179dc | 182 | |
| EricLew | 0:ad9dfc0179dc | 183 | /* Set component in low-power mode */ |
| EricLew | 0:ad9dfc0179dc | 184 | GyroscopeDrv->LowPower(ctrl); |
| EricLew | 0:ad9dfc0179dc | 185 | |
| EricLew | 0:ad9dfc0179dc | 186 | |
| EricLew | 0:ad9dfc0179dc | 187 | } |
| EricLew | 0:ad9dfc0179dc | 188 | |
| EricLew | 0:ad9dfc0179dc | 189 | /** |
| EricLew | 0:ad9dfc0179dc | 190 | * @brief Read ID of Gyroscope component. |
| EricLew | 0:ad9dfc0179dc | 191 | * @retval ID |
| EricLew | 0:ad9dfc0179dc | 192 | */ |
| EricLew | 0:ad9dfc0179dc | 193 | uint8_t BSP_GYRO_ReadID(void) |
| EricLew | 0:ad9dfc0179dc | 194 | { |
| EricLew | 0:ad9dfc0179dc | 195 | uint8_t id = 0x00; |
| EricLew | 0:ad9dfc0179dc | 196 | |
| EricLew | 0:ad9dfc0179dc | 197 | if(GyroscopeDrv->ReadID != NULL) |
| EricLew | 0:ad9dfc0179dc | 198 | { |
| EricLew | 0:ad9dfc0179dc | 199 | id = GyroscopeDrv->ReadID(); |
| EricLew | 0:ad9dfc0179dc | 200 | } |
| EricLew | 0:ad9dfc0179dc | 201 | return id; |
| EricLew | 0:ad9dfc0179dc | 202 | } |
| EricLew | 0:ad9dfc0179dc | 203 | |
| EricLew | 0:ad9dfc0179dc | 204 | /** |
| EricLew | 0:ad9dfc0179dc | 205 | * @brief Reboot memory content of Gyroscope. |
| EricLew | 0:ad9dfc0179dc | 206 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 207 | */ |
| EricLew | 0:ad9dfc0179dc | 208 | void BSP_GYRO_Reset(void) |
| EricLew | 0:ad9dfc0179dc | 209 | { |
| EricLew | 0:ad9dfc0179dc | 210 | if(GyroscopeDrv->Reset != NULL) |
| EricLew | 0:ad9dfc0179dc | 211 | { |
| EricLew | 0:ad9dfc0179dc | 212 | GyroscopeDrv->Reset(); |
| EricLew | 0:ad9dfc0179dc | 213 | } |
| EricLew | 0:ad9dfc0179dc | 214 | } |
| EricLew | 0:ad9dfc0179dc | 215 | |
| EricLew | 0:ad9dfc0179dc | 216 | /** |
| EricLew | 0:ad9dfc0179dc | 217 | * @brief Configure Gyroscope interrupts (INT1 or INT2). |
| EricLew | 0:ad9dfc0179dc | 218 | * @param pIntConfig: pointer to a GYRO_InterruptConfigTypeDef |
| EricLew | 0:ad9dfc0179dc | 219 | * structure that contains the configuration setting for the L3GD20 Interrupt. |
| EricLew | 0:ad9dfc0179dc | 220 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 221 | */ |
| EricLew | 0:ad9dfc0179dc | 222 | void BSP_GYRO_ITConfig(GYRO_InterruptConfigTypeDef *pIntConfig) |
| EricLew | 0:ad9dfc0179dc | 223 | { |
| EricLew | 0:ad9dfc0179dc | 224 | uint16_t interruptconfig = 0x0000; |
| EricLew | 0:ad9dfc0179dc | 225 | |
| EricLew | 0:ad9dfc0179dc | 226 | if(GyroscopeDrv->ConfigIT != NULL) |
| EricLew | 0:ad9dfc0179dc | 227 | { |
| EricLew | 0:ad9dfc0179dc | 228 | /* Configure latch Interrupt request and axe interrupts */ |
| EricLew | 0:ad9dfc0179dc | 229 | interruptconfig |= ((uint8_t)(pIntConfig->Latch_Request| \ |
| EricLew | 0:ad9dfc0179dc | 230 | pIntConfig->Interrupt_Axes) << 8); |
| EricLew | 0:ad9dfc0179dc | 231 | |
| EricLew | 0:ad9dfc0179dc | 232 | interruptconfig |= (uint8_t)(pIntConfig->Interrupt_ActiveEdge); |
| EricLew | 0:ad9dfc0179dc | 233 | |
| EricLew | 0:ad9dfc0179dc | 234 | GyroscopeDrv->ConfigIT(interruptconfig); |
| EricLew | 0:ad9dfc0179dc | 235 | } |
| EricLew | 0:ad9dfc0179dc | 236 | } |
| EricLew | 0:ad9dfc0179dc | 237 | |
| EricLew | 0:ad9dfc0179dc | 238 | /** |
| EricLew | 0:ad9dfc0179dc | 239 | * @brief Enable Gyroscope interrupts (INT1 or INT2). |
| EricLew | 0:ad9dfc0179dc | 240 | * @param IntPin: Interrupt pin |
| EricLew | 0:ad9dfc0179dc | 241 | * This parameter can be: |
| EricLew | 0:ad9dfc0179dc | 242 | * @arg L3GD20_INT1 |
| EricLew | 0:ad9dfc0179dc | 243 | * @arg L3GD20_INT2 |
| EricLew | 0:ad9dfc0179dc | 244 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 245 | */ |
| EricLew | 0:ad9dfc0179dc | 246 | void BSP_GYRO_EnableIT(uint8_t IntPin) |
| EricLew | 0:ad9dfc0179dc | 247 | { |
| EricLew | 0:ad9dfc0179dc | 248 | if(GyroscopeDrv->EnableIT != NULL) |
| EricLew | 0:ad9dfc0179dc | 249 | { |
| EricLew | 0:ad9dfc0179dc | 250 | GyroscopeDrv->EnableIT(IntPin); |
| EricLew | 0:ad9dfc0179dc | 251 | } |
| EricLew | 0:ad9dfc0179dc | 252 | } |
| EricLew | 0:ad9dfc0179dc | 253 | |
| EricLew | 0:ad9dfc0179dc | 254 | /** |
| EricLew | 0:ad9dfc0179dc | 255 | * @brief Disable Gyroscope interrupts (INT1 or INT2). |
| EricLew | 0:ad9dfc0179dc | 256 | * @param IntPin: Interrupt pin |
| EricLew | 0:ad9dfc0179dc | 257 | * This parameter can be: |
| EricLew | 0:ad9dfc0179dc | 258 | * @arg L3GD20_INT1 |
| EricLew | 0:ad9dfc0179dc | 259 | * @arg L3GD20_INT2 |
| EricLew | 0:ad9dfc0179dc | 260 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 261 | */ |
| EricLew | 0:ad9dfc0179dc | 262 | void BSP_GYRO_DisableIT(uint8_t IntPin) |
| EricLew | 0:ad9dfc0179dc | 263 | { |
| EricLew | 0:ad9dfc0179dc | 264 | if(GyroscopeDrv->DisableIT != NULL) |
| EricLew | 0:ad9dfc0179dc | 265 | { |
| EricLew | 0:ad9dfc0179dc | 266 | GyroscopeDrv->DisableIT(IntPin); |
| EricLew | 0:ad9dfc0179dc | 267 | } |
| EricLew | 0:ad9dfc0179dc | 268 | } |
| EricLew | 0:ad9dfc0179dc | 269 | |
| EricLew | 0:ad9dfc0179dc | 270 | /** |
| EricLew | 0:ad9dfc0179dc | 271 | * @brief Get XYZ angular acceleration from the Gyroscope. |
| EricLew | 0:ad9dfc0179dc | 272 | * @param pfData: pointer on floating array |
| EricLew | 0:ad9dfc0179dc | 273 | * @retval None |
| EricLew | 0:ad9dfc0179dc | 274 | */ |
| EricLew | 0:ad9dfc0179dc | 275 | void BSP_GYRO_GetXYZ(float* pfData) |
| EricLew | 0:ad9dfc0179dc | 276 | { |
| EricLew | 0:ad9dfc0179dc | 277 | if(GyroscopeDrv->GetXYZ!= NULL) |
| EricLew | 0:ad9dfc0179dc | 278 | { |
| EricLew | 0:ad9dfc0179dc | 279 | GyroscopeDrv->GetXYZ(pfData); |
| EricLew | 0:ad9dfc0179dc | 280 | } |
| EricLew | 0:ad9dfc0179dc | 281 | } |
| EricLew | 0:ad9dfc0179dc | 282 | |
| EricLew | 0:ad9dfc0179dc | 283 | /** |
| EricLew | 0:ad9dfc0179dc | 284 | * @} |
| EricLew | 0:ad9dfc0179dc | 285 | */ |
| EricLew | 0:ad9dfc0179dc | 286 | |
| EricLew | 0:ad9dfc0179dc | 287 | /** |
| EricLew | 0:ad9dfc0179dc | 288 | * @} |
| EricLew | 0:ad9dfc0179dc | 289 | */ |
| EricLew | 0:ad9dfc0179dc | 290 | |
| EricLew | 0:ad9dfc0179dc | 291 | /** |
| EricLew | 0:ad9dfc0179dc | 292 | * @} |
| EricLew | 0:ad9dfc0179dc | 293 | */ |
| EricLew | 0:ad9dfc0179dc | 294 | |
| EricLew | 0:ad9dfc0179dc | 295 | /** |
| EricLew | 0:ad9dfc0179dc | 296 | * @} |
| EricLew | 0:ad9dfc0179dc | 297 | */ |
| EricLew | 0:ad9dfc0179dc | 298 | |
| EricLew | 0:ad9dfc0179dc | 299 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| EricLew | 0:ad9dfc0179dc | 300 |