mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Tue Mar 20 16:56:18 2018 +0000
Revision:
182:a56a73fd2a6f
Parent:
161:2cc1468da177
mbed-dev library. Release version 160

Who changed what in which revision?

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