apm32f4xx_eint.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*!
  2. * @file apm32f4xx_eint.h
  3. *
  4. * @brief This file contains all the functions prototypes for the EINT firmware library.
  5. *
  6. * @version V1.0.2
  7. *
  8. * @date 2022-06-23
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2021-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be usefull and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F4XX_EINT_H
  27. #define __APM32F4XX_EINT_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f4xx.h"
  33. /** @addtogroup APM32F4xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup EINT_Driver
  37. @{
  38. */
  39. /** @defgroup EINT_Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief EINT mode enumeration
  44. */
  45. typedef enum
  46. {
  47. EINT_MODE_INTERRUPT = 0x00, /*!< Interrupt request mode */
  48. EINT_MODE_EVENT = 0x04 /*!< Event request mode */
  49. } EINT_MODE_T;
  50. /**
  51. * @brief EINT Trigger enumeration
  52. */
  53. typedef enum
  54. {
  55. EINT_TRIGGER_RISING = 0x08, /*!< Rising trigger */
  56. EINT_TRIGGER_FALLING = 0x0C, /*!< Falling trigger */
  57. EINT_TRIGGER_RISING_FALLING = 0x10 /*!< Rising and falling trigger */
  58. } EINT_TRIGGER_T;
  59. typedef enum
  60. {
  61. EINT_LINENONE = 0x00000, /*!< No interrupt selected */
  62. EINT_LINE_0 = 0x00001, /*!< External interrupt line 0 */
  63. EINT_LINE_1 = 0x00002, /*!< External interrupt line 1 */
  64. EINT_LINE_2 = 0x00004, /*!< External interrupt line 2 */
  65. EINT_LINE_3 = 0x00008, /*!< External interrupt line 3 */
  66. EINT_LINE_4 = 0x00010, /*!< External interrupt line 4 */
  67. EINT_LINE_5 = 0x00020, /*!< External interrupt line 5 */
  68. EINT_LINE_6 = 0x00040, /*!< External interrupt line 6 */
  69. EINT_LINE_7 = 0x00080, /*!< External interrupt line 7 */
  70. EINT_LINE_8 = 0x00100, /*!< External interrupt line 8 */
  71. EINT_LINE_9 = 0x00200, /*!< External interrupt line 9 */
  72. EINT_LINE_10 = 0x00400, /*!< External interrupt line 10 */
  73. EINT_LINE_11 = 0x00800, /*!< External interrupt line 11 */
  74. EINT_LINE_12 = 0x01000, /*!< External interrupt line 12 */
  75. EINT_LINE_13 = 0x02000, /*!< External interrupt line 13 */
  76. EINT_LINE_14 = 0x04000, /*!< External interrupt line 14 */
  77. EINT_LINE_15 = 0x08000, /*!< External interrupt line 15 */
  78. EINT_LINE_16 = 0x10000, /*!< External interrupt line 16 Connected to the PVD Output */
  79. EINT_LINE_17 = 0x20000, /*!< External interrupt line 17 Connected to the RTC Alarm event */
  80. EINT_LINE_18 = 0x40000, /*!< External interrupt line 18 Connected to the USB Device */
  81. EINT_LINE_19 = 0x80000, /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
  82. EINT_LINE_20 = 0x00100000, /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) */
  83. EINT_LINE_21 = 0x00200000, /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp even */
  84. EINT_LINE_22 = 0x00400000, /*!< External interrupt line 22 Connected to the RTC Wakeup event */
  85. } EINT_LINE_T;
  86. /**@} end of group EINT_Enumerations*/
  87. /** @addtogroup EINT_Structure Data Structure
  88. @{
  89. */
  90. /**
  91. * @brief EINT Config structure definition
  92. */
  93. typedef struct
  94. {
  95. EINT_LINE_T line; /*!< External interrupt line selection */
  96. EINT_MODE_T mode; /*!< External interrupt or event mode selection */
  97. EINT_TRIGGER_T trigger; /*!< External trigger mode */
  98. uint8_t lineCmd; /*!< External interrupt line command */
  99. } EINT_Config_T;
  100. /**@} end of group EINT_Structure*/
  101. /** @defgroup EINT_Functions
  102. @{
  103. */
  104. /* Reset and configuration */
  105. void EINT_Reset(void);
  106. void EINT_Config( EINT_Config_T* eintConfig);
  107. void EINT_ConfigStructInit(EINT_Config_T* eintConfig);
  108. /* Interrupt and flag */
  109. void EINT_SelectSWInterrupt(uint32_t line);
  110. uint8_t EINT_ReadStatusFlag(EINT_LINE_T line);
  111. void EINT_ClearStatusFlag(uint32_t line);
  112. uint8_t EINT_ReadIntFlag(EINT_LINE_T line);
  113. void EINT_ClearIntFlag(uint32_t line);
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif /* __APM32F4XX_EINT_H */
  118. /**@} end of group EINT_Enumerations */
  119. /**@} end of group EINT_Driver */
  120. /**@} end of group APM32F4xx_StdPeriphDriver */