Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32f30x_exti.h Source File

stm32f30x_exti.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f30x_exti.h
00004   * @author  MCD Application Team
00005   * @version V1.2.3
00006   * @date    10-July-2015
00007   * @brief   This file contains all the functions prototypes for the EXTI 
00008   *          firmware library.
00009   ******************************************************************************
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
00013   *
00014   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00015   * You may not use this file except in compliance with the License.
00016   * You may obtain a copy of the License at:
00017   *
00018   *        http://www.st.com/software_license_agreement_liberty_v2
00019   *
00020   * Unless required by applicable law or agreed to in writing, software 
00021   * distributed under the License is distributed on an "AS IS" BASIS, 
00022   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00023   * See the License for the specific language governing permissions and
00024   * limitations under the License.
00025   *
00026   ******************************************************************************
00027   */ 
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __STM32F30x_EXTI_H
00031 #define __STM32F30x_EXTI_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /* Includes ------------------------------------------------------------------*/
00038 #include "stm32f30x.h"
00039 
00040 /** @addtogroup STM32F30x_StdPeriph_Driver
00041   * @{
00042   */
00043 
00044 /** @addtogroup EXTI
00045   * @{
00046   */
00047 
00048 /* Exported types ------------------------------------------------------------*/
00049 
00050 /** 
00051   * @brief  EXTI mode enumeration  
00052   */
00053 
00054 typedef enum
00055 {
00056   EXTI_Mode_Interrupt = 0x00,
00057   EXTI_Mode_Event = 0x04
00058 }EXTIMode_TypeDef;
00059 
00060 #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
00061 
00062 /** 
00063   * @brief  EXTI Trigger enumeration  
00064   */
00065 
00066 typedef enum
00067 {
00068   EXTI_Trigger_Rising = 0x08,
00069   EXTI_Trigger_Falling = 0x0C,
00070   EXTI_Trigger_Rising_Falling = 0x10
00071 }EXTITrigger_TypeDef;
00072 
00073 #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
00074                                   ((TRIGGER) == EXTI_Trigger_Falling) || \
00075                                   ((TRIGGER) == EXTI_Trigger_Rising_Falling))
00076 /** 
00077   * @brief  EXTI Init Structure definition  
00078   */
00079 
00080 typedef struct
00081 {
00082   uint32_t EXTI_Line;               /*!< Specifies the EXTI lines to be enabled or disabled.
00083                                          This parameter can be any combination of @ref EXTI_Lines */
00084    
00085   EXTIMode_TypeDef EXTI_Mode;       /*!< Specifies the mode for the EXTI lines.
00086                                          This parameter can be a value of @ref EXTIMode_TypeDef */
00087 
00088   EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
00089                                          This parameter can be a value of @ref EXTITrigger_TypeDef */
00090 
00091   FunctionalState EXTI_LineCmd;     /*!< Specifies the new state of the selected EXTI lines.
00092                                          This parameter can be set either to ENABLE or DISABLE */
00093 }EXTI_InitTypeDef;
00094 
00095 /* Exported constants --------------------------------------------------------*/
00096 
00097 /** @defgroup EXTI_Exported_Constants
00098   * @{
00099   */ 
00100 /** @defgroup EXTI_Lines 
00101   * @{
00102   */
00103 
00104 #define EXTI_Line0       ((uint32_t)0x00)  /*!< External interrupt line 0  */
00105 #define EXTI_Line1       ((uint32_t)0x01)  /*!< External interrupt line 1  */
00106 #define EXTI_Line2       ((uint32_t)0x02)  /*!< External interrupt line 2  */
00107 #define EXTI_Line3       ((uint32_t)0x03)  /*!< External interrupt line 3  */
00108 #define EXTI_Line4       ((uint32_t)0x04)  /*!< External interrupt line 4  */
00109 #define EXTI_Line5       ((uint32_t)0x05)  /*!< External interrupt line 5  */
00110 #define EXTI_Line6       ((uint32_t)0x06)  /*!< External interrupt line 6  */
00111 #define EXTI_Line7       ((uint32_t)0x07)  /*!< External interrupt line 7  */
00112 #define EXTI_Line8       ((uint32_t)0x08)  /*!< External interrupt line 8  */
00113 #define EXTI_Line9       ((uint32_t)0x09)  /*!< External interrupt line 9  */
00114 #define EXTI_Line10      ((uint32_t)0x0A)  /*!< External interrupt line 10 */
00115 #define EXTI_Line11      ((uint32_t)0x0B)  /*!< External interrupt line 11 */
00116 #define EXTI_Line12      ((uint32_t)0x0C)  /*!< External interrupt line 12 */
00117 #define EXTI_Line13      ((uint32_t)0x0D)  /*!< External interrupt line 13 */
00118 #define EXTI_Line14      ((uint32_t)0x0E)  /*!< External interrupt line 14 */
00119 #define EXTI_Line15      ((uint32_t)0x0F)  /*!< External interrupt line 15 */
00120 #define EXTI_Line16      ((uint32_t)0x10)  /*!< External interrupt line 16 
00121                                                       Connected to the PVD Output */
00122 #define EXTI_Line17      ((uint32_t)0x11)  /*!< Internal interrupt line 17 
00123                                                       Connected to the RTC Alarm 
00124                                                       event */
00125 #define EXTI_Line18      ((uint32_t)0x12)  /*!< Internal interrupt line 18 
00126                                                       Connected to the USB Device
00127                                                       Wakeup from suspend event */
00128 #define EXTI_Line19      ((uint32_t)0x13)  /*!< Internal interrupt line 19
00129                                                       Connected to the RTC Tamper
00130                                                       and Time Stamp events */
00131 #define EXTI_Line20      ((uint32_t)0x14)  /*!< Internal interrupt line 20
00132                                                       Connected to the RTC wakeup
00133                                                       event */                                                      
00134 #define EXTI_Line21      ((uint32_t)0x15)  /*!< Internal interrupt line 21
00135                                                       Connected to the Comparator 1
00136                                                       event */
00137 #define EXTI_Line22      ((uint32_t)0x16)  /*!< Internal interrupt line 22
00138                                                       Connected to the Comparator 2
00139                                                       event */
00140 #define EXTI_Line23      ((uint32_t)0x17)  /*!< Internal interrupt line 23
00141                                                       Connected to the I2C1 wakeup
00142                                                       event */
00143 #define EXTI_Line24      ((uint32_t)0x18)  /*!< Internal interrupt line 24
00144                                                       Connected to the I2C2 wakeup
00145                                                       event */
00146 #define EXTI_Line25      ((uint32_t)0x19)  /*!< Internal interrupt line 25
00147                                                       Connected to the USART1 wakeup
00148                                                       event */
00149 #define EXTI_Line26      ((uint32_t)0x1A)  /*!< Internal interrupt line 26
00150                                                       Connected to the USART2 wakeup
00151                                                       event */
00152 #define EXTI_Line27      ((uint32_t)0x1B)  /*!< Internal interrupt line 27
00153                                                        reserved */
00154 #define EXTI_Line28      ((uint32_t)0x1C)  /*!< Internal interrupt line 28
00155                                                       Connected to the USART3 wakeup
00156                                                       event */
00157 #define EXTI_Line29      ((uint32_t)0x1D)  /*!< Internal interrupt line 29
00158                                                       Connected to the Comparator 3 
00159                                                       event */
00160 #define EXTI_Line30      ((uint32_t)0x1E)  /*!< Internal interrupt line 30
00161                                                       Connected to the Comparator 4 
00162                                                       event */
00163 #define EXTI_Line31      ((uint32_t)0x1F)  /*!< Internal interrupt line 31
00164                                                       Connected to the Comparator 5 
00165                                                       event */
00166 #define EXTI_Line32      ((uint32_t)0x20)  /*!< Internal interrupt line 32
00167                                                       Connected to the Comparator 6 
00168                                                       event */
00169 #define EXTI_Line33      ((uint32_t)0x21)  /*!< Internal interrupt line 33
00170                                                       Connected to the Comparator 7 
00171                                                       event */
00172 #define EXTI_Line34      ((uint32_t)0x22)  /*!< Internal interrupt line 34
00173                                                       Connected to the USART4 wakeup
00174                                                       event */
00175 #define EXTI_Line35      ((uint32_t)0x23)  /*!< Internal interrupt line 35
00176                                                       Connected to the USART5 wakeup
00177                                                       event */
00178                                                                                                                                                                                                                                                                                                                                                                                                                                                 
00179 #define IS_EXTI_LINE_ALL(LINE) ((LINE) <= 0x23)
00180 #define IS_EXTI_LINE_EXT(LINE) (((LINE) <= 0x16) || (((LINE) == EXTI_Line29) || ((LINE) == EXTI_Line30) || \
00181                                ((LINE) == EXTI_Line31) || ((LINE) == EXTI_Line32) || ((LINE) == EXTI_Line33)))
00182 
00183 #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
00184                                 ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
00185                                 ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
00186                                 ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
00187                                 ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
00188                                 ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
00189                                 ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
00190                                 ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
00191                                 ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
00192                                 ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
00193                                 ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) || \
00194                                 ((LINE) == EXTI_Line22) || ((LINE) == EXTI_Line29) || \
00195                                 ((LINE) == EXTI_Line30) || ((LINE) == EXTI_Line31) || \
00196                                 ((LINE) == EXTI_Line32) || ((LINE) == EXTI_Line33))
00197 /**
00198   * @}
00199   */
00200  
00201 /**
00202   * @}
00203   */
00204 
00205 /* Exported macro ------------------------------------------------------------*/
00206 /* Exported functions ------------------------------------------------------- */
00207 /* Function used to set the EXTI configuration to the default reset state *****/
00208 void EXTI_DeInit(void);
00209 
00210 /* Initialization and Configuration functions *********************************/
00211 void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
00212 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
00213 void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
00214 
00215 /* Interrupts and flags management functions **********************************/
00216 FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
00217 void EXTI_ClearFlag(uint32_t EXTI_Line);
00218 ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
00219 void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
00220 
00221 #ifdef __cplusplus
00222 }
00223 #endif
00224 
00225 #endif /* __STM32F30x_EXTI_H */
00226 /**
00227   * @}
00228   */ 
00229 
00230 /**
00231   * @}
00232   */
00233 
00234 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/