1
0

apm32f10x_eint.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*!
  2. * @file apm32f10x_eint.h
  3. *
  4. * @brief This file contains all the functions prototypes for the EINT firmware library
  5. *
  6. * @version V1.0.4
  7. *
  8. * @date 2022-12-01
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-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 useful 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 __APM32F10X_EINT_H
  27. #define __APM32F10X_EINT_H
  28. /* Includes */
  29. #include "apm32f10x.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /** @addtogroup APM32F10x_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup EINT_Driver EINT Driver
  37. @{
  38. */
  39. /** @defgroup EINT_Enumerations Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief EINT mode enumeration
  44. */
  45. typedef enum
  46. {
  47. EINT_MODE_INTERRUPT = 0x00,
  48. EINT_MODE_EVENT = 0x04
  49. } EINT_MODE_T;
  50. /**
  51. * @brief EINT Trigger enumeration
  52. */
  53. typedef enum
  54. {
  55. EINT_TRIGGER_RISING = 0x08,
  56. EINT_TRIGGER_FALLING = 0x0C,
  57. EINT_TRIGGER_RISING_FALLING = 0x10
  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_T;
  82. /**@} end of group EINT_Enumerations*/
  83. /** @defgroup EINT_Structures Structures
  84. @{
  85. */
  86. /**
  87. * @brief EINT Config structure definition
  88. */
  89. typedef struct
  90. {
  91. uint32_t line;
  92. EINT_MODE_T mode;
  93. EINT_TRIGGER_T trigger;
  94. uint8_t lineCmd;
  95. } EINT_Config_T;
  96. /**@} end of group EINT_Structures*/
  97. /** @defgroup EINT_Functions Functions
  98. @{
  99. */
  100. /* Reset and configuration */
  101. void EINT_Reset(void);
  102. void EINT_Config(EINT_Config_T* eintConfig);
  103. void EINT_ConfigStructInit(EINT_Config_T* eintConfig);
  104. /* Interrupt and flag */
  105. void EINT_SelectSWInterrupt(uint32_t line);
  106. uint8_t EINT_ReadStatusFlag(EINT_LINE_T line);
  107. void EINT_ClearStatusFlag(uint32_t line);
  108. uint8_t EINT_ReadIntFlag(EINT_LINE_T line);
  109. void EINT_ClearIntFlag(uint32_t line);
  110. /**@} end of group EINT_Functions*/
  111. /**@} end of group EINT_Driver */
  112. /**@} end of group APM32F10x_StdPeriphDriver*/
  113. #ifdef __APM32F10X_cplusplus
  114. }
  115. #endif
  116. #endif /* __EINT_H */