2 **************************************************************************
3 * @file at32f435_437_exint.h
6 * @brief at32f435_437 exint header file
7 **************************************************************************
8 * Copyright notice & Disclaimer
10 * The software Board Support Package (BSP) that is made available to
11 * download from Artery official website is the copyrighted work of Artery.
12 * Artery authorizes customers to use, copy, and distribute the BSP
13 * software and its related documentation for the purpose of design and
14 * development in conjunction with Artery microcontrollers. Use of the
15 * software is governed by this copyright notice and the following disclaimer.
17 * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
18 * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
19 * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
20 * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
21 * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24 **************************************************************************
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef __AT32F435_437_EXINT_H
29 #define __AT32F435_437_EXINT_H
36 /* Includes ------------------------------------------------------------------*/
37 #include "at32f435_437.h"
39 /** @addtogroup AT32F435_437_periph_driver
47 /** @defgroup EXINT_lines
51 #define EXINT_LINE_NONE ((uint32_t)0x000000)
52 #define EXINT_LINE_0 ((uint32_t)0x000001) /*!< external interrupt line 0 */
53 #define EXINT_LINE_1 ((uint32_t)0x000002) /*!< external interrupt line 1 */
54 #define EXINT_LINE_2 ((uint32_t)0x000004) /*!< external interrupt line 2 */
55 #define EXINT_LINE_3 ((uint32_t)0x000008) /*!< external interrupt line 3 */
56 #define EXINT_LINE_4 ((uint32_t)0x000010) /*!< external interrupt line 4 */
57 #define EXINT_LINE_5 ((uint32_t)0x000020) /*!< external interrupt line 5 */
58 #define EXINT_LINE_6 ((uint32_t)0x000040) /*!< external interrupt line 6 */
59 #define EXINT_LINE_7 ((uint32_t)0x000080) /*!< external interrupt line 7 */
60 #define EXINT_LINE_8 ((uint32_t)0x000100) /*!< external interrupt line 8 */
61 #define EXINT_LINE_9 ((uint32_t)0x000200) /*!< external interrupt line 9 */
62 #define EXINT_LINE_10 ((uint32_t)0x000400) /*!< external interrupt line 10 */
63 #define EXINT_LINE_11 ((uint32_t)0x000800) /*!< external interrupt line 11 */
64 #define EXINT_LINE_12 ((uint32_t)0x001000) /*!< external interrupt line 12 */
65 #define EXINT_LINE_13 ((uint32_t)0x002000) /*!< external interrupt line 13 */
66 #define EXINT_LINE_14 ((uint32_t)0x004000) /*!< external interrupt line 14 */
67 #define EXINT_LINE_15 ((uint32_t)0x008000) /*!< external interrupt line 15 */
68 #define EXINT_LINE_16 ((uint32_t)0x010000) /*!< external interrupt line 16 */
69 #define EXINT_LINE_17 ((uint32_t)0x020000) /*!< external interrupt line 17 */
70 #define EXINT_LINE_18 ((uint32_t)0x040000) /*!< external interrupt line 18 */
71 #define EXINT_LINE_19 ((uint32_t)0x080000) /*!< external interrupt line 19 */
72 #define EXINT_LINE_20 ((uint32_t)0x100000) /*!< external interrupt line 20 */
73 #define EXINT_LINE_21 ((uint32_t)0x200000) /*!< external interrupt line 21 */
74 #define EXINT_LINE_22 ((uint32_t)0x400000) /*!< external interrupt line 22 */
80 /** @defgroup EXINT_exported_types
85 * @brief exint line mode type
89 EXINT_LINE_INTERRUPUT
= 0x00, /*!< external interrupt line interrupt mode */
90 EXINT_LINE_EVENT
= 0x01 /*!< external interrupt line event mode */
91 } exint_line_mode_type
;
94 * @brief exint polarity configuration type
98 EXINT_TRIGGER_RISING_EDGE
= 0x00, /*!< external interrupt line rising trigger mode */
99 EXINT_TRIGGER_FALLING_EDGE
= 0x01, /*!< external interrupt line falling trigger mode */
100 EXINT_TRIGGER_BOTH_EDGE
= 0x02 /*!< external interrupt line both rising and falling trigger mode */
101 } exint_polarity_config_type
;
104 * @brief exint init type
108 exint_line_mode_type line_mode
; /*!< choose mode event or interrupt mode */
109 uint32_t line_select
; /*!< select the exint line, availiable for single line or multiple lines */
110 exint_polarity_config_type line_polarity
; /*!< select the tregger polarity, with rising edge, falling edge or both edge */
111 confirm_state line_enable
; /*!< enable or disable exint */
115 * @brief type define exint register all
121 * @brief exint inten register, offset:0x00
128 __IO
uint32_t intenx
: 23;/* [22:0] */
129 __IO
uint32_t reserved1
: 9; /* [31:23] */
134 * @brief exint evten register, offset:0x04
141 __IO
uint32_t evtenx
: 23;/* [22:0] */
142 __IO
uint32_t reserved1
: 9; /* [31:23] */
147 * @brief exint polcfg1 register, offset:0x08
151 __IO
uint32_t polcfg1
;
154 __IO
uint32_t rpx
: 23;/* [22:0] */
155 __IO
uint32_t reserved1
: 9; /* [31:23] */
160 * @brief exint polcfg2 register, offset:0x0C
164 __IO
uint32_t polcfg2
;
167 __IO
uint32_t fpx
: 23;/* [22:0] */
168 __IO
uint32_t reserved1
: 9; /* [31:23] */
173 * @brief exint swtrg register, offset:0x10
180 __IO
uint32_t swtx
: 23;/* [22:0] */
181 __IO
uint32_t reserved1
: 9; /* [31:23] */
186 * @brief exint intsts register, offset:0x14
190 __IO
uint32_t intsts
;
193 __IO
uint32_t linex
: 23;/* [22:0] */
194 __IO
uint32_t reserved1
: 9; /* [31:23] */
203 #define EXINT ((exint_type *) EXINT_BASE)
205 /** @defgroup EXINT_exported_functions
209 void exint_reset(void);
210 void exint_default_para_init(exint_init_type
*exint_struct
);
211 void exint_init(exint_init_type
*exint_struct
);
212 void exint_flag_clear(uint32_t exint_line
);
213 flag_status
exint_flag_get(uint32_t exint_line
);
214 void exint_software_interrupt_event_generate(uint32_t exint_line
);
215 void exint_interrupt_enable(uint32_t exint_line
, confirm_state new_state
);
216 void exint_event_enable(uint32_t exint_line
, confirm_state new_state
);