⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpio.h

📁 ch7013驱动
💻 H
字号:
#ifndef _GPIO_H
#define _GPIO_H

#include "config.h"

#define MaxGPIOPorts        8
#define MaxExINT            18


#define Trigger_RiseEdge        0x00
#define Trigger_FallEdge        0x01
#define Trigger_HighVoltage     0x02
#define Trigger_LowVoltage      0x03


enum PORT_ID { PortA = 0, PortB, PortC, PortD, PortE, PortF, PortG, PortH };

static const U32 Sel_Regs[MaxGPIOPorts] = { \
                PORTA_SEL, PORTB_SEL, PORTC_SEL, PORTD_SEL, \
                PORTE_SEL, PORTF_SEL, PORTG_SEL, PORTH_SEL};

static const U32 Dir_Regs[MaxGPIOPorts] = { \
                PORTA_DIR, PORTB_DIR, PORTC_DIR, PORTD_DIR, \
                PORTE_DIR, PORTF_DIR, PORTG_DIR, PORTH_DIR};

static const U32 Data_Regs[MaxGPIOPorts] = { \
                PORTA_DATA, PORTB_DATA, PORTC_DATA, PORTD_DATA, \
                PORTE_DATA, PORTF_DATA, PORTG_DATA, PORTH_DATA};

static const U32 INCTL_Regs[MaxGPIOPorts] = { \
                NULL, NULL, NULL, NULL, PORTE_INCTL, NULL, NULL, PORTH_INCTL};

static const U32 INTRCTL_Regs[MaxGPIOPorts] = { \
                NULL, NULL, NULL, NULL, PORTE_INTRCTL, NULL, NULL, PORTH_INTRCTL};

static const U32 INTRCLR_Regs[MaxGPIOPorts] = { \
                NULL, NULL, NULL, NULL, PORTE_INTRCLR, NULL, NULL, PORTH_INTRCLR};

typedef struct 
{
    U8 Port;
    U8 Bit;
} GPIOPortBit, ExIntBits;

static const GPIOPortBit ExInt2Ports[MaxExINT] = { \
    { PortE, 0 }, { PortE, 1 }, { PortE, 2 }, { PortE, 3 }, { PortE, 4 }, { PortE, 5 }, \
    { PortE, 6 }, { PortE, 7 }, { PortE, 8 }, { PortE, 9 }, { PortE, 10 }, { PortE, 11 },
    { PortH, 0 }, { PortH, 1 }, { PortH, 2 }, { PortH, 3 }, { PortH, 4 }, { PortH, 5 }, 
};


void GPIO_Output(enum PORT_ID /*Port*/, U16 /*Maks*/, U16 /*Data*/);
void GPIO_Input(enum PORT_ID /*Port*/, U16 /*Mask*/, RP16 /*Data*/);

void ExINT_Enable(U32 /*ExIntNo*/, U32 /*TriggerMode*/ );


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -