/*********************************************************************************************************************
* RT1064DVL6A Opensourec Library RT1064DVL6A Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
* 
* ļ RT1064DVL6A Դһ
* 
* RT1064DVL6A Դ 
* Ըᷢ GPLGNU General Public License GNUͨù֤
*  GPL ĵ3棨 GPL3.0ѡģκκİ汾·/޸
* 
* Դķϣܷãδκεı֤
* ûԻʺض;ı֤
* ϸμ GPL
* 
* ӦյԴͬʱյһ GPL ĸ
* ûУ<https://www.gnu.org/licenses/>
* 
* ע
* Դʹ GPL3.0 Դ֤Э Ϊİ汾
* Ӣİ libraries/doc ļµ GPL3_permission_statement.txt ļ
* ֤ libraries ļ ļµ LICENSE ļ
* ӭλʹò ޸ʱ뱣ɿƼİȨ
* 
* ļ          zf_driver_exti
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                               ע
* 2022-09-21        SeekFree            first version
********************************************************************************************************************/

#ifndef _zf_driver_exti_h_
#define _zf_driver_exti_h_

#include "zf_common_typedef.h"
#include "zf_driver_gpio.h"



typedef enum{                                                                   // ö EXTI ź  öٶ岻û޸
    EXTI_TRIGGER_LOW = 1,                                                       // ͵ƽģʽ
    EXTI_TRIGGER_HIGH,                                                          // ߵƽģʽ
    EXTI_TRIGGER_RISING,                                                        // شģʽ
    EXTI_TRIGGER_FALLING,                                                       // ½شģʽ
    EXTI_TRIGGER_BOTH,                                                          // ˫شģʽ
}exti_trigger_enum;



#define exti_flag_get(pin)      ((GPIO_GetPinsInterruptFlags(PORTPTR[pin>>5]) >> (pin&0x1f)) & 0x01)
#define exti_flag_clear(pin)    (GPIO_ClearPinsInterruptFlags(PORTPTR[pin>>5], (uint32)1<<(pin&0x1f)))

void    exti_enable             (gpio_pin_enum pin);
void    exti_disable            (gpio_pin_enum pin);
void    exti_init               (gpio_pin_enum pin, exti_trigger_enum trigger);

#endif
