mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
155:8435094ec241
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 155:8435094ec241 1 /**
mbed_official 155:8435094ec241 2 ******************************************************************************
mbed_official 155:8435094ec241 3 * @file stm32f30x_exti.c
mbed_official 155:8435094ec241 4 * @author MCD Application Team
mbed_official 155:8435094ec241 5 * @version V1.1.0
mbed_official 155:8435094ec241 6 * @date 27-February-2014
mbed_official 155:8435094ec241 7 * @brief This file provides firmware functions to manage the following
mbed_official 155:8435094ec241 8 * functionalities of the EXTI peripheral:
mbed_official 155:8435094ec241 9 * + Initialization and Configuration
mbed_official 155:8435094ec241 10 * + Interrupts and flags management
mbed_official 155:8435094ec241 11 *
mbed_official 155:8435094ec241 12 @verbatim
mbed_official 155:8435094ec241 13 ===============================================================================
mbed_official 155:8435094ec241 14 ##### EXTI features #####
mbed_official 155:8435094ec241 15 ===============================================================================
mbed_official 155:8435094ec241 16 [..] External interrupt/event lines are mapped as following:
mbed_official 155:8435094ec241 17 (#) All available GPIO pins are connected to the 16 external
mbed_official 155:8435094ec241 18 interrupt/event lines from EXTI0 to EXTI15.
mbed_official 155:8435094ec241 19 (#) EXTI line 16 is connected to the PVD output
mbed_official 155:8435094ec241 20 (#) EXTI line 17 is connected to the RTC Alarm event
mbed_official 155:8435094ec241 21 (#) EXTI line 18 is connected to USB Device wakeup event
mbed_official 155:8435094ec241 22 (#) EXTI line 19 is connected to the RTC Tamper and TimeStamp events
mbed_official 155:8435094ec241 23 (#) EXTI line 20 is connected to the RTC wakeup event
mbed_official 155:8435094ec241 24 (#) EXTI line 21 is connected to the Comparator 1 wakeup event
mbed_official 155:8435094ec241 25 (#) EXTI line 22 is connected to the Comparator 2 wakeup event
mbed_official 155:8435094ec241 26 (#) EXTI line 23 is connected to the I2C1 wakeup event
mbed_official 155:8435094ec241 27 (#) EXTI line 24 is connected to the I2C2 wakeup event
mbed_official 155:8435094ec241 28 (#) EXTI line 25 is connected to the USART1 wakeup event
mbed_official 155:8435094ec241 29 (#) EXTI line 26 is connected to the USART2 wakeup event
mbed_official 155:8435094ec241 30 (#) EXTI line 27 is reserved
mbed_official 155:8435094ec241 31 (#) EXTI line 28 is connected to the USART3 wakeup event
mbed_official 155:8435094ec241 32 (#) EXTI line 29 is connected to the Comparator 3 event
mbed_official 155:8435094ec241 33 (#) EXTI line 30 is connected to the Comparator 4 event
mbed_official 155:8435094ec241 34 (#) EXTI line 31 is connected to the Comparator 5 event
mbed_official 155:8435094ec241 35 (#) EXTI line 32 is connected to the Comparator 6 event
mbed_official 155:8435094ec241 36 (#) EXTI line 33 is connected to the Comparator 7 event
mbed_official 155:8435094ec241 37 (#) EXTI line 34 is connected for thr UART4 wakeup event
mbed_official 155:8435094ec241 38 (#) EXTI line 35 is connected for the UART5 wakeup event
mbed_official 155:8435094ec241 39
mbed_official 155:8435094ec241 40 ##### How to use this driver #####
mbed_official 155:8435094ec241 41 ===============================================================================
mbed_official 155:8435094ec241 42 [..] In order to use an I/O pin as an external interrupt source,
mbed_official 155:8435094ec241 43 follow steps below:
mbed_official 155:8435094ec241 44 (#) Configure the I/O in input mode using GPIO_Init().
mbed_official 155:8435094ec241 45 (#) Select the input source pin for the EXTI line using
mbed_official 155:8435094ec241 46 SYSCFG_EXTILineConfig().
mbed_official 155:8435094ec241 47 (#) Select the mode(interrupt, event) and configure the trigger
mbed_official 155:8435094ec241 48 selection (Rising, falling or both) using EXTI_Init(). For the
mbed_official 155:8435094ec241 49 internal interrupt, the trigger selection is not needed
mbed_official 155:8435094ec241 50 (the active edge is always the rising one).
mbed_official 155:8435094ec241 51 (#) Configure NVIC IRQ channel mapped to the EXTI line using NVIC_Init().
mbed_official 155:8435094ec241 52 (#) Optionally, you can generate a software interrupt using the function
mbed_official 155:8435094ec241 53 EXTI_GenerateSWInterrupt().
mbed_official 155:8435094ec241 54 [..]
mbed_official 155:8435094ec241 55 (@) SYSCFG APB clock must be enabled to get write access to SYSCFG_EXTICRx
mbed_official 155:8435094ec241 56 registers using RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
mbed_official 155:8435094ec241 57
mbed_official 155:8435094ec241 58 @endverbatim
mbed_official 155:8435094ec241 59
mbed_official 155:8435094ec241 60 ******************************************************************************
mbed_official 155:8435094ec241 61 * @attention
mbed_official 155:8435094ec241 62 *
mbed_official 155:8435094ec241 63 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 155:8435094ec241 64 *
mbed_official 155:8435094ec241 65 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 155:8435094ec241 66 * are permitted provided that the following conditions are met:
mbed_official 155:8435094ec241 67 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 155:8435094ec241 68 * this list of conditions and the following disclaimer.
mbed_official 155:8435094ec241 69 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 155:8435094ec241 70 * this list of conditions and the following disclaimer in the documentation
mbed_official 155:8435094ec241 71 * and/or other materials provided with the distribution.
mbed_official 155:8435094ec241 72 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 155:8435094ec241 73 * may be used to endorse or promote products derived from this software
mbed_official 155:8435094ec241 74 * without specific prior written permission.
mbed_official 155:8435094ec241 75 *
mbed_official 155:8435094ec241 76 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 155:8435094ec241 77 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 155:8435094ec241 78 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 155:8435094ec241 79 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 155:8435094ec241 80 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 155:8435094ec241 81 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 155:8435094ec241 82 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 155:8435094ec241 83 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 155:8435094ec241 84 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 155:8435094ec241 85 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 155:8435094ec241 86 *
mbed_official 155:8435094ec241 87 ******************************************************************************
mbed_official 155:8435094ec241 88 */
mbed_official 155:8435094ec241 89
mbed_official 155:8435094ec241 90 /* Includes ------------------------------------------------------------------*/
mbed_official 155:8435094ec241 91 #include "stm32f30x_exti.h"
mbed_official 155:8435094ec241 92
mbed_official 155:8435094ec241 93 /** @addtogroup STM32F30x_StdPeriph_Driver
mbed_official 155:8435094ec241 94 * @{
mbed_official 155:8435094ec241 95 */
mbed_official 155:8435094ec241 96
mbed_official 155:8435094ec241 97 /** @defgroup EXTI
mbed_official 155:8435094ec241 98 * @brief EXTI driver modules
mbed_official 155:8435094ec241 99 * @{
mbed_official 155:8435094ec241 100 */
mbed_official 155:8435094ec241 101
mbed_official 155:8435094ec241 102
mbed_official 155:8435094ec241 103 /* Private typedef -----------------------------------------------------------*/
mbed_official 155:8435094ec241 104 /* Private define ------------------------------------------------------------*/
mbed_official 155:8435094ec241 105 #define EXTI_LINENONE ((uint32_t)0x00000) /* No interrupt selected */
mbed_official 155:8435094ec241 106
mbed_official 155:8435094ec241 107 /* Private macro -------------------------------------------------------------*/
mbed_official 155:8435094ec241 108 /* Private variables ---------------------------------------------------------*/
mbed_official 155:8435094ec241 109 /* Private function prototypes -----------------------------------------------*/
mbed_official 155:8435094ec241 110 /* Private functions ---------------------------------------------------------*/
mbed_official 155:8435094ec241 111
mbed_official 155:8435094ec241 112 /** @defgroup EXTI_Private_Functions
mbed_official 155:8435094ec241 113 * @{
mbed_official 155:8435094ec241 114 */
mbed_official 155:8435094ec241 115
mbed_official 155:8435094ec241 116 /** @defgroup EXTI_Group1 Initialization and Configuration functions
mbed_official 155:8435094ec241 117 * @brief Initialization and Configuration functions
mbed_official 155:8435094ec241 118 *
mbed_official 155:8435094ec241 119 @verbatim
mbed_official 155:8435094ec241 120 ===============================================================================
mbed_official 155:8435094ec241 121 ##### Initialization and Configuration functions #####
mbed_official 155:8435094ec241 122 ===============================================================================
mbed_official 155:8435094ec241 123
mbed_official 155:8435094ec241 124 @endverbatim
mbed_official 155:8435094ec241 125 * @{
mbed_official 155:8435094ec241 126 */
mbed_official 155:8435094ec241 127
mbed_official 155:8435094ec241 128 /**
mbed_official 155:8435094ec241 129 * @brief Deinitializes the EXTI peripheral registers to their default reset
mbed_official 155:8435094ec241 130 * values.
mbed_official 155:8435094ec241 131 * @param None
mbed_official 155:8435094ec241 132 * @retval None
mbed_official 155:8435094ec241 133 */
mbed_official 155:8435094ec241 134 void EXTI_DeInit(void)
mbed_official 155:8435094ec241 135 {
mbed_official 155:8435094ec241 136 EXTI->IMR = 0x1F800000;
mbed_official 155:8435094ec241 137 EXTI->EMR = 0x00000000;
mbed_official 155:8435094ec241 138 EXTI->RTSR = 0x00000000;
mbed_official 155:8435094ec241 139 EXTI->FTSR = 0x00000000;
mbed_official 155:8435094ec241 140 EXTI->SWIER = 0x00000000;
mbed_official 155:8435094ec241 141 EXTI->PR = 0xE07FFFFF;
mbed_official 155:8435094ec241 142 EXTI->IMR2 = 0x0000000C;
mbed_official 155:8435094ec241 143 EXTI->EMR2 = 0x00000000;
mbed_official 155:8435094ec241 144 EXTI->RTSR2 = 0x00000000;
mbed_official 155:8435094ec241 145 EXTI->FTSR2 = 0x00000000;
mbed_official 155:8435094ec241 146 EXTI->SWIER2 = 0x00000000;
mbed_official 155:8435094ec241 147 EXTI->PR2 = 0x00000003;
mbed_official 155:8435094ec241 148 }
mbed_official 155:8435094ec241 149
mbed_official 155:8435094ec241 150 /**
mbed_official 155:8435094ec241 151 * @brief Initializes the EXTI peripheral according to the specified
mbed_official 155:8435094ec241 152 * parameters in the EXTI_InitStruct.
mbed_official 155:8435094ec241 153 * EXTI_Line specifies the EXTI line (EXTI0....EXTI35).
mbed_official 155:8435094ec241 154 * EXTI_Mode specifies which EXTI line is used as interrupt or an event.
mbed_official 155:8435094ec241 155 * EXTI_Trigger selects the trigger. When the trigger occurs, interrupt
mbed_official 155:8435094ec241 156 * pending bit will be set.
mbed_official 155:8435094ec241 157 * EXTI_LineCmd controls (Enable/Disable) the EXTI line.
mbed_official 155:8435094ec241 158 * @param EXTI_InitStruct: pointer to a EXTI_InitTypeDef structure that
mbed_official 155:8435094ec241 159 * contains the configuration information for the EXTI peripheral.
mbed_official 155:8435094ec241 160 * @retval None
mbed_official 155:8435094ec241 161 */
mbed_official 155:8435094ec241 162
mbed_official 155:8435094ec241 163
mbed_official 155:8435094ec241 164 void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct)
mbed_official 155:8435094ec241 165 {
mbed_official 155:8435094ec241 166 uint32_t tmp = 0;
mbed_official 155:8435094ec241 167
mbed_official 155:8435094ec241 168 /* Check the parameters */
mbed_official 155:8435094ec241 169 assert_param(IS_EXTI_MODE(EXTI_InitStruct->EXTI_Mode));
mbed_official 155:8435094ec241 170 assert_param(IS_EXTI_TRIGGER(EXTI_InitStruct->EXTI_Trigger));
mbed_official 155:8435094ec241 171 assert_param(IS_EXTI_LINE_ALL(EXTI_InitStruct->EXTI_Line));
mbed_official 155:8435094ec241 172 assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->EXTI_LineCmd));
mbed_official 155:8435094ec241 173
mbed_official 155:8435094ec241 174 tmp = (uint32_t)EXTI_BASE;
mbed_official 155:8435094ec241 175
mbed_official 155:8435094ec241 176 if (EXTI_InitStruct->EXTI_LineCmd != DISABLE)
mbed_official 155:8435094ec241 177 {
mbed_official 155:8435094ec241 178 /* Clear EXTI line configuration */
mbed_official 155:8435094ec241 179 *(__IO uint32_t *) (((uint32_t) &(EXTI->IMR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) &= ~(uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 180 *(__IO uint32_t *) (((uint32_t) &(EXTI->EMR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) &= ~(uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 181
mbed_official 155:8435094ec241 182 tmp += EXTI_InitStruct->EXTI_Mode + (((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20);
mbed_official 155:8435094ec241 183
mbed_official 155:8435094ec241 184 *(__IO uint32_t *) tmp |= (uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 185
mbed_official 155:8435094ec241 186 tmp = (uint32_t)EXTI_BASE;
mbed_official 155:8435094ec241 187
mbed_official 155:8435094ec241 188 /* Clear Rising Falling edge configuration */
mbed_official 155:8435094ec241 189 *(__IO uint32_t *) (((uint32_t) &(EXTI->RTSR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) &= ~(uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 190 *(__IO uint32_t *) (((uint32_t) &(EXTI->FTSR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) &= ~(uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 191
mbed_official 155:8435094ec241 192 /* Select the trigger for the selected interrupts */
mbed_official 155:8435094ec241 193 if (EXTI_InitStruct->EXTI_Trigger == EXTI_Trigger_Rising_Falling)
mbed_official 155:8435094ec241 194 {
mbed_official 155:8435094ec241 195 /* Rising Falling edge */
mbed_official 155:8435094ec241 196 *(__IO uint32_t *) (((uint32_t) &(EXTI->RTSR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) |= (uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 197 *(__IO uint32_t *) (((uint32_t) &(EXTI->FTSR)) + ((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20) |= (uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 198 }
mbed_official 155:8435094ec241 199 else
mbed_official 155:8435094ec241 200 {
mbed_official 155:8435094ec241 201 tmp += EXTI_InitStruct->EXTI_Trigger + (((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20);
mbed_official 155:8435094ec241 202
mbed_official 155:8435094ec241 203 *(__IO uint32_t *) tmp |= (uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 204 }
mbed_official 155:8435094ec241 205 }
mbed_official 155:8435094ec241 206
mbed_official 155:8435094ec241 207 else
mbed_official 155:8435094ec241 208 {
mbed_official 155:8435094ec241 209 tmp += EXTI_InitStruct->EXTI_Mode + (((EXTI_InitStruct->EXTI_Line) >> 5 ) * 0x20);
mbed_official 155:8435094ec241 210
mbed_official 155:8435094ec241 211 /* Disable the selected external lines */
mbed_official 155:8435094ec241 212 *(__IO uint32_t *) tmp &= ~(uint32_t)(1 << (EXTI_InitStruct->EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 213 }
mbed_official 155:8435094ec241 214
mbed_official 155:8435094ec241 215 }
mbed_official 155:8435094ec241 216
mbed_official 155:8435094ec241 217 /**
mbed_official 155:8435094ec241 218 * @brief Fills each EXTI_InitStruct member with its reset value.
mbed_official 155:8435094ec241 219 * @param EXTI_InitStruct: pointer to a EXTI_InitTypeDef structure which will
mbed_official 155:8435094ec241 220 * be initialized.
mbed_official 155:8435094ec241 221 * @retval None
mbed_official 155:8435094ec241 222 */
mbed_official 155:8435094ec241 223 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct)
mbed_official 155:8435094ec241 224 {
mbed_official 155:8435094ec241 225 EXTI_InitStruct->EXTI_Line = EXTI_LINENONE;
mbed_official 155:8435094ec241 226 EXTI_InitStruct->EXTI_Mode = EXTI_Mode_Interrupt;
mbed_official 155:8435094ec241 227 EXTI_InitStruct->EXTI_Trigger = EXTI_Trigger_Rising_Falling;
mbed_official 155:8435094ec241 228 EXTI_InitStruct->EXTI_LineCmd = DISABLE;
mbed_official 155:8435094ec241 229 }
mbed_official 155:8435094ec241 230
mbed_official 155:8435094ec241 231 /**
mbed_official 155:8435094ec241 232 * @brief Generates a Software interrupt on selected EXTI line.
mbed_official 155:8435094ec241 233 * @param EXTI_Line: specifies the EXTI line on which the software interrupt
mbed_official 155:8435094ec241 234 * will be generated.
mbed_official 155:8435094ec241 235 * This parameter can be any combination of EXTI_Linex where x can be (0..20).
mbed_official 155:8435094ec241 236 * @retval None
mbed_official 155:8435094ec241 237 */
mbed_official 155:8435094ec241 238 void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
mbed_official 155:8435094ec241 239 {
mbed_official 155:8435094ec241 240 /* Check the parameters */
mbed_official 155:8435094ec241 241 assert_param(IS_EXTI_LINE_EXT(EXTI_Line));
mbed_official 155:8435094ec241 242
mbed_official 155:8435094ec241 243 *(__IO uint32_t *) (((uint32_t) &(EXTI->SWIER)) + ((EXTI_Line) >> 5 ) * 0x20) |= (uint32_t)(1 << (EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 244
mbed_official 155:8435094ec241 245 }
mbed_official 155:8435094ec241 246
mbed_official 155:8435094ec241 247 /**
mbed_official 155:8435094ec241 248 * @}
mbed_official 155:8435094ec241 249 */
mbed_official 155:8435094ec241 250
mbed_official 155:8435094ec241 251 /** @defgroup EXTI_Group2 Interrupts and flags management functions
mbed_official 155:8435094ec241 252 * @brief EXTI Interrupts and flags management functions
mbed_official 155:8435094ec241 253 *
mbed_official 155:8435094ec241 254 @verbatim
mbed_official 155:8435094ec241 255 ===============================================================================
mbed_official 155:8435094ec241 256 ##### Interrupts and flags management functions #####
mbed_official 155:8435094ec241 257 ===============================================================================
mbed_official 155:8435094ec241 258 [..]
mbed_official 155:8435094ec241 259 This section provides functions allowing to configure the EXTI Interrupts
mbed_official 155:8435094ec241 260 sources and check or clear the flags or pending bits status.
mbed_official 155:8435094ec241 261
mbed_official 155:8435094ec241 262 @endverbatim
mbed_official 155:8435094ec241 263 * @{
mbed_official 155:8435094ec241 264 */
mbed_official 155:8435094ec241 265
mbed_official 155:8435094ec241 266 /**
mbed_official 155:8435094ec241 267 * @brief Checks whether the specified EXTI line flag is set or not.
mbed_official 155:8435094ec241 268 * @param EXTI_Line: specifies the EXTI line flag to check.
mbed_official 155:8435094ec241 269 * This parameter can be any combination of EXTI_Linex where x can be (0..20).
mbed_official 155:8435094ec241 270 * @retval The new state of EXTI_Line (SET or RESET).
mbed_official 155:8435094ec241 271 */
mbed_official 155:8435094ec241 272 FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line)
mbed_official 155:8435094ec241 273 {
mbed_official 155:8435094ec241 274 FlagStatus bitstatus = RESET;
mbed_official 155:8435094ec241 275
mbed_official 155:8435094ec241 276 /* Check the parameters */
mbed_official 155:8435094ec241 277 assert_param(IS_GET_EXTI_LINE(EXTI_Line));
mbed_official 155:8435094ec241 278
mbed_official 155:8435094ec241 279 if ((*(__IO uint32_t *) (((uint32_t) &(EXTI->PR)) + ((EXTI_Line) >> 5 ) * 0x20)& (uint32_t)(1 << (EXTI_Line & 0x1F))) != (uint32_t)RESET)
mbed_official 155:8435094ec241 280 {
mbed_official 155:8435094ec241 281 bitstatus = SET;
mbed_official 155:8435094ec241 282 }
mbed_official 155:8435094ec241 283 else
mbed_official 155:8435094ec241 284 {
mbed_official 155:8435094ec241 285 bitstatus = RESET;
mbed_official 155:8435094ec241 286 }
mbed_official 155:8435094ec241 287 return bitstatus;
mbed_official 155:8435094ec241 288 }
mbed_official 155:8435094ec241 289
mbed_official 155:8435094ec241 290 /**
mbed_official 155:8435094ec241 291 * @brief Clears the EXTI's line pending flags.
mbed_official 155:8435094ec241 292 * @param EXTI_Line: specifies the EXTI lines flags to clear.
mbed_official 155:8435094ec241 293 * This parameter can be any combination of EXTI_Linex where x can be (0..20).
mbed_official 155:8435094ec241 294 * @retval None
mbed_official 155:8435094ec241 295 */
mbed_official 155:8435094ec241 296 void EXTI_ClearFlag(uint32_t EXTI_Line)
mbed_official 155:8435094ec241 297 {
mbed_official 155:8435094ec241 298 /* Check the parameters */
mbed_official 155:8435094ec241 299 assert_param(IS_EXTI_LINE_EXT(EXTI_Line));
mbed_official 155:8435094ec241 300
mbed_official 155:8435094ec241 301 *(__IO uint32_t *) (((uint32_t) &(EXTI->PR)) + ((EXTI_Line) >> 5 ) * 0x20) = (1 << (EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 302 }
mbed_official 155:8435094ec241 303
mbed_official 155:8435094ec241 304 /**
mbed_official 155:8435094ec241 305 * @brief Checks whether the specified EXTI line is asserted or not.
mbed_official 155:8435094ec241 306 * @param EXTI_Line: specifies the EXTI line to check.
mbed_official 155:8435094ec241 307 * This parameter can be any combination of EXTI_Linex where x can be (0..20).
mbed_official 155:8435094ec241 308 * @retval The new state of EXTI_Line (SET or RESET).
mbed_official 155:8435094ec241 309 */
mbed_official 155:8435094ec241 310 ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
mbed_official 155:8435094ec241 311 {
mbed_official 155:8435094ec241 312 ITStatus bitstatus = RESET;
mbed_official 155:8435094ec241 313
mbed_official 155:8435094ec241 314 /* Check the parameters */
mbed_official 155:8435094ec241 315 assert_param(IS_GET_EXTI_LINE(EXTI_Line));
mbed_official 155:8435094ec241 316
mbed_official 155:8435094ec241 317 if ((*(__IO uint32_t *) (((uint32_t) &(EXTI->PR)) + ((EXTI_Line) >> 5 ) * 0x20)& (uint32_t)(1 << (EXTI_Line & 0x1F))) != (uint32_t)RESET)
mbed_official 155:8435094ec241 318 {
mbed_official 155:8435094ec241 319 bitstatus = SET;
mbed_official 155:8435094ec241 320 }
mbed_official 155:8435094ec241 321 else
mbed_official 155:8435094ec241 322 {
mbed_official 155:8435094ec241 323 bitstatus = RESET;
mbed_official 155:8435094ec241 324 }
mbed_official 155:8435094ec241 325 return bitstatus;
mbed_official 155:8435094ec241 326
mbed_official 155:8435094ec241 327 }
mbed_official 155:8435094ec241 328
mbed_official 155:8435094ec241 329 /**
mbed_official 155:8435094ec241 330 * @brief Clears the EXTI's line pending bits.
mbed_official 155:8435094ec241 331 * @param EXTI_Line: specifies the EXTI lines to clear.
mbed_official 155:8435094ec241 332 * This parameter can be any combination of EXTI_Linex where x can be (0..20).
mbed_official 155:8435094ec241 333 * @retval None
mbed_official 155:8435094ec241 334 */
mbed_official 155:8435094ec241 335 void EXTI_ClearITPendingBit(uint32_t EXTI_Line)
mbed_official 155:8435094ec241 336 {
mbed_official 155:8435094ec241 337 /* Check the parameters */
mbed_official 155:8435094ec241 338 assert_param(IS_EXTI_LINE_EXT(EXTI_Line));
mbed_official 155:8435094ec241 339
mbed_official 155:8435094ec241 340 *(__IO uint32_t *) (((uint32_t) &(EXTI->PR)) + ((EXTI_Line) >> 5 ) * 0x20) = (1 << (EXTI_Line & 0x1F));
mbed_official 155:8435094ec241 341 }
mbed_official 155:8435094ec241 342
mbed_official 155:8435094ec241 343 /**
mbed_official 155:8435094ec241 344 * @}
mbed_official 155:8435094ec241 345 */
mbed_official 155:8435094ec241 346
mbed_official 155:8435094ec241 347 /**
mbed_official 155:8435094ec241 348 * @}
mbed_official 155:8435094ec241 349 */
mbed_official 155:8435094ec241 350
mbed_official 155:8435094ec241 351 /**
mbed_official 155:8435094ec241 352 * @}
mbed_official 155:8435094ec241 353 */
mbed_official 155:8435094ec241 354
mbed_official 155:8435094ec241 355 /**
mbed_official 155:8435094ec241 356 * @}
mbed_official 155:8435094ec241 357 */
mbed_official 155:8435094ec241 358
mbed_official 155:8435094ec241 359 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/