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 22 23 24 #ifndef __AIR105_EXTI_H 25 #define __AIR105_EXTI_H 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 /* Includes -----------------------------------------------------------------*/ 32 #include "air105.h" 33 34 35 /** 36 * @brief EXTI Trigger enumeration 37 */ 38 typedef enum 39 { 40 EXTI_Trigger_Off = (uint32_t)0x00, 41 EXTI_Trigger_Rising = (uint32_t)0x01, 42 EXTI_Trigger_Falling = (uint32_t)0x02, 43 EXTI_Trigger_Rising_Falling = (uint32_t)0x03 44 }EXTI_TriggerTypeDef; 45 46 #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Off) || \ 47 ((TRIGGER) == EXTI_Trigger_Rising) || \ 48 ((TRIGGER) == EXTI_Trigger_Falling) || \ 49 ((TRIGGER) == EXTI_Trigger_Rising_Falling)) 50 /** 51 * @} 52 */ 53 54 55 /** @defgroup EXTI_Lines 56 * @{ 57 */ 58 #define EXTI_Line0 ((uint32_t)0x0000) /*!< External interrupt line 0 */ 59 #define EXTI_Line1 ((uint32_t)0x0001) /*!< External interrupt line 1 */ 60 #define EXTI_Line2 ((uint32_t)0x0002) /*!< External interrupt line 2 */ 61 #define EXTI_Line3 ((uint32_t)0x0003) /*!< External interrupt line 3 */ 62 #define EXTI_Line4 ((uint32_t)0x0004) /*!< External interrupt line 4 */ 63 #define EXTI_Line5 ((uint32_t)0x0005) /*!< External interrupt line 5 */ 64 65 #define IS_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \ 66 ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \ 67 ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5)) 68 /** 69 * @} 70 */ 71 72 /** @defgroup EXTI_PinSource 73 * @{ 74 */ 75 #define EXTI_PinSource0 ((uint32_t)0x0001) /*!< Pin 0 selected */ 76 #define EXTI_PinSource1 ((uint32_t)0x0002) /*!< Pin 1 selected */ 77 #define EXTI_PinSource2 ((uint32_t)0x0004) /*!< Pin 2 selected */ 78 #define EXTI_PinSource3 ((uint32_t)0x0008) /*!< Pin 3 selected */ 79 #define EXTI_PinSource4 ((uint32_t)0x0010) /*!< Pin 4 selected */ 80 #define EXTI_PinSource5 ((uint32_t)0x0020) /*!< Pin 5 selected */ 81 #define EXTI_PinSource6 ((uint32_t)0x0040) /*!< Pin 6 selected */ 82 #define EXTI_PinSource7 ((uint32_t)0x0080) /*!< Pin 7 selected */ 83 #define EXTI_PinSource8 ((uint32_t)0x0100) /*!< Pin 8 selected */ 84 #define EXTI_PinSource9 ((uint32_t)0x0200) /*!< Pin 9 selected */ 85 #define EXTI_PinSource10 ((uint32_t)0x0400) /*!< Pin 10 selected */ 86 #define EXTI_PinSource11 ((uint32_t)0x0800) /*!< Pin 11 selected */ 87 #define EXTI_PinSource12 ((uint32_t)0x1000) /*!< Pin 12 selected */ 88 #define EXTI_PinSource13 ((uint32_t)0x2000) /*!< Pin 13 selected */ 89 #define EXTI_PinSource14 ((uint32_t)0x4000) /*!< Pin 14 selected */ 90 #define EXTI_PinSource15 ((uint32_t)0x8000) /*!< Pin 15 selected */ 91 #define EXTI_PinSourceAll ((uint32_t)0xffff) /*!< Pin All selected */ 92 93 #define IS_EXTI_PIN_SOURCE(PIN) (((((PIN) & ~(uint32_t)0xFFFF)) == 0x00) && ((PIN) != (uint32_t)0x00)) 94 /** 95 * @} 96 */ 97 98 99 /** @defgroup EXTI_Exported_Functions 100 * @{ 101 */ 102 103 void EXTI_DeInit(void); 104 void EXTI_LineConfig(uint32_t EXTI_Line, uint32_t EXTI_PinSource, EXTI_TriggerTypeDef EXTI_Trigger); 105 uint32_t EXTI_GetITStatus(void); 106 uint32_t EXTI_GetITLineStatus(uint32_t EXTI_Line); 107 void EXTI_ClearITPendingBit(uint32_t EXTI_Line); 108 109 /** 110 * @} 111 */ 112 113 #ifdef __cplusplus 114 } 115 #endif 116 117 #endif // __AIR105_EXTI_H 118 119 /************************** (C) COPYRIGHT Megahunt *****END OF FILE****/ 120