cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

YaXi_4492421
New Contributor II

我使用GPIO做输入中断,但是进不去中断,请问是我哪里弄错了吗?以下是我的初始化及中断代码:

// gpio int

void CyFxGpioIntrCb (uint8_t gpioId)

{

CyBool_t gpioValue = CyFalse;

CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

/* Get the status of the pin */

apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);

if (gpioValue == CyTrue)

{

CyU3PGpioSetValue (22, CyFalse); // FOR IR LED

}

else

{

CyU3PGpioSetValue (22, CyTrue); // FOR IR LED

}

if( GPIO_SSOR_XVS == gpioId)

{

}

}

// init gpio

void

CyFxGpioInit (void)

{

CyU3PGpioClock_t gpioClock;

CyU3PGpioComplexConfig_t gpioConfig;

CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

/* 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;

vJackyTestPrintNormal (4, "CyU3PGpioInit begin\n");

apiRetStatus = CyU3PGpioInit(&gpioClock, CyFxGpioIntrCb);

if (apiRetStatus != 0)

{

/* Error Handling */

vJackyTestPrintErr (4, "CyU3PGpioInit failed, error code = %d\n", apiRetStatus);

// CyFxAppErrorHandler(apiRetStatus);

}

CyU3PGpioSimpleConfig_t gpioConf = {0};

gpioConf.inputEn     = CyTrue;

gpioConf.driveLowEn  = CyFalse;

gpioConf.driveHighEn = CyFalse;

gpioConf.outValue    = CyFalse;

gpioConf.intrMode    = CY_U3P_GPIO_INTR_BOTH_EDGE;

apiRetStatus = CyU3PGpioSetSimpleConfig (44, &gpioConf);

}

main function:

io_cfg.gpioSimpleEn[1]  = io_cfg.gpioSimpleEn[1]  | FX3_GPIO_TO_HIFLAG(44);

0 Likes
1 Solution
YaXi_4492421
New Contributor II

返回0.

现在解决了,去掉CyU3PMipicsiInitializeGPIO,就可以了

谢谢您啊

View solution in original post

0 Likes
2 Replies
YiZ_31
Moderator
Moderator

apiRetStatus = CyU3PGpioSetSimpleConfig (44, &gpioConf);这里你打印返回值看过了吗?

请尝试用CyU3PDeviceGpioOverride 配置引脚44。

0 Likes
YaXi_4492421
New Contributor II

返回0.

现在解决了,去掉CyU3PMipicsiInitializeGPIO,就可以了

谢谢您啊

View solution in original post

0 Likes