1 /*! 2 * @file apm32f4xx_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-06-23 9 * 10 * @attention 11 * 12 * Copyright (C) 2021-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 26 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32F4XX_EINT_H 28 #define __APM32F4XX_EINT_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32f4xx.h" 36 37 /** @addtogroup APM32F4xx_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup EINT_Driver 42 @{ 43 */ 44 45 /** @defgroup EINT_Enumerations 46 @{ 47 */ 48 49 /** 50 * @brief EINT mode enumeration 51 */ 52 typedef enum 53 { 54 EINT_MODE_INTERRUPT = 0x00, /*!< Interrupt request mode */ 55 EINT_MODE_EVENT = 0x04 /*!< Event request mode */ 56 } EINT_MODE_T; 57 58 /** 59 * @brief EINT Trigger enumeration 60 */ 61 typedef enum 62 { 63 EINT_TRIGGER_RISING = 0x08, /*!< Rising trigger */ 64 EINT_TRIGGER_FALLING = 0x0C, /*!< Falling trigger */ 65 EINT_TRIGGER_RISING_FALLING = 0x10 /*!< Rising and falling trigger */ 66 } EINT_TRIGGER_T; 67 68 typedef enum 69 { 70 EINT_LINENONE = 0x00000, /*!< No interrupt selected */ 71 EINT_LINE_0 = 0x00001, /*!< External interrupt line 0 */ 72 EINT_LINE_1 = 0x00002, /*!< External interrupt line 1 */ 73 EINT_LINE_2 = 0x00004, /*!< External interrupt line 2 */ 74 EINT_LINE_3 = 0x00008, /*!< External interrupt line 3 */ 75 EINT_LINE_4 = 0x00010, /*!< External interrupt line 4 */ 76 EINT_LINE_5 = 0x00020, /*!< External interrupt line 5 */ 77 EINT_LINE_6 = 0x00040, /*!< External interrupt line 6 */ 78 EINT_LINE_7 = 0x00080, /*!< External interrupt line 7 */ 79 EINT_LINE_8 = 0x00100, /*!< External interrupt line 8 */ 80 EINT_LINE_9 = 0x00200, /*!< External interrupt line 9 */ 81 EINT_LINE_10 = 0x00400, /*!< External interrupt line 10 */ 82 EINT_LINE_11 = 0x00800, /*!< External interrupt line 11 */ 83 EINT_LINE_12 = 0x01000, /*!< External interrupt line 12 */ 84 EINT_LINE_13 = 0x02000, /*!< External interrupt line 13 */ 85 EINT_LINE_14 = 0x04000, /*!< External interrupt line 14 */ 86 EINT_LINE_15 = 0x08000, /*!< External interrupt line 15 */ 87 EINT_LINE_16 = 0x10000, /*!< External interrupt line 16 Connected to the PVD Output */ 88 EINT_LINE_17 = 0x20000, /*!< External interrupt line 17 Connected to the RTC Alarm event */ 89 EINT_LINE_18 = 0x40000, /*!< External interrupt line 18 Connected to the USB Device */ 90 EINT_LINE_19 = 0x80000, /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ 91 EINT_LINE_20 = 0x00100000, /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) */ 92 EINT_LINE_21 = 0x00200000, /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp even */ 93 EINT_LINE_22 = 0x00400000, /*!< External interrupt line 22 Connected to the RTC Wakeup event */ 94 } EINT_LINE_T; 95 96 /**@} end of group EINT_Enumerations*/ 97 98 /** @addtogroup EINT_Structure Data Structure 99 @{ 100 */ 101 102 /** 103 * @brief EINT Config structure definition 104 */ 105 typedef struct 106 { 107 EINT_LINE_T line; /*!< External interrupt line selection */ 108 EINT_MODE_T mode; /*!< External interrupt or event mode selection */ 109 EINT_TRIGGER_T trigger; /*!< External trigger mode */ 110 uint8_t lineCmd; /*!< External interrupt line command */ 111 } EINT_Config_T; 112 113 /**@} end of group EINT_Structure*/ 114 115 /** @defgroup EINT_Functions 116 @{ 117 */ 118 119 /* Reset and configuration */ 120 void EINT_Reset(void); 121 void EINT_Config( EINT_Config_T* eintConfig); 122 void EINT_ConfigStructInit(EINT_Config_T* eintConfig); 123 124 /* Interrupt and flag */ 125 void EINT_SelectSWInterrupt(uint32_t line); 126 uint8_t EINT_ReadStatusFlag(EINT_LINE_T line); 127 void EINT_ClearStatusFlag(uint32_t line); 128 uint8_t EINT_ReadIntFlag(EINT_LINE_T line); 129 void EINT_ClearIntFlag(uint32_t line); 130 131 #ifdef __cplusplus 132 } 133 #endif 134 135 #endif /* __APM32F4XX_EINT_H */ 136 137 /**@} end of group EINT_Enumerations */ 138 /**@} end of group EINT_Driver */ 139 /**@} end of group APM32F4xx_StdPeriphDriver */ 140