stm32f0xx_exti.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /**
  2. ******************************************************************************
  3. * @file stm32f0xx_exti.h
  4. * @author MCD Application Team
  5. * @version V1.5.0
  6. * @date 05-December-2014
  7. * @brief This file contains all the functions prototypes for the EXTI
  8. * firmware library
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM32F0XX_EXTI_H
  30. #define __STM32F0XX_EXTI_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* Includes ------------------------------------------------------------------*/
  35. #include "stm32f0xx.h"
  36. /** @addtogroup STM32F0xx_StdPeriph_Driver
  37. * @{
  38. */
  39. /** @addtogroup EXTI
  40. * @{
  41. */
  42. /* Exported types ------------------------------------------------------------*/
  43. /**
  44. * @brief EXTI mode enumeration
  45. */
  46. typedef enum
  47. {
  48. EXTI_Mode_Interrupt = 0x00,
  49. EXTI_Mode_Event = 0x04
  50. }EXTIMode_TypeDef;
  51. #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
  52. /**
  53. * @brief EXTI Trigger enumeration
  54. */
  55. typedef enum
  56. {
  57. EXTI_Trigger_Rising = 0x08,
  58. EXTI_Trigger_Falling = 0x0C,
  59. EXTI_Trigger_Rising_Falling = 0x10
  60. }EXTITrigger_TypeDef;
  61. #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
  62. ((TRIGGER) == EXTI_Trigger_Falling) || \
  63. ((TRIGGER) == EXTI_Trigger_Rising_Falling))
  64. /**
  65. * @brief EXTI Init Structure definition
  66. */
  67. typedef struct
  68. {
  69. uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled.
  70. This parameter can be any combination of @ref EXTI_Lines */
  71. EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines.
  72. This parameter can be a value of @ref EXTIMode_TypeDef */
  73. EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
  74. This parameter can be a value of @ref EXTIMode_TypeDef */
  75. FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines.
  76. This parameter can be set either to ENABLE or DISABLE */
  77. }EXTI_InitTypeDef;
  78. /* Exported constants --------------------------------------------------------*/
  79. /** @defgroup EXTI_Exported_Constants
  80. * @{
  81. */
  82. /** @defgroup EXTI_Lines
  83. * @{
  84. */
  85. #define EXTI_Line0 ((uint32_t)0x00000001) /*!< External interrupt line 0 */
  86. #define EXTI_Line1 ((uint32_t)0x00000002) /*!< External interrupt line 1 */
  87. #define EXTI_Line2 ((uint32_t)0x00000004) /*!< External interrupt line 2 */
  88. #define EXTI_Line3 ((uint32_t)0x00000008) /*!< External interrupt line 3 */
  89. #define EXTI_Line4 ((uint32_t)0x00000010) /*!< External interrupt line 4 */
  90. #define EXTI_Line5 ((uint32_t)0x00000020) /*!< External interrupt line 5 */
  91. #define EXTI_Line6 ((uint32_t)0x00000040) /*!< External interrupt line 6 */
  92. #define EXTI_Line7 ((uint32_t)0x00000080) /*!< External interrupt line 7 */
  93. #define EXTI_Line8 ((uint32_t)0x00000100) /*!< External interrupt line 8 */
  94. #define EXTI_Line9 ((uint32_t)0x00000200) /*!< External interrupt line 9 */
  95. #define EXTI_Line10 ((uint32_t)0x00000400) /*!< External interrupt line 10 */
  96. #define EXTI_Line11 ((uint32_t)0x00000800) /*!< External interrupt line 11 */
  97. #define EXTI_Line12 ((uint32_t)0x00001000) /*!< External interrupt line 12 */
  98. #define EXTI_Line13 ((uint32_t)0x00002000) /*!< External interrupt line 13 */
  99. #define EXTI_Line14 ((uint32_t)0x00004000) /*!< External interrupt line 14 */
  100. #define EXTI_Line15 ((uint32_t)0x00008000) /*!< External interrupt line 15 */
  101. #define EXTI_Line16 ((uint32_t)0x00010000) /*!< External interrupt line 16
  102. Connected to the PVD Output,
  103. not applicable for STM32F030 devices */
  104. #define EXTI_Line17 ((uint32_t)0x00020000) /*!< Internal interrupt line 17
  105. Connected to the RTC Alarm
  106. event */
  107. #define EXTI_Line18 ((uint32_t)0x00040000) /*!< Internal interrupt line 18
  108. Connected to the USB
  109. event, only applicable for
  110. STM32F072 devices */
  111. #define EXTI_Line19 ((uint32_t)0x00080000) /*!< Internal interrupt line 19
  112. Connected to the RTC Tamper
  113. and Time Stamp events */
  114. #define EXTI_Line20 ((uint32_t)0x00100000) /*!< Internal interrupt line 20
  115. Connected to the RTC wakeup
  116. event, only applicable for
  117. STM32F072 devices */
  118. #define EXTI_Line21 ((uint32_t)0x00200000) /*!< Internal interrupt line 21
  119. Connected to the Comparator 1
  120. event, only applicable for STM32F051
  121. ans STM32F072 devices */
  122. #define EXTI_Line22 ((uint32_t)0x00400000) /*!< Internal interrupt line 22
  123. Connected to the Comparator 2
  124. event, only applicable for STM32F051
  125. and STM32F072 devices */
  126. #define EXTI_Line23 ((uint32_t)0x00800000) /*!< Internal interrupt line 23
  127. Connected to the I2C1 wakeup
  128. event, not applicable for STM32F030 devices */
  129. #define EXTI_Line25 ((uint32_t)0x02000000) /*!< Internal interrupt line 25
  130. Connected to the USART1 wakeup
  131. event, not applicable for STM32F030 devices */
  132. #define EXTI_Line26 ((uint32_t)0x04000000) /*!< Internal interrupt line 26
  133. Connected to the USART2 wakeup
  134. event, applicable only for
  135. STM32F072 devices */
  136. #define EXTI_Line27 ((uint32_t)0x08000000) /*!< Internal interrupt line 27
  137. Connected to the CEC wakeup
  138. event, applicable only for STM32F051
  139. and STM32F072 devices */
  140. #define EXTI_Line31 ((uint32_t)0x80000000) /*!< Internal interrupt line 31
  141. Connected to the VDD USB monitor
  142. event, applicable only for
  143. STM32F072 devices */
  144. #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0x71000000) == 0x00) && ((LINE) != (uint16_t)0x00))
  145. #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
  146. ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
  147. ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
  148. ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
  149. ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
  150. ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
  151. ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
  152. ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
  153. ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
  154. ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
  155. ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) || \
  156. ((LINE) == EXTI_Line22) || ((LINE) == EXTI_Line23) || \
  157. ((LINE) == EXTI_Line25) || ((LINE) == EXTI_Line26) || \
  158. ((LINE) == EXTI_Line27) || ((LINE) == EXTI_Line31))
  159. /**
  160. * @}
  161. */
  162. /**
  163. * @}
  164. */
  165. /* Exported macro ------------------------------------------------------------*/
  166. /* Exported functions ------------------------------------------------------- */
  167. /* Function used to set the EXTI configuration to the default reset state *****/
  168. void EXTI_DeInit(void);
  169. /* Initialization and Configuration functions *********************************/
  170. void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
  171. void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
  172. void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
  173. /* Interrupts and flags management functions **********************************/
  174. FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
  175. void EXTI_ClearFlag(uint32_t EXTI_Line);
  176. ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
  177. void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif /* __STM32F0XX_EXTI_H */
  182. /**
  183. * @}
  184. */
  185. /**
  186. * @}
  187. */
  188. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/