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

📄 dsp281x_gpio.c

📁 基于2812的触摸屏的程序,能够显示基本图形.
💻 C
字号:
//###########################################################################
//
// FILE:	DSP281x_Gpio.c
//
// TITLE:	DSP281x General Purpose I/O Initialization & Support Functions.
//
//###########################################################################
//
//  Ver | dd mmm yyyy | Who  | Description of changes
// =====|=============|======|===============================================
//  1.00| 11 Sep 2003 | L.H. | No change since previous version (v.58 Alpha)
//###########################################################################

#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;
	
// Set GPIO A port pins     
     GpioMuxRegs.GPAMUX.all = 0x00D5;	//bit 02467 AS PWM135,T1PWM,T2PWM funcs
     GpioMuxRegs.GPADIR.all = 0x00ff;  	//as input ->PA15,14,13,12,11,10,9,8; 
     									//as signal LED output ->GpioA5,3,1      
// Set GPIO B port pins
     GpioMuxRegs.GPBMUX.all = 0x00D5;	//bit 02467 AS PWM135,T1PWM,T2PWM funcs
     GpioMuxRegs.GPBDIR.all = 0xffff;  	//as output ->PB15,14,13,12,11,10,9,8;
     									//as output ->SPICLK_EN; No use ->PB3,1  
// Set GPIO D port pins
     GpioMuxRegs.GPDMUX.all = 0x0000;	//as gpio functions all 4
     GpioMuxRegs.GPDDIR.all = 0x0000;  	//as input PD6,5,1,0->PD3,2,1,0 
     GpioMuxRegs.GPDQUAL.all= 0x0004;	//8 clock cycle qualifier	 

// Set GPIO E port pins
     GpioMuxRegs.GPEMUX.all = 0x0000;	//as gpio functions all 3
     GpioMuxRegs.GPEDIR.all = 0x0002;  	//as input, PE2,0->USBIRQ,FLSREADY
     									//GPIOE1 as output for lcd reset
	  GpioMuxRegs.GPEQUAL.all= 0x0004;	//8 clock cycle qualifier

// Set GPIO F port pins
     GpioMuxRegs.GPFMUX.all = 0x00f7;	//bit 76543210 AS CANRXA,CANTXA,SCIRXDA,SCITXDA,
     									//SPICLK,SPISOMI,SPISIMO
     GpioMuxRegs.GPFDIR.all = 0x0008;  	//as input -> /TCPINT,PF11,10,9,8; No use ->PF12;
										//only SPISTEA as output ->SPIFLS_EN
// Set GPIO G port pins  
     GpioMuxRegs.GPGMUX.all=0x0030;		//bit 54 AS  SCIRXDB,SCITXDB
     
     EDIS;
}	
	
//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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