1 /*********************************************************************************************************//**
2  * @file    ht32f1xxxx_gpio.h
3  * @version $Rev:: 2971         $
4  * @date    $Date:: 2023-10-25 #$
5  * @brief   The header file of the GPIO and AFIO library.
6  *************************************************************************************************************
7  * @attention
8  *
9  * Firmware Disclaimer Information
10  *
11  * 1. The customer hereby acknowledges and agrees that the program technical documentation, including the
12  *    code, which is supplied by Holtek Semiconductor Inc., (hereinafter referred to as "HOLTEK") is the
13  *    proprietary and confidential intellectual property of HOLTEK, and is protected by copyright law and
14  *    other intellectual property laws.
15  *
16  * 2. The customer hereby acknowledges and agrees that the program technical documentation, including the
17  *    code, is confidential information belonging to HOLTEK, and must not be disclosed to any third parties
18  *    other than HOLTEK and the customer.
19  *
20  * 3. The program technical documentation, including the code, is provided "as is" and for customer reference
21  *    only. After delivery by HOLTEK, the customer shall use the program technical documentation, including
22  *    the code, at their own risk. HOLTEK disclaims any expressed, implied or statutory warranties, including
23  *    the warranties of merchantability, satisfactory quality and fitness for a particular purpose.
24  *
25  * <h2><center>Copyright (C) Holtek Semiconductor Inc. All rights reserved</center></h2>
26  ************************************************************************************************************/
27 
28 /* Define to prevent recursive inclusion -------------------------------------------------------------------*/
29 #ifndef __HT32F1XXXX_GPIO_H
30 #define __HT32F1XXXX_GPIO_H
31 
32 #ifdef __cplusplus
33  extern "C" {
34 #endif
35 
36 /* Includes ------------------------------------------------------------------------------------------------*/
37 #include "ht32.h"
38 
39 /** @addtogroup HT32F1xxxx_Peripheral_Driver HT32F1xxxx Peripheral Driver
40   * @{
41   */
42 
43 /** @addtogroup GPIO
44   * @{
45   */
46 
47 
48 /* Settings ------------------------------------------------------------------------------------------------*/
49 /** @defgroup GPIO_Settings GPIO settings
50   * @{
51   */
52 #ifndef AUTO_CK_CONTROL
53 #define AUTO_CK_CONTROL      (0)
54 #endif
55 /**
56   * @}
57   */
58 
59 /* Exported types ------------------------------------------------------------------------------------------*/
60 /** @defgroup GPIO_Exported_Types GPIO exported types
61   * @{
62   */
63 
64 /**
65  * @brief  Enumeration of GPIO pull resistor.
66  */
67 typedef enum
68 {
69   GPIO_PR_UP = 0,        /*!< weak pull-up resistor                                                         */
70   GPIO_PR_DOWN,          /*!< weak pull-down resistor                                                       */
71   GPIO_PR_DISABLE        /*!< Tri-state                                                                     */
72 } GPIO_PR_Enum;
73 /**
74  * @brief  Enumeration of GPIO output drive current.
75  */
76 typedef enum
77 {
78   GPIO_DV_4MA = 0,   /*!<  4mA source/sink current                                                          */
79   GPIO_DV_8MA,       /*!<  8mA source/sink current                                                          */
80   #if (LIBCFG_GPIO_DV_4_8MA_ONLY)
81   #else
82   GPIO_DV_12MA,      /*!< 12mA source/sink current                                                          */
83   GPIO_DV_16MA       /*!< 16mA source/sink current                                                          */
84   #endif
85 } GPIO_DV_Enum;
86 /**
87  * @brief  Enumeration of GPIO direction.
88  */
89 typedef enum
90 {
91   GPIO_DIR_IN = 0,    /*!< input mode                                                                       */
92   GPIO_DIR_OUT        /*!< output mode                                                                      */
93 } GPIO_DIR_Enum;
94 /**
95  * @brief  Enumeration of GPIO port source for EXTI channel.
96  */
97 typedef enum
98 {
99   AFIO_ESS_PA = 0,  /*!< EXTI channel x source come from GPIO Port A                                        */
100   AFIO_ESS_PB = 1,  /*!< EXTI channel x source come from GPIO Port B                                        */
101   AFIO_ESS_PC = 2,  /*!< EXTI channel x source come from GPIO Port C                                        */
102   AFIO_ESS_PD = 3,  /*!< EXTI channel x source come from GPIO Port D                                        */
103 #if (LIBCFG_GPIOE)
104   AFIO_ESS_PE = 4,  /*!< EXTI channel x source come from GPIO Port E                                        */
105 #endif
106 #if (LIBCFG_GPIOF)
107   AFIO_ESS_PF = 5   /*!< EXTI channel x source come from GPIO Port F                                        */
108 #endif
109 } AFIO_ESS_Enum;
110 /**
111  * @brief  Enumeration of AFIO for EXTI channel.
112  */
113 typedef enum
114 {
115   AFIO_EXTI_CH_0 = 0,     /*!< GPIO pin 0                                                                   */
116   AFIO_EXTI_CH_1,         /*!< GPIO pin 1                                                                   */
117   AFIO_EXTI_CH_2,         /*!< GPIO pin 2                                                                   */
118   AFIO_EXTI_CH_3,         /*!< GPIO pin 3                                                                   */
119   AFIO_EXTI_CH_4,         /*!< GPIO pin 4                                                                   */
120   AFIO_EXTI_CH_5,         /*!< GPIO pin 5                                                                   */
121   AFIO_EXTI_CH_6,         /*!< GPIO pin 6                                                                   */
122   AFIO_EXTI_CH_7,         /*!< GPIO pin 7                                                                   */
123   AFIO_EXTI_CH_8,         /*!< GPIO pin 8                                                                   */
124   AFIO_EXTI_CH_9,         /*!< GPIO pin 9                                                                   */
125   AFIO_EXTI_CH_10,        /*!< GPIO pin 10                                                                  */
126   AFIO_EXTI_CH_11,        /*!< GPIO pin 11                                                                  */
127   AFIO_EXTI_CH_12,        /*!< GPIO pin 12                                                                  */
128   AFIO_EXTI_CH_13,        /*!< GPIO pin 13                                                                  */
129   AFIO_EXTI_CH_14,        /*!< GPIO pin 14                                                                  */
130   AFIO_EXTI_CH_15         /*!< GPIO pin 15                                                                  */
131 } AFIO_EXTI_CH_Enum;
132 /**
133  * @brief Enumeration of AFIO_MODE.
134  */
135 typedef enum
136 {
137  AFIO_MODE_DEFAULT = 0,   /*!< Default AFIO mode                                                            */
138  AFIO_MODE_1,             /*!< AFIO mode 1                                                                  */
139  AFIO_MODE_2,             /*!< AFIO mode 2                                                                  */
140  AFIO_MODE_3,             /*!< AFIO mode 3                                                                  */
141  AFIO_MODE_4,             /*!< AFIO mode 4                                                                  */
142  AFIO_MODE_5,             /*!< AFIO mode 5                                                                  */
143  AFIO_MODE_6,             /*!< AFIO mode 6                                                                  */
144  AFIO_MODE_7,             /*!< AFIO mode 7                                                                  */
145  AFIO_MODE_8,             /*!< AFIO mode 8                                                                  */
146  AFIO_MODE_9,             /*!< AFIO mode 9                                                                  */
147  AFIO_MODE_10,            /*!< AFIO mode 10                                                                 */
148  AFIO_MODE_11,            /*!< AFIO mode 11                                                                 */
149  AFIO_MODE_12,            /*!< AFIO mode 12                                                                 */
150  AFIO_MODE_13,            /*!< AFIO mode 13                                                                 */
151  AFIO_MODE_14,            /*!< AFIO mode 14                                                                 */
152  AFIO_MODE_15             /*!< AFIO mode 15                                                                 */
153 } AFIO_MODE_Enum;
154 /**
155   * @}
156   */
157 
158 /* Exported constants --------------------------------------------------------------------------------------*/
159 /** @defgroup GPIO_Exported_Constants GPIO exported constants
160   * @{
161   */
162 
163 /* Definitions of AFIO_FUN                                                                                  */
164 #define AFIO_FUN_DEFAULT    AFIO_MODE_DEFAULT  /*!< Default AFIO mode                                       */
165 #define AFIO_FUN_GPIO       AFIO_MODE_1        /*!< AFIO mode GPIO                                          */
166 #define AFIO_FUN_ADC0       AFIO_MODE_2        /*!< AFIO mode ADC0                                          */
167 #define AFIO_FUN_CMP        AFIO_MODE_3        /*!< AFIO mode CMP                                           */
168 #define AFIO_FUN_MCTM_GPTM  AFIO_MODE_4        /*!< AFIO mode MCTM/GPTM                                     */
169 #define AFIO_FUN_SPI        AFIO_MODE_5        /*!< AFIO mode SPI                                           */
170 #define AFIO_FUN_USART_UART AFIO_MODE_6        /*!< AFIO mode USART/UART                                    */
171 #define AFIO_FUN_I2C        AFIO_MODE_7        /*!< AFIO mode I2C                                           */
172 #define AFIO_FUN_SCI        AFIO_MODE_8        /*!< AFIO mode SCI                                           */
173 #define AFIO_FUN_EBI        AFIO_MODE_9        /*!< AFIO mode EBI                                           */
174 #define AFIO_FUN_I2S        AFIO_MODE_10       /*!< AFIO mode I2S                                           */
175 #define AFIO_FUN_SDIO       AFIO_MODE_11       /*!< AFIO mode SDIO                                          */
176 #define AFIO_FUN_CSIF       AFIO_MODE_12       /*!< AFIO mode CSIF                                          */
177 #define AFIO_FUN_SCTM       AFIO_MODE_13       /*!< AFIO mode SCTM                                          */
178 #define AFIO_FUN_PWM        AFIO_MODE_13       /*!< AFIO mode PWM                                           */
179 #define AFIO_FUN_SYSTEM     AFIO_MODE_15       /*!< AFIO mode System                                        */
180 
181 /* Definitions of AFIO_FUN alias                                                                            */
182 #define AFIO_FUN_MCTM0      AFIO_FUN_MCTM_GPTM
183 #define AFIO_FUN_MCTM1      AFIO_FUN_MCTM_GPTM
184 
185 #define AFIO_FUN_GPTM0      AFIO_FUN_MCTM_GPTM
186 #define AFIO_FUN_GPTM1      AFIO_FUN_MCTM_GPTM
187 #define AFIO_FUN_GPTM2      AFIO_FUN_MCTM_GPTM
188 #define AFIO_FUN_GPTM3      AFIO_FUN_MCTM_GPTM
189 
190 #define AFIO_FUN_PWM0       AFIO_FUN_PWM
191 #define AFIO_FUN_PWM1       AFIO_FUN_PWM
192 #define AFIO_FUN_PWM2       AFIO_FUN_PWM
193 #define AFIO_FUN_PWM3       AFIO_FUN_PWM
194 
195 #define AFIO_FUN_SCTM0      AFIO_FUN_SCTM
196 #define AFIO_FUN_SCTM1      AFIO_FUN_SCTM
197 
198 #define AFIO_FUN_ADC        AFIO_FUN_ADC0
199 #define AFIO_FUN_PWM_SCTM   AFIO_MODE_13
200 
201 /* Definitions of GPIO_Px                                                                                   */
202 #define GPIO_PORT_NUM   (6)
203 #define GPIO_PIN_NUM    (16)
204 #define GPIO_PA         (0)
205 #define GPIO_PB         (1)
206 #define GPIO_PC         (2)
207 #define GPIO_PD         (3)
208 #if (LIBCFG_GPIOE)
209 #define GPIO_PE         (4)
210 #endif
211 #if (LIBCFG_GPIOF)
212 #define GPIO_PF         (5)
213 #endif
214 
215 /* Definitions of GPIO port source for EXTI channel                                                         */
216 #define AFIO_ESS_PA GPIO_PA  /*!< EXTI channel x source come from GPIO Port A                               */
217 #define AFIO_ESS_PB GPIO_PB  /*!< EXTI channel x source come from GPIO Port B                               */
218 #define AFIO_ESS_PC GPIO_PC  /*!< EXTI channel x source come from GPIO Port C                               */
219 #define AFIO_ESS_PD GPIO_PD  /*!< EXTI channel x source come from GPIO Port D                               */
220 #if (LIBCFG_GPIOE)
221 #define AFIO_ESS_PE GPIO_PE  /*!< EXTI channel x source come from GPIO Port E                               */
222 #endif
223 #if (LIBCFG_GPIOF)
224 #define AFIO_ESS_PF GPIO_PF  /*!< EXTI channel x source come from GPIO Port F                               */
225 #endif
226 
227 /* Definitions of GPIO_PIN                                                                                  */
228 #define GPIO_PIN_0    0x0001   /*!< GPIO pin 0 selected                                                     */
229 #define GPIO_PIN_1    0x0002   /*!< GPIO pin 1 selected                                                     */
230 #define GPIO_PIN_2    0x0004   /*!< GPIO pin 2 selected                                                     */
231 #define GPIO_PIN_3    0x0008   /*!< GPIO pin 3 selected                                                     */
232 #define GPIO_PIN_4    0x0010   /*!< GPIO pin 4 selected                                                     */
233 #define GPIO_PIN_5    0x0020   /*!< GPIO pin 5 selected                                                     */
234 #define GPIO_PIN_6    0x0040   /*!< GPIO pin 6 selected                                                     */
235 #define GPIO_PIN_7    0x0080   /*!< GPIO pin 7 selected                                                     */
236 #define GPIO_PIN_8    0x0100   /*!< GPIO pin 8 selected                                                     */
237 #define GPIO_PIN_9    0x0200   /*!< GPIO pin 9 selected                                                     */
238 #define GPIO_PIN_10   0x0400   /*!< GPIO pin 10 selected                                                    */
239 #define GPIO_PIN_11   0x0800   /*!< GPIO pin 11 selected                                                    */
240 #define GPIO_PIN_12   0x1000   /*!< GPIO pin 12 selected                                                    */
241 #define GPIO_PIN_13   0x2000   /*!< GPIO pin 13 selected                                                    */
242 #define GPIO_PIN_14   0x4000   /*!< GPIO pin 14 selected                                                    */
243 #define GPIO_PIN_15   0x8000   /*!< GPIO pin 15 selected                                                    */
244 #define GPIO_PIN_ALL  0xFFFF   /*!< GPIO all pins selected                                                  */
245 
246 /* Definitions of AFIO_PIN                                                                                  */
247 #define AFIO_PIN_0    0x0001   /*!< AFIO pin 0 selected                                                     */
248 #define AFIO_PIN_1    0x0002   /*!< AFIO pin 1 selected                                                     */
249 #define AFIO_PIN_2    0x0004   /*!< AFIO pin 2 selected                                                     */
250 #define AFIO_PIN_3    0x0008   /*!< AFIO pin 3 selected                                                     */
251 #define AFIO_PIN_4    0x0010   /*!< AFIO pin 4 selected                                                     */
252 #define AFIO_PIN_5    0x0020   /*!< AFIO pin 5 selected                                                     */
253 #define AFIO_PIN_6    0x0040   /*!< AFIO pin 6 selected                                                     */
254 #define AFIO_PIN_7    0x0080   /*!< AFIO pin 7 selected                                                     */
255 #define AFIO_PIN_8    0x0100   /*!< AFIO pin 8 selected                                                     */
256 #define AFIO_PIN_9    0x0200   /*!< AFIO pin 9 selected                                                     */
257 #define AFIO_PIN_10   0x0400   /*!< AFIO pin 10 selected                                                    */
258 #define AFIO_PIN_11   0x0800   /*!< AFIO pin 11 selected                                                    */
259 #define AFIO_PIN_12   0x1000   /*!< AFIO pin 12 selected                                                    */
260 #define AFIO_PIN_13   0x2000   /*!< AFIO pin 13 selected                                                    */
261 #define AFIO_PIN_14   0x4000   /*!< AFIO pin 14 selected                                                    */
262 #define AFIO_PIN_15   0x8000   /*!< AFIO pin 15 selected                                                    */
263 #define AFIO_PIN_ALL  0xFFFF   /*!< All AFIO pins selected                                                  */
264 
265 /* Definitions of GPIO_PIN_NUM                                                                              */
266 #define GPIO_PIN_NUM_0    0x00   /*!< GPIO pin number 0 selected                                            */
267 #define GPIO_PIN_NUM_1    0x01   /*!< GPIO pin number 1 selected                                            */
268 #define GPIO_PIN_NUM_2    0x02   /*!< GPIO pin number 2 selected                                            */
269 #define GPIO_PIN_NUM_3    0x03   /*!< GPIO pin number 3 selected                                            */
270 #define GPIO_PIN_NUM_4    0x04   /*!< GPIO pin number 4 selected                                            */
271 #define GPIO_PIN_NUM_5    0x05   /*!< GPIO pin number 5 selected                                            */
272 #define GPIO_PIN_NUM_6    0x06   /*!< GPIO pin number 6 selected                                            */
273 #define GPIO_PIN_NUM_7    0x07   /*!< GPIO pin number 7 selected                                            */
274 #define GPIO_PIN_NUM_8    0x08   /*!< GPIO pin number 8 selected                                            */
275 #define GPIO_PIN_NUM_9    0x09   /*!< GPIO pin number 9 selected                                            */
276 #define GPIO_PIN_NUM_10   0x0A   /*!< GPIO pin number 10 selected                                           */
277 #define GPIO_PIN_NUM_11   0x0B   /*!< GPIO pin number 11 selected                                           */
278 #define GPIO_PIN_NUM_12   0x0C   /*!< GPIO pin number 12 selected                                           */
279 #define GPIO_PIN_NUM_13   0x0D   /*!< GPIO pin number 13 selected                                           */
280 #define GPIO_PIN_NUM_14   0x0E   /*!< GPIO pin number 14 selected                                           */
281 #define GPIO_PIN_NUM_15   0x0F   /*!< GPIO pin number 15 selected                                           */
282 
283 /**
284   * @}
285   */
286 
287 /* Exported macro ------------------------------------------------------------------------------------------*/
288 /** @defgroup GPIO_Exported_Macro GPIO exported macro
289   * @{
290   */
291 /* check parameter of the GPIOx                                                                             */
292 #define IS_GPIO(x)           (IS_GPIOABCD(x) || IS_GPIOE(x) || IS_GPIOF(x))
293 #define IS_GPIOABCD(x)       ((x==HT_GPIOA) || (x==HT_GPIOB) || (x==HT_GPIOC) || (x==HT_GPIOD))
294 #if (LIBCFG_GPIOE)
295 #define IS_GPIOE(x)          (x == HT_GPIOE)
296 #else
297 #define IS_GPIOE(x)          (0)
298 #endif
299 #if (LIBCFG_GPIOF)
300 #define IS_GPIOF(x)          (x == HT_GPIOF)
301 #else
302 #define IS_GPIOF(x)          (0)
303 #endif
304 
305 /* check parameter of the GPIO_Px                                                                           */
306 #define IS_GPIO_PORT(x)           (IS_GPIO_PORT1(x) || IS_GPIO_PORT2(x) || IS_GPIO_PORT3(x) || IS_GPIO_PORT4(x) || IS_GPIO_PORT5(x))
307 
308 #define IS_GPIO_PORT1(x)          ((x == GPIO_PA) || (x == GPIO_PB) )
309 
310 #define IS_GPIO_PORT2(x)          (x == GPIO_PC)
311 
312 #define IS_GPIO_PORT3(x)          (x == GPIO_PD)
313 
314 #if (LIBCFG_GPIOE)
315 #define IS_GPIO_PORT4(x)          (x == GPIO_PE)
316 #else
317 #define IS_GPIO_PORT4(x)          (0)
318 #endif
319 #if (LIBCFG_GPIOF)
320 #define IS_GPIO_PORT5(x)          (x == GPIO_PF)
321 #else
322 #define IS_GPIO_PORT5(x)          (0)
323 #endif
324 
325 /* check parameter of the GPIO_PIN_NUM                                                                       */
326 #define IS_GPIO_PIN_NUM(x)        (x < 16)
327 
328 /* check parameter of the GPIOx pull resistor                                                               */
329 #define IS_GPIO_PR(x)        (((x) == GPIO_PR_UP) || ((x) == GPIO_PR_DOWN) || ((x) == GPIO_PR_DISABLE))
330 
331 /* check parameter of the GPIOx driving current                                                             */
332 #if (LIBCFG_GPIO_DV_4_8MA_ONLY)
333 #define IS_GPIO_DV_12_16MA(x)       (0)
334 #else
335 #define IS_GPIO_DV_12_16MA(x)       (((x) == GPIO_DV_12MA) || ((x) == GPIO_DV_16MA))
336 #endif
337 #define IS_GPIO_DV(x)        (((x) == GPIO_DV_4MA) || ((x) == GPIO_DV_8MA) || IS_GPIO_DV_12_16MA(x))
338 
339 /* check parameter of the GPIOx input/output direction                                                      */
340 #define IS_GPIO_DIR(x)       (((x) == GPIO_DIR_IN) || ((x) == GPIO_DIR_OUT) )
341 
342 /* check parameter of the EXTI source port                                                                  */
343 #if (LIBCFG_GPIOE)
344 #define IS_ESSE(x)           (x == AFIO_ESS_PE)
345 #else
346 #define IS_ESSE(x)           (0)
347 #endif
348 #if (LIBCFG_GPIOF)
349 #define IS_ESSF(x)           (x == AFIO_ESS_PF)
350 #else
351 #define IS_ESSF(x)           (0)
352 #endif
353 
354 #define IS_AFIO_ESS(x)       ((x == AFIO_ESS_PA) || (x == AFIO_ESS_PB) || (x == AFIO_ESS_PC) || (x == AFIO_ESS_PD) || IS_ESSE(x) || IS_ESSF(x))
355 
356 /* check parameter of the EXTI channel                                                                      */
357 #define IS_AFIO_EXTI_CH(x)   ((x == AFIO_EXTI_CH_0)  || (x == AFIO_EXTI_CH_1)  || \
358                               (x == AFIO_EXTI_CH_2)  || (x == AFIO_EXTI_CH_3)  || \
359                               (x == AFIO_EXTI_CH_4)  || (x == AFIO_EXTI_CH_5)  || \
360                               (x == AFIO_EXTI_CH_6)  || (x == AFIO_EXTI_CH_7)  || \
361                               (x == AFIO_EXTI_CH_8)  || (x == AFIO_EXTI_CH_9)  || \
362                               (x == AFIO_EXTI_CH_10) || (x == AFIO_EXTI_CH_11) || \
363                               (x == AFIO_EXTI_CH_12) || (x == AFIO_EXTI_CH_13) || \
364                               (x == AFIO_EXTI_CH_14) || (x == AFIO_EXTI_CH_15))
365 
366 /* check parameter of the AFIO mode                                                                         */
367 #define IS_AFIO_MODE(x)      ((x == AFIO_MODE_DEFAULT) || (x == AFIO_MODE_1)  || \
368                               (x == AFIO_MODE_2)       || (x == AFIO_MODE_3)  || \
369                               (x == AFIO_MODE_4)       || (x == AFIO_MODE_5)  || \
370                               (x == AFIO_MODE_6)       || (x == AFIO_MODE_7)  || \
371                               (x == AFIO_MODE_8)       || (x == AFIO_MODE_9)  || \
372                               (x == AFIO_MODE_10)      || (x == AFIO_MODE_11) || \
373                               (x == AFIO_MODE_12)      || (x == AFIO_MODE_13) || \
374                               (x == AFIO_MODE_14)      || (x == AFIO_MODE_15))
375 /**
376   * @}
377   */
378 
379 /* Exported functions --------------------------------------------------------------------------------------*/
380 /** @defgroup GPIO_Exported_Functions GPIO exported functions
381   * @{
382   */
383 
384 /* Prototype of related GPIO function                                                                       */
385 void GPIO_DeInit(HT_GPIO_TypeDef* HT_GPIOx);
386 void GPIO_DirectionConfig(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, GPIO_DIR_Enum GPIO_DIR_INorOUT);
387 void GPIO_PullResistorConfig(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, GPIO_PR_Enum GPIO_PR_x);
388 void GPIO_InputConfig(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, ControlStatus Cmd);
389 void GPIO_DriveConfig(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, GPIO_DV_Enum GPIO_DV_nMA);
390 void GPIO_OpenDrainConfig(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, ControlStatus Cmd);
391 FlagStatus GPIO_ReadInBit(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_n);
392 FlagStatus GPIO_ReadOutBit(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_n);
393 u16 GPIO_ReadInData(HT_GPIO_TypeDef* HT_GPIOx);
394 u16 GPIO_ReadOutData(HT_GPIO_TypeDef* HT_GPIOx);
395 void GPIO_SetOutBits(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP);
396 void GPIO_ClearOutBits(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP);
397 void GPIO_WriteOutBits(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP, FlagStatus Status);
398 void GPIO_WriteOutData(HT_GPIO_TypeDef* HT_GPIOx, u16 Data);
399 void GPIO_PinLock(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_nBITMAP);
400 bool GPIO_IsPortLocked(HT_GPIO_TypeDef* HT_GPIOx);
401 bool GPIO_IsPinLocked(HT_GPIO_TypeDef* HT_GPIOx, u16 GPIO_PIN_n);
402 void GPIO_DisableDebugPort(void);
403 u32 GPIO_GetID(HT_GPIO_TypeDef* HT_GPIOx);
404 
405 /* Prototype of related AFIO function                                                                       */
406 void AFIO_DeInit(void);
407 void AFIO_GPxConfig(u32 GPIO_Px, u32 AFIO_PIN_n, AFIO_MODE_Enum AFIO_MODE_n);
408 void AFIO_EXTISourceConfig(u32 GPIO_PIN_NUM_n, u32 GPIO_Px);
409 /**
410   * @}
411   */
412 
413 
414 /**
415   * @}
416   */
417 
418 /**
419   * @}
420   */
421 
422 #ifdef __cplusplus
423 }
424 #endif
425 
426 #endif
427