apm32f10x_eint.h 2.9 KB

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