forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-04-29 c5be44e4c66ca59789e9ed8e63572929328e3976
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
/**
  ******************************************************************************
  * @file    fm33a0xxev_gpio.h
  * @author  FM33A0XXEV Application Team
  * @version V1.0.0
  * @date    16-April-2020
  * @brief   This file contains all the functions prototypes for the GPIO firmware library.  
  ******************************************************************************
  */
  
/* Define to prevent recursive inclusion -------------------------------------*/
 
#ifndef __FM33A0XXEV_GPIO_H
#define __FM33A0XXEV_GPIO_H
 
 
#ifdef __cplusplus
 extern "C" {
#endif
 
/* Includes ------------------------------------------------------------------*/
 
#include "FM33A0XXEV.h" 
 
//------------------------------------------------------------------------------
typedef enum
    GPIO_FCR_IN        = 0x00, /*!< GPIO ÊäÈë */
    GPIO_FCR_OUT    = 0x01, /*!< GPIO Êä³ö */
    GPIO_FCR_DIG    = 0x02, /*!< GPIO Êý×ÖÌØÊ⹦ÄÜ */
    GPIO_FCR_ANA    = 0x03  /*!< GPIO Ä£Ä⹦ÄÜ */
}GPIO_FCR_TypeDef;
 
/** 
  * @brief  GPIO Output type enumeration 
  */  
typedef enum
    GPIO_OD_Dis = 0x00,
    GPIO_OD_En = 0x01
}GPIO_ODEN_TypeDef;
 
/** 
  * @brief  GPIO Configuration PullUp enumeration 
  */ 
typedef enum
    GPIO_PU_Dis = 0x00,
    GPIO_PU_En  = 0x01 
}GPIO_PUEN_TypeDef;
 
/** 
  * @brief  GPIO Configuration InEn enumeration 
  */ 
typedef enum
    GPIO_IN_Dis        = 0x00,
    GPIO_IN_En        = 0x01 
}GPIO_INEN_TypeDef;
 
/** 
  * @brief  GPIO Configuration HighDrive enumeration 
  */ 
typedef enum
    GPIO_HD_Dis        = 0x00,
    GPIO_HD_En        = 0x01 
}GPIO_HD_TypeDef;
 
/** 
  * @brief  GPIO Configuration AnalogChannel enumeration 
  */ 
typedef enum
    GPIO_ANEN_Dis        = 0x00,
    GPIO_ANEN_En        = 0x01 
}GPIO_ANEN_TypeDef;
 
/** 
  * @brief   GPIO Init structure definition  
  */ 
typedef struct
{
    uint32_t                    Pin;         //PINÑ¡Ôñ
    GPIO_FCR_TypeDef            PxFCR;        //IO¹¦ÄÜÑ¡Ôñ
    GPIO_ODEN_TypeDef            PxODEN;        //¿ªÂ©Êä³öʹÄÜ¿ØÖÆ
    GPIO_PUEN_TypeDef            PxPUEN;        //ÉÏÀ­µç×èʹÄÜ¿ØÖÆ
    GPIO_INEN_TypeDef            PxINEN;        //ÊäÈëʹÄÜ¿ØÖÆ
}GPIO_InitTypeDef;
 
/** 
  * @brief  GPIO Bit SET and Bit RESET enumeration 
  */ 
typedef enum
    Bit_RESET = 0,
    Bit_SET
}BitAction;
#define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
 
typedef enum
    EXTI_RISING,
    EXTI_FALLING,
    EXTI_BOTH,
    EXTIDISABLE,
}GPIOExtiEdge;
#define IS_GPIO_INTERRUPT_TRIGER_EDGE(EDGE) (((EDGE) == EXTI_RISING) || ((EDGE) == EXTI_FALLING)|| ((EDGE) == EXTI_BOTH)|| ((EDGE) == EXTIDISABLE))
 
 
/* Exported constants --------------------------------------------------------*/
 
/** @defgroup GPIO_Exported_Constants
  * @{
  */
     
/**
* @}
*/ 
 
/** @defgroup GPIO_Exported_Types
  * @{
  */
 
#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
                                    ((PERIPH) == GPIOB) || \
                                    ((PERIPH) == GPIOC) || \
                                    ((PERIPH) == GPIOD)    || \
                                    ((PERIPH) == GPIOE)    || \
                                    ((PERIPH) == GPIOF)    || \
                                    ((PERIPH) == GPIOG))
    
#define IS_GPIO_HD_PERIPH(PERIPH)  ((PERIPH) == GPIOH)    
/** @defgroup GPIO_pins_define 
  * @{
  */ 
#define GPIO_Pin_0                 ((uint32_t)0x00000001)  /* Pin 0 selected */
#define GPIO_Pin_1                 ((uint32_t)0x00000002)  /* Pin 1 selected */
#define GPIO_Pin_2                 ((uint32_t)0x00000004)  /* Pin 2 selected */
#define GPIO_Pin_3                 ((uint32_t)0x00000008)  /* Pin 3 selected */
#define GPIO_Pin_4                 ((uint32_t)0x00000010)  /* Pin 4 selected */
#define GPIO_Pin_5                 ((uint32_t)0x00000020)  /* Pin 5 selected */
#define GPIO_Pin_6                 ((uint32_t)0x00000040)  /* Pin 6 selected */
#define GPIO_Pin_7                 ((uint32_t)0x00000080)  /* Pin 7 selected */
#define GPIO_Pin_8                 ((uint32_t)0x00000100)  /* Pin 8 selected */
#define GPIO_Pin_9                 ((uint32_t)0x00000200)  /* Pin 9 selected */
#define GPIO_Pin_10                ((uint32_t)0x00000400)  /* Pin 10 selected */
#define GPIO_Pin_11                ((uint32_t)0x00000800)  /* Pin 11 selected */
#define GPIO_Pin_12                ((uint32_t)0x00001000)  /* Pin 12 selected */
#define GPIO_Pin_13                ((uint32_t)0x00002000)  /* Pin 13 selected */
#define GPIO_Pin_14                ((uint32_t)0x00004000)  /* Pin 14 selected */
#define GPIO_Pin_15                ((uint32_t)0x00008000)  /* Pin 15 selected */
#define GPIO_Pin_All               ((uint16_t)0xFFFF)  /*!< All pins selected */
 
#define IS_GPIO_PIN(PIN) ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))
#define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
                              ((PIN) == GPIO_Pin_1) || \
                              ((PIN) == GPIO_Pin_2) || \
                              ((PIN) == GPIO_Pin_3) || \
                              ((PIN) == GPIO_Pin_4) || \
                              ((PIN) == GPIO_Pin_5) || \
                              ((PIN) == GPIO_Pin_6) || \
                              ((PIN) == GPIO_Pin_7) || \
                              ((PIN) == GPIO_Pin_8) || \
                              ((PIN) == GPIO_Pin_9) || \
                              ((PIN) == GPIO_Pin_10) || \
                              ((PIN) == GPIO_Pin_11) || \
                              ((PIN) == GPIO_Pin_12) || \
                              ((PIN) == GPIO_Pin_13) || \
                              ((PIN) == GPIO_Pin_14) || \
                              ((PIN) == GPIO_Pin_15))
 
 
 
#define IS_GET_GPIOH_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
                              ((PIN) == GPIO_Pin_1) || \
                              ((PIN) == GPIO_Pin_2) || \
                              ((PIN) == GPIO_Pin_3))
/* Exported macro ------------------------------------------------------------*/
 
 
/* WKUPÒý½ÅʹÄÜPINºê¶¨Òå */
#define        PINWKEN_PD6        7
#define        PINWKEN_PE9        6
#define        PINWKEN_PE2        5
#define        PINWKEN_PA13     4
#define        PINWKEN_PG7        3
#define        PINWKEN_PC13    2
#define        PINWKEN_PB0        1
#define        PINWKEN_PF5        0
 
// 1. PortXÊäÈëʹÄܼĴæÆ÷
#define    GPIOx_INEN_INEN_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_INEN_INEN_Msk    (0xffffU << GPIOx_INEN_INEN_Pos)
                                //GPIOÊäÈëʹÄÜ¿ØÖÆ
                                //0£º¹Ø±ÕÊäÈëʹÄÜ
                                //1£º´ò¿ªÊäÈëʹÄÜ
 
// 2. PortXÉÏÀ­Ê¹ÄܼĴæÆ÷
#define    GPIOx_PUEN_PUEN_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_PUEN_PUEN_Msk    (0xffffU << GPIOx_PUEN_PUEN_Pos)                                
                                //GPIOÉÏÀ­¿ØÖÆ
                                //0£º¹Ø±ÕÉÏÀ­
                                //1£ºÊ¹ÄÜÉÏÀ­    
 
// 3. PortX¿ªÂ©Ê¹ÄܼĴæÆ÷                                
#define    GPIOx_ODEN_ODEN_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_ODEN_ODEN_Msk    (0xffffU << GPIOx_ODEN_ODEN_Pos)
                                //GPIO¿ªÂ©Êä³öʹÄÜ
                                //0£º¹Ø±Õ¿ªÂ©Êä³ö
                                //1£ºÊ¹ÄÜ¿ªÂ©Êä³ö
 
// 4. PortX¹¦ÄÜÑ¡Ôñ¼Ä´æÆ÷                                
#define    GPIOx_FCR_Px15FCR_Pos    30    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px15FCR_Msk    (0x03U << GPIOx_FCR_Px15FCR_Pos)
                                //Px[15]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function                                
#define    GPIOx_FCR_Px14FCR_Pos    28    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px14FCR_Msk    (0x03U << GPIOx_FCR_Px14FCR_Pos)
                                //Px[14]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px13FCR_Pos    26    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px13FCR_Msk    (0x03U << GPIOx_FCR_Px13FCR_Pos)
                                //Px[13]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px12FCR_Pos    24    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px12FCR_Msk    (0x03U << GPIOx_FCR_Px12FCR_Pos)
                                //Px[12]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px11FCR_Pos    22    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px11FCR_Msk    (0x03U << GPIOx_FCR_Px11FCR_Pos)
                                //Px[11]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px10FCR_Pos    20    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px10FCR_Msk    (0x03U << GPIOx_FCR_Px10FCR_Pos)
                                //Px[10]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //10£ºAnalog function
#define    GPIOx_FCR_Px9FCR_Pos    18    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px9FCR_Msk    (0x03U << GPIOx_FCR_Px9FCR_Pos)
                                //Px[9]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function    
#define    GPIOx_FCR_Px8FCR_Pos    16    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px8FCR_Msk    (0x03U << GPIOx_FCR_Px8FCR_Pos)
                                //Px[8]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px7FCR_Pos    14    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px7FCR_Msk    (0x03U << GPIOx_FCR_Px7FCR_Pos)
                                //Px[7]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px6FCR_Pos    12    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px6FCR_Msk    (0x03U << GPIOx_FCR_Px6FCR_Pos)
                                //Px[6]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px5FCR_Pos    10    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px5FCR_Msk    (0x03U << GPIOx_FCR_Px5FCR_Pos)
                                //Px[5]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px4FCR_Pos    8    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px4FCR_Msk    (0x03U << GPIOx_FCR_Px4FCR_Pos)
                                //Px[4]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px3FCR_Pos    6    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px3FCR_Msk    (0x03U << GPIOx_FCR_Px3FCR_Pos)
                                //Px[3]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px2FCR_Pos    4    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px2FCR_Msk    (0x03U << GPIOx_FCR_Px2FCR_Pos)
                                //Px[2]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px1FCR_Pos    2    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px1FCR_Msk    (0x03U << GPIOx_FCR_Px1FCR_Pos)
                                //Px[1]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function
#define    GPIOx_FCR_Px0FCR_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_FCR_Px0FCR_Msk    (0x03U << GPIOx_FCR_Px0FCR_Pos)
                                //Px[0]Òý½Å¹¦ÄÜÑ¡Ôñ
                                //00£ºGPIOÊäÈë
                                //01£ºGPIOÊä³ö
                                //10£ºDigital function
                                //11£ºAnalog function    
 
// 5. PortXÊä³öÊý¾Ý¼Ä´æÆ÷                                                                                        
#define    GPIOx_DO_DO_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_DO_DO_Msk    (0xffffU << GPIOx_DO_DO_Pos)
                                //GPIO output data register
 
// 6. PortXÊä³öÊý¾ÝÖÃλ¼Ä´æÆ÷                                
#define    GPIOx_DSET_DSET_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_DSET_DSET_Msk    (0xffffU << GPIOx_DSET_DSET_Pos)
                                //GPIO output data set register
                                //¾ÙÀý£ºÏòPADSETд0x0000_8000£¬ÔòPADOR[15]ÖÃ룬ÆäÓàλ±£³Ö²»±ä¡£
                                //PASET/PBSETΪ16λ£»PCSET/PDSETΪ13λ
 
// 7. PortXÊä³öÊý¾Ý¸´Î»¼Ä´æÆ÷                                
#define    GPIOx_DRST_DRESET_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_DRST_DRESET_Msk    (0xffffU << GPIOx_DRST_DRESET_Pos)
                                //GPIO output data reset register
                                //¾ÙÀý£ºÏòPADRSTд0x0000_8000£¬ÔòPADOR[15]ÇåÁ㣬ÆäÓàλ±£³Ö²»±ä
                                //PASET/PBSETΪ16λ£»PCSET/PDSETΪ13λ
 
// 8. PortXÊäÈëÊý¾Ý¼Ä´æÆ÷                                                                                                                                                                                            
#define    GPIOx_DIN_DIN_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_DIN_DIN_Msk    (0xffffU << GPIOx_DIN_DIN_Pos)
                                //Portx input data register
                                //´Ë¼Ä´æÆ÷½öÕ¼ÓõØÖ·¿Õ¼ä£¬ÎÞÎïÀíʵÏÖ¡£
                                //Èí¼þ¶Á´Ë¼Ä´æÆ÷Ö±½Ó·µ»ØÒý½ÅÊäÈëÐźţ¬Ð¾Æ¬²¢²»¶ÔÒý½ÅÊäÈë½øÐÐËø´æ
 
// 9. PortX¶îÍâÊý×Ö¹¦ÄܼĴæÆ÷                                
#define    GPIOx_DFS_DFS_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_DFS_DFS_Msk    (0xffffU << GPIOx_DFS_DFS_Pos)
                                //Portx Digital Function Select
                                //¶ÔÓÚ¾ßÓжà¸öÊý×ÖÍâÉ蹦ÄܵÄÒý½Å£¬Í¨¹ýPxDFS¼Ä´æÆ÷¿ÉÒÔÑ¡ÔñʹÓÃÄĸöÍâÉ蹦ÄÜ¡£
                                //×¢Ò⣬¶ÔÓÚ²»Í¬µÄIO·Ö×飬ÓÐЧµÄ¼Ä´æÆ÷λÖÃÊDz»Ò»ÑùµÄ
 
// 11. PortXÄ£Ä⿪¹ØÊ¹ÄܼĴæÆ÷                                
#define    GPIOx_ANEN_ANEN_Pos    0    //R/W: rw    ResetValue: 0x0
#define    GPIOx_ANEN_ANEN_Msk    (0xffffU << GPIOx_ANEN_ANEN_Pos)
                                //PortX Ä£Ä⿪¹ØÊ¹ÄÜ
                                //1£ºÊ¹ÄÜIOÄ£Ä⿪¹Ø
                                //0£º¹Ø±ÕIOÄ£Ä⿪¹Ø
                                //×¢£ºÖ§³ÖÄ£Ä⿪¹ØµÄIOÓÐ
                                //PA6/PA7/PA13/PA14/PA15
                                //PB0/PB1/PB13/PB14/PB15
                                //PC0/PC1/PC6/PC7/PC8/PC9/PC10
                                //PD0/PD1/PD2/PD11/PD12
                                //¶ÔÓ¦ÒÔÉÏIOµÄPxANEN¼Ä´æÆ÷ÓÐЧ£»ÆäÓà¼Ä´æÆ÷ÎÞÒâÒå¡£
 
 
#define    GPIO_FOUTSEL_FOUT1SEL_Pos    8    /* FOUTÊä³öƵÂÊÑ¡ÔñÐźŠ*/
#define    GPIO_FOUTSEL_FOUT1SEL_Msk    (0x1fU << GPIO_FOUTSEL_FOUT1SEL_Pos)
#define    GPIO_FOUTSEL_FOUT1SEL_XTLF    (0x0U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00000: XTLF */
#define    GPIO_FOUTSEL_FOUT1SEL_RCLP    (0x1U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00001: RCLP */
#define    GPIO_FOUTSEL_FOUT1SEL_RCHFD64    (0x2U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00010: RCHF/64 */
#define    GPIO_FOUTSEL_FOUT1SEL_LSCLK    (0x3U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00011: LSCLK */
#define    GPIO_FOUTSEL_FOUT1SEL_AHBCLKD64    (0x4U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00100: AHBCLK/64 */
#define    GPIO_FOUTSEL_FOUT1SEL_RTC_TM    (0x5U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00101: RTC_TM */
#define    GPIO_FOUTSEL_FOUT1SEL_PLLHD64    (0x6U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00110: PLL_H/64 */
#define    GPIO_FOUTSEL_FOUT1SEL_RTCCLK64Hz    (0x7U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 00111: RTCCLK64Hz */
#define    GPIO_FOUTSEL_FOUT1SEL_APBCLKD64    (0x8U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01000: APBCLK/64 */
#define    GPIO_FOUTSEL_FOUT1SEL_PLL_L    (0x9U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01001: PLL_L */
#define    GPIO_FOUTSEL_FOUT1SEL_RCMF    (0xAU << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01010: RCMF */
#define    GPIO_FOUTSEL_FOUT1SEL_RCHF    (0xBU << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01011: RCHF */
#define    GPIO_FOUTSEL_FOUT1SEL_XTHFD64    (0xCU << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01100: XTHF/64 */
#define    GPIO_FOUTSEL_FOUT1SEL_ADCCLK    (0xDU << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01101: ADCCLK */
#define    GPIO_FOUTSEL_FOUT1SEL_PLL_H    (0xEU << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 01110: PLL_H */
#define    GPIO_FOUTSEL_FOUT1SEL_BOOST_FLAG    (0x10U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 10000: Boost Flag */
#define    GPIO_FOUTSEL_FOUT1SEL_AUTOTRIM_OUTPUT    (0x11U << GPIO_FOUTSEL_FOUT1SEL_Pos)    /* 10001: Autotrim output */
 
 
#define    GPIO_FOUTSEL_FOUT0SEL_Pos    0    /* FOUTÊä³öƵÂÊÑ¡ÔñÐźŠ*/
#define    GPIO_FOUTSEL_FOUT0SEL_Msk    (0x1fU << GPIO_FOUTSEL_FOUT0SEL_Pos)
#define    GPIO_FOUTSEL_FOUT0SEL_XTLF    (0x0U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00000: XTLF */
#define    GPIO_FOUTSEL_FOUT0SEL_RCLP    (0x1U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00001: RCLP */
#define    GPIO_FOUTSEL_FOUT0SEL_RCHFD64    (0x2U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00010: RCHF/64 */
#define    GPIO_FOUTSEL_FOUT0SEL_LSCLK    (0x3U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00011: LSCLK */
#define    GPIO_FOUTSEL_FOUT0SEL_AHBCLKD64    (0x4U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00100: AHBCLK/64 */
#define    GPIO_FOUTSEL_FOUT0SEL_RTC_TM    (0x5U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00101: RTC_TM */
#define    GPIO_FOUTSEL_FOUT0SEL_PLLHD64    (0x6U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00110: PLL_H/64 */
#define    GPIO_FOUTSEL_FOUT0SEL_RTCCLK64Hz    (0x7U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 00111: RTCCLK64Hz */
#define    GPIO_FOUTSEL_FOUT0SEL_APBCLKD64    (0x8U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01000: APBCLK/64 */
#define    GPIO_FOUTSEL_FOUT0SEL_PLL_L    (0x9U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01001: PLL_L */
#define    GPIO_FOUTSEL_FOUT0SEL_RCMF    (0xAU << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01010: RCMF */
#define    GPIO_FOUTSEL_FOUT0SEL_RCHF    (0xBU << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01011: RCHF */
#define    GPIO_FOUTSEL_FOUT0SEL_XTHFD64    (0xCU << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01100: XTHF/64 */
#define    GPIO_FOUTSEL_FOUT0SEL_ADCCLK    (0xDU << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01101: ADCCLK */
#define    GPIO_FOUTSEL_FOUT0SEL_PLL_H    (0xEU << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 01110: PLL_H */
#define    GPIO_FOUTSEL_FOUT0SEL_BOOST_FLAG    (0x10U << GPIO_FOUTSEL_FOUT0SEL_Pos)    /* 10000: Boost Flag */
 
#define    GPIO_IOMCR_IOMUXSEL_Pos 1
#define    GPIO_IOMCR_IOMUXSEL_Msk    (0x3U << GPIO_IOMCR_IOMUXSEL_Pos)
#define    GPIO_IOMCR_IOMUXSEL_PD6    (0x0U << GPIO_IOMCR_IOMUXSEL_Pos)
#define    GPIO_IOMCR_IOMUXSEL_PD7    (0x1U << GPIO_IOMCR_IOMUXSEL_Pos)
#define    GPIO_IOMCR_IOMUXSEL_PG2    (0x2U << GPIO_IOMCR_IOMUXSEL_Pos)
#define    GPIO_IOMCR_IOMUXSEL_PG3    (0x3U << GPIO_IOMCR_IOMUXSEL_Pos)
 
#define    GPIO_IOMCR_IOMUXEN_Pos    0
#define    GPIO_IOMCR_IOMCUEN_Msk    (0x1U << GPIO_IOMCR_IOMUXEN_Pos)
 
#define    GPIO_PINWKEN_WKISEL_Pos    31    /* WKUPÖжÏÈë¿ÚÑ¡Ôñ¼Ä´æÆ÷ */
#define    GPIO_PINWKEN_WKISEL_Msk    (0x1U << GPIO_PINWKEN_WKISEL_Pos)
#define    GPIO_PINWKEN_WKISEL_NMI    (0x0U << GPIO_PINWKEN_WKISEL_Pos)   /* NMIÖжϠ*/
#define    GPIO_PINWKEN_WKISEL_46    (0x1U << GPIO_PINWKEN_WKISEL_Pos)   /* #46ÖжϠ*/
 
#define    GPIO_PINWKEN_PINWKSEL_Pos    8    /* WKUP±ßÑØÑ¡Ôñ¼Ä´æÆ÷*/
#define    GPIO_PINWKEN_PINWKSEL_Msk    (0xffffU << GPIO_PINWKEN_PINWKSEL_Pos)
#define    GPIO_PINWKEN_PINWKSEL_FALLING   0   /* ¶ÔÓ¦µÄWKUPÒý½ÅΪϽµÑØ»½ÐÑ */
#define    GPIO_PINWKEN_PINWKSEL_RISING    1   /* ¶ÔÓ¦µÄWKUPÒý½ÅΪÉÏÉýÑØ»½ÐÑ */
#define    GPIO_PINWKEN_PINWKSEL_BOTH      2   /* ¶ÔÓ¦µÄWKUPÒý½ÅΪÉÏÉý¡¢Ï½µÑØ»½ÐÑ */
 
#define    GPIO_PINWKEN_PINWKEN_Pos    0    /* WKUPÒý½ÅʹÄܼĴæÆ÷ */
#define    GPIO_PINWKEN_PINWKEN_Msk    (0xffU << GPIO_PINWKEN_PINWKEN_Pos)
 
 
//PortHÊä³öÊý¾Ý¼Ä´æÆ÷                                                                                        
#define    GPIOH_DO_PHDO_Pos    0    
#define    GPIOH_DO_PHDO_Msk    (0xfU << GPIOH_DO_PHDO_Pos)
 
//PortHÊäÈëÊý¾Ý¼Ä´æÆ÷                                                                                        
#define    GPIOH_DIN_PHDIN_Pos    0    
#define    GPIOH_DIN_PHDIN_Msk    (0xfU << GPIOH_DIN_PHDIN_Pos)
                                //GPIO output data register
/* Exported functions --------------------------------------------------------*/ 
 
/* PortXÊä³öÊý¾Ý¼Ä´æÆ÷ Ïà¹Øº¯Êý */
extern void GPIOx_DO_Write(GPIO_Type* GPIOx, uint32_t SetValue);
extern uint32_t GPIOx_DO_Read(GPIO_Type* GPIOx);
 
/* PortXÊä³öÊý¾ÝÖÃλ¼Ä´æÆ÷ Ïà¹Øº¯Êý */
extern void GPIOx_DSET_Write(GPIO_Type* GPIOx, uint32_t SetValue);
 
/* PortXÊä³öÊý¾Ý¸´Î»¼Ä´æÆ÷ Ïà¹Øº¯Êý */
extern void GPIOx_DRST_Write(GPIO_Type* GPIOx, uint32_t SetValue);
 
/* PortXÊäÈëÊý¾Ý¼Ä´æÆ÷ Ïà¹Øº¯Êý */
extern uint32_t GPIOx_DIN_Read(GPIO_Type* GPIOx);
 
/* PortX¶îÍâÊý×Ö¹¦ÄܼĴæÆ÷ Ïà¹Øº¯Êý */
extern void GPIOx_DFS_Setable(GPIO_Type* GPIOx, uint32_t GPIO_Pin, FunState NewState);
extern FunState GPIOx_DFS_Getable(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* PortXÄ£Ä⿪¹ØÊ¹ÄܼĴæÆ÷ Ïà¹Øº¯Êý */
extern void GPIOx_ANEN_Setable(GPIO_Type* GPIOx, uint32_t GPIO_Pin, FunState NewState);
extern FunState GPIOx_ANEN_Getable(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* GPIO ³õʼ»¯ÅäÖà*/
extern void GPIO_Init(GPIO_Type* GPIOx, GPIO_InitTypeDef* para);
 
/* »ñȡһ¸öIO¿ÚµÄÅäÖòÎÊý½á¹¹Ìå 
    ×¢ÒâÒ»´ÎÖ»ÄܶÁȡһ¸öIOµÄÅäÖÃ*/
extern void GPIO_Get_InitPara(GPIO_Type* GPIOx, uint32_t GPIO_Pin, GPIO_InitTypeDef* para);
 
/* ¶ÁÈ¡GPIOxÊäÈëÊý¾Ý¼Ä´æÆ÷ */
extern uint32_t GPIO_ReadInputData(GPIO_Type* GPIOx);
 
/* ¶ÁÈ¡GPIOxÊäÈëÊý¾Ý¼Ä´æÆ÷bit */
extern uint8_t GPIO_ReadInputDataBit(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* GPIOxÊä³öÊý¾ÝÖÃ1 */
extern void GPIO_SetBits(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* GPIOxÊä³öÊý¾ÝÖÃ0 */
extern void GPIO_ResetBits(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* GPIOxÊä³öÊý¾ÝÖ÷­×ª */
extern void GPIO_ToggleBits(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* GPIOHÊä³öÊý¾ÝÖÃ1 */
extern void GPIOH_SetBits(uint32_t GPIO_Pin);
 
/* GPIOHÊä³öÊý¾ÝÖÃ0 */
extern void GPIOH_ResetBits(uint32_t GPIO_Pin);
 
/* GPIOHÊä³öÊý¾ÝÖ÷­×ª */
extern void GPIOH_ToggleBits(uint32_t GPIO_Pin);
 
/* ¶ÁÈ¡GPIOxÊä³öÊý¾Ý¼Ä´æÆ÷ */
extern uint32_t GPIO_ReadOutputData(GPIO_Type* GPIOx);
 
/* ¶ÁÈ¡GPIOxÊä³öÊý¾Ý¼Ä´æÆ÷bit */
extern uint8_t GPIO_ReadOutputDataBit(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* ÍⲿÒý½ÅÑ¡Ôñ */
extern void GPIO_EXTI_Select_Pin(GPIO_Type* GPIOx,uint32_t GPIO_Pin);
 
/* ÍⲿÖжϱßÑØÑ¡Ôñ */
extern void GPIO_EXTI_Select_Edge(GPIO_Type* GPIOx,uint32_t GPIO_Pin,GPIOExtiEdge edge_select);
 
 
/* EXTIÊý×ÖÂ˲¨¿ØÖƼĴæÆ÷ Ïà¹Øº¯Êý */
extern void GPIO_EXTI_EXTIDF_Setable(GPIO_Type* GPIOx, uint32_t GPIO_Pin, FunState NewState);
 
/* ¶ÁÈ¡EXTIÊäÈëÐźżĴæÆ÷ */
extern FunState GPIO_EXTI_EXTIDI_Getable(GPIO_Type* GPIOx, uint32_t GPIO_Pin);
 
/* Çå³ýÖжϱêÖ¾ */
extern void GPIO_EXTI_EXTIISR_ClrEx(GPIO_Type* GPIOx,uint32_t GPIO_Pin);
 
/* ¶ÁÈ¡Öжϱê־״̬ */
extern FlagStatus GPIO_EXTI_EXTIISR_ChkEx(GPIO_Type* GPIOx,uint32_t GPIO_Pin);
 
/* FOUT1Êä³öÅäÖú¯Êý */
extern void GPIO_FOUTSEL_FOUT1SEL_Set(uint32_t SetValue);
 
/* ¶ÁFOUT1Êä³ö״̬º¯Êý */
extern uint32_t GPIO_FOUTSEL_FOUT1SEL_Get(void);
 
/* FOUT0Êä³öÅäÖú¯Êý */
extern void GPIO_FOUTSEL_FOUT0SEL_Set(uint32_t SetValue);
 
/* ¶ÁFOUT0Êä³ö״̬º¯Êý */
extern uint32_t GPIO_FOUTSEL_FOUT0SEL_Get(void);
 
/* ¹¦ÄÜ˵Ã÷£ºGPIO_EXTI_Init ÍⲿÖжϳõʼ»¯ */
extern void GPIO_EXTI_Init(GPIO_Type* GPIOx, uint32_t GPIO_Pin, GPIOExtiEdge edge_select, FunState DFState);
 
/* GPIO_EXTI_CloseÍⲿÖжϹرՠ*/
extern void GPIO_EXTI_Close(GPIO_Type* GPIOx,uint32_t GPIO_Pin);
 
/* GPIOH³õʼ»¯ÅäÖú¯Êý */
extern void GPIOH_Init(GPIO_InitTypeDef* para);
 
/* »ñȡһ¸öIOÅäÖòÎÊý½á¹¹Ì庯Êý */
extern void GPIOH_Get_InitPara(uint32_t GPIO_Pin, GPIO_InitTypeDef* para);
 
/* GPIOHÊä³öÊý¾Ý¼Ä´æÆ÷ÅäÖú¯Êý */
extern void GPIOH_DO_Write(uint32_t SetValue);
 
/* ¶ÁÈ¡GPIOHÊä³ö¼Ä´æÆ÷ */
extern uint32_t GPIOH_ReadOutputData(void);
 
/* °´¹Ü½ÅPin¶ÁÈ¡Êä³ö¼Ä´æÆ÷ */
extern uint8_t GPIOH_ReadOutputDataBit(uint32_t GPIO_Pin);
 
/* ¶ÁÈ¡GPIOHÊäÈë¼Ä´æÆ÷ */
extern uint32_t GPIOH_ReadInputData(void);
 
/* °´¹Ü½ÅPin¶ÁÈ¡ÊäÈë¼Ä´æÆ÷ */
extern uint8_t GPIOH_ReadInputDataBit(uint32_t GPIO_Pin);
 
/*ÅäÖÃIOËÄѡһÊä³ö*/
extern void GPIO_IOMCR_IOMUXSEL_Set(uint32_t SetValue);
    
/*¶ÁIOMCRËÄѡһÅäÖÃ״̬*/
extern uint32_t GPIO_IOMCR_IOMUXSEL_Get(void);
 
/* GPIO ËÄѡһʹÄÜ º¯Êý */
extern void GPIO_IOMCR_Setable(FunState NewState);
 
/* GPIO »ñÈ¡GPIO ËÄѡһʹÄÜ º¯Êý */
extern FunState GPIO_IOMCR_Getable(void);
 
extern void GPIO_PINWKEN_SetableEx(uint32_t NWKPinDef, FunState NewState);
extern FunState GPIO_PINWKEN_GetableEx(uint32_t NWKPinDef);
extern void GPIO_PINWKSEL_SetEx(uint32_t NWKPinDef, uint32_t SetValue);
extern uint32_t GPIO_PINWKSEL_GetEx(uint32_t NWKPinDef);
extern void GPIO_PINWKEN_WKISEL_Set(uint32_t SetValue);
extern uint32_t GPIO_PINWKEN_WKISEL_Get(void);
            
#ifdef __cplusplus
}
#endif
 
#endif /* __FM33A0XXEV_GPIO_H */