📄 dsp281x_gpio.c
字号:
//###########################################################################
// FILE: DSP281x_Gpio.c
// TITLE: DSP281x General Purpose I/O Initialization & Support Functions.
//###########################################################################
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
//---------------------------------------------------------------------------
// InitGpio:
//---------------------------------------------------------------------------
// This function initializes the Gpio to a known state.
void InitGpio(void)
{
// Set GPIO A port pins,AL(Bits 7:0)(input)-AH(Bits 15:8) (output) 8bits
// Input Qualifier =0, none
EALLOW;
GpioDataRegs.GPACLEAR.all=0x000F;
GpioMuxRegs.GPAMUX.all=0x000F; //GPIOA0-3配置成pwm功能
GpioMuxRegs.GPADIR.all=0x000F; //
GpioMuxRegs.GPAQUAL.all=0x0000; //
/* GpioMuxRegs.GPDMUX.all=0x0000; //D口都配置成I/O
GpioMuxRegs.GPDDIR.all=0x009C; // bit 0,1;5,6 as inputs
GpioMuxRegs.GPDQUAL.all=0x0001; // 输入限定控制寄存器 消除不必要的采样噪声
//QUALPRD=2个SYSCLKOUT周期
GpioMuxRegs.GPGMUX.all=0x0000;//GPIOG --IO port G口都配置成I/O
GpioMuxRegs.GPGDIR.all=0x0030;// upper byte as output/low byte as input*/
// GpioMuxRegs.GPBMUX.all=0x0000; //B口都配置I/O口
//GpioMuxRegs.GPBDIR.all=0xFF00; //GPBIO0~7为输入,GPBIO8~15为输出
//GpioMuxRegs.GPBQUAL.all=0x0002; //设置2个采样周期宽的采样窗口
EDIS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -