summaryrefslogtreecommitdiff
path: root/bsp/apm32/libraries/APM32F10x_Library/APM32F10x_StdPeriphDriver/inc/apm32f10x_eint.h
blob: 74e8ac8573211c0b0b6057b62eb6c59407140bad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*!
 * @file        apm32f10x_eint.h
 *
 * @brief       This file contains all the functions prototypes for the EINT firmware library
 *
 * @version     V1.0.4
 *
 * @date        2022-12-01
 *
 * @attention
 *
 *  Copyright (C) 2020-2022 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef __APM32F10X_EINT_H
#define __APM32F10X_EINT_H

/* Includes */
#include "apm32f10x.h"

#ifdef __cplusplus
extern "C" {
#endif

/** @addtogroup APM32F10x_StdPeriphDriver
  @{
*/

/** @addtogroup EINT_Driver EINT Driver
  @{
*/

/** @defgroup EINT_Enumerations Enumerations
  @{
*/

/**
 * @brief    EINT mode enumeration
 */
typedef enum
{
    EINT_MODE_INTERRUPT = 0x00,
    EINT_MODE_EVENT     = 0x04
} EINT_MODE_T;

/**
 * @brief    EINT Trigger enumeration
 */
typedef enum
{
    EINT_TRIGGER_RISING         = 0x08,
    EINT_TRIGGER_FALLING        = 0x0C,
    EINT_TRIGGER_RISING_FALLING = 0x10
} EINT_TRIGGER_T;

typedef enum
{
    EINT_LINENONE = 0x00000,  /*!<No interrupt selected > */
    EINT_LINE_0   = 0x00001,  /*!< External interrupt line 0 */
    EINT_LINE_1   = 0x00002,  /*!< External interrupt line 1 */
    EINT_LINE_2   = 0x00004,  /*!< External interrupt line 2 */
    EINT_LINE_3   = 0x00008,  /*!< External interrupt line 3 */
    EINT_LINE_4   = 0x00010,  /*!< External interrupt line 4 */
    EINT_LINE_5   = 0x00020,  /*!< External interrupt line 5 */
    EINT_LINE_6   = 0x00040,  /*!< External interrupt line 6 */
    EINT_LINE_7   = 0x00080,  /*!< External interrupt line 7 */
    EINT_LINE_8   = 0x00100,  /*!< External interrupt line 8 */
    EINT_LINE_9   = 0x00200,  /*!< External interrupt line 9 */
    EINT_LINE_10  = 0x00400,  /*!< External interrupt line 10 */
    EINT_LINE_11  = 0x00800,  /*!< External interrupt line 11 */
    EINT_LINE_12  = 0x01000,  /*!< External interrupt line 12 */
    EINT_LINE_13  = 0x02000,  /*!< External interrupt line 13 */
    EINT_LINE_14  = 0x04000,  /*!< External interrupt line 14 */
    EINT_LINE_15  = 0x08000,  /*!< External interrupt line 15 */
    EINT_LINE_16  = 0x10000,  /*!< External interrupt line 16 Connected to the PVD Output */
    EINT_LINE_17  = 0x20000,  /*!< External interrupt line 17 Connected to the RTC Alarm event */
    EINT_LINE_18  = 0x40000,  /*!< External interrupt line 18 Connected to the USB Device */
} EINT_LINE_T;

/**@} end of group EINT_Enumerations*/


/** @defgroup EINT_Structures Structures
  @{
*/

/**
 * @brief    EINT Config structure definition
 */
typedef struct
{
    uint32_t        line;
    EINT_MODE_T     mode;
    EINT_TRIGGER_T  trigger;
    uint8_t         lineCmd;
} EINT_Config_T;

/**@} end of group EINT_Structures*/


/** @defgroup EINT_Functions Functions
  @{
*/

/* Reset and configuration */
void EINT_Reset(void);
void EINT_Config(EINT_Config_T* eintConfig);
void EINT_ConfigStructInit(EINT_Config_T* eintConfig);

/* Interrupt and flag */
void EINT_SelectSWInterrupt(uint32_t line);
uint8_t EINT_ReadStatusFlag(EINT_LINE_T line);
void EINT_ClearStatusFlag(uint32_t line);
uint8_t EINT_ReadIntFlag(EINT_LINE_T line);
void EINT_ClearIntFlag(uint32_t line);

/**@} end of group EINT_Functions*/
/**@} end of group EINT_Driver */
/**@} end of group APM32F10x_StdPeriphDriver*/

#ifdef __APM32F10X_cplusplus
}
#endif

#endif /* __EINT_H */