📄 dsp28_gpio.c
字号:
//
// TMDX ALPHA RELEASE
// Intended for product evaluation purposes
//
//###########################################################################
//
// FILE: DSP28_Gpio.c
//
// TITLE: DSP28 General Purpose I/O Initialization & Support Functions.
//
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// =====|=============|======|===============================================
// 0.55| 06 May 2002 | L.H. | EzDSP Alpha Release
// 0.56| 20 May 2002 | L.H. | No change
// 0.57| 27 May 2002 | L.H. | No change
// 0.58| 29 Jun 2002 | L.H. | No change
//###########################################################################
#include "DSP28_Device.h"
//---------------------------------------------------------------------------
// 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;
GpioMuxRegs.GPAMUX.all=0x00FF;
// GpioMuxRegs.GPADIR.all=0xFF00; // upper byte as output/low byte as input
// GpioMuxRegs.GPAQUAL.all=0x0000; // Input qualifier disabled
GpioMuxRegs.GPADIR.bit.GPIOA11=0; //as input for switch 1 of s1
GpioMuxRegs.GPADIR.bit.GPIOA12=0; //as input for switch 2 of s1
GpioMuxRegs.GPADIR.bit.GPIOA13=0; //as input for switch 3 of s1
GpioMuxRegs.GPADIR.bit.GPIOA14=0; //as input for switch 4 of s1
GpioMuxRegs.GPADIR.bit.GPIOA15=0; //as input for switch 5 of s1
// Set GPIO B port pins, configured as EVB signals
// Input Qualifier =0, none
// Set bits to 1 to configure peripherals signals on the pins
//GpioMuxRegs.GPBMUX.all=0xFFFF;
GpioMuxRegs.GPBQUAL.all=0x0000; // Input qualifier disabled
//GpioMuxRegs.GPBMUX.bit.TCLKINB_GPIOB12 = 0; //as io
//GpioMuxRegs.GPBMUX.bit.C4TRIP_GPIOB13 = 0;
GpioMuxRegs.GPBMUX.all =0;// as io
GpioMuxRegs.GPBDIR.bit.GPIOB6 =1;
GpioMuxRegs.GPBDIR.bit.GPIOB7 =1;
GpioMuxRegs.GPBDIR.bit.GPIOB11 =1;
GpioMuxRegs.GPBDIR.bit.GPIOB14 = 1;
GpioMuxRegs.GPBDIR.bit.GPIOB15 = 1;
GpioMuxRegs.GPBDIR.bit.GPIOB12 = 1;//as output
GpioMuxRegs.GPBDIR.bit.GPIOB13 = 1;//as output
GpioMuxRegs.GPBDIR.bit.GPIOB8 = 0;//as input for switch6 of s1
GpioMuxRegs.GPBDIR.bit.GPIOB9 = 0;//as input for switch 7 of s1
GpioMuxRegs.GPBDIR.bit.GPIOB10 = 0;//as input for switch 8 of s1
// set lamp to gpioe2
GpioMuxRegs.GPEMUX.bit.XNMI_XINT13_GPIOE2=0;//as io
GpioMuxRegs.GPEDIR.bit.GPIOE2=1;// as output
// set brake to gpioe1
GpioMuxRegs.GPEMUX.bit.XINT2_ADCSOC_GPIOE1=0;//as io
GpioMuxRegs.GPEDIR.bit.GPIOE1=1;// as output
// set short to gpiod6
GpioMuxRegs.GPDMUX.bit.T4CTRIP_SOCB_GPIOD6=0;//as io
GpioMuxRegs.GPDDIR.bit.GPIOD6=1;// as output
GpioMuxRegs.GPDDIR.bit.GPIOD1 =1;
// set alarm to gpiof14
GpioMuxRegs.GPFMUX.bit.XF_GPIOF14=0;//as io
GpioMuxRegs.GPFDIR.bit.GPIOF14=1;// as output
// set spistea to gpiof3
GpioMuxRegs.GPFMUX.bit.SPISTEA_GPIOF3=0;//as io
GpioMuxRegs.GPFDIR.bit.GPIOF3=1;// as output
GpioMuxRegs.GPGMUX.all=0x0030; // Select GPIOs to be Sci pinsP
EDIS;
}
//===========================================================================
// No more.
//===========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -