mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_ll_exti.c@165:e614a9f1c9e2, 2017-05-26 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri May 26 12:39:01 2017 +0100
- Revision:
- 165:e614a9f1c9e2
- Parent:
- 161:2cc1468da177
- Child:
- 182:a56a73fd2a6f
This updates the lib to the mbed lib v 143
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 161:2cc1468da177 | 1 | /** |
<> | 161:2cc1468da177 | 2 | ****************************************************************************** |
<> | 161:2cc1468da177 | 3 | * @file stm32f7xx_ll_exti.c |
<> | 161:2cc1468da177 | 4 | * @author MCD Application Team |
<> | 161:2cc1468da177 | 5 | * @version V1.2.0 |
<> | 161:2cc1468da177 | 6 | * @date 30-December-2016 |
<> | 161:2cc1468da177 | 7 | * @brief EXTI LL module driver. |
<> | 161:2cc1468da177 | 8 | ****************************************************************************** |
<> | 161:2cc1468da177 | 9 | * @attention |
<> | 161:2cc1468da177 | 10 | * |
<> | 161:2cc1468da177 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
<> | 161:2cc1468da177 | 12 | * |
<> | 161:2cc1468da177 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
<> | 161:2cc1468da177 | 14 | * are permitted provided that the following conditions are met: |
<> | 161:2cc1468da177 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 161:2cc1468da177 | 16 | * this list of conditions and the following disclaimer. |
<> | 161:2cc1468da177 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 161:2cc1468da177 | 18 | * this list of conditions and the following disclaimer in the documentation |
<> | 161:2cc1468da177 | 19 | * and/or other materials provided with the distribution. |
<> | 161:2cc1468da177 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
<> | 161:2cc1468da177 | 21 | * may be used to endorse or promote products derived from this software |
<> | 161:2cc1468da177 | 22 | * without specific prior written permission. |
<> | 161:2cc1468da177 | 23 | * |
<> | 161:2cc1468da177 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 161:2cc1468da177 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 161:2cc1468da177 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 161:2cc1468da177 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 161:2cc1468da177 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 161:2cc1468da177 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 161:2cc1468da177 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 161:2cc1468da177 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 161:2cc1468da177 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 161:2cc1468da177 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 161:2cc1468da177 | 34 | * |
<> | 161:2cc1468da177 | 35 | ****************************************************************************** |
<> | 161:2cc1468da177 | 36 | */ |
<> | 161:2cc1468da177 | 37 | #if defined(USE_FULL_LL_DRIVER) |
<> | 161:2cc1468da177 | 38 | |
<> | 161:2cc1468da177 | 39 | /* Includes ------------------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 40 | #include "stm32f7xx_ll_exti.h" |
<> | 161:2cc1468da177 | 41 | #ifdef USE_FULL_ASSERT |
<> | 161:2cc1468da177 | 42 | #include "stm32_assert.h" |
<> | 161:2cc1468da177 | 43 | #else |
<> | 161:2cc1468da177 | 44 | #define assert_param(expr) ((void)0U) |
<> | 161:2cc1468da177 | 45 | #endif |
<> | 161:2cc1468da177 | 46 | |
<> | 161:2cc1468da177 | 47 | /** @addtogroup STM32F7xx_LL_Driver |
<> | 161:2cc1468da177 | 48 | * @{ |
<> | 161:2cc1468da177 | 49 | */ |
<> | 161:2cc1468da177 | 50 | |
<> | 161:2cc1468da177 | 51 | #if defined (EXTI) |
<> | 161:2cc1468da177 | 52 | |
<> | 161:2cc1468da177 | 53 | /** @defgroup EXTI_LL EXTI |
<> | 161:2cc1468da177 | 54 | * @{ |
<> | 161:2cc1468da177 | 55 | */ |
<> | 161:2cc1468da177 | 56 | |
<> | 161:2cc1468da177 | 57 | /* Private types -------------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 58 | /* Private variables ---------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 59 | /* Private constants ---------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 60 | /* Private macros ------------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 61 | /** @addtogroup EXTI_LL_Private_Macros |
<> | 161:2cc1468da177 | 62 | * @{ |
<> | 161:2cc1468da177 | 63 | */ |
<> | 161:2cc1468da177 | 64 | |
<> | 161:2cc1468da177 | 65 | #define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U) |
<> | 161:2cc1468da177 | 66 | |
<> | 161:2cc1468da177 | 67 | #define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \ |
<> | 161:2cc1468da177 | 68 | || ((__VALUE__) == LL_EXTI_MODE_EVENT) \ |
<> | 161:2cc1468da177 | 69 | || ((__VALUE__) == LL_EXTI_MODE_IT_EVENT)) |
<> | 161:2cc1468da177 | 70 | |
<> | 161:2cc1468da177 | 71 | |
<> | 161:2cc1468da177 | 72 | #define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \ |
<> | 161:2cc1468da177 | 73 | || ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \ |
<> | 161:2cc1468da177 | 74 | || ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \ |
<> | 161:2cc1468da177 | 75 | || ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING)) |
<> | 161:2cc1468da177 | 76 | |
<> | 161:2cc1468da177 | 77 | /** |
<> | 161:2cc1468da177 | 78 | * @} |
<> | 161:2cc1468da177 | 79 | */ |
<> | 161:2cc1468da177 | 80 | |
<> | 161:2cc1468da177 | 81 | /* Private function prototypes -----------------------------------------------*/ |
<> | 161:2cc1468da177 | 82 | |
<> | 161:2cc1468da177 | 83 | /* Exported functions --------------------------------------------------------*/ |
<> | 161:2cc1468da177 | 84 | /** @addtogroup EXTI_LL_Exported_Functions |
<> | 161:2cc1468da177 | 85 | * @{ |
<> | 161:2cc1468da177 | 86 | */ |
<> | 161:2cc1468da177 | 87 | |
<> | 161:2cc1468da177 | 88 | /** @addtogroup EXTI_LL_EF_Init |
<> | 161:2cc1468da177 | 89 | * @{ |
<> | 161:2cc1468da177 | 90 | */ |
<> | 161:2cc1468da177 | 91 | |
<> | 161:2cc1468da177 | 92 | /** |
<> | 161:2cc1468da177 | 93 | * @brief De-initialize the EXTI registers to their default reset values. |
<> | 161:2cc1468da177 | 94 | * @retval An ErrorStatus enumeration value: |
<> | 161:2cc1468da177 | 95 | * - SUCCESS: EXTI registers are de-initialized |
<> | 161:2cc1468da177 | 96 | * - ERROR: not applicable |
<> | 161:2cc1468da177 | 97 | */ |
<> | 161:2cc1468da177 | 98 | uint32_t LL_EXTI_DeInit(void) |
<> | 161:2cc1468da177 | 99 | { |
<> | 161:2cc1468da177 | 100 | /* Interrupt mask register set to default reset values */ |
<> | 161:2cc1468da177 | 101 | LL_EXTI_WriteReg(IMR, 0x00000000U); |
<> | 161:2cc1468da177 | 102 | /* Event mask register set to default reset values */ |
<> | 161:2cc1468da177 | 103 | LL_EXTI_WriteReg(EMR, 0x00000000U); |
<> | 161:2cc1468da177 | 104 | /* Rising Trigger selection register set to default reset values */ |
<> | 161:2cc1468da177 | 105 | LL_EXTI_WriteReg(RTSR, 0x00000000U); |
<> | 161:2cc1468da177 | 106 | /* Falling Trigger selection register set to default reset values */ |
<> | 161:2cc1468da177 | 107 | LL_EXTI_WriteReg(FTSR, 0x00000000U); |
<> | 161:2cc1468da177 | 108 | /* Software interrupt event register set to default reset values */ |
<> | 161:2cc1468da177 | 109 | LL_EXTI_WriteReg(SWIER, 0x00000000U); |
<> | 161:2cc1468da177 | 110 | /* Pending register set to default reset values */ |
<> | 161:2cc1468da177 | 111 | LL_EXTI_WriteReg(PR, 0x01FFFFFFU); |
<> | 161:2cc1468da177 | 112 | |
<> | 161:2cc1468da177 | 113 | return SUCCESS; |
<> | 161:2cc1468da177 | 114 | } |
<> | 161:2cc1468da177 | 115 | |
<> | 161:2cc1468da177 | 116 | /** |
<> | 161:2cc1468da177 | 117 | * @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct. |
<> | 161:2cc1468da177 | 118 | * @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure. |
<> | 161:2cc1468da177 | 119 | * @retval An ErrorStatus enumeration value: |
<> | 161:2cc1468da177 | 120 | * - SUCCESS: EXTI registers are initialized |
<> | 161:2cc1468da177 | 121 | * - ERROR: not applicable |
<> | 161:2cc1468da177 | 122 | */ |
<> | 161:2cc1468da177 | 123 | uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct) |
<> | 161:2cc1468da177 | 124 | { |
<> | 161:2cc1468da177 | 125 | ErrorStatus status = SUCCESS; |
<> | 161:2cc1468da177 | 126 | /* Check the parameters */ |
<> | 161:2cc1468da177 | 127 | assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31)); |
<> | 161:2cc1468da177 | 128 | assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand)); |
<> | 161:2cc1468da177 | 129 | assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode)); |
<> | 161:2cc1468da177 | 130 | |
<> | 161:2cc1468da177 | 131 | /* ENABLE LineCommand */ |
<> | 161:2cc1468da177 | 132 | if (EXTI_InitStruct->LineCommand != DISABLE) |
<> | 161:2cc1468da177 | 133 | { |
<> | 161:2cc1468da177 | 134 | assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger)); |
<> | 161:2cc1468da177 | 135 | |
<> | 161:2cc1468da177 | 136 | /* Configure EXTI Lines in range from 0 to 31 */ |
<> | 161:2cc1468da177 | 137 | if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE) |
<> | 161:2cc1468da177 | 138 | { |
<> | 161:2cc1468da177 | 139 | switch (EXTI_InitStruct->Mode) |
<> | 161:2cc1468da177 | 140 | { |
<> | 161:2cc1468da177 | 141 | case LL_EXTI_MODE_IT: |
<> | 161:2cc1468da177 | 142 | /* First Disable Event on provided Lines */ |
<> | 161:2cc1468da177 | 143 | LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 144 | /* Then Enable IT on provided Lines */ |
<> | 161:2cc1468da177 | 145 | LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 146 | break; |
<> | 161:2cc1468da177 | 147 | case LL_EXTI_MODE_EVENT: |
<> | 161:2cc1468da177 | 148 | /* First Disable IT on provided Lines */ |
<> | 161:2cc1468da177 | 149 | LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 150 | /* Then Enable Event on provided Lines */ |
<> | 161:2cc1468da177 | 151 | LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 152 | break; |
<> | 161:2cc1468da177 | 153 | case LL_EXTI_MODE_IT_EVENT: |
<> | 161:2cc1468da177 | 154 | /* Directly Enable IT & Event on provided Lines */ |
<> | 161:2cc1468da177 | 155 | LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 156 | LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 157 | break; |
<> | 161:2cc1468da177 | 158 | default: |
<> | 161:2cc1468da177 | 159 | status = ERROR; |
<> | 161:2cc1468da177 | 160 | break; |
<> | 161:2cc1468da177 | 161 | } |
<> | 161:2cc1468da177 | 162 | if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE) |
<> | 161:2cc1468da177 | 163 | { |
<> | 161:2cc1468da177 | 164 | switch (EXTI_InitStruct->Trigger) |
<> | 161:2cc1468da177 | 165 | { |
<> | 161:2cc1468da177 | 166 | case LL_EXTI_TRIGGER_RISING: |
<> | 161:2cc1468da177 | 167 | /* First Disable Falling Trigger on provided Lines */ |
<> | 161:2cc1468da177 | 168 | LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 169 | /* Then Enable Rising Trigger on provided Lines */ |
<> | 161:2cc1468da177 | 170 | LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 171 | break; |
<> | 161:2cc1468da177 | 172 | case LL_EXTI_TRIGGER_FALLING: |
<> | 161:2cc1468da177 | 173 | /* First Disable Rising Trigger on provided Lines */ |
<> | 161:2cc1468da177 | 174 | LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 175 | /* Then Enable Falling Trigger on provided Lines */ |
<> | 161:2cc1468da177 | 176 | LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 177 | break; |
<> | 161:2cc1468da177 | 178 | case LL_EXTI_TRIGGER_RISING_FALLING: |
<> | 161:2cc1468da177 | 179 | LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 180 | LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 181 | break; |
<> | 161:2cc1468da177 | 182 | default: |
<> | 161:2cc1468da177 | 183 | status = ERROR; |
<> | 161:2cc1468da177 | 184 | break; |
<> | 161:2cc1468da177 | 185 | } |
<> | 161:2cc1468da177 | 186 | } |
<> | 161:2cc1468da177 | 187 | } |
<> | 161:2cc1468da177 | 188 | } |
<> | 161:2cc1468da177 | 189 | /* DISABLE LineCommand */ |
<> | 161:2cc1468da177 | 190 | else |
<> | 161:2cc1468da177 | 191 | { |
<> | 161:2cc1468da177 | 192 | /* De-configure EXTI Lines in range from 0 to 31 */ |
<> | 161:2cc1468da177 | 193 | LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 194 | LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); |
<> | 161:2cc1468da177 | 195 | } |
<> | 161:2cc1468da177 | 196 | return status; |
<> | 161:2cc1468da177 | 197 | } |
<> | 161:2cc1468da177 | 198 | |
<> | 161:2cc1468da177 | 199 | /** |
<> | 161:2cc1468da177 | 200 | * @brief Set each @ref LL_EXTI_InitTypeDef field to default value. |
<> | 161:2cc1468da177 | 201 | * @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure. |
<> | 161:2cc1468da177 | 202 | * @retval None |
<> | 161:2cc1468da177 | 203 | */ |
<> | 161:2cc1468da177 | 204 | void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct) |
<> | 161:2cc1468da177 | 205 | { |
<> | 161:2cc1468da177 | 206 | EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE; |
<> | 161:2cc1468da177 | 207 | EXTI_InitStruct->LineCommand = DISABLE; |
<> | 161:2cc1468da177 | 208 | EXTI_InitStruct->Mode = LL_EXTI_MODE_IT; |
<> | 161:2cc1468da177 | 209 | EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING; |
<> | 161:2cc1468da177 | 210 | } |
<> | 161:2cc1468da177 | 211 | |
<> | 161:2cc1468da177 | 212 | /** |
<> | 161:2cc1468da177 | 213 | * @} |
<> | 161:2cc1468da177 | 214 | */ |
<> | 161:2cc1468da177 | 215 | |
<> | 161:2cc1468da177 | 216 | /** |
<> | 161:2cc1468da177 | 217 | * @} |
<> | 161:2cc1468da177 | 218 | */ |
<> | 161:2cc1468da177 | 219 | |
<> | 161:2cc1468da177 | 220 | /** |
<> | 161:2cc1468da177 | 221 | * @} |
<> | 161:2cc1468da177 | 222 | */ |
<> | 161:2cc1468da177 | 223 | |
<> | 161:2cc1468da177 | 224 | #endif /* defined (EXTI) */ |
<> | 161:2cc1468da177 | 225 | |
<> | 161:2cc1468da177 | 226 | /** |
<> | 161:2cc1468da177 | 227 | * @} |
<> | 161:2cc1468da177 | 228 | */ |
<> | 161:2cc1468da177 | 229 | |
<> | 161:2cc1468da177 | 230 | #endif /* USE_FULL_LL_DRIVER */ |
<> | 161:2cc1468da177 | 231 | |
<> | 161:2cc1468da177 | 232 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |