复用控制寄存器 --- GPxMUX (0---数字IO,1---专用外设功能)
方向控制寄存器 --- GPxDIR (0---输入,1---输出)
量化控制寄存器 --- GPxQUAL (0---无量化,1---量化范围0x00--0xff)
I/O数据寄存器 --- GPxDAT (0---输出--引脚置低,1---输出--引脚置高)#此前在首页部分显示#
I/O置位寄存器 --- GPxSET (0---无变化,1---引脚置为高)
I/O清零寄存器 --- GPxCLEAR (0---无变化,1---引脚置为低)
单独触发寄存器 --- GPxTOGGLE (0---无变化,1---引脚置电平跳变一次)
//IO口初始化
void InitGpio(void)
{
EALLOW; // Enable EALLOW protected register access
//--- Group A pins
GpioMuxRegs.GPADIR.all=0x0000; //若设为数字I/O,可配置为输入(0)/输出(1)
GpioMuxRegs.GPAQUAL.all=0x0000; // 0x00--无量化,0xff--510个SYSCLKOUT周期量化过程
//---选择引脚作为专用外设或通用I/O
GpioMuxRegs.GPAMUX.bit.C3TRIP_GPIOA15 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.C2TRIP_GPIOA14 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.C1TRIP_GPIOA13 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.TCLKINA_GPIOA12 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.TDIRA_GPIOA11 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.CAP3QI1_GPIOA10 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.CAP2Q2_GPIOA9 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.CAP1Q1_GPIOA8 = 1; // 1: select periph
GpioMuxRegs.GPAMUX.bit.T2PWM_GPIOA7 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.T1PWM_GPIOA6 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM6_GPIOA5 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM5_GPIOA4 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM4_GPIOA3 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM3_GPIOA2 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM2_GPIOA1 = 0; // 0: select GPIO
GpioMuxRegs.GPAMUX.bit.PWM1_GPIOA0 = 1; // 1: select periph
EDIS; // Disable EALLOW protected register access
}