Hi All,
最近使用Cypress CY3065学习GPIO操作。现在结果是基本的控制IO输出,和非中断输入读取电平是OK的。但中断输入却一直无法触发。不知道问题出在哪?麻烦坛友高人指点一二。下面是CX3的中断配置!
- CyU3PGpioClock_t gpioClock;
- /* Init the GPIO module */
- gpioClock.fastClkDiv = 2;
- gpioClock.slowClkDiv = 0;
- gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;
- gpioClock.clkSrc = CY_U3P_SYS_CLK;
- gpioClock.halfDiv = 0;
- status = CyU3PGpioInit(&gpioClock, CyCX3AppGpioCB);
- if( status != CY_U3P_SUCCESS)
- {
- CyU3PDebugPrint (4, "\n\rAppInit:GPIOInit Err = 0x%x",status);
- CyCx3AppErrorHandler(status);
- }
-
- status = CyU3PDeviceGpioOverride(20, CyTrue);
- if(status != 0)
- {
- CyU3PDebugPrint (4, "GPIO Override failed, Error Code = %d\n",status);
- CyCx3AppErrorHandler (status);
- }
-
- gpioConfig.outValue = CyFalse; //默认输出低电平
- gpioConfig.driveLowEn = CyFalse; //不允许输出低
- gpioConfig.driveHighEn = CyFalse; //不允许输出高
- gpioConfig.inputEn = CyTrue; //输入使能
- gpioConfig.intrMode = CY_U3P_GPIO_INTR_POS_EDGE;
- status = CyU3PGpioSetSimpleConfig (20, &gpioConfig);
- if (status != CY_U3P_SUCCESS)
- {
- CyU3PDebugPrint (4, "GPIO Set Config Error, Error Code = %d\n", status);
- CyCx3AppErrorHandler (status);
- }
|