air105_exti.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (c) 2022 OpenLuat & AirM2M
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. * this software and associated documentation files (the "Software"), to deal in
  6. * the Software without restriction, including without limitation the rights to
  7. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. * the Software, and to permit persons to whom the Software is furnished to do so,
  9. * subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in all
  12. * copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. #ifndef __AIR105_EXTI_H
  22. #define __AIR105_EXTI_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes -----------------------------------------------------------------*/
  27. #include "air105.h"
  28. /**
  29. * @brief EXTI Trigger enumeration
  30. */
  31. typedef enum
  32. {
  33. EXTI_Trigger_Off = (uint32_t)0x00,
  34. EXTI_Trigger_Rising = (uint32_t)0x01,
  35. EXTI_Trigger_Falling = (uint32_t)0x02,
  36. EXTI_Trigger_Rising_Falling = (uint32_t)0x03
  37. }EXTI_TriggerTypeDef;
  38. #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Off) || \
  39. ((TRIGGER) == EXTI_Trigger_Rising) || \
  40. ((TRIGGER) == EXTI_Trigger_Falling) || \
  41. ((TRIGGER) == EXTI_Trigger_Rising_Falling))
  42. /**
  43. * @}
  44. */
  45. /** @defgroup EXTI_Lines
  46. * @{
  47. */
  48. #define EXTI_Line0 ((uint32_t)0x0000) /*!< External interrupt line 0 */
  49. #define EXTI_Line1 ((uint32_t)0x0001) /*!< External interrupt line 1 */
  50. #define EXTI_Line2 ((uint32_t)0x0002) /*!< External interrupt line 2 */
  51. #define EXTI_Line3 ((uint32_t)0x0003) /*!< External interrupt line 3 */
  52. #define EXTI_Line4 ((uint32_t)0x0004) /*!< External interrupt line 4 */
  53. #define EXTI_Line5 ((uint32_t)0x0005) /*!< External interrupt line 5 */
  54. #define IS_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
  55. ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
  56. ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5))
  57. /**
  58. * @}
  59. */
  60. /** @defgroup EXTI_PinSource
  61. * @{
  62. */
  63. #define EXTI_PinSource0 ((uint32_t)0x0001) /*!< Pin 0 selected */
  64. #define EXTI_PinSource1 ((uint32_t)0x0002) /*!< Pin 1 selected */
  65. #define EXTI_PinSource2 ((uint32_t)0x0004) /*!< Pin 2 selected */
  66. #define EXTI_PinSource3 ((uint32_t)0x0008) /*!< Pin 3 selected */
  67. #define EXTI_PinSource4 ((uint32_t)0x0010) /*!< Pin 4 selected */
  68. #define EXTI_PinSource5 ((uint32_t)0x0020) /*!< Pin 5 selected */
  69. #define EXTI_PinSource6 ((uint32_t)0x0040) /*!< Pin 6 selected */
  70. #define EXTI_PinSource7 ((uint32_t)0x0080) /*!< Pin 7 selected */
  71. #define EXTI_PinSource8 ((uint32_t)0x0100) /*!< Pin 8 selected */
  72. #define EXTI_PinSource9 ((uint32_t)0x0200) /*!< Pin 9 selected */
  73. #define EXTI_PinSource10 ((uint32_t)0x0400) /*!< Pin 10 selected */
  74. #define EXTI_PinSource11 ((uint32_t)0x0800) /*!< Pin 11 selected */
  75. #define EXTI_PinSource12 ((uint32_t)0x1000) /*!< Pin 12 selected */
  76. #define EXTI_PinSource13 ((uint32_t)0x2000) /*!< Pin 13 selected */
  77. #define EXTI_PinSource14 ((uint32_t)0x4000) /*!< Pin 14 selected */
  78. #define EXTI_PinSource15 ((uint32_t)0x8000) /*!< Pin 15 selected */
  79. #define EXTI_PinSourceAll ((uint32_t)0xffff) /*!< Pin All selected */
  80. #define IS_EXTI_PIN_SOURCE(PIN) (((((PIN) & ~(uint32_t)0xFFFF)) == 0x00) && ((PIN) != (uint32_t)0x00))
  81. /**
  82. * @}
  83. */
  84. /** @defgroup EXTI_Exported_Functions
  85. * @{
  86. */
  87. void EXTI_DeInit(void);
  88. void EXTI_LineConfig(uint32_t EXTI_Line, uint32_t EXTI_PinSource, EXTI_TriggerTypeDef EXTI_Trigger);
  89. uint32_t EXTI_GetITStatus(void);
  90. uint32_t EXTI_GetITLineStatus(uint32_t EXTI_Line);
  91. void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
  92. /**
  93. * @}
  94. */
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif // __AIR105_EXTI_H
  99. /************************** (C) COPYRIGHT Megahunt *****END OF FILE****/