#ifndef _API_GPIO_H
#define _API_GPIO_H

enum {
    GPIOxSET    =   0,
    GPIOxCLR,
    GPIOx,
    GPIOxDIR,
    GPIOxDE,
    GPIOxFEN,
    GPIOxDRV,
    GPIOxPU,
    GPIOxPD,
    GPIOxPU200K,
    GPIOxPD200K,
    GPIOxPU300,
    GPIOxPD300,
};

typedef struct {
    psfr_t sfr;             //GPIO SFR ADDR
    u8 num;
    u8 type;                //type = 1,high-handed IO，No strong pull-down resistance of 300R。 type = 0, common IO, There is an internal 300R pull-down resistor.
} gpio_t;

#define bsp_gpio_cfg_init(x, y)         gpio_cfg_init(x, y)

void gpio_cfg_init(gpio_t *g, u8 io_num);       //Initialize GPIO structure according to GPIO number
void wakeup_disable(void);
u8 get_adc_gpio_num(u8 adc_ch);
void wakeup_gpio_config(u8 io_num, u8 edge, u8 pupd_sel);    //Edge wake-up configuration of any GPIO, parameter edge: 0 falling edge, 1 rising edge, parameter pupd 0: no internal pull-up, 1: internal pull-up, 2: internal pull-down
void wakeup_wko_config(void);                   //Configure WKO Wakeup
void wakeup_wko_hlevel_config(void);      	    //Configure WKO high-level wake-up
void wakeup_udisk_config(u8 edge);              //Configure USB flash disk wake-up 0: rising edge wake-up, 1: falling edge wake-up
u32 wakeup_get_status(void);                    //Get wake-up status, public area function
void adcch_io_pu10k_enable(u8 adc_ch);
void adcch_io_pd10k_enable(u8 adc_ch);
#endif // _API_GPIO_H
