1 /* Define to prevent recursive inclusion -------------------------------------*/ 2 #ifndef __AIR32F10x_EXTI_H 3 #define __AIR32F10x_EXTI_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 /* Includes ------------------------------------------------------------------*/ 10 #include "air32f10x.h" 11 12 /** @addtogroup air32f10x_StdPeriph_Driver 13 * @{ 14 */ 15 16 /** @addtogroup EXTI 17 * @{ 18 */ 19 20 /** @defgroup EXTI_Exported_Types 21 * @{ 22 */ 23 24 /** 25 * @brief EXTI mode enumeration 26 */ 27 28 typedef enum 29 { 30 EXTI_Mode_Interrupt = 0x00, 31 EXTI_Mode_Event = 0x04 32 }EXTIMode_TypeDef; 33 34 #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event)) 35 36 /** 37 * @brief EXTI Trigger enumeration 38 */ 39 40 typedef enum 41 { 42 EXTI_Trigger_Rising = 0x08, 43 EXTI_Trigger_Falling = 0x0C, 44 EXTI_Trigger_Rising_Falling = 0x10 45 }EXTITrigger_TypeDef; 46 47 #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \ 48 ((TRIGGER) == EXTI_Trigger_Falling) || \ 49 ((TRIGGER) == EXTI_Trigger_Rising_Falling)) 50 /** 51 * @brief EXTI Init Structure definition 52 */ 53 54 typedef struct 55 { 56 uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled. 57 This parameter can be any combination of @ref EXTI_Lines */ 58 59 EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines. 60 This parameter can be a value of @ref EXTIMode_TypeDef */ 61 62 EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines. 63 This parameter can be a value of @ref EXTIMode_TypeDef */ 64 65 FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines. 66 This parameter can be set either to ENABLE or DISABLE */ 67 }EXTI_InitTypeDef; 68 69 /** 70 * @} 71 */ 72 73 /** @defgroup EXTI_Exported_Constants 74 * @{ 75 */ 76 77 /** @defgroup EXTI_Lines 78 * @{ 79 */ 80 81 #define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 */ 82 #define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 */ 83 #define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */ 84 #define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */ 85 #define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */ 86 #define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */ 87 #define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */ 88 #define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */ 89 #define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */ 90 #define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */ 91 #define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */ 92 #define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */ 93 #define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */ 94 #define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */ 95 #define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */ 96 #define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */ 97 #define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output */ 98 #define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */ 99 #define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB Device/USB OTG FS 100 Wakeup from suspend event */ 101 #define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ 102 103 #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF00000) == 0x00) && ((LINE) != (uint16_t)0x00)) 104 #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \ 105 ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \ 106 ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \ 107 ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \ 108 ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \ 109 ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \ 110 ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \ 111 ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \ 112 ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \ 113 ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19)) 114 115 116 /** 117 * @} 118 */ 119 120 /** 121 * @} 122 */ 123 124 /** @defgroup EXTI_Exported_Macros 125 * @{ 126 */ 127 128 /** 129 * @} 130 */ 131 132 /** @defgroup EXTI_Exported_Functions 133 * @{ 134 */ 135 136 void EXTI_DeInit(void); 137 void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct); 138 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); 139 void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); 140 FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line); 141 void EXTI_ClearFlag(uint32_t EXTI_Line); 142 ITStatus EXTI_GetITStatus(uint32_t EXTI_Line); 143 void EXTI_ClearITPendingBit(uint32_t EXTI_Line); 144 145 #ifdef __cplusplus 146 } 147 #endif 148 149 #endif /* __AIR32F10x_EXTI_H */ 150 /** 151 * @} 152 */ 153 154 /** 155 * @} 156 */ 157 158 /** 159 * @} 160 */ 161 162