apm32f10x_eint.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.2
  7. *
  8. * @date 2022-01-05
  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 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. #ifndef __APM32F10X_EINT_H
  26. #define __APM32F10X_EINT_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f10x.h"
  31. /** @addtogroup Peripherals_Library Standard Peripheral Library
  32. @{
  33. */
  34. /** @addtogroup EINT_Driver EINT Driver
  35. @{
  36. */
  37. /** @addtogroup EINT_Enumerations Enumerations
  38. @{
  39. */
  40. /**
  41. * @brief EINT mode enumeration
  42. */
  43. typedef enum
  44. {
  45. EINT_MODE_INTERRUPT = 0x00,
  46. EINT_MODE_EVENT = 0x04
  47. } EINT_MODE_T;
  48. /**
  49. * @brief EINT Trigger enumeration
  50. */
  51. typedef enum
  52. {
  53. EINT_TRIGGER_RISING = 0x08,
  54. EINT_TRIGGER_FALLING = 0x0C,
  55. EINT_TRIGGER_RISING_FALLING = 0x10
  56. } EINT_TRIGGER_T;
  57. typedef enum
  58. {
  59. EINT_LINENONE = 0x00000, //!<No interrupt selected >
  60. EINT_LINE_0 = 0x00001, //!< External interrupt line 0
  61. EINT_LINE_1 = 0x00002, //!< External interrupt line 1
  62. EINT_LINE_2 = 0x00004, //!< External interrupt line 2
  63. EINT_LINE_3 = 0x00008, //!< External interrupt line 3
  64. EINT_LINE_4 = 0x00010, //!< External interrupt line 4
  65. EINT_LINE_5 = 0x00020, //!< External interrupt line 5
  66. EINT_LINE_6 = 0x00040, //!< External interrupt line 6
  67. EINT_LINE_7 = 0x00080, //!< External interrupt line 7
  68. EINT_LINE_8 = 0x00100, //!< External interrupt line 8
  69. EINT_LINE_9 = 0x00200, //!< External interrupt line 9
  70. EINT_LINE_10 = 0x00400, //!< External interrupt line 10
  71. EINT_LINE_11 = 0x00800, //!< External interrupt line 11
  72. EINT_LINE_12 = 0x01000, //!< External interrupt line 12
  73. EINT_LINE_13 = 0x02000, //!< External interrupt line 13
  74. EINT_LINE_14 = 0x04000, //!< External interrupt line 14
  75. EINT_LINE_15 = 0x08000, //!< External interrupt line 15
  76. EINT_LINE_16 = 0x10000, //!< External interrupt line 16 Connected to the PVD Output
  77. EINT_LINE_17 = 0x20000, //!< External interrupt line 17 Connected to the RTC Alarm event
  78. EINT_LINE_18 = 0x40000, //!< External interrupt line 18 Connected to the USB Device
  79. } EINT_LINE_T;
  80. /**@} end of group EINT_Enumerations*/
  81. /** @addtogroup EINT_Structure Data Structure
  82. @{
  83. */
  84. /**
  85. * @brief EINT Config structure definition
  86. */
  87. typedef struct
  88. {
  89. uint32_t line;
  90. EINT_MODE_T mode;
  91. EINT_TRIGGER_T trigger;
  92. uint8_t lineCmd;
  93. } EINT_Config_T;
  94. /**@} end of group EINT_Structure*/
  95. /** @addtogroup EINT_Fuctions Fuctions
  96. @{
  97. */
  98. /** Reset and configuration */
  99. void EINT_Reset(void);
  100. void EINT_Config( EINT_Config_T* eintConfig);
  101. void EINT_ConfigStructInit(EINT_Config_T* eintConfig);
  102. /** Interrupt and flag */
  103. void EINT_SelectSWInterrupt(uint32_t line);
  104. uint8_t EINT_ReadStatusFlag(EINT_LINE_T line);
  105. void EINT_ClearStatusFlag(uint32_t line);
  106. uint8_t EINT_ReadIntFlag(EINT_LINE_T line);
  107. void EINT_ClearIntFlag(uint32_t line);
  108. /**@} end of group EINT_Fuctions*/
  109. /**@} end of group EINT_Driver*/
  110. /**@} end of group Peripherals_Library*/
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* __APM32F10XEINT_H */