这里要介绍一下,DSP的GPIO口都可以配置为外部中断口,其配置方法如下:
GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 0; //选择他们是GPIO口
GpioCtrlRegs.GPBMUX2.bit.GPIO55 = 0;
GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 0;
GpioCtrlRegs.GPBMUX2.bit.GPIO57 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO54 = 0;//选择他们都是输入口
GpioCtrlRegs.GPBDIR.bit.GPIO55 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO56 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO57 = 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO54= 0;//GPIO时钟和系统时钟一样且支持GPIO
GpioCtrlRegs.GPBQSEL2.bit.GPIO55= 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO56= 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO57= 0;
GpioIntRegs.GPIOXINT3SEL.bit.GPIOSEL = 54;//中断3选择GPIO
GpioIntRegs.GPIOXINT4SEL.bit.GPIOSEL = 55;
GpioIntRegs.GPIOXINT5SEL.bit.GPIOSEL = 56;
GpioIntRegs.GPIOXINT6SEL.bit.GPIOSEL = 57;
var cpro_psid ="u2572954"; var cpro_pswidth =966; var cpro_psheight =120;
XIntruptRegs.XINT3CR.bit.POLARITY= 0;//触发模式为下降沿触发
XIntruptRegs.XINT4CR.bit.POLARITY= 0;
XIntruptRegs.XINT5CR.bit.POLARITY= 0;
XIntruptRegs.XINT6CR.bit.POLARITY= 0;
XIntruptRegs.XINT3CR.bit.ENABLE = 1;//使能中断
XIntruptRegs.XINT4CR.bit.ENABLE = 1;
XIntruptRegs.XINT5CR.bit.ENABLE = 1;
XIntruptRegs.XINT6CR.bit.ENABLE = 1;
注意一点就是外部中断1和2只能对GPIO0—GPIO31配置;外部中断3和4、5、6、7只对GPIO32—GPIO63配置。
这里要介绍一下,DSP的GPIO口都可以配置为外部中断口,其配置方法如下:
GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 0; //选择他们是GPIO口
GpioCtrlRegs.GPBMUX2.bit.GPIO55 = 0;
GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 0;
GpioCtrlRegs.GPBMUX2.bit.GPIO57 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO54 = 0;//选择他们都是输入口
GpioCtrlRegs.GPBDIR.bit.GPIO55 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO56 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO57 = 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO54= 0;//GPIO时钟和系统时钟一样且支持GPIO
GpioCtrlRegs.GPBQSEL2.bit.GPIO55= 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO56= 0;
GpioCtrlRegs.GPBQSEL2.bit.GPIO57= 0;
GpioIntRegs.GPIOXINT3SEL.bit.GPIOSEL = 54;//中断3选择GPIO
GpioIntRegs.GPIOXINT4SEL.bit.GPIOSEL = 55;
GpioIntRegs.GPIOXINT5SEL.bit.GPIOSEL = 56;
GpioIntRegs.GPIOXINT6SEL.bit.GPIOSEL = 57;
var cpro_psid ="u2572954"; var cpro_pswidth =966; var cpro_psheight =120;
XIntruptRegs.XINT3CR.bit.POLARITY= 0;//触发模式为下降沿触发
XIntruptRegs.XINT4CR.bit.POLARITY= 0;
XIntruptRegs.XINT5CR.bit.POLARITY= 0;
XIntruptRegs.XINT6CR.bit.POLARITY= 0;
XIntruptRegs.XINT3CR.bit.ENABLE = 1;//使能中断
XIntruptRegs.XINT4CR.bit.ENABLE = 1;
XIntruptRegs.XINT5CR.bit.ENABLE = 1;
XIntruptRegs.XINT6CR.bit.ENABLE = 1;
注意一点就是外部中断1和2只能对GPIO0—GPIO31配置;外部中断3和4、5、6、7只对GPIO32—GPIO63配置。
举报