?? dsp2808_gpio.c
字號(hào):
// TI File $Revision: /main/2 $
// Checkin $Date: December 2, 2004 11:50:58 $
//###########################################################################
//
// FILE: DSP280x_Gpio.c
//
// TITLE: DSP280x General Purpose I/O Initialization & Support Functions.
//
//###########################################################################
// $TI Release: DSP280x V1.30 $
// $Release Date: February 10, 2006 $
//###########################################################################
#include "DSP280x_Device.h" // DSP280x Headerfile Include File
#include "DSP280x_Examples.h" // DSP280x Examples Include File
//---------------------------------------------------------------------------
// InitGpio:
//---------------------------------------------------------------------------
// This function initializes the Gpio to a known (default) state.
//
// For more details on configuring GPIO's as peripheral functions,
// refer to the individual peripheral examples and/or GPIO setup example.
void InitGpio(void)
{
EALLOW;
GpioCtrlRegs.GPAPUD.all=0x00000000; //gpio0-31---UP
GpioCtrlRegs.GPAMUX1.all=0x0000; //0--15 as IO
GpioCtrlRegs.GPAMUX2.all=0x0000; //16--31 as IO
GpioCtrlRegs.GPADIR.all=0x3FFFFFFF; //0--29 output 30 31 input
//Make wakeup and TRX GPIO
// Make GPIO30 wakeup from HALT/STANDBY Low Power Modes GPIO0--GPIO31 can be selected
GpioIntRegs.GPIOLPMSEL.bit.GPIO30=1; // GPIO30 will wake the device
SysCtrlRegs.LPMCR0.bit.QUALSTDBY=2; // Qualify GPIO30 by 2 OSCCLK
// cycles before waking the device
// from STANDBY
//Make xint1 GPIO 編程SCK和讀書(shū)JOE
GpioCtrlRegs.GPAQSEL2.bit.GPIO31 = 2; // XINT1 Qual using 6 samples
GpioCtrlRegs.GPACTRL.bit.QUALPRD3 = 0xFF; // Each sampling window is 510*SYSCLKOUT
// GPIO31 is XINT1
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 31; // XINT1 is GPIO31
// Configure XINT1
XIntruptRegs.XINT1CR.bit.POLARITY = 1; // 1=Rising edge interrupt 0=Falling edge interrupt
XIntruptRegs.XINT1CR.bit.ENABLE = 1; // Enable XINT1
//GPB
GpioCtrlRegs.GPBPUD.all=0x0000; //gpio32-35---UP
GpioCtrlRegs.GPBMUX1.all = 0x0000; //32 33 34 all GPIO
//32output( MWE-oupput)
//33output(RETUEN 33作為推地址判斷)
//34output(控制ONE\)
GpioCtrlRegs.GPBDIR.all = 0x000F;
EDIS;
}
//===========================================================================
// End of file.
//===========================================================================
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -