- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to set/reset GPIO in the application code or does it have to be done using the GPIF?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes. You can do that in the firmware.
I am showing you the example where CTL 6 (GPIO 23) is configured as GPIO.
/* 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;
/* Initialize Gpio interface */
apiRetStatus = CyU3PGpioInit(&gpioClock, NULL);
if (apiRetStatus != 0)
{
/* Error Handling */
CyU3PDebugPrint (4, "GPIO Init failed, Error Code = %d\n",apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
apiRetStatus = CyU3PDeviceGpioOverride (23, CyTrue);
gpioConfig.outValue = CyFalse;
gpioConfig.inputEn = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
apiRetStatus = CyU3PGpioSetSimpleConfig(23, &gpioConfig);
CyU3PGpioSimpleSetValue (23, 1);
Thanks,
sai krishna.