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

📄 dsp2808_gpio.c

📁 AD转换 数据采集 串口读数 定时器控制采样频率
💻 C
字号:
// 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和读书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.
//===========================================================================


⌨️ 快捷键说明

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